Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Created November 5, 2017 12:24
Show Gist options
  • Save pgpt10/c4582681b38d3c8ba33ca1c359a2be9d to your computer and use it in GitHub Desktop.
Save pgpt10/c4582681b38d3c8ba33ca1c359a2be9d to your computer and use it in GitHub Desktop.
class City: NSObject, NSCoding
{
var name: String?
var id: Int?
required init?(coder aDecoder: NSCoder)
{
self.name = aDecoder.decodeObject(forKey: "name") as? String
self.id = aDecoder.decodeObject(forKey: "id") as? Int
}
func encode(with aCoder: NSCoder)
{
aCoder.encode(self.name, forKey: "name")
aCoder.encode(self.id, forKey: "id")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment