Skip to content

Instantly share code, notes, and snippets.

@Herakleis
Last active August 11, 2017 10:00
Show Gist options
  • Save Herakleis/554a0b7eaf6ebc63302a3e1e85519556 to your computer and use it in GitHub Desktop.
Save Herakleis/554a0b7eaf6ebc63302a3e1e85519556 to your computer and use it in GitHub Desktop.
import RxSwift
import Action
protocol MyViewModelInputsType {
// Inputs headers
}
protocol MyViewModelOutputsType {
// Outputs headers
}
protocol MyViewModelActionsType {
// Actions headers
}
protocol MyViewModelType: class {
var inputs: MyViewModelInputsType { get }
var outputs: MyViewModelOutputsType { get }
var actions: MyViewModelActionsType { get }
}
final class MyViewModel: MyViewModelType {
var inputs: MyViewModelInputsType { return self }
var outputs: MyViewModelOutputsType { return self }
var actions: MyViewModelActionsType { return self }
// Setup
private let myViewModelService: MyViewModelServiceType
private let coordinator: SceneCoordinatorType
// Inputs
// Outputs
// ViewModel Life Cycle
init(service: MyViewModelServiceType, coordinator: SceneCoordinatorType) {
// Setup
self.myViewModelService = service
self.coordinator = coordinator
// Inputs
// Outputs
// ViewModel Life Cycle
}
// Actions
}
extension MyViewModel: MyViewModelInputsType, MyViewModelOutputsType, MyViewModelActionsType { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment