Is there any data binding mechanism available for iOS?

前端 未结 8 1273
执念已碎
执念已碎 2020-12-09 03:36

In .NET I just do something like DataForm.Source = Object and then magic happens. Platform routes data changes from ui fileds to object properties, does validation and so on

8条回答
  •  难免孤独
    2020-12-09 03:54

    Probably should also mention Github's Reactive Cocoa, a framework for composing and transforming sequences of values, an objective-C version of .NET's Reactive Extensions (Rx).

    Binding mechanics can be done really simple (from the sample):

    // RACObserve(self, username) creates a new RACSignal that sends a new value
    // whenever the username changes. -subscribeNext: will execute the block
    // whenever the signal sends a value.
    [RACObserve(self, username) subscribeNext:^(NSString *newName) {
        NSLog(@"%@", newName);
    }];
    

提交回复
热议问题