我一直在试图找出一种实施这种行为的方法,但无法提出工作解决方案。
我想实现的目标
var dataSource = Variable<[T]>([])
var arrayObserver: Observable<SomeType> {
return dataSource.asObservable()
.map({ (elementoftype[T]) in
// do something with it and return element of SomeType
})
}
dataSource
变量以1乘1的含量为1,我希望arrayObserver
能够缓冲/"握住"到map
ping上,直到自上次发射以来dataSource
以来为0.5秒。p>非常感谢您的建议!
结果调用
.throttle(0.5, MainScheduler.instance)
映射完成作业之前。