Conway’s Game of Life in Swift 2.0 and SpriteKit


Coding in Xcode 7?

If you are able to compile Swift 2.0 in Xcode 7 or higher, the files below are pretty much all you need.

  1. Create a new SpriteKit project for either iOS or Mac
  2. Create the files below
  3. include the following line at the end of the ViewController setup: 
         scene.setLife()
  4. Define the type alias RMColor based on whether you are developing for Mac of iOS: 
         typealias RMColor = NSColor (iOS) / UIColor (Mac)

Max OS X

Swift / SpriteKit

Android

Unity

Unity Web Player | guisystem

The Life.Swift file was translated from the example available on golang.org.

Leave a comment