Last active
June 9, 2020 21:08
-
-
Save DhavalDobariya86/00b47b0ef9f5db38e6d7ba65c21c5620 to your computer and use it in GitHub Desktop.
ViewModel protocol
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
import Foundation | |
/// This protocol defines basic responsibility for `ViewModel` | |
protocol ViewModel { | |
/// This method is called when `ViewModel` updates itself with `new` data | |
var didUpdate: (() -> Void)? { get set } | |
/// This method is called when `ViewModel` changes its state | |
/// - isLoading: Loading state of ViewModel | |
/// - loadingMessage: Loading messages to display while ViewModel is loading | |
var didChangeState: ((_ isLoading: Bool, _ loadingMessage: String?) -> Void)? { get set } | |
} | |
protocol Searchable { | |
func searchFor(keyword: String) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment