Skip to content

Instantly share code, notes, and snippets.

@Sajjon
Last active November 26, 2018 15:26
Show Gist options
  • Save Sajjon/923858af437e248423635f0efd603283 to your computer and use it in GitHub Desktop.
Save Sajjon/923858af437e248423635f0efd603283 to your computer and use it in GitHub Desktop.
Medium article: SLC part 1 - ViewModelled
import RxSwift
protocol EmptyInitializable {
init()
}
protocol ViewModelled: EmptyInitializable {
associatedtype ViewModel: ViewModelType
var inputFromView: ViewModel.Input.FromView { get }
func populate(with viewModel: ViewModel.Output) -> [Disposable]
}
// MARK: - Default implementation
extension ViewModelled {
// Making `populate` "optional"
func populate(with viewModel: ViewModel.Output) -> [Disposable] { return [] }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment