@@ -63,31 +63,32 @@ import Cocoa
6363extension Reactive where Base: NSTableView {
6464
6565 public func realmChanges< E> ( _ dataSource: RxTableViewRealmDataSource < E > )
66- -> RealmBindObserver < E , AnyRealmCollection < E > , RxTableViewRealmDataSource < E > > {
66+ -> Binder < RealmChange < E > > {
6767
6868 base. delegate = dataSource
6969 base. dataSource = dataSource
7070
71- return RealmBindObserver ( dataSource : dataSource ) { ds , results , changes in
71+ return Binder ( base ) { tableView , element in
7272 if dataSource. tableView == nil {
73- dataSource. tableView = self . base
73+ dataSource. tableView = tableView
7474 }
75- ds . applyChanges ( items: AnyRealmCollection < E > ( results ) , changes: changes )
75+ dataSource . applyChanges ( items: element . 0 , changes: element . 1 )
7676 }
7777 }
7878}
7979
8080extension Reactive where Base: NSCollectionView {
8181
8282 public func realmChanges< E> ( _ dataSource: RxCollectionViewRealmDataSource < E > )
83- -> RealmBindObserver < E , AnyRealmCollection < E > , RxCollectionViewRealmDataSource < E > > {
83+ -> Binder < RealmChange < E > > {
8484
85- return RealmBindObserver ( dataSource: dataSource) { ds, results, changes in
86- if ds. collectionView == nil {
87- ds. collectionView = self . base
85+ base. dataSource = dataSource
86+
87+ return Binder ( base) { collectionView, element in
88+ if dataSource. collectionView == nil {
89+ dataSource. collectionView = collectionView
8890 }
89- ds. collectionView? . dataSource = ds
90- ds. applyChanges ( items: AnyRealmCollection < E > ( results) , changes: changes)
91+ dataSource. applyChanges ( items: element. 0 , changes: element. 1 )
9192 }
9293 }
9394}
0 commit comments