Created
January 3, 2018 03:46
-
-
Save joelmarquez90/ee5cb203426e22bd64b3b6681600814a to your computer and use it in GitHub Desktop.
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 definition. You're right, only ONE LINE of code! | |
class VersionViewModel: BaseViewModel<Version> {} | |
// Using it | |
let viewModel = VersionViewModel(provider: MoyaProvider<Service>()) | |
viewModel.fetchData(service: .version(version: AppInfo.version())).startWithResult { result in | |
switch result { | |
case let .success(version): | |
// Handle version success response | |
case let .failure(error): | |
// Handle error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment