Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created November 27, 2017 20:10
Show Gist options
  • Save azamsharp/b98ad009a04b5b1442a61672d274e431 to your computer and use it in GitHub Desktop.
Save azamsharp/b98ad009a04b5b1442a61672d274e431 to your computer and use it in GitHub Desktop.
Source Model Class
class Source {
var id :String!
var name :String!
var description :String!
init?(dictionary :JSONDictionary) {
guard let id = dictionary["id"] as? String,
let name = dictionary["name"] as? String,
let description = dictionary["description"] as? String else {
return nil
}
self.id = id
self.name = name
self.description = description
}
init(viewModel :SourceViewModel) {
self.id = viewModel.id
self.name = viewModel.name
self.description = viewModel.body
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment