Fixes playgrounds compilation issues.
This commit is contained in:
parent
a2ee04e721
commit
58e427b045
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ example("deferred") {
|
|||
example("error") {
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
Observable<Int>.error(Error.test)
|
||||
Observable<Int>.error(TestError.test)
|
||||
.subscribe { print($0) }
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ example("debug") {
|
|||
observer.onNext("🍊")
|
||||
|
||||
if count < 5 {
|
||||
observer.onError(Error.Test)
|
||||
observer.onError(TestError.test)
|
||||
print("Error encountered")
|
||||
count += 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue