문제

I wonder if there is any frameworks I'm not aware that I can use to achieve the concept of databinding, bind a NSObject derived class (the model) to a UIControl/NSControl derived component properties.

For example I have a class with a property name and I need to bind it to a UITextView text property so that when the model's name property changes the UITextView text property updates.

I guess that there would be something built on the Key-Value Observing concept.

I would like something that is working in both OSX and iOS or any other related frameworks for the platforms.

Thank you.

도움이 되었습니까?

해결책

You're looking for ReactiveCocoa - super awesome framework that does exactly what you asked for and more. Also a good way to implement MVVM - they have cool extensions that enable that ReactiveViewModel as well as extensions for AFNetworking

다른 팁

Take a look at AKA Beacon (https://github.com/mutech/aka-ios-beacon). It's a binding framework that allows you to bind views to properties right from interface builder. The view controller (by default) serves as view model for bindings. You just have to add one line of code to the view controller to activate binding support and the framework takes care for all the rest.

Beacon supports most standard views (Label, TextField/View, Image, Slider, Stepper, Switch, TableView, etc.). It's relatively easy to write extension bindings for custom views.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top