Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gallaugher/bf81460d130f2f494b256bbbcbb5b601 to your computer and use it in GitHub Desktop.

Select an option

Save gallaugher/bf81460d130f2f494b256bbbcbb5b601 to your computer and use it in GitHub Desktop.
Photo.swift's dictionary convenience initializer
convenience init(dictionary: [String: Any]) {
let description = dictionary["description"] as! String? ?? ""
let postedBy = dictionary["postedBy"] as! String? ?? ""
let date = dictionary["date"] as! Date? ?? Date()
self.init(image: UIImage(), description: description, postedBy: postedBy, date: date, documentUUID: "")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment