SHARE
TWEET

Untitled

a guest Sep 17th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         data = realm.objects(HealthModel.self)
  2.        
  3.         dataArr = data.toArray()
  4.        
  5.         let section = BehaviorRelay(value: [
  6.             HealthSectionModel(title: "", data: dataArr)
  7.             ])
  8.  
  9.         let dataSource = RxCollectionViewSectionedAnimatedDataSource<HealthSectionModel>(configureCell: { _, collectionView, indexPath, item in
  10.            
  11.             let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HealthCell", for: indexPath) as! HealthCell
  12.             cell.label.text = item.title
  13.             cell.imageView.image = UIImage(data: item.image!)
  14.            
  15.             return cell
  16.         })
  17.        
  18.         section.asDriver().drive(collectionView.rx.items(dataSource: dataSource)).disposed(by: disposeBag)
  19.        
  20.         notificationToken = realm.observe { [unowned self] notification, realm in
  21.             self.dataArr = self.data.toArray()
  22.            
  23.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top