Last active
July 14, 2017 16:27
-
-
Save SiarheiFedartsou/5f05db3a5dec0846719ca4b9bf626318 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
enum ViewModel { | |
case normal(model: Model) | |
case error(title: String, description: String, showRetryButton: Bool) | |
} | |
extension ViewModel { | |
static func serverError(showRetryButton: Bool) -> ViewModel { | |
return .error(title: "Oops", description: "Something went wrong", showRetryButton: showRetryButton) | |
} | |
static func noInternetConnection(showRetryButton: Bool) -> ViewModel { | |
return .error(title: "Oops", description: "No Internet connection", showRetryButton: showRetryButton) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment