diff --git a/Documentation/API.md b/Documentation/API.md index 1739e67d..5b8c487a 100644 --- a/Documentation/API.md +++ b/Documentation/API.md @@ -455,3 +455,11 @@ extension NSTextField { } ``` + +```swift +extension UITabBarItem { + + public var rx_badgeValue: AnyObserver {} + +} +``` diff --git a/Documentation/Examples.md b/Documentation/Examples.md index ae81a65b..78950266 100644 --- a/Documentation/Examples.md +++ b/Documentation/Examples.md @@ -46,7 +46,9 @@ let b /*: Observable*/ = Variable(2) // b = 2 // if a + b >= 0 { // c = "\(a + b) is positive" // } -let c = Observable.combineLatest(a, b) { $0 + $1 } // combines latest values of variables `a` and `b` using `+` + + // combines latest values of variables `a` and `b` using `+` +let c = Observable.combineLatest(a.asObservable(), b.asObservable()) { $0 + $1 } .filter { $0 >= 0 } // if `a + b >= 0` is true, `a + b` is passed to map operator .map { "\($0) is positive" } // maps `a + b` to "\(a + b) is positive" diff --git a/Documentation/GettingStarted.md b/Documentation/GettingStarted.md index 0abc561a..c6039b2f 100644 --- a/Documentation/GettingStarted.md +++ b/Documentation/GettingStarted.md @@ -481,7 +481,7 @@ Disposed Ended ---- ``` -**Every subscriber upon subscription usually generates it's own separate sequence of elements. Operators are stateless by default. There is vastly more stateless operators then stateful ones.** +**Every subscriber upon subscription usually generates it's own separate sequence of elements. Operators are stateless by default. There are vastly more stateless operators than stateful ones.** ## Sharing subscription and `shareReplay` operator @@ -964,7 +964,7 @@ self.rx_observe(CGRect.self, "view.frame", retainSelf: false) ### `rx_observeWeakly` -`rx_observeWeakly` has somewhat slower then `rx_observe` because it has to handle object deallocation in case of weak references. +`rx_observeWeakly` has somewhat slower than `rx_observe` because it has to handle object deallocation in case of weak references. It can be used in all cases where `rx_observe` can be used and additionally diff --git a/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift index 7887749b..8935a67f 100644 --- a/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Combining_Observables.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift 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 9da1d2ec..d14a2cda 100644 --- a/Rx.playground/Pages/Conditional_and_Boolean_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Conditional_and_Boolean_Operators.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import Cocoa diff --git a/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift index 1bbdd93b..208caf56 100644 --- a/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Connectable_Observable_Operators.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift diff --git a/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift index 71f812ca..206279e9 100644 --- a/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift diff --git a/Rx.playground/Pages/Filtering_Observables.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Filtering_Observables.xcplaygroundpage/Contents.swift index 1f6406f1..29405905 100644 --- a/Rx.playground/Pages/Filtering_Observables.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Filtering_Observables.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift diff --git a/Rx.playground/Pages/Index.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Index.xcplaygroundpage/Contents.swift index cb6598bf..720c1a62 100644 --- a/Rx.playground/Pages/Index.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Index.xcplaygroundpage/Contents.swift @@ -1,6 +1,6 @@ /*: -> # IMPORTANT: To use `RxSamples`, please: +> # IMPORTANT: To use `Rx.playground`, please: 1. Open `Rx.xcworkspace` 2. Build `RxSwift-OSX` scheme diff --git a/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift index 81be41fa..04994d5a 100644 --- a/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Index](@previous) import RxSwift 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 9e390081..a6b78f35 100644 --- a/Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift diff --git a/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift index 3010400c..a1230154 100644 --- a/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Observable_Utility_Operators.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift diff --git a/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift index e74015e4..dc8df166 100644 --- a/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Subjects.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift diff --git a/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift b/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift index f0216cf5..57f978b5 100644 --- a/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift +++ b/Rx.playground/Pages/Transforming_Observables.xcplaygroundpage/Contents.swift @@ -1,3 +1,12 @@ +/*: +> # IMPORTANT: To use `Rx.playground`, please: + +1. Open `Rx.xcworkspace` +2. Build `RxSwift-OSX` scheme +3. And then open `Rx` playground in `Rx.xcworkspace` tree view. +4. Choose `View > Show Debug Area` +*/ + //: [<< Previous](@previous) - [Index](Index) import RxSwift diff --git a/Rx.playground/contents.xcplayground b/Rx.playground/contents.xcplayground index 0d291cc1..f511ccd7 100644 --- a/Rx.playground/contents.xcplayground +++ b/Rx.playground/contents.xcplayground @@ -1,5 +1,5 @@ - + diff --git a/Rx.xcodeproj/project.pbxproj b/Rx.xcodeproj/project.pbxproj index 54156dc4..b4d3dfab 100644 --- a/Rx.xcodeproj/project.pbxproj +++ b/Rx.xcodeproj/project.pbxproj @@ -11,6 +11,11 @@ 79E9DE8A1C3417FD009970AF /* DispatchQueueSchedulerQOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E9DE881C3417FD009970AF /* DispatchQueueSchedulerQOS.swift */; }; 79E9DE8B1C3417FD009970AF /* DispatchQueueSchedulerQOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E9DE881C3417FD009970AF /* DispatchQueueSchedulerQOS.swift */; }; 79E9DE8C1C3417FD009970AF /* DispatchQueueSchedulerQOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E9DE881C3417FD009970AF /* DispatchQueueSchedulerQOS.swift */; }; + 7EDBAEB41C89B1A6006CBE67 /* UITabBarItem+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */; }; + 7EDBAEBC1C89B9B7006CBE67 /* UITabBarItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDBAEB71C89B9B7006CBE67 /* UITabBarItem+Rx.swift */; }; + 7EDBAEBE1C89B9B7006CBE67 /* UITabBarItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDBAEB71C89B9B7006CBE67 /* UITabBarItem+Rx.swift */; }; + 7EDBAEBF1C89B9B7006CBE67 /* UITabBarItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDBAEB71C89B9B7006CBE67 /* UITabBarItem+Rx.swift */; }; + 7EDBAEC31C89BCB9006CBE67 /* UITabBarItem+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */; }; 7F600F3F1C5D0C6C00535B1D /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */; }; 7F600F401C5D0C6D00535B1D /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */; }; 7F600F411C5D0C6E00535B1D /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */; }; @@ -1322,6 +1327,8 @@ /* Begin PBXFileReference section */ 79E9DE881C3417FD009970AF /* DispatchQueueSchedulerQOS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchQueueSchedulerQOS.swift; sourceTree = ""; }; + 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarItem+RxTests.swift"; sourceTree = ""; }; + 7EDBAEB71C89B9B7006CBE67 /* UITabBarItem+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarItem+Rx.swift"; sourceTree = ""; }; 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIRefreshControl+Rx.swift"; sourceTree = ""; }; 7F600F421C5D0D2D00535B1D /* UIRefreshControl+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIRefreshControl+RxTests.swift"; sourceTree = ""; }; 842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextStorage+Rx.swift"; sourceTree = ""; }; @@ -2209,6 +2216,7 @@ C83508F01C38706D0027C24C /* SentMessageTest.swift */, C83508F11C38706D0027C24C /* UIView+RxTests.swift */, 7F600F421C5D0D2D00535B1D /* UIRefreshControl+RxTests.swift */, + 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */, ); path = RxCocoaTests; sourceTree = ""; @@ -2346,6 +2354,7 @@ 9BA1CBD11C0F7C0A0044B50A /* UIActivityIndicatorView+Rx.swift */, 8479BC4A1C3ACED100FB8B54 /* UIImagePickerController+Rx.swift */, C8BCD3EC1C14B5FB005F1280 /* UIView+Rx.swift */, + 7EDBAEB71C89B9B7006CBE67 /* UITabBarItem+Rx.swift */, ); path = iOS; sourceTree = ""; @@ -3254,6 +3263,7 @@ C882542E1B8A752B00B02D69 /* UILabel+Rx.swift in Sources */, C88254211B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift in Sources */, C80DDEA71BCE69BA006A1832 /* ObservableConvertibleType+Driver.swift in Sources */, + 7EDBAEBC1C89B9B7006CBE67 /* UITabBarItem+Rx.swift in Sources */, C839365F1C70E02200A9A09E /* UIApplication+Rx.swift in Sources */, C80DDE9F1BCE69BA006A1832 /* Driver+Subscription.swift in Sources */, C811C89D1C24D80100A2DDD4 /* DeallocObservable.swift in Sources */, @@ -3407,6 +3417,7 @@ C83509331C38706E0027C24C /* Driver+Extensions.swift in Sources */, C835094F1C38706E0027C24C /* CurrentThreadSchedulerTest.swift in Sources */, C835093E1C38706E0027C24C /* UIView+RxTests.swift in Sources */, + 7EDBAEB41C89B1A6006CBE67 /* UITabBarItem+RxTests.swift in Sources */, C83509411C38706E0027C24C /* BackgroundThreadPrimitiveHotObservable.swift in Sources */, C83509581C38706E0027C24C /* Observable+MultipleTest+CombineLatest.swift in Sources */, C83509651C38706E0027C24C /* VirtualSchedulerTest.swift in Sources */, @@ -3492,6 +3503,7 @@ C8350A121C38756A0027C24C /* Observable+StandardSequenceOperatorsTest.swift in Sources */, C83509C31C3875220027C24C /* KVOObservableTests.swift in Sources */, C83509F91C38755D0027C24C /* MainSchedulerTests.swift in Sources */, + 7EDBAEC31C89BCB9006CBE67 /* UITabBarItem+RxTests.swift in Sources */, C83509AB1C3874D20027C24C /* XCTest+AllTests.swift in Sources */, C83509C11C3875220027C24C /* Driver+Extensions.swift in Sources */, C83509DD1C38754C0027C24C /* EquatableArray.swift in Sources */, @@ -4187,6 +4199,7 @@ C8F0C03A1BBBFBB9001B112F /* ControlTarget.swift in Sources */, C8F0C03B1BBBFBB9001B112F /* UISearchBar+Rx.swift in Sources */, C8F0C03C1BBBFBB9001B112F /* ItemEvents.swift in Sources */, + 7EDBAEBF1C89B9B7006CBE67 /* UITabBarItem+Rx.swift in Sources */, C8DB968B1BF756F40084BD53 /* KVORepresentable+CoreGraphics.swift in Sources */, C8FD21B11C67E14C00863EC3 /* UIBindingObserver.swift in Sources */, C8F0C03D1BBBFBB9001B112F /* RxTableViewDataSourceType.swift in Sources */, @@ -4280,6 +4293,7 @@ 9D71C4D21BF08191006E8F59 /* UIButton+Rx.swift in Sources */, D203C4FD1BB9C53700D02D00 /* RxSearchBarDelegateProxy.swift in Sources */, D2138C8A1BB9BEBE00339B5C /* Logging.swift in Sources */, + 7EDBAEBE1C89B9B7006CBE67 /* UITabBarItem+Rx.swift in Sources */, C8DB968A1BF756F40084BD53 /* KVORepresentable+CoreGraphics.swift in Sources */, C8FD21B01C67E14C00863EC3 /* UIBindingObserver.swift in Sources */, D203C50F1BB9C53E00D02D00 /* UIStepper+Rx.swift in Sources */, diff --git a/RxCocoa/iOS/UITabBarItem+Rx.swift b/RxCocoa/iOS/UITabBarItem+Rx.swift new file mode 100644 index 00000000..2d07cde4 --- /dev/null +++ b/RxCocoa/iOS/UITabBarItem+Rx.swift @@ -0,0 +1,30 @@ +// +// UITabBarItem+Rx.swift +// Rx +// +// Created by Mateusz Derks on 04/03/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + + import Foundation + import UIKit +#if !RX_NO_MODULE + import RxSwift +#endif + +extension UITabBarItem { + + /** + Bindable sink for `badgeValue` property. + */ + public var rx_badgeValue: AnyObserver { + return UIBindingObserver(UIElement: self) { tabBarItem, badgeValue in + tabBarItem.badgeValue = badgeValue + }.asObserver() + } + +} + +#endif diff --git a/RxExample/RxExample/Examples/ImagePicker/ImagePickerController.swift b/RxExample/RxExample/Examples/ImagePicker/ImagePickerController.swift index 3dd568d2..0f247051 100644 --- a/RxExample/RxExample/Examples/ImagePicker/ImagePickerController.swift +++ b/RxExample/RxExample/Examples/ImagePicker/ImagePickerController.swift @@ -68,7 +68,7 @@ class ImagePickerController: ViewController { .take(1) } .map { info in - return info[UIImagePickerControllerOriginalImage] as? UIImage + return info[UIImagePickerControllerEditedImage] as? UIImage } .bindTo(imageView.rx_image) .addDisposableTo(disposeBag) diff --git a/RxSwift/Observables/Implementations/SingleAsync.swift b/RxSwift/Observables/Implementations/SingleAsync.swift index 38938144..af7a09ae 100644 --- a/RxSwift/Observables/Implementations/SingleAsync.swift +++ b/RxSwift/Observables/Implementations/SingleAsync.swift @@ -36,8 +36,8 @@ class SingleAsyncSink : S } if _seenValue == false { - forwardOn(.Next(value)) _seenValue = true + forwardOn(.Next(value)) } else { forwardOn(.Error(RxError.MoreThanOneElement)) dispose() diff --git a/Sources/AllTests/main.swift b/Sources/AllTests/main.swift index 7caa7139..d9e262f0 100644 --- a/Sources/AllTests/main.swift +++ b/Sources/AllTests/main.swift @@ -468,11 +468,13 @@ _ObservableStandardSequenceOperatorsTest.allTests = [ ("testSingle_One", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSingle_One(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), ("testSingle_Many", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSingle_Many(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), //("testSingle_Error", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSingle_Error(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), + ("testSingle_DecrementCountsFirst", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSingle_DecrementCountsFirst(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), ("testSinglePredicate_Empty", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSinglePredicate_Empty(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), ("testSinglePredicate_One", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSinglePredicate_One(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), ("testSinglePredicate_Many", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSinglePredicate_Many(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), //("testSinglePredicate_Error", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSinglePredicate_Error(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), //("testSinglePredicate_Throws", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSinglePredicate_Throws(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), + ("testSinglePredicate_DecrementCountsFirst", { _ObservableStandardSequenceOperatorsTest.setUp(); _ObservableStandardSequenceOperatorsTest.testSinglePredicate_DecrementCountsFirst(); _ObservableStandardSequenceOperatorsTest.tearDown(); }), ] diff --git a/Tests/RxCocoaTests/UITabBarItem+RxTests.swift b/Tests/RxCocoaTests/UITabBarItem+RxTests.swift new file mode 100644 index 00000000..b3a2165d --- /dev/null +++ b/Tests/RxCocoaTests/UITabBarItem+RxTests.swift @@ -0,0 +1,33 @@ +// +// UITabBarItem+RxTests.swift +// Rx +// +// Created by Mateusz Derks on 04/03/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +import RxSwift +import RxCocoa +import UIKit +import XCTest + +class UITabBarItemTests : RxTest { +} + +extension UITabBarItemTests { + func testBadgetValue_Text() { + let subject = UITabBarItem(tabBarSystemItem: .More, tag: 0) + Observable.just("5").subscribe(subject.rx_badgeValue).dispose() + + XCTAssertTrue(subject.badgeValue == "5") + } + + func testBadgetValue_Empty() { + let subject = UITabBarItem(tabBarSystemItem: .More, tag: 0) + Observable.just(nil).subscribe(subject.rx_badgeValue).dispose() + + XCTAssertTrue(subject.badgeValue == nil) + } +} diff --git a/Tests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift b/Tests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift index 7dcf86ad..31f0858d 100644 --- a/Tests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift +++ b/Tests/RxSwiftTests/Tests/Observable+StandardSequenceOperatorsTest.swift @@ -5067,6 +5067,14 @@ extension ObservableStandardSequenceOperatorsTest { Subscription(200, 210) ]) } + + func testSingle_DecrementCountsFirst() { + let k = BehaviorSubject(value: false) + + _ = k.single { _ in true }.subscribeNext { n in + k.on(.Next(!n)) + } + } func testSinglePredicate_Empty() { let scheduler = TestScheduler(initialClock: 0) @@ -5199,5 +5207,14 @@ extension ObservableStandardSequenceOperatorsTest { Subscription(200, 230) ]) } + + func testSinglePredicate_DecrementCountsFirst() { + let k = BehaviorSubject(value: false) + + _ = k.single { _ in true }.subscribeNext { n in + k.on(.Next(!n)) + } + + } }