RxSwift reload tableview

前端 未结 3 1667
野的像风
野的像风 2020-12-21 07:04
let officialAccountObservable : Observable<[SearchUser]> = SearchAPI.sharedAPI.suggestAccounts()

        officialAccountObservable.bind(to: tableView.rx.items         


        
3条回答
  •  星月不相逢
    2020-12-21 07:46

    AFAIK, this is the standard way of doing this -

    let source = PublishSubject>()
    let officialAccountObservable: Observable<[SearchUser]> = source.switchLatest()
    source.onNext(suggestAccounts()) // every call will refresh your table
    

提交回复
热议问题