Data Binding: The Connection Between UI & Business Logic
Data Binding: The Connection Between UI & Business Logic
userNameTextField.text = viewModel.userName
Property Observing
Notification
Delegation
Closure (Callbacks)
A container for information broadcast through a notification center to all registered observers.
Specifically in the name of the notification, it support many state of application, like some example below:
Notification
enum Action {
case increase
case decrease
} Define an enumeration
var count = Box(0) Create variable and inherit from class Box
func increase() {
count.value += 1
}
Modify value by access to value variable
func decrease() {
count.value -= 1
}
}
Closure
At the listener, using function bind to handle when value of variable has been changed.
Key-Value Observation is a mechanism in Cocoa to receive callbacks when an object changes state. An
object first registers to observe a property of another object. Then, whenever that property changes
value, the observer is automatically notified
Functional Reactive Programming
Reactive programming là phương pháp lập trình với luồng dữ liệu bất đồng bộ hay những thay đổi có tính
lan truyền (the propagation of change). Khái niệm luồng (stream) rất phổ biến, bạn có thể tạo một luồng
từ bất kì kiểu dữ liệu nào: các biến (variables), giá trị đầu vào từ người dùng (user inputs), properties,
caches, data structures, etc. Có thể nói luồng là trung tâm của reactive.
Thank you so much for your attending !!
References:
https://docs.microsoft.com/en-us/dotnet/framework/wpf/data/data-binding-overview
http://reactivex.io
http://rxmarbles.com/#scan
https://github.com/blkbrds/rxswift-tutorials#get-started
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyVal
ueObserving/KeyValueObserving.html
https://developer.apple.com/documentation/foundation/nsnotificationcenter
https://github.com/blkbrds/rxswift-tutorials#get-started