diff --git a/Documentation/API.md b/Documentation/API.md index e0549f25..a35f98c9 100644 --- a/Documentation/API.md +++ b/Documentation/API.md @@ -21,6 +21,8 @@ Operators are stateless by default. * [`never`](http://reactivex.io/documentation/operators/empty-never-throw.html) * [`returnElement` / `just`](http://reactivex.io/documentation/operators/just.html) * [`returnElements`](http://reactivex.io/documentation/operators/from.html) + * [`range`](http://reactivex.io/documentation/operators/range.html) + * [`repeatElement`](http://reactivex.io/documentation/operators/repeat.html) * [`timer`](http://reactivex.io/documentation/operators/timer.html) #### Transforming Observables @@ -32,10 +34,12 @@ Operators are stateless by default. #### Filtering Observables * [`debounce` / `throttle`](http://reactivex.io/documentation/operators/debounce.html) * [`distinctUntilChanged`](http://reactivex.io/documentation/operators/distinct.html) + * [`elementAt`](http://reactivex.io/documentation/operators/elementat.html) * [`filter` / `where`](http://reactivex.io/documentation/operators/filter.html) * [`sample`](http://reactivex.io/documentation/operators/sample.html) * [`skip`](http://reactivex.io/documentation/operators/skip.html) * [`take`](http://reactivex.io/documentation/operators/take.html) + * [`takeLast`](http://reactivex.io/documentation/operators/takelast.html) #### Combining Observables @@ -57,11 +61,13 @@ Operators are stateless by default. * [`observeOn` / `observeSingleOn`](http://reactivex.io/documentation/operators/observeon.html) * [`subscribe`](http://reactivex.io/documentation/operators/subscribe.html) * [`subscribeOn`](http://reactivex.io/documentation/operators/subscribeon.html) + * [`using`](http://reactivex.io/documentation/operators/using.html) * debug #### Conditional and Boolean Operators * [`amb`](http://reactivex.io/documentation/operators/amb.html) * [`skipWhile`](http://reactivex.io/documentation/operators/skipwhile.html) + * [`skipUntil`](http://reactivex.io/documentation/operators/skipuntil.html) * [`takeUntil`](http://reactivex.io/documentation/operators/takeuntil.html) * [`takeWhile`](http://reactivex.io/documentation/operators/takewhile.html) @@ -69,6 +75,7 @@ Operators are stateless by default. * [`concat`](http://reactivex.io/documentation/operators/concat.html) * [`reduce` / `aggregate`](http://reactivex.io/documentation/operators/reduce.html) + * [`toArray`](http://reactivex.io/documentation/operators/to.html) #### Connectable Observable Operators @@ -434,6 +441,6 @@ extension NSTextField { public var rx_delegate: DelegateProxy {} public var rx_text: ControlProperty {} - + } ``` diff --git a/Documentation/GettingStarted.md b/Documentation/GettingStarted.md index 71427a0f..74b5d768 100644 --- a/Documentation/GettingStarted.md +++ b/Documentation/GettingStarted.md @@ -304,7 +304,7 @@ Let's create a function which creates a sequence that returns one element upon s func myJust(element: E) -> Observable { return create { observer in observer.on(.Next(element)) - obsever.on(.Completed) + observer.on(.Completed) return NopDisposable.instance } } diff --git a/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift index ea0ef648..5ae6ce57 100644 --- a/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift @@ -45,7 +45,7 @@ example("combineLatest 1") { let intOb1 = PublishSubject() let intOb2 = PublishSubject() - combineLatest(intOb1, intOb2) { + _ = combineLatest(intOb1, intOb2) { "\($0) \($1)" } .subscribe { @@ -68,7 +68,7 @@ example("combineLatest 2") { let intOb1 = just(2) let intOb2 = sequenceOf(0, 1, 2, 3, 4) - combineLatest(intOb1, intOb2) { + _ = combineLatest(intOb1, intOb2) { $0 * $1 } .subscribe { @@ -85,7 +85,7 @@ example("combineLatest 3") { let intOb2 = sequenceOf(0, 1, 2, 3) let intOb3 = sequenceOf(0, 1, 2, 3, 4) - combineLatest(intOb1, intOb2, intOb3) { + _ = combineLatest(intOb1, intOb2, intOb3) { ($0 + $1) * $2 } .subscribe { @@ -108,7 +108,7 @@ example("zip 1") { let intOb1 = PublishSubject() let intOb2 = PublishSubject() - zip(intOb1, intOb2) { + _ = zip(intOb1, intOb2) { "\($0) \($1)" } .subscribe { @@ -132,7 +132,7 @@ example("zip 2") { let intOb2 = sequenceOf(0, 1, 2, 3, 4) - zip(intOb1, intOb2) { + _ = zip(intOb1, intOb2) { $0 * $1 } .subscribe { @@ -146,7 +146,7 @@ example("zip 3") { let intOb2 = sequenceOf(0, 1, 2, 3) let intOb3 = sequenceOf(0, 1, 2, 3, 4) - zip(intOb1, intOb2, intOb3) { + _ = zip(intOb1, intOb2, intOb3) { ($0 + $1) * $2 } .subscribe { @@ -170,7 +170,7 @@ example("merge 1") { let subject1 = PublishSubject() let subject2 = PublishSubject() - sequenceOf(subject1, subject2) + _ = sequenceOf(subject1, subject2) .merge() .subscribeNext { int in print(int) @@ -190,7 +190,7 @@ example("merge 2") { let subject1 = PublishSubject() let subject2 = PublishSubject() - sequenceOf(subject1, subject2) + _ = sequenceOf(subject1, subject2) .merge(maxConcurrent: 2) .subscribe { print($0) diff --git a/Rx.playground/Pages/Conditional_and_Boolean_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Conditional_and_Boolean_Operators.xcplaygroundpage/Contents.swift index 03398d0c..9da1d2ec 100644 --- a/Rx.playground/Pages/Conditional_and_Boolean_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Conditional_and_Boolean_Operators.xcplaygroundpage/Contents.swift @@ -23,7 +23,7 @@ example("takeUntil") { let originalSequence = PublishSubject() let whenThisSendsNextWorldStops = PublishSubject() - originalSequence + _ = originalSequence .takeUntil(whenThisSendsNextWorldStops) .subscribe { print($0) @@ -53,7 +53,7 @@ example("takeWhile") { let sequence = PublishSubject() - sequence + _ = sequence .takeWhile { int in int < 4 } diff --git a/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift index 01c41486..c366e4a2 100644 --- a/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift @@ -1,7 +1,6 @@ //: [<< Previous](@previous) - [Index](Index) import RxSwift -import XCPlayground /*: ## Connectable Observable Operators @@ -15,13 +14,13 @@ func sampleWithoutConnectableOperators() { let int1 = interval(1, MainScheduler.sharedInstance) - int1 + _ = int1 .subscribe { print("first subscription \($0)") } delay(5) { - int1 + _ = int1 .subscribe { print("second subscription \($0)") } @@ -44,7 +43,7 @@ func sampleWithMulticast() { let subject1 = PublishSubject() - subject1 + _ = subject1 .subscribe { print("Subject \($0)") } @@ -52,7 +51,7 @@ func sampleWithMulticast() { let int1 = interval(1, MainScheduler.sharedInstance) .multicast(subject1) - int1 + _ = int1 .subscribe { print("first subscription \($0)") } @@ -62,14 +61,14 @@ func sampleWithMulticast() { } delay(4) { - int1 + _ = int1 .subscribe { print("second subscription \($0)") } } delay(6) { - int1 + _ = int1 .subscribe { print("third subscription \($0)") } @@ -95,7 +94,7 @@ func sampleWithReplayBuffer0() { let int1 = interval(1, MainScheduler.sharedInstance) .replay(0) - int1 + _ = int1 .subscribe { print("first subscription \($0)") } @@ -105,14 +104,14 @@ func sampleWithReplayBuffer0() { } delay(4) { - int1 + _ = int1 .subscribe { print("second subscription \($0)") } } delay(6) { - int1 + _ = int1 .subscribe { print("third subscription \($0)") } @@ -130,7 +129,7 @@ func sampleWithReplayBuffer2() { let int1 = interval(1, MainScheduler.sharedInstance) .replay(2) - int1 + _ = int1 .subscribe { print("first subscription \($0)") } @@ -140,14 +139,14 @@ func sampleWithReplayBuffer2() { } delay(4) { - int1 + _ = int1 .subscribe { print("second subscription \($0)") } } delay(6) { - int1 + _ = int1 .subscribe { print("third subscription \($0)") } @@ -173,7 +172,7 @@ func sampleWithPublish() { let int1 = interval(1, MainScheduler.sharedInstance) .publish() - int1 + _ = int1 .subscribe { print("first subscription \($0)") } @@ -183,14 +182,14 @@ func sampleWithPublish() { } delay(4) { - int1 + _ = int1 .subscribe { print("second subscription \($0)") } } delay(6) { - int1 + _ = int1 .subscribe { print("third subscription \($0)") } @@ -200,6 +199,6 @@ func sampleWithPublish() { // sampleWithPublish() -XCPSetExecutionShouldContinueIndefinitely(true) +playgroundShouldContinueIndefinitely() //: [Index](Index) diff --git a/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift index f6099112..59f10a58 100644 --- a/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift @@ -21,7 +21,7 @@ example("catchError 1") { let sequenceThatFails = PublishSubject() let recoverySequence = sequenceOf(100, 200, 300, 400) - sequenceThatFails + _ = sequenceThatFails .catchError { error in return recoverySequence } @@ -40,7 +40,7 @@ example("catchError 1") { example("catchError 2") { let sequenceThatFails = PublishSubject() - sequenceThatFails + _ = sequenceThatFails .catchErrorJustReturn(100) .subscribe { print($0) @@ -83,7 +83,7 @@ example("retry") { return NopDisposable.instance } - funnyLookingSequence + _ = funnyLookingSequence .retry() .subscribe { print($0) diff --git a/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift index 69908bf4..9055e826 100644 --- a/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift @@ -149,12 +149,12 @@ example("deferred") { } } - deferredSequence + _ = deferredSequence .subscribe { event in print(event) } - deferredSequence + _ = deferredSequence .subscribe { event in print(event) } diff --git a/Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift index 64273983..8ee29c4c 100644 --- a/Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift @@ -65,7 +65,7 @@ This function will perform a function on each element in the sequence until it i */ example("reduce") { - sequenceOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) + _ = sequenceOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) .reduce(0, +) .subscribe { print($0) diff --git a/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift index 4df8d1ad..3010400c 100644 --- a/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift @@ -18,7 +18,7 @@ A toolbox of useful Operators for working with Observables. example("subscribe") { let sequenceOfInts = PublishSubject() - sequenceOfInts + _ = sequenceOfInts .subscribe { print($0) } @@ -40,7 +40,7 @@ There are several variants of the `subscribe` operator. example("subscribeNext") { let sequenceOfInts = PublishSubject() - sequenceOfInts + _ = sequenceOfInts .subscribeNext { print($0) } @@ -58,7 +58,7 @@ example("subscribeNext") { example("subscribeCompleted") { let sequenceOfInts = PublishSubject() - sequenceOfInts + _ = sequenceOfInts .subscribeCompleted { print("It's completed") } @@ -76,7 +76,7 @@ example("subscribeCompleted") { example("subscribeError") { let sequenceOfInts = PublishSubject() - sequenceOfInts + _ = sequenceOfInts .subscribeError { error in print(error) } @@ -98,7 +98,7 @@ register an action to take upon a variety of Observable lifecycle events example("doOn") { let sequenceOfInts = PublishSubject() - sequenceOfInts + _ = sequenceOfInts .doOn { print("Intercepted event \($0)") } diff --git a/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift index 0a5b5753..c9f667ee 100644 --- a/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift @@ -8,7 +8,7 @@ A Subject is a sort of bridge or proxy that is available in some implementations */ func writeSequenceToConsole(name: String, sequence: O) { - sequence + _ = sequence .subscribe { e in print("Subscription: \(name), event: \(e)") } diff --git a/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift index 60ed7d24..92f02385 100644 --- a/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift @@ -21,7 +21,7 @@ Transform the items emitted by an Observable by applying a function to each item example("map") { let originalSequence = sequenceOf(Character("A"), Character("B"), Character("C")) - originalSequence + _ = originalSequence .map { char in char.hashValue } @@ -43,7 +43,7 @@ example("flatMap") { let sequenceString = sequenceOf("A", "B", "C", "D", "E", "F", "--") - sequenceInt + _ = sequenceInt .flatMap { int in sequenceString } @@ -65,7 +65,7 @@ Apply a function to each item emitted by an Observable, sequentially, and emit e example("scan") { let sequenceToSum = sequenceOf(0, 1, 2, 3, 4, 5) - sequenceToSum + _ = sequenceToSum .scan(0) { acum, elem in acum + elem } diff --git a/Rx.playground/Sources/SupportCode.swift b/Rx.playground/Sources/SupportCode.swift index f609a0b9..0228d59e 100644 --- a/Rx.playground/Sources/SupportCode.swift +++ b/Rx.playground/Sources/SupportCode.swift @@ -13,4 +13,19 @@ public func delay(delay:Double, closure:()->()) { Int64(delay * Double(NSEC_PER_SEC)) ), dispatch_get_main_queue(), closure) -} \ No newline at end of file +} + +#if NOT_IN_PLAYGROUND + +public func playgroundShouldContinueIndefinitely() { +} + +#else + +import XCPlayground + +public func playgroundShouldContinueIndefinitely() { + XCPSetExecutionShouldContinueIndefinitely(true) +} + +#endif diff --git a/Rx.xcodeproj/project.pbxproj b/Rx.xcodeproj/project.pbxproj index 73e50d3d..b2c015a0 100644 --- a/Rx.xcodeproj/project.pbxproj +++ b/Rx.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + B1B7C3BD1BDD39DB0076934E /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1B7C3BC1BDD39DB0076934E /* TakeLast.swift */; }; + B1B7C3BE1BDD39DB0076934E /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1B7C3BC1BDD39DB0076934E /* TakeLast.swift */; }; + B1B7C3BF1BDD39DB0076934E /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1B7C3BC1BDD39DB0076934E /* TakeLast.swift */; }; + B1B7C3C01BDD39DB0076934E /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1B7C3BC1BDD39DB0076934E /* TakeLast.swift */; }; C8093CC51B8A72BE0088E94D /* Cancelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C491B8A72BE0088E94D /* Cancelable.swift */; }; C8093CC61B8A72BE0088E94D /* Cancelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C491B8A72BE0088E94D /* Cancelable.swift */; }; C8093CC71B8A72BE0088E94D /* AsyncLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C4B1B8A72BE0088E94D /* AsyncLock.swift */; }; @@ -786,6 +790,7 @@ /* Begin PBXFileReference section */ A111CE961B91C97C00D0DCEE /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B1B7C3BC1BDD39DB0076934E /* TakeLast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TakeLast.swift; sourceTree = ""; }; C809396D1B8A71760088E94D /* RxCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C80939E71B8A71840088E94D /* RxCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C8093BC71B8A71F00088E94D /* RxBlocking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxBlocking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1221,6 +1226,7 @@ C8093C8B1B8A72BE0088E94D /* SubscribeOn.swift */, C8093C8C1B8A72BE0088E94D /* Switch.swift */, C8093C8D1B8A72BE0088E94D /* Take.swift */, + B1B7C3BC1BDD39DB0076934E /* TakeLast.swift */, C8093C8E1B8A72BE0088E94D /* TakeUntil.swift */, C8093C8F1B8A72BE0088E94D /* TakeWhile.swift */, C8093C901B8A72BE0088E94D /* Throttle.swift */, @@ -1836,7 +1842,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0710; ORGANIZATIONNAME = "Krunoslav Zaher"; TargetAttributes = { C8A56AD61AD7424700B4673B = { @@ -2145,6 +2151,7 @@ C8093D1A1B8A72BE0088E94D /* DistinctUntilChanged.swift in Sources */, C8093D561B8A72BE0088E94D /* Observable+Binding.swift in Sources */, C8093D7A1B8A72BE0088E94D /* TailRecursiveSink.swift in Sources */, + B1B7C3BE1BDD39DB0076934E /* TakeLast.swift in Sources */, C8093CC81B8A72BE0088E94D /* AsyncLock.swift in Sources */, C8093CD81B8A72BE0088E94D /* BinaryDisposable.swift in Sources */, C89CDB371BCB0DD7002063D9 /* ShareReplay1.swift in Sources */, @@ -2267,6 +2274,7 @@ C8093D191B8A72BE0088E94D /* DistinctUntilChanged.swift in Sources */, C8093D551B8A72BE0088E94D /* Observable+Binding.swift in Sources */, C8093D791B8A72BE0088E94D /* TailRecursiveSink.swift in Sources */, + B1B7C3BD1BDD39DB0076934E /* TakeLast.swift in Sources */, C8093CC71B8A72BE0088E94D /* AsyncLock.swift in Sources */, C8093CD71B8A72BE0088E94D /* BinaryDisposable.swift in Sources */, C89CDB361BCB0DD7002063D9 /* ShareReplay1.swift in Sources */, @@ -2389,6 +2397,7 @@ C8F0BFB21BBBFB8B001B112F /* DistinctUntilChanged.swift in Sources */, C8F0BFB31BBBFB8B001B112F /* Observable+Binding.swift in Sources */, C8F0BFB41BBBFB8B001B112F /* TailRecursiveSink.swift in Sources */, + B1B7C3C01BDD39DB0076934E /* TakeLast.swift in Sources */, C8F0BFB51BBBFB8B001B112F /* AsyncLock.swift in Sources */, C8F0BFB61BBBFB8B001B112F /* BinaryDisposable.swift in Sources */, C89CDB391BCB0DD7002063D9 /* ShareReplay1.swift in Sources */, @@ -2661,6 +2670,7 @@ D2EBEB3A1BB9B6D8003A27DC /* MainScheduler.swift in Sources */, D2EBEB101BB9B6C1003A27DC /* Just.swift in Sources */, D2EBEB181BB9B6C1003A27DC /* Range.swift in Sources */, + B1B7C3BF1BDD39DB0076934E /* TakeLast.swift in Sources */, D2EBEAE21BB9B697003A27DC /* Observable.swift in Sources */, D2EBEB091BB9B6C1003A27DC /* DistinctUntilChanged.swift in Sources */, D2EBEB2A1BB9B6C5003A27DC /* Zip+CollectionType.swift in Sources */, @@ -2805,6 +2815,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2821,6 +2832,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2837,6 +2849,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2855,6 +2868,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -2873,6 +2887,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -2891,6 +2906,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -2907,6 +2923,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2923,6 +2940,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2939,6 +2957,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2957,6 +2976,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -2975,6 +2995,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -2993,6 +3014,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -3003,6 +3025,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -3056,6 +3079,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -3074,6 +3098,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxSwift/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -3092,6 +3117,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxSwift/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -3110,6 +3136,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxSwift/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = macosx; SKIP_INSTALL = YES; @@ -3120,6 +3147,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -3173,6 +3201,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -3224,6 +3253,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -3241,6 +3271,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -3258,6 +3289,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3276,6 +3308,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3294,6 +3327,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3312,6 +3346,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3330,6 +3365,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3348,6 +3384,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3366,6 +3403,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3384,6 +3422,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3402,6 +3441,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -3423,6 +3463,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3441,6 +3482,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3459,6 +3501,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3482,7 +3525,7 @@ INFOPLIST_FILE = RxSwift/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = ""; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3501,7 +3544,7 @@ INFOPLIST_FILE = RxSwift/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = ""; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3520,7 +3563,7 @@ INFOPLIST_FILE = RxSwift/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = ""; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3539,6 +3582,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3557,6 +3601,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = appletvos; SKIP_INSTALL = YES; @@ -3575,6 +3620,7 @@ INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SDKROOT = appletvos; SKIP_INSTALL = YES; diff --git a/RxBlocking/Info.plist b/RxBlocking/Info.plist index c1620d0a..d3de8eef 100644 --- a/RxBlocking/Info.plist +++ b/RxBlocking/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/RxCocoa/Info.plist b/RxCocoa/Info.plist index c1620d0a..d3de8eef 100644 --- a/RxCocoa/Info.plist +++ b/RxCocoa/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/RxExample/RxExample.xcodeproj/project.pbxproj b/RxExample/RxExample.xcodeproj/project.pbxproj index 70f3c369..75817321 100644 --- a/RxExample/RxExample.xcodeproj/project.pbxproj +++ b/RxExample/RxExample.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 07E300071B14995F00F00100 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E300061B14995F00F00100 /* TableViewController.swift */; }; 07E300091B149A2A00F00100 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E300081B149A2A00F00100 /* User.swift */; }; 07E3C2331B03605B0010338D /* Dependencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E3C2321B03605B0010338D /* Dependencies.swift */; }; + B1B7C3D01BE006870076934E /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1B7C3CF1BE006870076934E /* TakeLast.swift */; }; C803973A1BD3E17D009D8B26 /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */; }; C803973B1BD3E17D009D8B26 /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */; }; C80397491BD3E9A6009D8B26 /* GitHubSearchRepositoriesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80397481BD3E9A6009D8B26 /* GitHubSearchRepositoriesAPI.swift */; }; @@ -451,6 +452,7 @@ 07E300061B14995F00F00100 /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; 07E300081B149A2A00F00100 /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; 07E3C2321B03605B0010338D /* Dependencies.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Dependencies.swift; path = Examples/Dependencies.swift; sourceTree = ""; }; + B1B7C3CF1BE006870076934E /* TakeLast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TakeLast.swift; sourceTree = ""; }; C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = ""; }; C80397481BD3E9A6009D8B26 /* GitHubSearchRepositoriesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitHubSearchRepositoriesAPI.swift; sourceTree = ""; }; C80DDE7A1BCDA952006A1832 /* SkipWhile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkipWhile.swift; sourceTree = ""; }; @@ -1130,6 +1132,7 @@ C894646F1BC6C2B00055219D /* SubscribeOn.swift */, C89464701BC6C2B00055219D /* Switch.swift */, C89464711BC6C2B00055219D /* Take.swift */, + B1B7C3CF1BE006870076934E /* TakeLast.swift */, C89464721BC6C2B00055219D /* TakeUntil.swift */, C89464731BC6C2B00055219D /* TakeWhile.swift */, C89464741BC6C2B00055219D /* Throttle.swift */, @@ -1661,6 +1664,7 @@ C89464BB1BC6C2B00055219D /* AnonymousObservable.swift in Sources */, C89465991BC6C2BC0055219D /* UISegmentedControl+Rx.swift in Sources */, C8297E371B6CF905000589EA /* RxCollectionViewSectionedDataSource.swift in Sources */, + B1B7C3D01BE006870076934E /* TakeLast.swift in Sources */, C89464CD1BC6C2B00055219D /* FlatMap.swift in Sources */, C8297E381B6CF905000589EA /* Changeset.swift in Sources */, C8297E391B6CF905000589EA /* CollectionViewImageCell.swift in Sources */, diff --git a/RxExample/RxExample/Examples/Calculator/CalculatorViewController.swift b/RxExample/RxExample/Examples/Calculator/CalculatorViewController.swift index 9620320f..b094033e 100644 --- a/RxExample/RxExample/Examples/Calculator/CalculatorViewController.swift +++ b/RxExample/RxExample/Examples/Calculator/CalculatorViewController.swift @@ -67,7 +67,7 @@ class CalculatorViewController: ViewController { let CLEAR_STATE = CalState(previousNumber: nil, action: .Clear, currentNumber: "0", inScreen: "0", replace: true) - let diposeBag = DisposeBag() + let disposeBag = DisposeBag() override func viewDidLoad() { let commands:[Observable] = [ @@ -122,7 +122,7 @@ class CalculatorViewController: ViewController { self?.lastSignLabel.text = "" } } - .addDisposableTo(diposeBag) + .addDisposableTo(disposeBag) } func tranformState(a: CalState, _ x: Action) -> CalState { diff --git a/RxSwift/Info.plist b/RxSwift/Info.plist index c1620d0a..d3de8eef 100644 --- a/RxSwift/Info.plist +++ b/RxSwift/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - Krunoslav-Zaher.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/RxSwift/Observables/Implementations/Take.swift b/RxSwift/Observables/Implementations/Take.swift index 1f4dc72e..9208e618 100644 --- a/RxSwift/Observables/Implementations/Take.swift +++ b/RxSwift/Observables/Implementations/Take.swift @@ -54,6 +54,9 @@ class TakeCount: Producer { private let _count: Int init(source: Observable, count: Int) { + if count < 0 { + rxFatalError("count can't be negative") + } _source = source _count = count } diff --git a/RxSwift/Observables/Implementations/TakeLast.swift b/RxSwift/Observables/Implementations/TakeLast.swift new file mode 100644 index 00000000..34edb8a2 --- /dev/null +++ b/RxSwift/Observables/Implementations/TakeLast.swift @@ -0,0 +1,63 @@ +// +// TakeLast.swift +// Rx +// +// Created by Tomi Koskinen on 25/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + + +class TakeLastSink : Sink, ObserverType { + typealias Parent = TakeLast + typealias E = ElementType + + private let _parent: Parent + + private var _elements: Queue + + init(parent: Parent, observer: O, cancel: Disposable) { + _parent = parent + _elements = Queue(capacity: parent._count + 1) + super.init(observer: observer, cancel: cancel) + } + + func on(event: Event) { + switch event { + case .Next(let value): + _elements.enqueue(value) + if _elements.count > self._parent._count { + _elements.dequeue() + } + case .Error: + observer?.on(event) + dispose() + case .Completed: + for e in _elements { + observer?.on(.Next(e)) + } + observer?.on(.Completed) + dispose() + } + } +} + +class TakeLast: Producer { + private let _source: Observable + private let _count: Int + + init(source: Observable, count: Int) { + if count < 0 { + rxFatalError("count can't be negative") + } + _source = source + _count = count + } + + override func run(observer: O, cancel: Disposable, setSink: (Disposable) -> Void) -> Disposable { + let sink = TakeLastSink(parent: self, observer: observer, cancel: cancel) + setSink(sink) + return _source.subscribe(sink) + } +} \ No newline at end of file diff --git a/RxSwift/Observables/Observable+StandardSequenceOperators.swift b/RxSwift/Observables/Observable+StandardSequenceOperators.swift index fadccece..5278c3de 100644 --- a/RxSwift/Observables/Observable+StandardSequenceOperators.swift +++ b/RxSwift/Observables/Observable+StandardSequenceOperators.swift @@ -77,7 +77,27 @@ extension ObservableType { } } } + +// MARK: takeLast + +extension ObservableType { + /** + Returns a specified number of contiguous elements from the end of an observable sequence. + + This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. + + - parameter count: Number of elements to take from the end of the source sequence. + - returns: An observable sequence containing the specified number of elements from the end of the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func takeLast(count: Int) + -> Observable { + return TakeLast(source: self.asObservable(), count: count) + } +} + + // MARK: skip extension ObservableType { diff --git a/RxTests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift b/RxTests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift index ecdc305c..5015bac7 100644 --- a/RxTests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift +++ b/RxTests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift @@ -2816,6 +2816,254 @@ extension ObservableStandardSequenceOperators { } } +// MARK: takeLast + +extension ObservableStandardSequenceOperators { + func testTakeLast_Complete_Less() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13), + next(270, 7), + next(280, 1), + next(300, -1), + completed(300) + ]) + + let res = scheduler.start { + xs.takeLast(7) + } + + XCTAssertEqual(res.messages, [ + next(300, 9), + next(300, 13), + next(300, 7), + next(300, 1), + next(300, -1), + completed(300) + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 300) + ]) + } + + func testTakeLast_Complete_Same() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13), + next(270, 7), + next(280, 1), + next(300, -1), + completed(310) + ]) + + let res = scheduler.start { + xs.takeLast(5) + } + + XCTAssertEqual(res.messages, [ + next(310, 9), + next(310, 13), + next(310, 7), + next(310, 1), + next(310, -1), + completed(310) + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 310) + ]) + } + + func testTakeLast_Complete_More() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13), + next(270, 7), + next(280, 1), + next(300, -1), + next(310, 3), + next(340, 8), + completed(350) + ]) + + let res = scheduler.start { + xs.takeLast(5) + } + + XCTAssertEqual(res.messages, [ + next(350, 7), + next(350, 1), + next(350, -1), + next(350, 3), + next(350, 8), + completed(350) + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 350) + ]) + } + + func testTakeLast_Error_Less() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13), + next(270, 7), + next(280, 1), + next(290, 64), + error(300, testError) + ]) + + let res = scheduler.start { + xs.takeLast(7) + } + + XCTAssertEqual(res.messages, [ + error(300, testError) + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 300) + ]) + } + + func testTakeLast_Error_Same() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13), + next(270, 7), + next(280, 1), + next(300, -1), + error(310, testError) + ]) + + let res = scheduler.start { + xs.takeLast(5) + } + + XCTAssertEqual(res.messages, [ + error(310, testError) + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 310) + ]) + } + + func testTakeLast_Error_More() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13), + next(270, 7), + next(280, 1), + next(300, -1), + next(310, 3), + next(340, 64), + error(360, testError) + ]) + + let res = scheduler.start { + xs.takeLast(5) + } + + XCTAssertEqual(res.messages, [ + error(360, testError) + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 360) + ]) + } + + func testTakeLast_0_DefaultScheduler() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13) + ]) + + let res = scheduler.start { + xs.takeLast(0) + } + + XCTAssertEqual(res.messages, [ + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 1000) + ]) + } + + func testTakeLast_TakeLast1() { + let scheduler = TestScheduler(initialClock: 0) + + let xs = scheduler.createHotObservable([ + next(70, 6), + next(150, 4), + next(210, 9), + next(230, 13), + next(270, 7), + next(280, 1), + next(300, -1), + next(310, 3), + next(340, 8), + next(370, 11), + completed(400) + ]) + + let res = scheduler.start { + xs.takeLast(3) + } + + XCTAssertEqual(res.messages, [ + next(400, 3), + next(400, 8), + next(400, 11), + completed(400) + ]) + + XCTAssertEqual(xs.subscriptions, [ + Subscription(200, 400) + ]) + } + + func testTakeLast_DecrementCountsFirst() { + let k = BehaviorSubject(value: false) + + _ = k.takeLast(1).subscribeNext { n in + k.on(.Next(!n)) + } + } +} + // MARK: skip extension ObservableStandardSequenceOperators { func testSkip_Complete_After() { diff --git a/scripts/playgrounds.sh b/scripts/playgrounds.sh new file mode 100755 index 00000000..cbcb5615 --- /dev/null +++ b/scripts/playgrounds.sh @@ -0,0 +1,16 @@ +. scripts/common.sh + +CONFIGURATIONS=(Release) + +# make sure osx builds +for scheme in "RxSwift-OSX" +do + for configuration in ${CONFIGURATIONS[@]} + do + PAGES_PATH=${BUILD_DIRECTORY}/Build/Products/${configuration}/all-playground-pages.swift + rx ${scheme} ${configuration} "" build + cat Rx.playground/Sources/*.swift Rx.playground/Pages/**/*.swift > ${PAGES_PATH} + swift -v -D NOT_IN_PLAYGROUND -F ${BUILD_DIRECTORY}/Build/Products/${configuration} ${PAGES_PATH} + done +done + diff --git a/scripts/pre-release-tests.sh b/scripts/pre-release-tests.sh index 0227a968..d8ae809f 100755 --- a/scripts/pre-release-tests.sh +++ b/scripts/pre-release-tests.sh @@ -113,6 +113,10 @@ do done done +# compile and run playgrounds + +. scripts/playgrounds.sh + if [ "${RELEASE_TEST}" -eq 1 ]; then mdast -u mdast-slug -u mdast-validate-links ./*.md mdast -u mdast-slug -u mdast-validate-links ./**/*.md