[Chapter 6] Error using take(_:scheduler:) with Completable

Hi there! I’m working through Chapter 6 of the RxSwift book in Xcode 10 with RxSwift 4.0.0 as per the example project’s Podfile.

When I get to the section “Completing a subscription after a given time interval,” I’m trying to use the following code:

alert(title: "No access to Camera Roll", text: "You can grant access to Combinestagram from the Settings app.")
    .take(5.0, scheduler: MainScheduler.instance)

This produces the following error in Xcode:

Value of type 'Completable' (aka 'PrimitiveSequence<CompletableTrait, Never>') has no member 'take'

What am I missing about Completable that prevents me from calling take(_:scheduler:) on it?

I figured out a workaround: Adding .asObservable() before .take(_:scheduler:).

@slaunchaman Thank you for sharing the solution - much appreciated!

This topic was automatically closed after 166 days. New replies are no longer allowed.