Skip to content

Instantly share code, notes, and snippets.

@BeauNouvelle
Created August 6, 2018 06:49
Show Gist options
  • Save BeauNouvelle/b1e4f8fb5a585433d299469e3aeff4f0 to your computer and use it in GitHub Desktop.
Save BeauNouvelle/b1e4f8fb5a585433d299469e3aeff4f0 to your computer and use it in GitHub Desktop.
for cell in world.cells {
let rect = CGRect(x: cell.x * cellSize, y: cell.y * cellSize, width: cellSize, height: cellSize)
let color = cell.state == .alive ? UIColor.green.cgColor : UIColor.white.cgColor
context?.addRect(rect)
context?.setFillColor(color)
context?.fill(rect)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment