Observable ( ObservableType) is equivalent to Sequence ObservableType.subscribe method is equivalent to Sequence.makeIterator method. RxSwift to Combine - SlideShare While this version aims to stay true to the original spirit and naming conventions of Rx, this projects also aims to provide a . You make subscription to it and receive events/movies. Step by step: Transform our variable into Observable - since Variable can be both Observer and Observable, we need to decide which one is it.And since we want to observe it, we transform it into Observable. Reactive Programming — RxSwift. Öncelikle Reactive ... The observer will get the element as soon as it has been added to the Observable object. RxCocoa provide wrapper to Cocoa API's to adopt reactive environment. Similarly when we talk about transforming operators it means changing the type of a value or sequence. When you bind an observable subscription to the text property, the property returns a new observer which executes its block parameter when each value is emitted. In this article, I aim to explain Publish, Connect . RxSwift là framework hỗ trợ lập trình FRP bằng ngôn ngữ Swift trong các ứng dụng iOS. 本スライドの対象者. What is Observer. Both frameworks are very similar, but the devil's in the details and if you want to make the transition, it really helps to have a clear mapping from all the RxSwift operators, types, and functions to their Combine equivalents. Chào bạn đến với Fx Studio.Hành trình trong thế giới RxSwift của chúng ta vẫn còn dài. It took me a lot of time to make that operator work so when I saw folks contribute their operators to RxSwift-Ext I naturally also wanted to merge mine in. Observable is called as " Observable sequence " in RxSwift and " Observable streams " in other platforms but they are the same thing. RxSwift, however, has a single type called Observable<T> which caters to both. Few things to note. Chào bạn đến với Fx Studio.Chúng ta tiếp tục với series RxSwift, phần tiếp theo là Observables.Trong các phần trước, bạn đã cài đặt và Hello world thành công với RxSwift rồi. let eventSwitch: BehaviorSubject<Observable<T>> = BehaviorSubject.create(/*initial value*/) // where T is your type of choice let events = eventSwitch.switchLatest() // subscribe consumer to this eventSwitch.onNext(/*new event source of type Observable<T . We are creating an observable using create function of Observable which returns a callback with an observer object. Observable的核心函数: subscribe 订阅操作, Observable 和 Observer 通过订阅建立联系, Observable 好比水源, Observer 好比水龙头(永远开着的水龙头), 订阅的过程就是在Observable 和 Observer 之间建立管道, 一旦建立管道即是永久性的,只要水源有谁, 水龙头就会有水。 While this version aims to stay true to the original spirit and naming conventions of Rx, this projects also aims to provide a . Stars - the number of stars that a project has on GitHub.Growth - month over month growth in stars. We can create an Observable for any type of data. Rx is a generic abstraction of computation expressed through Observable<Element> interface, which lets you broadcast and subscribe to values and other events from an Observable stream. You can read more about errors in RxSwift here. Huỷ một subscription bằng dispose(); Quản lý nhiều subscription cho nó tự huỷ bằng DisposeBag.create tạo ra một Observable và cài đặt các hành vi cho nó. RxSwift minimal Observable.create example, You may use RxExamples for better understanding RxSwift . Günlük . The code is more readable, there is less opportunity to introduce bugs, and there's nothing wrong with it. At that point, the Observable can no longer emit anything. In Custom convenience operators with RxSwift, Part 2 I discussed creating the unwrap() operator, which unwraps non-nil values emitted by an observable. Observable.from(): This method takes array of elements like String, Int etc. Imagine a user changes the permission in iOS settings before an observer subscribes for the permissionObservable.The observer will receive the old value of the permission.. Observables are nothing but a sequence of data or elements with some special abilities. RXSwift Update single element. The content of this page is licensed under Creative Commons Attribution 3.0 License, and code samples are licensed under the BSD License. The key advantage for an Observable vs Swift's Sequence is that it can also receive elements asynchronously. SwiftUI 2. I suppose it is better to switch to the next observable (which may be dormant at the time of the switch) using '.switchLatest()' operator. Observable class constructor takes a function as a parameter, and that function has an observer object inside. ; Okay! An Observer subscribes to an Observable and gets notified when that Observable has changed. Now negate() worked also in other contexts. With this schedulers, you can define an observable which does its work in a background thread, and post our results to the main thread. Observable.create { [weak self] observer in observer.onNext(NewsTopScrollCellModel()) observer.onCompleted() return Disposables.create() } 你可以使用just which表示等价: Observable.just(NewsTopScrollCellModel()) 阅读全文 . The observer is a consumer of values delivered by the Observable. Reactive programlama, "değişikliklere tepki verme" temeline dayalı bir yöntemdir. That's literally all there is to adding a . The key advantage for an Observable vs Swift's Sequence is that it can also receive elements asynchronously. I found it in RxSwift repo. Transforming means making a marked change in the form, nature, or appearance. flatMap at a time can subscribed to multiple inner observable ReactiveCocoa-20,016 4.8 Swift Observable VS ReactiveCocoa . In Custom convenience operators with RxSwift, Part 2 I discussed creating the unwrap() operator, which unwraps non-nil values emitted by an observable. OR. Khác nhau ở góc độ mà họ muốn mình hiểu. Deallocating a . RxSwift vs PromiseKit 我们可以看到二者相类似的地方是都能 链式处理异步 ,不同点是 RxSwift 提供了 声明式 的写法,而 PromiseKit 仍然需要 命令式 的写法 . In this chapter, you'll learn about the different types of subjects in RxSwift, see how to work with each one and why you might choose one over another based on some common use cases. Rxを聞いたことあるけど、まだ触ってない or 触っては見たけど普段は使ってない; 下記のどれかの言語を読み書きできる Similar projects and alternatives to Observable RxSwift-21,158 6.9 Swift Observable VS RxSwift Reactive Programming in Swift. 1. You read the authorizationStatus while creating the Observable not when an observer subscribes to it.. Photo by Maxwell Nelson on Unsplash. Conclusion. Observable. Active 1 year, 11 months ago. For real life example, Think Netflix as an observable, which emits movies or web series. Tạm kết. It took me a lot of time to make that operator work so when I saw folks contribute their operators to RxSwift-Ext I naturally also wanted to merge mine in. RxSwift includes a shared scheduler that uses the main thread MainScheduler.instance so you can use it to observe elements easily like so: Observable<Int>.create { observer in observer.onNext(1) sleep(1) observer.onNext . The main difference between the pure MVVM and the Rx-enhanced version is the binding handling. These are the two most important naming changes: Observable -> Publisher Observer -> Subscriber Error types and error handling As mentioned above, RxSwift's Observable Combine is the new cool kid in town when it comes to reactive programming with Swift, so many developers in the community want to switch from RxSwift to Combine. "observer 1: 0.7184075243594013" "observer 2: 0.41271850211336103" "observer subject 1: 0.8034263165479893" "observer subject 2: 0.8034263165479893" Observable.create を使用すると、オブザーバーごとに異なる出力が作成されますが、 BehaviorSubject は、すべてのオブザーバーに対して同じ出力を提供し . RxSwift → is a framework for interacting with the Swift programming language, in a reactive manner. #6 - Subscribing multiple times into 1 Observable. 4 min read. ; Map every new value of CGPoint to UIColor.We get the new center that our Observable produced, then based on (not-so) really complicated math calculations we create new UIColor. 2021-09-26 07:37:08 . Note: In RxSwift 4 UIBindingObserver has been changed to Binder. In this article, I aim to explain Publish, Connect . Ở bài trước với Observable đại cương, bạn cũng đã tạo được Observable bằng 3 toán tử huyền thoại just, of & from. Hitting the button there are two possible outcomes: 1 can help you gain a practical of! Observable is equivalent to sequence in Swift. Observable. It took me a while to switch my brain to the state that everything is an Observable. The key advantage for an Observable vs Swift's SequenceType is that it can also receive elements asynchronously. Personally, I find that knowing the signal's semantics is important, because it better describes how it is used in a specific context. Observable<String>, Observable<Int>, Observable<Bool> struct Person {let name: String} Observable<[Person]> etc. Các đối tượng của nó đều thuộc class Observable trong RxSwift. 위의 내용은 하단 참고에서 2,3번째 링크를 보기로 하고, 일단 이번 포스팅에서는 기본 개념만을… Let'Swift 2019 컨퍼런스에서 RxSwift to Combine 이라고 발표한 자료입니다. RxSwift is one of them, and it's definitely a big fish in the sea. Subjects act as both an observable and an observer. Rxswift开关阵列中的异步api. any time it receives a new value it runs the code label.text = text. pod 'RxSwift' pod 'RxCocoa' end . Part 4 - Hot Observable Vs Cold Observable; Part 5 - Observer Vs Subscriber Vs Consumer แตกต่างกันยังไง . Combine is the new cool kid in town when it comes to reactive programming with Swift, so many developers in the community want to switch from RxSwift to Combine. They can receive events and also be . Introduce 3. Bây giờ, chúng ta tới phần sử dụng Model trong RxSwift vs. UIKit.Điểm đặc biệt là sẽ Tạo Model với Custom Observable.Ngoài ra, sẽ giải quyết thêm bài toán call back khi sử dụng Model. Về khả năng: Cho phép tạo ra 1 chuỗi các sự kiện không đồng bộ. This library brings to Swift the capabilities of functional reactive programming. 뱅크샐러드박보영 RxSwift to Combine feat. As stated earlier, observables and observing sequences are the main ideas around which reactive programming is built. Rx is a generic abstraction of computation expressed through Observable<Element> interface, which lets you broadcast and subscribe to values and other events from an Observable stream.. RxSwift is the Swift-specific implementation of the Reactive Extensions standard.. 即一个 Observable(ObservableType)相当于一个序列 Sequence(SequenceType)。; ObservableType.subscribe(_:)方法其实就相当于 SequenceType.generate() (2)但它们之间还是有许多区别的: In ReactiveX an observer subscribes to an Observable.Then that observer reacts to whatever item or sequence of items the Observable emits.This pattern facilitates concurrent operations because it does not need to block while waiting for the Observable to emit objects, but instead it creates a sentry in the form of an observer that stands ready to react appropriately at whatever . An Observer is the other side of the coin — a subscription to an Observable that listens for the events that are emitted over time. Every operator returns a new Observable object and doesn't modify the . public final class PublishRelay extends Relay Relay that, once an Observer has subscribed, emits all subsequently observed items to the subscriber. What you want is something that can act as both an observable and as an observer. It does not allow to go back to the previous event; it's a past. RxSwift is the Swift-specific implementation of the Reactive Extensions standard. Hot and Cold Observables. Every Observable sequence is just a sequence. Ok, let's try to RxSwift minimal Observable.create example. Activity is a relative number indicating how actively a project is being developed. However, deferred is the operator which solves all of these problems: Từ đó, tạo tiền đề cho xử lý bất đồng bộ . The most important one is that it can receive the data asynchronously. When the Observable changes, it will notify all its Observers. Observable is immutable class. The above code may not work as you want. The equivalence of observer pattern (Observable<Element> sequence) and normal sequences (SequenceType) is the most important thing to understand about Rx. Observer. Observer lắng nghe Observable —> bất kì nắng mưa, bão tố … Về giá trị thì nó sẽ phát ra 3 kiểu sau đây: element; error; completed Günlük yaşamımızdan ve insanlar arası iletişimimizden ilham alıyor diyebiliriz. And observer must subscribe to Observable to receive events. In order to combine Variable s with other streams, you have to. only 2 properties: centerVariable which will be our observer & observable - we will save data to it and we will get it. Mục đích của phần này là viết những bài bổ sung thêm kiến thức mà không làm ảnh hưởng đến trục chính mình đang viết bên RxSwift kia. Many implementations of ReactiveX use "Schedulers" to govern an Observable's transitions between threads in a multi-threaded environment. You could also make a network request in the closure, or you could call onNext every time a button is tapped. RxSwift Combine; Deployment Target: iOS 8.0+ iOS 13.0+ Platforms supported: iOS, macOS, tvOS, watchOS, Linux: iOS, macOS, tvOS, watchOS, UIKit for Mac ¹ Step 1: Create RxSwift Observables: In viewDidLoad, let's add these lines of code: // Create observable with the signal is String let observable = Observable<String>.create { (observer) -> Disposable in observer.onNext ("First signal") observer.onCompleted () return Disposables.create () } Lecture on Reactive programming on Android, mDevCamp 2016. The Observer is notified when an item is emitted, if an . Happens, download the github extension for Visual Studio and try again 10.1 and below, please RxSwift! An observable emits events. RxSwift 學習心得 (持續更新中) MVVM 進入RxSwift的世界 RxSwift 什麼是 Observable & Observer Observable Observer <Observable.subscibe> (ObservableType.subscribe) Driver vs Observable Subject Variable [Deprecated] 請愛用 BehaviorRelay BehaviorRelay: accept(_ event: Element) value DisposeBag: 自動釋放 手動釋放 . RxSwift is a library for composing asynchronous and event-based code by using observable sequences and functional style operators, allowing for parameterized execution via schedulers. Does having different types to represent hot and cold signals matter? Every Observable sequence is just a sequence. Observable<String>, Observable<Int>, Observable<Bool> struct Person {let name: String} Observable<[Person]> etc. Recent commits have higher weight than older ones. To prevent terminating of loginAtButtonTap you can for example use Result<T> type to have an Observable<Result<User>> or to use materialize(). Khi tìm hiểu về RxSwift hay Rx nói chung, bạn sẽ nghe tới các khái niệm observable , observable sequence hay đơn giản là sequence. RxSwift by Examples #2 - Observable and the Bind, Edit 18.01.2017: This post was updated to Swift 3.0 and RxSwift 3.1 You specify it in init of the Subject. An observer is also known as subscriber. E.g. This is the kernel of the RxSwift . The equivalence of observer pattern (Observable<Element> sequence) and normal sequences (Sequence) is the most important thing to understand about Rx. Ask Question Asked 4 years, 10 months ago. Introduce Observable : là nguồn phát ra dữ liệu mà các đối tượng khác có thể quan sát được và đăng ký tới được. With its large community and lots of support, RxSwift is a perfect choice for you to add some functional flavor to your code. Tới đây, mình xin kết thúc bài viết về DisposeBag trong RxSwift.Và nếu có gì thắc mắc hay góp ý cho mình thì bạn có thể để lại bình luận hoặc gởi . This is where the framework shines. I also had some trouble at first to figure out when to use Variable, Observable, PublishSubject and how I should bind values to UI components. ReactiveX is a collection of open source projects. Operators; Utility; ObserveOn; ObserveOn specify the Scheduler on which an observer will observe this Observable. You can instruct an Observable to send its notifications to observers on a particular Scheduler by means of the ObserveOn operator. Observables are nothing but a sequence of data or elements with some special abilities. RxSwift to Combine 1. RxSwift provides the Variable type, a mutable box that holds a current value and lets you observe changes to its value over time. Before we answer this question we need to know what does transformation mean. FlatMap then merges the emissions of these resulting Observables into own sequence. If you used it on Observable<Bool> it would apply a logical not to the value; if you used it on a Observable<Int> it would produce the negative value of the element. In addition to emitting events, an Observable can terminate with an error, or with completion. The observer will get the element as soon as it has been added to the Observable object. RxSwift in. Follow their code on GitHub. The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives. We can't change the past. Viewed 39k times . The DisposeBag. We removed the closures and replaced them with RxSwift bindings. The DisposeBag is an additional tool RxSwift provides to help deal with ARC and memory management. We need a function named callAPIFromApiHandler, which takes a parameter named withUrlString and returns an observable of type optional Data defined as Observable<Data?>. Observable. We can't change the past. Observable 继承体系. 자료 내에 언급되는 코드 링크는 다음과 같습니다 . 3 Common Mistakes I see people use in Rx and the Observable Pattern. In ReactiveX an observer subscribes to an Observable.Then that observer reacts to whatever item or sequence of items the Observable emits.This pattern facilitates concurrent operations because it does not need to block while waiting for the Observable to emit objects, but instead it creates a sentry in the form of an observer that stands ready to react appropriately at whatever . Creating your own convenience operators is awesome. "hot" Observable có thể bắt đầu phát ra events ngay khi nó được tạo ra và những observer mà bắt đầu subscribes có . Còn nếu bạn chưa đọc qua thì có thể ghé sang link sau đây: It does not allow to go back to the previous event; it's a past. #Events #Functional #Reactive #Programming #Observable #Observer #Swift #Easy #Observe #Value #Values #Generic #Generics #Library #Libraries #Swift5 #swift-5 . Khá là mơ hồ nhưng tất cả chúng đều là một và ám chỉ tới nguồn phát. Both frameworks are very similar, but the devil's in the details and if you want to make the transition, it really helps to have a clear mapping from all the RxSwift operators, types, and functions to their Combine equivalents. Qiita < /a > RxSwift, you have to < /a > Observable 继承体系 s to adopt environment... Receive elements asynchronously, once an observer subscribes to it and observer must subscribe to Observable RxSwift-21,158 Swift! - Qiita < /a > 1 by the Observable changes, it will notify its... Tử RxSwift được bọc lại trong các API của ReactiveX Qiita < /a RxSwift... Is emitted, if an - the number of stars that a project is being developed most. To Observable to send its notifications to Observers on a particular Scheduler by means of the ObserveOn operator tạo. //Stackoverflow.Com/Questions/64733638/Rxswift-Purpose-Of-Observable '' > Rxswift开关阵列中的异步api - 错说 < /a > 4 min read a parameter, and function! //Thetopsites.Net/Article/52553397.Shtml '' > RxSwift subjects khá là mơ hồ nhưng tất cả chúng là! Took me a while to switch my brain to the previous event it... The previous event ; it & # x27 ; s a past it will notify all its Observers this,! X27 ; t change the past cold signals matter s to adopt Reactive environment Rx and the Observable Pattern naming! Filter - 入門サンプル < /a > Observable 继承体系 listening to an Observable use... These resulting observables into own sequence with Swift, Chapter 3... < /a 4. Brain to the state that everything is an Observable vs RxSwift Reactive Programming cho ngôn ngữ khác lại thấy! The ObserveOn operator to represent hot and cold signals matter, this projects also to., Connect here is about ways that we expand on that idea ký... Your code to RxSwift minimal Observable.create example most important one is that it becomes possible to static! Multiple times into 1 Observable I see people use in Rx and the Observable also make a network request the. Không thấy are creating an Observable vs Swift & # x27 ; s to adopt Reactive.! Programming in Swift Subscribing multiple times into 1 Observable receive events observables are nothing a... 4 min read a button is tapped Observable 继承体系 into 1 Observable under the BSD License to adding a growth. Brings to Swift the capabilities of functional Reactive Programming — RxSwift DisposeBag is an tool. Main ideas around which Reactive Programming in Swift khác nhau ở góc độ họ! Order to combine 1 günlük yaşamımızdan ve insanlar arası iletişimimizden ilham alıyor diyebiliriz emissions these! For real life example, you may use RxExamples for better understanding.! And observer must subscribe to Observable to receive events khác nhau ở góc độ mà họ muốn mình hiểu:. Qiita < /a > Observable.create RxSwift question Asked 4 years, 10 months ago other... With some special abilities to RxSwift minimal Observable.create example article, I aim to explain Publish, Connect time. Apis used in iOS and OS X easier to use with Reactive techniques observables and sequences... Rxjs angular filter - 入門サンプル < /a > RxSwift Part 4 could call onNext every time button! Example, you may use RxExamples for better understanding RxSwift receives a new Observable object doesn. To switch my brain to the state that everything is an additional tool RxSwift provides to help deal ARC. > Observable.create RxSwift a new value it runs the code label.text = text will notify its. Lý bất đồng bộ filter - 入門サンプル < /a > Tạm kết Programming on Android, mDevCamp 2016: @! The most important one is that it becomes observer vs observable rxswift to express static ( e.g RxSwift Binding! Design Pattern Sequence.makeIterator method ( rxcocoa ) other streams, you have to life example Think. > RxSwift to combine Variable s with other streams, you have to multiple Observable!, emits all subsequently observed items to the subscriber no longer emit.. Rxexamples for better understanding RxSwift subjects act as both an Observable, emits. Api của ReactiveX have to months ago go back to the original spirit and naming of... //Code-Examples.Net/Ja/Q/25Aa1Aa '' > Gorgeous RxSwift, Binding and MVVM Design Pattern MVVM Design Pattern is! Brain to the subscriber s new in RxSwift 4 UIBindingObserver has been to. It means changing the type of data as a parameter, and that function has observer... In Swift growth in stars bạn chuyển sang Rx cho ngôn ngữ khác lại không thấy a button tapped... To it walasymedia.com < /a > Observable.create RxSwift subsequently observed items to the previous event ; it & # ;... To represent hot and cold signals matter ; it & # x27 ; s a past and &! The Reactive Extensions standard which emits movies or web series to express static ( e.g Observable ( ). Ilham alıyor diyebiliriz we talk about transforming operators it means changing the type of data elements! Data or elements with some special abilities the code label.text = text elements asynchronously key. Can no longer emit anything = text PublishRelay extends Relay Relay that once. Creative Commons Attribution 3.0 License, and code samples are licensed under the BSD.... To go back to the previous event ; it & # x27 ; s a.! Rxswift here you have to both an Observable for any type of data elements... With an observer subscribes to it of values delivered by the Observable changes, it notify! # 6 - Subscribing multiple times into 1 Observable change in the form,,...: cho phép tạo ra 1 chuỗi các sự kiện không đồng bộ for type. Subscribe to Observable to send its notifications to Observers on a particular Scheduler by means of the Extensions. Over month growth in stars min read can also receive elements asynchronously article, I aim explain! Does not allow to go back to the previous event ; it & # x27 ; t change past... Phát ra dữ liệu mà các đối tượng khác có thể quan sát được và đăng tới... Its notifications to Observers on a particular Scheduler by means of the ObserveOn operator → is a perfect choice you! Relay Relay that, once an observer object inside to the subscriber listening to an,. Extensions standard does transformation mean month observer vs observable rxswift month growth in stars method equivalent. Merges the emissions of these resulting observables into own sequence of previous… by... Nhưng tất cả chúng đều là một và ám chỉ tới nguồn.... As an Observable vs Swift & # x27 ; t change the past signals matter past! Mình hiểu khả năng: cho phép tạo ra 1 chuỗi các kiện. < /a > Observable 继承体系 this article, I aim to explain Publish, Connect > RxSwift Observable to events... And lots of support, RxSwift is a perfect choice for you to add functional! Streams, you may use RxExamples for better understanding RxSwift functional flavor your. With Rx < /a > Observable functional flavor to your code: Reactive Programming — RxSwift > Gorgeous,. Nhau ở góc độ mà họ muốn mình hiểu Attribution 3.0 License, and that function has an observer to! Swift - RxSwift purpose of Observable which returns a new value it runs the code label.text = text MVVM Pattern... To go back to the subscriber closure, or you could also make a network in... > Tạm kết that it can also receive elements asynchronously sequence of data also receive elements asynchronously RxSwift-21,158 Swift! Capabilities of functional Reactive Programming — RxSwift observed items to the subscriber -... 1 can help you gain a practical of Cocoa API & # x27 ; t change the past đề xử! Observables and observing sequences are the main ideas around which Reactive Programming — RxSwift chúng đều là một ám... The BSD License RxSwift được bọc lại trong các API của ReactiveX chỉ tới nguồn phát ra dữ mà... By means of the Reactive Extensions standard günlük yaşamımızdan ve insanlar arası iletişimimizden ilham alıyor diyebiliriz of!, 10 months ago Programming — RxSwift ways that we expand on that idea act both. A practical of yaşamımızdan ve insanlar arası iletişimimizden ilham alıyor diyebiliriz Observable to single - walasymedia.com < >. ( ObservableType ) is equivalent to sequence ObservableType.subscribe method is equivalent to Sequence.makeIterator method or with. Arc and memory management when we talk about transforming operators it means changing the type of data elements! Is equivalent to sequence ObservableType.subscribe method is equivalent to Sequence.makeIterator method hồ nhưng tất chúng! Rxjs angular filter - 入門サンプル < /a > RxSwift Observable to single - walasymedia.com < /a > 4 read! Order to combine Variable s with other streams, you may use RxExamples for better understanding RxSwift thể. Tool RxSwift provides to help deal with ARC and memory management question we need to know What does mean... Can create an Observable it runs the code label.text = text multiple inner Observable < a ''! Everything is an additional tool RxSwift provides to help deal with ARC and management! A practical of this is the kernel of RxSwift, Binding and MVVM Design Pattern ký tới được hot cold! > RxSwift/RxJava入門 - Qiita < /a > Observable 继承体系 and memory management about ways we. Also receive elements asynchronously Programming in Swift subjects act as both an Observable single. Observer is a consumer of values delivered by the Observable observables are nothing but sequence... To your code & # x27 ; t change the past có thể quan được! We answer this question we need to know What does transformation mean its Observers dữ liệu mà các đối khác...