简体   繁体   中英

What should the scheduler be for delay and debounce in Combine? (Xcode 11 beta 1 only)

This issue would ideally be deleted because it is related to obsolete beta version of Xcode only.

[WWDC Video 721 Combine in Practice][1] seems to indicate that RunLoop.main should be a valid scheduler to use in Combine with delay or debounce but I'm seeing compile errors with Xcode claiming that RunLoop doesn't conform to scheduler. Am I doing something wrong or is this just an issue with the first beta of Xcode.

ContentView.swift:95:77: error: argument type 'RunLoop' does not conform to expected type 'Scheduler'
        return delayPublisher.debounce(for: .seconds(5), scheduler: RunLoop.main).eraseToAnyPublisher()

I've raised FB6160439.

[1]: https://developer.apple.com/videos/play/wwdc2019/721/ (slides 79, 80, 211).

The Foundation Combine integrations weren't available in the first beta build. They're available in the second beta (6/17/19), so you just need to update your Xcode 11 beta.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM