Skip to content

Instantly share code, notes, and snippets.

@SiarheiFedartsou
Last active July 14, 2017 16:27
Show Gist options
  • Save SiarheiFedartsou/5f05db3a5dec0846719ca4b9bf626318 to your computer and use it in GitHub Desktop.
Save SiarheiFedartsou/5f05db3a5dec0846719ca4b9bf626318 to your computer and use it in GitHub Desktop.
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