Created
November 27, 2017 20:10
-
-
Save azamsharp/b98ad009a04b5b1442a61672d274e431 to your computer and use it in GitHub Desktop.
Source Model Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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