Skip to content

Instantly share code, notes, and snippets.

@ayanonagon
Last active November 12, 2015 17:11
Show Gist options
  • Save ayanonagon/c87a56cbc319a79607ab to your computer and use it in GitHub Desktop.
Save ayanonagon/c87a56cbc319a79607ab to your computer and use it in GitHub Desktop.
struct Message {
let text: String
let status: Status
init?(dictionary: NSDictionary) {
guard
let text = dictionary["text"] as? String,
let statusString = dictionary["status"] as? String,
let status = Status(rawValue: statusString)
else { return nil }
self.text = text
self.status = status
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment