Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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