Created
October 10, 2018 08:44
-
-
Save IsaAliev/25f77a92fa5f1933cd6936c51e1be598 to your computer and use it in GitHub Desktop.
This file contains 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 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