The memory game with a grid of 4x4 cells written in Swift.
- iOS 9.0+
- XCode 10.0
- Swift 4.0+
- Cocoapods (Dependency Manager)
- Open a terminal and go to project directory.
- Install Cocoapods with command
sudo gem install cocoapods
- Install dependencies via
pod install
- Please open
.xcworkspace
file, not.xcodeproj
. - Hit the run button!
Application consists of three different pages.
- Initial Page: This is the beginning page of the application. You can either start the game button or learn how to play button.
- Game Page: This is where game is played by user.
- Game Complete Page: When the game finishes, app is navigated to that page.
When user taps to "Play Game" button;
-
New
GameSetup
instance will be instantiated. That class will send a request toSoundCloud API
and retrieve the tracks. Then that class will prepare cards and instantiate Game instance. State changes are listened by theInitialViewController
, If anything fails, error message will be prompted. If everything is OK, then game view controller is presented. -
GameViewController starts with a game instance. That view controller will append card views into a
StackView
and prepare the layout. Also,Game
class will handle the Memory Game logic and it has delegate instance to invokeshow
,hide
cards andfinish
the game. -
When game is finished,
GameResultViewController
is presented.
Model-View-Controller(MVC) architecture is used.
There is an Environment.swift
file under Util
folder. This file is containing app specific constants like Api URL, Client Id and Client Secret etc. It's designed with a such structure to deliver the app for multiple environments for debug or release. If you build the app with Debug, app logs will be shown.
There are two different folders within the project. These are SoundCloudMemoryUnitTests
and SoundCloudMemoryUITests
Unit tests resides in SoundCloudMemoryUnitTests
folder structure. Each folder is corresponding to a class in the application level.
UI tests reside just under SoundCloudMemoryUITests
folder.
Cocoapods is used as dependency manager to manage 3rd party libraries and resources. See also Cocoapods