Skip to content

Instantly share code, notes, and snippets.

@IsaAliev
Created October 10, 2018 08:44
Show Gist options
  • Save IsaAliev/25f77a92fa5f1933cd6936c51e1be598 to your computer and use it in GitHub Desktop.
Save IsaAliev/25f77a92fa5f1933cd6936c51e1be598 to your computer and use it in GitHub Desktop.
import UIKit
import Bond
protocol AlertPresentableView {
associatedtype ModelType: AlertPresentableViewModel
var model: ModelType { get set }
}
extension AlertPresentableView where Self: UIViewController {
func bindToAlerts() {
model.alertModel.observeOn(.main).observeNext { [weak self] (model) in
guard let model = model else {
return
}
let alert = AlertBuilder.buildAlertController(for: model)
self?.present(alert, animated: true, completion: nil)
}.dispose(in: bag)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment