我讀過documentation,通過他們精彩的遊樂場示例,搜索了S.O.,並且達到了我的google-fu的範圍,但是我不能在我的生活中圍繞如何使用ReactiveSwift。ReactiveSwift簡單示例
鑑於以下....
class SomeModel {
var mapType: MKMapType = .standard
var selectedAnnotation: MKAnnotation?
var annotations = [MKAnnotation]()
var enableRouteButton = false
// The rest of the implementation...
}
class SomeViewController: UIViewController {
let model: SomeModel
let mapView = MKMapView(frame: .zero) // It's position is set elsewhere
@IBOutlet var routeButton: UIBarButtonItem?
init(model: SomeModel) {
self.model = model
super.init(nibName: nil, bundle: nil)
}
// The rest of the implementation...
}
....我如何使用ReactiveSwift從SomeModel
初始化SomeViewController
的價值觀,然後更新SomeViewController
每當SomeModel
變化值是多少?
我以前從來沒有用過任何反應,但是我讀的所有東西都讓我相信這應該是可能的。 這讓我發瘋。
我意識到ReactiveSwift比本示例中要實現的要多得多,但如果有人可以請使用它來幫助我開始,我將不勝感激。我希望一旦我得到這部分,其餘的只是「點擊」。
剛剛聽到的「點擊」是我閱讀你的答案後有意義的一切。謝謝你在這個例子中分解它,因爲它使所有的區別! – forgot
很高興我能幫到你 – MeXx