├── GameOfLifeSwift ├── Images.xcassets │ ├── grid.imageset │ │ ├── grid.png │ │ └── Contents.json │ ├── play.imageset │ │ ├── play.png │ │ └── Contents.json │ ├── bubble.imageset │ │ ├── bubble.png │ │ └── Contents.json │ ├── pause.imageset │ │ ├── pause.png │ │ └── Contents.json │ ├── balloon.imageset │ │ ├── balloon.png │ │ └── Contents.json │ ├── background.imageset │ │ ├── background.png │ │ └── Contents.json │ ├── microscope.imageset │ │ ├── microscope.png │ │ └── Contents.json │ ├── play-pressed.imageset │ │ ├── play-pressed.png │ │ └── Contents.json │ ├── pause-pressed.imageset │ │ ├── pause-pressed.png │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Creature.swift ├── Info.plist ├── Base.lproj │ └── Main.storyboard ├── AppDelegate.swift ├── GameViewController.swift ├── GameScene.swift └── Grid.swift ├── GameOfLifeSwift.xcodeproj ├── xcuserdata │ └── dmitri.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GameOfLifeSwift.xcscheme ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── GameOfLifeSwift.xccheckout └── project.pbxproj ├── GameOfLifeSwiftTests ├── Info.plist └── GameOfLifeSwiftTests.swift └── README.md /GameOfLifeSwift/Images.xcassets/grid.imageset/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/grid.imageset/grid.png -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/play.imageset/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/play.imageset/play.png -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/bubble.imageset/bubble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/bubble.imageset/bubble.png -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/pause.imageset/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/pause.imageset/pause.png -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/balloon.imageset/balloon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/balloon.imageset/balloon.png -------------------------------------------------------------------------------- /GameOfLifeSwift.xcodeproj/xcuserdata/dmitri.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/background.imageset/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/background.imageset/background.png -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/microscope.imageset/microscope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/microscope.imageset/microscope.png -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/play-pressed.imageset/play-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/play-pressed.imageset/play-pressed.png -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/pause-pressed.imageset/pause-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/voronianski-on-games/GameOfLifeSwift/HEAD/GameOfLifeSwift/Images.xcassets/pause-pressed.imageset/pause-pressed.png -------------------------------------------------------------------------------- /GameOfLifeSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/grid.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "grid.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/play.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "play.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/balloon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "balloon.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/bubble.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "bubble.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/pause.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "pause.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "background.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/microscope.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "microscope.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/play-pressed.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "play-pressed.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/pause-pressed.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "iphone", 9 | "scale" : "2x", 10 | "filename" : "pause-pressed.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /GameOfLifeSwift/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /GameOfLifeSwift.xcodeproj/xcuserdata/dmitri.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GameOfLifeSwift.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 2AAAB5B81942EA3800CB6192 16 | 17 | primary 18 | 19 | 20 | 2AAAB5CE1942EA3800CB6192 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /GameOfLifeSwift/Creature.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Creature.swift 3 | // GameOfLifeSwift 4 | // 5 | // Created by Dmitri Voronianski on 07.06.14. 6 | // Copyright (c) 2014 Dmitri Voronianski. All rights reserved. 7 | // 8 | 9 | import SpriteKit 10 | 11 | class Creature: SKSpriteNode { 12 | var isAlive:Bool = false { 13 | didSet { 14 | self.hidden = !isAlive 15 | } 16 | } 17 | var livingNeighbours:Int = 0 18 | 19 | required init?(coder aDecoder: NSCoder) { 20 | super.init(coder: aDecoder) 21 | } 22 | 23 | convenience override init() { 24 | self.init(imageNamed:"bubble") 25 | self.hidden = true 26 | } 27 | 28 | override init(texture: SKTexture!, color: UIColor!, size: CGSize) { 29 | super.init(texture: texture, color: color, size: size) 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /GameOfLifeSwiftTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.voronianski.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GameOfLifeSwift 2 | 3 | An implementation of [Conway's Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) in [Swift](https://developer.apple.com/swift/) for iOS8. 4 | 5 | ![](https://dl.dropboxusercontent.com/u/100463011/GameOfLife.gif) 6 | 7 | ## Details 8 | 9 | This app is build with brand new Apple language - Swift and SpriteKit framework. 10 | 11 | It's one of the implemetations based on the **The Game of Life** - cellular automaton devised by the British mathematician John Horton Conway in 1970. You can check out and compare the same game implemented in [Objective-C + SpriteKit](https://github.com/voronianski-on-games/GameOfLifeSpriteKit) or [Objective-C + Cocos2d](https://github.com/voronianski-on-games/GameOfLifeCocos2d). 12 | 13 | ## References 14 | 15 | - Dmitri Voronianski [@voronianski](https://twitter.com/voronianski) 16 | - Based on concept and game art by [MakeGamesWithUs](https://www.makegameswith.us/tutorials/game-of-life-spritebuilder/) 17 | -------------------------------------------------------------------------------- /GameOfLifeSwiftTests/GameOfLifeSwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameOfLifeSwiftTests.swift 3 | // GameOfLifeSwiftTests 4 | // 5 | // Created by Dmitri Voronianski on 07.06.14. 6 | // Copyright (c) 2014 Dmitri Voronianski. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class GameOfLifeSwiftTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /GameOfLifeSwift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.voronianski.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /GameOfLifeSwift.xcodeproj/project.xcworkspace/xcshareddata/GameOfLifeSwift.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | D5819A95-E930-45A6-889C-681FE2D4B12C 9 | IDESourceControlProjectName 10 | GameOfLifeSwift 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 17DF2F6D06D47FDF3B603FD22E90D118A9DD9A56 14 | github.com:voronianski-on-games/GameOfLifeSwift.git 15 | 16 | IDESourceControlProjectPath 17 | GameOfLifeSwift.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 17DF2F6D06D47FDF3B603FD22E90D118A9DD9A56 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:voronianski-on-games/GameOfLifeSwift.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 17DF2F6D06D47FDF3B603FD22E90D118A9DD9A56 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 17DF2F6D06D47FDF3B603FD22E90D118A9DD9A56 36 | IDESourceControlWCCName 37 | GameOfLifeSwift 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /GameOfLifeSwift/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /GameOfLifeSwift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // GameOfLifeSwift 4 | // 5 | // Created by Dmitri Voronianski on 07.06.14. 6 | // Copyright (c) 2014 Dmitri Voronianski. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(application: UIApplication) { 22 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 23 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 24 | } 25 | 26 | func applicationDidEnterBackground(application: UIApplication) { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | func applicationWillEnterForeground(application: UIApplication) { 32 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 33 | } 34 | 35 | func applicationDidBecomeActive(application: UIApplication) { 36 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 37 | } 38 | 39 | func applicationWillTerminate(application: UIApplication) { 40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 41 | } 42 | 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /GameOfLifeSwift/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // GameOfLifeSwift 4 | // 5 | // Created by Dmitri Voronianski on 07.06.14. 6 | // Copyright (c) 2014 Dmitri Voronianski. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | class GameViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | // Configure the view. 18 | let skView = self.view as SKView 19 | //skView.showsFPS = true 20 | //skView.showsNodeCount = true 21 | 22 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 23 | skView.ignoresSiblingOrder = true 24 | 25 | let scene:GameScene = GameScene(size: skView.bounds.size) 26 | scene.scaleMode = .ResizeFill 27 | 28 | skView.presentScene(scene) 29 | 30 | let playButton:UIButton = UIButton(frame: CGRectMake(10, 10, 70, 38)) 31 | playButton.setImage(UIImage(named: "play"), forState: UIControlState.Normal) 32 | playButton.setImage(UIImage(named: "play-pressed"), forState: UIControlState.Highlighted) 33 | playButton.addTarget(scene, action:"play", forControlEvents: UIControlEvents.TouchDown) 34 | self.view.addSubview(playButton) 35 | 36 | let pauseButton:UIButton = UIButton(frame: CGRectMake(10, 58, 70, 38)) 37 | pauseButton.setImage(UIImage(named: "pause"), forState: UIControlState.Normal) 38 | pauseButton.setImage(UIImage(named: "pause-pressed"), forState: UIControlState.Highlighted) 39 | pauseButton.addTarget(scene, action:"pause", forControlEvents: UIControlEvents.TouchDown) 40 | self.view.addSubview(pauseButton) 41 | } 42 | 43 | override func shouldAutorotate() -> Bool { 44 | return true 45 | } 46 | 47 | override func supportedInterfaceOrientations() -> Int { 48 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 49 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) 50 | } else { 51 | return Int(UIInterfaceOrientationMask.All.rawValue) 52 | } 53 | } 54 | 55 | override func didReceiveMemoryWarning() { 56 | super.didReceiveMemoryWarning() 57 | // Release any cached data, images, etc that aren't in use. 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /GameOfLifeSwift.xcodeproj/xcuserdata/dmitri.xcuserdatad/xcschemes/GameOfLifeSwift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /GameOfLifeSwift/GameScene.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameScene.swift 3 | // GameOfLifeSwift 4 | // 5 | // Created by Dmitri Voronianski on 07.06.14. 6 | // Copyright (c) 2014 Dmitri Voronianski. All rights reserved. 7 | // 8 | 9 | import SpriteKit 10 | 11 | class GameScene: SKScene { 12 | var _grid = Grid() 13 | var _isPaused = false 14 | var _populationLabel = SKLabelNode() 15 | var _generationLabel = SKLabelNode() 16 | var _timer:SKAction? 17 | 18 | required init?(coder aDecoder: NSCoder) { 19 | super.init(coder: aDecoder) 20 | } 21 | 22 | required override init(size: CGSize) { 23 | super.init(size: size) 24 | } 25 | 26 | override func didMoveToView(view: SKView) { 27 | let background = SKSpriteNode(imageNamed:"background") 28 | background.anchorPoint = CGPoint(x: 0, y: 0) 29 | background.position = CGPoint(x: 0, y: 0) 30 | self.addChild(background) 31 | 32 | _grid.anchorPoint = CGPoint(x: 0, y: 0) 33 | _grid.position = CGPoint(x: size.width - _grid.size.width-10, y: 6) 34 | self.addChild(_grid) 35 | 36 | let microscope = SKSpriteNode(imageNamed:"microscope") 37 | microscope.anchorPoint = CGPoint(x: 0, y: 0) 38 | microscope.position = CGPoint(x: 16, y: 10) 39 | self.addChild(microscope) 40 | 41 | let balloon = SKSpriteNode(imageNamed:"balloon") 42 | balloon.anchorPoint = CGPoint(x: 0.5, y: 0) 43 | balloon.position = CGPoint(x: balloon.size.width/2 + 3, y: microscope.size.height + 18) 44 | self.addChild(balloon) 45 | 46 | let fontName = "Helvetica Neue Bold" 47 | let fontSize:CGFloat = 12 48 | let labelColor = UIColor(red: (35/255.0), green:(116/255.0), blue:(53/255.0), alpha:1) 49 | 50 | let populationLabelText:SKLabelNode = SKLabelNode(fontNamed:fontName) 51 | populationLabelText.text = "Population" 52 | populationLabelText.fontSize = fontSize 53 | populationLabelText.fontColor = labelColor 54 | populationLabelText.position = CGPoint(x: 2, y: 65) 55 | balloon.addChild(populationLabelText) 56 | 57 | _populationLabel.fontName = fontName 58 | _populationLabel.text = "0" 59 | _populationLabel.fontSize = fontSize 60 | _populationLabel.fontColor = labelColor 61 | _populationLabel.position = CGPoint(x: 2, y: 50) 62 | balloon.addChild(_populationLabel) 63 | 64 | let generationLabelText:SKLabelNode = SKLabelNode(fontNamed:fontName) 65 | generationLabelText.text = "Generation" 66 | generationLabelText.fontSize = fontSize 67 | generationLabelText.fontColor = labelColor 68 | generationLabelText.position = CGPoint(x: 2, y: 33) 69 | balloon.addChild(generationLabelText) 70 | 71 | _generationLabel.fontName = fontName 72 | _generationLabel.text = "0" 73 | _generationLabel.fontSize = fontSize 74 | _generationLabel.fontColor = labelColor 75 | _generationLabel.position = CGPoint(x: 2, y: 18) 76 | balloon.addChild(_generationLabel) 77 | } 78 | 79 | func play() { 80 | if (_isPaused) { 81 | _isPaused = false 82 | self.speed = 1 83 | } 84 | 85 | if let timing = _timer { 86 | return 87 | } 88 | 89 | let wait:SKAction = SKAction.waitForDuration(0.5) 90 | let performSelector:SKAction = SKAction.runBlock(self.step) 91 | let sequence:SKAction = SKAction.sequence([performSelector, wait]) 92 | _timer = SKAction.repeatActionForever(sequence) 93 | self.runAction(_timer) 94 | 95 | } 96 | 97 | func pause() { 98 | if (_isPaused) { 99 | return 100 | } 101 | _isPaused = true 102 | self.speed = 0 103 | } 104 | 105 | func step() { 106 | _grid.evolveStep() 107 | _populationLabel.text = "\(_grid.totalAlive)" 108 | _generationLabel.text = "\(_grid.generation)" 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /GameOfLifeSwift/Grid.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Grid.swift 3 | // GameOfLifeSwift 4 | // 5 | // Created by Dmitri Voronianski on 07.06.14. 6 | // Copyright (c) 2014 Dmitri Voronianski. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | let GRID_ROWS = 8 13 | let GRID_COLUMNS = 10 14 | 15 | class Grid: SKSpriteNode { 16 | var _gridArray = Array>() 17 | var _cellWidth:Double = 0 18 | var _cellHeight:Double = 0 19 | 20 | var totalAlive:Int = 0 21 | var generation:Int = 0 22 | 23 | required init?(coder aDecoder: NSCoder) { 24 | super.init(coder: aDecoder) 25 | } 26 | 27 | convenience override init() { 28 | self.init(imageNamed:"grid") 29 | self.userInteractionEnabled = true 30 | self.setupGrid() 31 | } 32 | 33 | override init(texture: SKTexture!, color: UIColor!, size: CGSize) { 34 | super.init(texture: texture, color: color, size: size) 35 | } 36 | 37 | override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { 38 | let touch:UITouch = touches.anyObject() as UITouch 39 | let touchLocation = touch.locationInNode(self) 40 | let creature:Creature = self.creatureForTouchPosition(touchLocation) 41 | creature.isAlive = !creature.isAlive 42 | } 43 | 44 | func creatureForTouchPosition(touchPosition: CGPoint) -> Creature { 45 | let column:Double = Double(touchPosition.x) / _cellWidth 46 | let row:Double = Double(touchPosition.y) / _cellHeight 47 | let creature:Creature = _gridArray[Int(row)][Int(column)] 48 | return creature 49 | } 50 | 51 | func setupGrid() { 52 | _cellWidth = Double(self.size.width) / Double(GRID_COLUMNS) 53 | _cellHeight = Double(self.size.height) / Double(GRID_ROWS) 54 | 55 | var posX:Double = 0; 56 | var posY:Double = 0; 57 | 58 | for (var i = 0; i < GRID_ROWS; i++) { 59 | _gridArray.insert([], atIndex: i) 60 | 61 | posX = 0 // start of every row 62 | 63 | for (var j = 0; j < GRID_COLUMNS; j++) { 64 | let creature = Creature() 65 | creature.anchorPoint = CGPoint(x: 0, y: 0) 66 | creature.position = CGPoint(x: Int(posX), y: Int(posY)) 67 | self.addChild(creature) 68 | 69 | _gridArray[i].insert(creature, atIndex: j) 70 | 71 | posX += _cellWidth 72 | } 73 | 74 | posY += _cellHeight 75 | } 76 | } 77 | 78 | /* 79 | * GAME OF LIFE RULES 80 | * 81 | * If it has 0-1 live neighbors the Creature on that cell dies or stays dead. 82 | * If it has 2-3 live neighbors it stays alive. 83 | * If it has 4 or more, it stays dead or dies. 84 | * If it has exactly 3 neighbors and it is dead, it comes to life! 85 | */ 86 | 87 | func evolveStep() { 88 | self.countNeighbours() 89 | self.updateCreatures() 90 | generation++ 91 | } 92 | 93 | func countNeighbours() { 94 | for (var i = 0; i < _gridArray.count; i++) { 95 | for (var j = 0; j < _gridArray[i].count; j++) { 96 | let currentCreature:Creature = _gridArray[i][j]; 97 | currentCreature.livingNeighbours = 0; 98 | 99 | for (var x = (i-1); x <= (i+1); x++) { 100 | for (var y = (j-1); y <= (j+1); y++) { 101 | let isIndexValid = self.isIndexValid(x, y: y) 102 | if (isIndexValid && !((x == i) && (y == j))) { 103 | let neighbour:Creature = _gridArray[x][y]; 104 | if (neighbour.isAlive) { 105 | currentCreature.livingNeighbours += 1; 106 | } 107 | } 108 | } 109 | } 110 | } 111 | } 112 | } 113 | 114 | func updateCreatures() { 115 | var aliveNum = 0; 116 | 117 | for (var i = 0; i < _gridArray.count; i++) { 118 | for (var j = 0; j < _gridArray[i].count; j++) { 119 | let currentCreature:Creature = _gridArray[i][j] 120 | 121 | if (currentCreature.livingNeighbours == 3) { 122 | currentCreature.isAlive = true 123 | } else if (currentCreature.livingNeighbours <= 1 || currentCreature.livingNeighbours >= 4) { 124 | currentCreature.isAlive = false 125 | } 126 | 127 | if (currentCreature.isAlive) { 128 | aliveNum++ 129 | } 130 | } 131 | } 132 | 133 | totalAlive = aliveNum 134 | } 135 | 136 | func isIndexValid(x: Int, y: Int) -> Bool { 137 | return (x < 0 || y < 0 || x >= GRID_ROWS || y >= GRID_COLUMNS) ? false : true 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /GameOfLifeSwift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2AAAB5BF1942EA3800CB6192 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AAAB5BE1942EA3800CB6192 /* AppDelegate.swift */; }; 11 | 2AAAB5C31942EA3800CB6192 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AAAB5C21942EA3800CB6192 /* GameScene.swift */; }; 12 | 2AAAB5C51942EA3800CB6192 /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AAAB5C41942EA3800CB6192 /* GameViewController.swift */; }; 13 | 2AAAB5C81942EA3800CB6192 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2AAAB5C61942EA3800CB6192 /* Main.storyboard */; }; 14 | 2AAAB5CA1942EA3800CB6192 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2AAAB5C91942EA3800CB6192 /* Images.xcassets */; }; 15 | 2AAAB5D61942EA3800CB6192 /* GameOfLifeSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AAAB5D51942EA3800CB6192 /* GameOfLifeSwiftTests.swift */; }; 16 | 2AAAB5E01942ECEE00CB6192 /* Grid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AAAB5DF1942ECEE00CB6192 /* Grid.swift */; }; 17 | 2AAAB5E21942FA8900CB6192 /* Creature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AAAB5E11942FA8900CB6192 /* Creature.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 2AAAB5D01942EA3800CB6192 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 2AAAB5B11942EA3800CB6192 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 2AAAB5B81942EA3800CB6192; 26 | remoteInfo = GameOfLifeSwift; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 2AAAB5B91942EA3800CB6192 /* GameOfLifeSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GameOfLifeSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 2AAAB5BD1942EA3800CB6192 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 2AAAB5BE1942EA3800CB6192 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 34 | 2AAAB5C21942EA3800CB6192 /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; }; 35 | 2AAAB5C41942EA3800CB6192 /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; 36 | 2AAAB5C71942EA3800CB6192 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | 2AAAB5C91942EA3800CB6192 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 2AAAB5CF1942EA3800CB6192 /* GameOfLifeSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GameOfLifeSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 2AAAB5D41942EA3800CB6192 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 2AAAB5D51942EA3800CB6192 /* GameOfLifeSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameOfLifeSwiftTests.swift; sourceTree = ""; }; 41 | 2AAAB5DF1942ECEE00CB6192 /* Grid.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Grid.swift; sourceTree = ""; }; 42 | 2AAAB5E11942FA8900CB6192 /* Creature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Creature.swift; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 2AAAB5B61942EA3800CB6192 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | 2AAAB5CC1942EA3800CB6192 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 2AAAB5B01942EA3800CB6192 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 2AAAB5BB1942EA3800CB6192 /* GameOfLifeSwift */, 67 | 2AAAB5D21942EA3800CB6192 /* GameOfLifeSwiftTests */, 68 | 2AAAB5BA1942EA3800CB6192 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 2AAAB5BA1942EA3800CB6192 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 2AAAB5B91942EA3800CB6192 /* GameOfLifeSwift.app */, 76 | 2AAAB5CF1942EA3800CB6192 /* GameOfLifeSwiftTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 2AAAB5BB1942EA3800CB6192 /* GameOfLifeSwift */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 2AAAB5BE1942EA3800CB6192 /* AppDelegate.swift */, 85 | 2AAAB5C21942EA3800CB6192 /* GameScene.swift */, 86 | 2AAAB5DF1942ECEE00CB6192 /* Grid.swift */, 87 | 2AAAB5E11942FA8900CB6192 /* Creature.swift */, 88 | 2AAAB5C41942EA3800CB6192 /* GameViewController.swift */, 89 | 2AAAB5C61942EA3800CB6192 /* Main.storyboard */, 90 | 2AAAB5C91942EA3800CB6192 /* Images.xcassets */, 91 | 2AAAB5BC1942EA3800CB6192 /* Supporting Files */, 92 | ); 93 | path = GameOfLifeSwift; 94 | sourceTree = ""; 95 | }; 96 | 2AAAB5BC1942EA3800CB6192 /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 2AAAB5BD1942EA3800CB6192 /* Info.plist */, 100 | ); 101 | name = "Supporting Files"; 102 | sourceTree = ""; 103 | }; 104 | 2AAAB5D21942EA3800CB6192 /* GameOfLifeSwiftTests */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 2AAAB5D51942EA3800CB6192 /* GameOfLifeSwiftTests.swift */, 108 | 2AAAB5D31942EA3800CB6192 /* Supporting Files */, 109 | ); 110 | path = GameOfLifeSwiftTests; 111 | sourceTree = ""; 112 | }; 113 | 2AAAB5D31942EA3800CB6192 /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 2AAAB5D41942EA3800CB6192 /* Info.plist */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 2AAAB5B81942EA3800CB6192 /* GameOfLifeSwift */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 2AAAB5D91942EA3800CB6192 /* Build configuration list for PBXNativeTarget "GameOfLifeSwift" */; 127 | buildPhases = ( 128 | 2AAAB5B51942EA3800CB6192 /* Sources */, 129 | 2AAAB5B61942EA3800CB6192 /* Frameworks */, 130 | 2AAAB5B71942EA3800CB6192 /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = GameOfLifeSwift; 137 | productName = GameOfLifeSwift; 138 | productReference = 2AAAB5B91942EA3800CB6192 /* GameOfLifeSwift.app */; 139 | productType = "com.apple.product-type.application"; 140 | }; 141 | 2AAAB5CE1942EA3800CB6192 /* GameOfLifeSwiftTests */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 2AAAB5DC1942EA3800CB6192 /* Build configuration list for PBXNativeTarget "GameOfLifeSwiftTests" */; 144 | buildPhases = ( 145 | 2AAAB5CB1942EA3800CB6192 /* Sources */, 146 | 2AAAB5CC1942EA3800CB6192 /* Frameworks */, 147 | 2AAAB5CD1942EA3800CB6192 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | 2AAAB5D11942EA3800CB6192 /* PBXTargetDependency */, 153 | ); 154 | name = GameOfLifeSwiftTests; 155 | productName = GameOfLifeSwiftTests; 156 | productReference = 2AAAB5CF1942EA3800CB6192 /* GameOfLifeSwiftTests.xctest */; 157 | productType = "com.apple.product-type.bundle.unit-test"; 158 | }; 159 | /* End PBXNativeTarget section */ 160 | 161 | /* Begin PBXProject section */ 162 | 2AAAB5B11942EA3800CB6192 /* Project object */ = { 163 | isa = PBXProject; 164 | attributes = { 165 | LastUpgradeCheck = 0600; 166 | ORGANIZATIONNAME = "Dmitri Voronianski"; 167 | TargetAttributes = { 168 | 2AAAB5B81942EA3800CB6192 = { 169 | CreatedOnToolsVersion = 6.0; 170 | }; 171 | 2AAAB5CE1942EA3800CB6192 = { 172 | CreatedOnToolsVersion = 6.0; 173 | TestTargetID = 2AAAB5B81942EA3800CB6192; 174 | }; 175 | }; 176 | }; 177 | buildConfigurationList = 2AAAB5B41942EA3800CB6192 /* Build configuration list for PBXProject "GameOfLifeSwift" */; 178 | compatibilityVersion = "Xcode 3.2"; 179 | developmentRegion = English; 180 | hasScannedForEncodings = 0; 181 | knownRegions = ( 182 | en, 183 | Base, 184 | ); 185 | mainGroup = 2AAAB5B01942EA3800CB6192; 186 | productRefGroup = 2AAAB5BA1942EA3800CB6192 /* Products */; 187 | projectDirPath = ""; 188 | projectRoot = ""; 189 | targets = ( 190 | 2AAAB5B81942EA3800CB6192 /* GameOfLifeSwift */, 191 | 2AAAB5CE1942EA3800CB6192 /* GameOfLifeSwiftTests */, 192 | ); 193 | }; 194 | /* End PBXProject section */ 195 | 196 | /* Begin PBXResourcesBuildPhase section */ 197 | 2AAAB5B71942EA3800CB6192 /* Resources */ = { 198 | isa = PBXResourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 2AAAB5CA1942EA3800CB6192 /* Images.xcassets in Resources */, 202 | 2AAAB5C81942EA3800CB6192 /* Main.storyboard in Resources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | 2AAAB5CD1942EA3800CB6192 /* Resources */ = { 207 | isa = PBXResourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXResourcesBuildPhase section */ 214 | 215 | /* Begin PBXSourcesBuildPhase section */ 216 | 2AAAB5B51942EA3800CB6192 /* Sources */ = { 217 | isa = PBXSourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | 2AAAB5C31942EA3800CB6192 /* GameScene.swift in Sources */, 221 | 2AAAB5C51942EA3800CB6192 /* GameViewController.swift in Sources */, 222 | 2AAAB5BF1942EA3800CB6192 /* AppDelegate.swift in Sources */, 223 | 2AAAB5E21942FA8900CB6192 /* Creature.swift in Sources */, 224 | 2AAAB5E01942ECEE00CB6192 /* Grid.swift in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | 2AAAB5CB1942EA3800CB6192 /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 2AAAB5D61942EA3800CB6192 /* GameOfLifeSwiftTests.swift in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXSourcesBuildPhase section */ 237 | 238 | /* Begin PBXTargetDependency section */ 239 | 2AAAB5D11942EA3800CB6192 /* PBXTargetDependency */ = { 240 | isa = PBXTargetDependency; 241 | target = 2AAAB5B81942EA3800CB6192 /* GameOfLifeSwift */; 242 | targetProxy = 2AAAB5D01942EA3800CB6192 /* PBXContainerItemProxy */; 243 | }; 244 | /* End PBXTargetDependency section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 2AAAB5C61942EA3800CB6192 /* Main.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 2AAAB5C71942EA3800CB6192 /* Base */, 251 | ); 252 | name = Main.storyboard; 253 | sourceTree = ""; 254 | }; 255 | /* End PBXVariantGroup section */ 256 | 257 | /* Begin XCBuildConfiguration section */ 258 | 2AAAB5D71942EA3800CB6192 /* Debug */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ALWAYS_SEARCH_USER_PATHS = NO; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BOOL_CONVERSION = YES; 267 | CLANG_WARN_CONSTANT_CONVERSION = YES; 268 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 269 | CLANG_WARN_EMPTY_BODY = YES; 270 | CLANG_WARN_ENUM_CONVERSION = YES; 271 | CLANG_WARN_INT_CONVERSION = YES; 272 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 273 | CLANG_WARN_UNREACHABLE_CODE = YES; 274 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 275 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 276 | COPY_PHASE_STRIP = NO; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu99; 279 | GCC_DYNAMIC_NO_PIC = NO; 280 | GCC_OPTIMIZATION_LEVEL = 0; 281 | GCC_PREPROCESSOR_DEFINITIONS = ( 282 | "DEBUG=1", 283 | "$(inherited)", 284 | ); 285 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 286 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 287 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 288 | GCC_WARN_UNDECLARED_SELECTOR = YES; 289 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 290 | GCC_WARN_UNUSED_FUNCTION = YES; 291 | GCC_WARN_UNUSED_VARIABLE = YES; 292 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 293 | METAL_ENABLE_DEBUG_INFO = YES; 294 | ONLY_ACTIVE_ARCH = YES; 295 | SDKROOT = iphoneos; 296 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 297 | }; 298 | name = Debug; 299 | }; 300 | 2AAAB5D81942EA3800CB6192 /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ALWAYS_SEARCH_USER_PATHS = NO; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_WARN_BOOL_CONVERSION = YES; 309 | CLANG_WARN_CONSTANT_CONVERSION = YES; 310 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 311 | CLANG_WARN_EMPTY_BODY = YES; 312 | CLANG_WARN_ENUM_CONVERSION = YES; 313 | CLANG_WARN_INT_CONVERSION = YES; 314 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 315 | CLANG_WARN_UNREACHABLE_CODE = YES; 316 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 317 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 318 | COPY_PHASE_STRIP = YES; 319 | ENABLE_NS_ASSERTIONS = NO; 320 | ENABLE_STRICT_OBJC_MSGSEND = YES; 321 | GCC_C_LANGUAGE_STANDARD = gnu99; 322 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 323 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 324 | GCC_WARN_UNDECLARED_SELECTOR = YES; 325 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 326 | GCC_WARN_UNUSED_FUNCTION = YES; 327 | GCC_WARN_UNUSED_VARIABLE = YES; 328 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 329 | METAL_ENABLE_DEBUG_INFO = NO; 330 | SDKROOT = iphoneos; 331 | VALIDATE_PRODUCT = YES; 332 | }; 333 | name = Release; 334 | }; 335 | 2AAAB5DA1942EA3800CB6192 /* Debug */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 339 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 340 | INFOPLIST_FILE = GameOfLifeSwift/Info.plist; 341 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 342 | PRODUCT_NAME = "$(TARGET_NAME)"; 343 | }; 344 | name = Debug; 345 | }; 346 | 2AAAB5DB1942EA3800CB6192 /* Release */ = { 347 | isa = XCBuildConfiguration; 348 | buildSettings = { 349 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 350 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 351 | INFOPLIST_FILE = GameOfLifeSwift/Info.plist; 352 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | }; 355 | name = Release; 356 | }; 357 | 2AAAB5DD1942EA3800CB6192 /* Debug */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/GameOfLifeSwift.app/GameOfLifeSwift"; 361 | FRAMEWORK_SEARCH_PATHS = ( 362 | "$(SDKROOT)/Developer/Library/Frameworks", 363 | "$(inherited)", 364 | ); 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | INFOPLIST_FILE = GameOfLifeSwiftTests/Info.plist; 370 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 371 | METAL_ENABLE_DEBUG_INFO = YES; 372 | PRODUCT_NAME = "$(TARGET_NAME)"; 373 | TEST_HOST = "$(BUNDLE_LOADER)"; 374 | }; 375 | name = Debug; 376 | }; 377 | 2AAAB5DE1942EA3800CB6192 /* Release */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/GameOfLifeSwift.app/GameOfLifeSwift"; 381 | FRAMEWORK_SEARCH_PATHS = ( 382 | "$(SDKROOT)/Developer/Library/Frameworks", 383 | "$(inherited)", 384 | ); 385 | INFOPLIST_FILE = GameOfLifeSwiftTests/Info.plist; 386 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 387 | METAL_ENABLE_DEBUG_INFO = NO; 388 | PRODUCT_NAME = "$(TARGET_NAME)"; 389 | TEST_HOST = "$(BUNDLE_LOADER)"; 390 | }; 391 | name = Release; 392 | }; 393 | /* End XCBuildConfiguration section */ 394 | 395 | /* Begin XCConfigurationList section */ 396 | 2AAAB5B41942EA3800CB6192 /* Build configuration list for PBXProject "GameOfLifeSwift" */ = { 397 | isa = XCConfigurationList; 398 | buildConfigurations = ( 399 | 2AAAB5D71942EA3800CB6192 /* Debug */, 400 | 2AAAB5D81942EA3800CB6192 /* Release */, 401 | ); 402 | defaultConfigurationIsVisible = 0; 403 | defaultConfigurationName = Release; 404 | }; 405 | 2AAAB5D91942EA3800CB6192 /* Build configuration list for PBXNativeTarget "GameOfLifeSwift" */ = { 406 | isa = XCConfigurationList; 407 | buildConfigurations = ( 408 | 2AAAB5DA1942EA3800CB6192 /* Debug */, 409 | 2AAAB5DB1942EA3800CB6192 /* Release */, 410 | ); 411 | defaultConfigurationIsVisible = 0; 412 | defaultConfigurationName = Release; 413 | }; 414 | 2AAAB5DC1942EA3800CB6192 /* Build configuration list for PBXNativeTarget "GameOfLifeSwiftTests" */ = { 415 | isa = XCConfigurationList; 416 | buildConfigurations = ( 417 | 2AAAB5DD1942EA3800CB6192 /* Debug */, 418 | 2AAAB5DE1942EA3800CB6192 /* Release */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Release; 422 | }; 423 | /* End XCConfigurationList section */ 424 | }; 425 | rootObject = 2AAAB5B11942EA3800CB6192 /* Project object */; 426 | } 427 | --------------------------------------------------------------------------------