diff --git a/Rx.playground/Pages/Connectable_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Connectable_Operators.xcplaygroundpage/Contents.swift index d7637db0..28587da8 100644 --- a/Rx.playground/Pages/Connectable_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Connectable_Operators.xcplaygroundpage/Contents.swift @@ -49,7 +49,7 @@ func sampleWithPublish() { _ = intSequence .subscribeNext { print("Subscription 1:, Event: \($0)") } - delay(2) { intSequence.connect() } + delay(2) { _ = intSequence.connect() } delay(4) { _ = intSequence @@ -81,7 +81,7 @@ func sampleWithReplayBuffer() { _ = intSequence .subscribeNext { print("Subscription 1:, Event: \($0)") } - delay(2) { intSequence.connect() } + delay(2) { _ = intSequence.connect() } delay(4) { _ = intSequence @@ -115,7 +115,7 @@ func sampleWithMulticast() { _ = intSequence .subscribeNext { print("\tSubscription 1:, Event: \($0)") } - delay(2) { intSequence.connect() } + delay(2) { _ = intSequence.connect() } delay(4) { _ = intSequence diff --git a/Rx.playground/Pages/Creating_and_Subscribing_to_Observables.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Creating_and_Subscribing_to_Observables.xcplaygroundpage/Contents.swift index 7f751cf0..0df97e9b 100644 --- a/Rx.playground/Pages/Creating_and_Subscribing_to_Observables.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Creating_and_Subscribing_to_Observables.xcplaygroundpage/Contents.swift @@ -190,7 +190,7 @@ example("deferred") { example("error") { let disposeBag = DisposeBag() - Observable.error(Error.test) + Observable.error(TestError.test) .subscribe { print($0) } .addDisposableTo(disposeBag) } diff --git a/Rx.playground/Pages/Debugging_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Debugging_Operators.xcplaygroundpage/Contents.swift index fdde6b68..4165dad9 100644 --- a/Rx.playground/Pages/Debugging_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Debugging_Operators.xcplaygroundpage/Contents.swift @@ -24,7 +24,7 @@ example("debug") { observer.onNext("🍊") if count < 5 { - observer.onError(Error.Test) + observer.onError(TestError.test) print("Error encountered") count += 1 } diff --git a/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift index 0383aa15..37c6b6d4 100644 --- a/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift @@ -29,7 +29,7 @@ example("catchErrorJustReturn") { sequenceThatFails.onNext("😨") sequenceThatFails.onNext("😡") sequenceThatFails.onNext("🔴") - sequenceThatFails.onError(Error.Test) + sequenceThatFails.onError(TestError.test) } /*: ---- @@ -55,7 +55,7 @@ example("catchError") { sequenceThatFails.onNext("😨") sequenceThatFails.onNext("😡") sequenceThatFails.onNext("🔴") - sequenceThatFails.onError(Error.Test) + sequenceThatFails.onError(TestError.test) recoverySequence.onNext("😊") } @@ -75,7 +75,7 @@ example("retry") { observer.onNext("🍊") if count == 1 { - observer.onError(Error.Test) + observer.onError(TestError.test) print("Error encountered") count += 1 } @@ -109,7 +109,7 @@ example("retry maxAttemptCount") { observer.onNext("🍊") if count < 5 { - observer.onError(Error.Test) + observer.onError(TestError.test) print("Error encountered") count += 1 } diff --git a/Rx.playground/Pages/Working_with_Subjects.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Working_with_Subjects.xcplaygroundpage/Contents.swift index 7d8e4da2..b61ffd75 100644 --- a/Rx.playground/Pages/Working_with_Subjects.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Working_with_Subjects.xcplaygroundpage/Contents.swift @@ -18,7 +18,7 @@ extension ObservableType { Add observer with `id` and print each emitted event. - parameter id: an identifier for the subscription. */ - func addObserver(id: String) -> Disposable { + func addObserver(_ id: String) -> Disposable { return subscribe { print("Subscription:", id, "Event:", $0) } } diff --git a/Rx.playground/Sources/SupportCode.swift b/Rx.playground/Sources/SupportCode.swift index 298f20e7..e830a8f7 100644 --- a/Rx.playground/Sources/SupportCode.swift +++ b/Rx.playground/Sources/SupportCode.swift @@ -5,16 +5,16 @@ import Foundation - parameter description: example description - parameter action: `Void` closure */ -public func example(description: String, action: @noescape(Void) -> Void) { - printExampleHeader(description: description) +public func example(_ description: String, action: @noescape(Void) -> Void) { + printExampleHeader(description) action() } -public func printExampleHeader(description: String) { +public func printExampleHeader(_ description: String) { print("\n--- \(description) example ---") } -public enum Error: Swift.Error { +public enum TestError: Swift.Error { case test } @@ -24,7 +24,7 @@ public enum Error: Swift.Error { - parameter delay: time in seconds to wait before executing `closure` - parameter closure: `Void` closure */ -public func delay(delay: Double, closure: (Void) -> Void) { +public func delay(_ delay: Double, closure: (Void) -> Void) { let delayTime = DispatchTime.now() + DispatchTimeInterval.seconds(Int(delay)) DispatchQueue.main.asyncAfter(deadline: delayTime) {