【发布时间】:2019-05-24 08:02:52
【问题描述】:
我有 BehaviourSubject,我想用最后一个发出的值刷新项目。下面的例子我可以做到,
func refreshCurrent() {
do {
let items = try currentMatchList.value()
if !(items.first?.items ?? []).isEmpty {
refreshItems(sportId: try currentSport.value())
}
} catch {
LOG.error(error.localizedDescription)
return
}
}
但我想知道是否有任何内置的 RxSwift 功能可以用于相同的任务?
我发现曾经有一个 Variable() 类型,但现在它已经消失了,建议使用 BehaviourSubject 似乎。
提前致谢。
【问题讨论】:
标签: swift system.reactive rx-swift behaviorsubject