Created
December 9, 2017 03:12
-
-
Save kidcodely/e870ce02be4243fac3775b44e9e1c9a2 to your computer and use it in GitHub Desktop.
Game model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppKit | |
class Game: NSObject { | |
var id: Int? | |
var desc: String? | |
var title: String? | |
var releaseDate: String? | |
override init(){} | |
init(data: [String: AnyObject]){ | |
if let id = data["id"] as? Int { | |
self.id = id | |
} | |
if let desc = data["description"] as? String { | |
self.desc = desc | |
} | |
if let title = data["title"] as? String { | |
self.title = title | |
} | |
if let releaseDate = data["date"] as? String { | |
self.releaseDate = releaseDate | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment