在 model 中监听属性变化,  然后通过发射信号

class Item: Convertible {

    /** 监听收藏属性变化, 通知cell的收藏状态变更*/
    var rx_favoritiesVar: BehaviorRelay<Bool> = BehaviorRelay(value: false)

    var favoritesStatus: Bool = false {

        willSet {
            rx_favoritiesVar.accept(newValue)
        }

    }



    required init() {
        
    }


}
var item: Item? {
       didSet {
        
           item?.rx_favoritiesVar.asObservable().subscribe(onNext: {[weak self] (isCollect) in

           }).disposed(by: self.bag)
       }
   }

 

相关文章:

  • 2021-06-01
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2021-07-22
  • 2022-12-23
  • 2021-09-25
猜你喜欢
  • 2022-12-23
  • 2021-04-16
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案