作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
无法在 rxswift 中为去抖设置 Rxtimeinterval。我的代码如下。我收到此错误消息“无法将‘Double’类型的值转换为预期的参数类型‘RxTimeInterval’(又名‘DispatchTimeInterval’)”
searchBar
.rx.text // Observable property thanks to RxCocoa
.orEmpty // Make it non-optional
.debounce(0.5, scheduler: MainScheduler.instance) // Wait 0.5 for changes.
.distinctUntilChanged() // If they didn't occur, check if the new value is the same as old.
.filter { !$0.isEmpty }
错误信息:
"Cannot convert value of type 'Double' to expected argument type 'RxTimeInterval' (aka 'DispatchTimeInterval')"
最佳答案
searchBar
.rx.text // Observable property thanks to RxCocoa
.orEmpty // Make it non-optional
.debounce(.milliseconds(500), scheduler: MainScheduler.instance) // Wait 0.5 for changes.
.distinctUntilChanged() // If they didn't occur, check if the new value is the same as old.
.filter { !$0.isEmpty }
关于ios - 如何在 RxSwift 中为去抖设置 RxTimeInterval?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56506808/
无法在 rxswift 中为去抖设置 Rxtimeinterval。我的代码如下。我收到此错误消息“无法将‘Double’类型的值转换为预期的参数类型‘RxTimeInterval’(又名‘Dispa
我是一名优秀的程序员,十分优秀!