Compare commits
195 Commits
slack-chan
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
8b07d0cbde | |
|
|
2969fbe70d | |
|
|
6ed8c6c00d | |
|
|
de28113c06 | |
|
|
08501da396 | |
|
|
e85b3203bc | |
|
|
900035d78b | |
|
|
ef71ba9f20 | |
|
|
72122e3e43 | |
|
|
87b792e54d | |
|
|
8cebcd786f | |
|
|
7208a8d1cc | |
|
|
e1f72cb566 | |
|
|
154ac2583d | |
|
|
136322ab6a | |
|
|
24c4587b51 | |
|
|
22219781a5 | |
|
|
48bb9fcba5 | |
|
|
7f43e1eecd | |
|
|
f8d8c45f10 | |
|
|
92d4bdf5e1 | |
|
|
ff6e4fd651 | |
|
|
b68fc4260e | |
|
|
c9742e51b6 | |
|
|
1f363cea2e | |
|
|
83f3323ed8 | |
|
|
278c681753 | |
|
|
9b1f22e6a0 | |
|
|
9473953b65 | |
|
|
1998e54085 | |
|
|
94d6c01e3b | |
|
|
a4f15128bf | |
|
|
5610073ca9 | |
|
|
9ce054936d | |
|
|
4bd842301b | |
|
|
0fe4c9a792 | |
|
|
b9b593d740 | |
|
|
6763f1a4b7 | |
|
|
d43e717415 | |
|
|
819635d9aa | |
|
|
b0026d65eb | |
|
|
695ea19e02 | |
|
|
e55c6675f4 | |
|
|
301ad9f438 | |
|
|
047c77a698 | |
|
|
a2be331fee | |
|
|
2d36297601 | |
|
|
c12b315149 | |
|
|
74464a4940 | |
|
|
fcf8e4d092 | |
|
|
43c0b952ec | |
|
|
96ef70cc2f | |
|
|
7adc86f7d2 | |
|
|
cbb0ed5d29 | |
|
|
e2f4bad2bb | |
|
|
7f65914f93 | |
|
|
e59adc3ae9 | |
|
|
e4e422c4f1 | |
|
|
4f54c9bf5a | |
|
|
8b00921da7 | |
|
|
bdbcb5bc87 | |
|
|
55f4bb3b65 | |
|
|
f1b4e0f6b7 | |
|
|
f8a11aa0cb | |
|
|
8754166f35 | |
|
|
75971c61c6 | |
|
|
c643d4c0b5 | |
|
|
64526c8dcd | |
|
|
1fe15bb9da | |
|
|
a981d4caab | |
|
|
6d17e711ab | |
|
|
341ef8fc3b | |
|
|
2812da1f5e | |
|
|
2498b3194d | |
|
|
2e4b6990e8 | |
|
|
6eda820476 | |
|
|
2df8c43077 | |
|
|
ac876f35db | |
|
|
0058d2ff67 | |
|
|
23ae9692e7 | |
|
|
eb646a97a6 | |
|
|
b0a819981b | |
|
|
d3eacdfcb5 | |
|
|
dbc635d6e7 | |
|
|
cb5d23c757 | |
|
|
38e5a500c7 | |
|
|
6887745089 | |
|
|
e530858bd0 | |
|
|
10ff55cfba | |
|
|
46286d3291 | |
|
|
aef4e69339 | |
|
|
3637153169 | |
|
|
8a58deaa2b | |
|
|
441a4a22db | |
|
|
d1cde77b18 | |
|
|
afd40f5d8b | |
|
|
1b0e0a3c88 | |
|
|
10b0d39e05 | |
|
|
091b12242a | |
|
|
4b602fd88e | |
|
|
2f06600985 | |
|
|
8e01b2ffe4 | |
|
|
9c14b7fde1 | |
|
|
03d6950bf1 | |
|
|
7b6a244f45 | |
|
|
e2c3330d61 | |
|
|
0b1856d43e | |
|
|
58e427b045 | |
|
|
a2ee04e721 | |
|
|
38c45c066d | |
|
|
01d86ff684 | |
|
|
2ead37809e | |
|
|
72e5488631 | |
|
|
21a56a8ebd | |
|
|
a9d0cfeb5b | |
|
|
7f84ec604e | |
|
|
bfb9441414 | |
|
|
3b34850675 | |
|
|
c844b6bdb3 | |
|
|
544e00d917 | |
|
|
490b6cbbc5 | |
|
|
b1c6673da7 | |
|
|
99e21bdb46 | |
|
|
181a94bbc9 | |
|
|
fa14592a2b | |
|
|
61420eef9f | |
|
|
fbee131886 | |
|
|
2cb931d8e9 | |
|
|
0c8d28b1b6 | |
|
|
1301e9925a | |
|
|
070907471c | |
|
|
f3f2b0e083 | |
|
|
e79457dcd3 | |
|
|
824f23c94e | |
|
|
5c908f18b8 | |
|
|
d4981303b5 | |
|
|
7c2f20cf36 | |
|
|
cba021a961 | |
|
|
9cac0cc234 | |
|
|
b47ce13eae | |
|
|
1124f40ef1 | |
|
|
03fae9de6f | |
|
|
996caf6917 | |
|
|
a1b34f0f50 | |
|
|
125deae0c8 | |
|
|
8e46d377da | |
|
|
348ce89e17 | |
|
|
e222e52223 | |
|
|
edf423d42e | |
|
|
e2edffc39d | |
|
|
6770c8a4c0 | |
|
|
bce8e9cd2d | |
|
|
a64c07d1e1 | |
|
|
d40557bbd7 | |
|
|
987afd4a92 | |
|
|
14fa47c623 | |
|
|
7e2a492895 | |
|
|
b7cd7ba56c | |
|
|
cfb8b1558a | |
|
|
d1916b4a19 | |
|
|
98cf430382 | |
|
|
c33d5806fd | |
|
|
45b8b32b35 | |
|
|
b72a2ce86d | |
|
|
76a63104fa | |
|
|
7ec1ffc935 | |
|
|
ada55ed8e5 | |
|
|
5bf319adda | |
|
|
c51f4f3b95 | |
|
|
c719c8cf86 | |
|
|
5d47db7609 | |
|
|
7ff150aafc | |
|
|
5a9f47262a | |
|
|
db4c04dcea | |
|
|
9287bebd10 | |
|
|
924a9a4983 | |
|
|
8d5b85306d | |
|
|
bc86d47a3f | |
|
|
a5f19de922 | |
|
|
8bad8e547f | |
|
|
ced6ce3a7e | |
|
|
ff0d588189 | |
|
|
c35136fe0b | |
|
|
39a20441e1 | |
|
|
c4cf2e0d12 | |
|
|
0e38ecbc87 | |
|
|
6b038ad039 | |
|
|
94833e438d | |
|
|
a4ae75d03f | |
|
|
37d685690c | |
|
|
7622d9c5b7 | |
|
|
c11c7a8f97 | |
|
|
4e6880d218 | |
|
|
1b5cd9ecb5 | |
|
|
c4ca775bdc |
|
|
@ -1,6 +1,6 @@
|
|||
language: objective-c
|
||||
|
||||
osx_image: xcode7.3
|
||||
osx_image: xcode8
|
||||
|
||||
notifications:
|
||||
slack: rxswift:3ykt2Z61f8GkdvhCZTYPduOL
|
||||
|
|
@ -8,4 +8,6 @@ notifications:
|
|||
|
||||
script:
|
||||
- "bundle exec danger --verbose"
|
||||
- xcodebuild -version
|
||||
- xcodebuild -showsdks
|
||||
- ./scripts/all-tests.sh
|
||||
|
|
|
|||
37
CHANGELOG.md
37
CHANGELOG.md
|
|
@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## Master
|
||||
|
||||
## [3.0.0.alpha.1](https://github.com/ReactiveX/RxSwift/releases/tag/3.0.0.alpha.1) (Xcode 8 beta 6 compatible 8S201h)
|
||||
|
||||
#### Features
|
||||
|
||||
* Modernizes API to be more consistent with Swift 3.0 API Design Guidelines
|
||||
* Replaces `rx_*` prefix with `rx.*` extensions. (Inspired by `.lazy` collections API). We've tried annotate deprecated APIs with `@available(*, deprecated, renamed: "new method")` but trivial replacements aren't annotated.
|
||||
* `rx_text` -> `rx.text`
|
||||
* `rx_tap` -> `rx.tap`
|
||||
* `rx_date` -> `rx.date`
|
||||
* ...
|
||||
* Deprecates `subscribeNext`, `subscribeError`, `subscribeCompleted` in favor of `subscribe(onNext:onError:onCompleted:onDisposed)` (The downsides of old extensions were inconsistencies with Swift API guidelines. They also weren't expressing that calling them actually performes additional subscriptions and thus potentially additional work beside just registering observers).
|
||||
* Deprecates `doOnNext`, `doOnCompleted`, `doOnError` in favor of `do(onNext:onCompleted:onError:onSubscribe:onDisposed:)`
|
||||
* Adds `onSubscribe` and `onDisposed` to `do` operator.
|
||||
* Adds namespace for immutable disposables called `Disposables`
|
||||
* Deprecates `AnonymousDisposable` in favor of `Disposables.create(with:)`
|
||||
* Deprecates `NopDisposable` in favor of `Disposables.create()`
|
||||
* Deprecates `BinaryDisposable` in favor of `Disposables.create(_:_:)`
|
||||
* Deprecates `toObservable` in favor of `Observable.from()`.
|
||||
* Replaces old javascript automation tests with Swift UI Tests.
|
||||
* ...
|
||||
|
||||
#### Anomalies
|
||||
|
||||
* There is a problem using `UISwitch` extensions because it seems that a bug exists in UIKit that causes all `UISwitch` instances to leak. https://github.com/ReactiveX/RxSwift/issues/842
|
||||
|
||||
## [2.6.0](https://github.com/ReactiveX/RxSwift/releases/tag/2.6.0)
|
||||
|
||||
#### Features
|
||||
|
|
@ -118,12 +143,12 @@ All notable changes to this project will be documented in this file.
|
|||
This is example of those changes:
|
||||
|
||||
```swift
|
||||
- public func rx_itemsWithCellFactory<S : SequenceType, O : ObservableType where O.E == S>
|
||||
- public func rx_itemsWithCellFactory<S : Sequence, O : ObservableType where O.E == S>
|
||||
(source: O)
|
||||
(cellFactory: (UITableView, Int, S.Generator.Element) -> UITableViewCell) -> Disposable
|
||||
+ public func rx_itemsWithCellFactory<S : SequenceType, O : ObservableType where O.E == S>
|
||||
(cellFactory: (UITableView, Int, S.Iterator.Element) -> UITableViewCell) -> Disposable
|
||||
+ public func rx_itemsWithCellFactory<S : Sequence, O : ObservableType where O.E == S>
|
||||
(source: O)
|
||||
-> (cellFactory: (UITableView, Int, S.Generator.Element) -> UITableViewCell) -> Disposable
|
||||
-> (cellFactory: (UITableView, Int, S.Iterator.Element) -> UITableViewCell) -> Disposable
|
||||
```
|
||||
|
||||
* Fixes anomaly in `CLLocationManager` extensions
|
||||
|
|
@ -395,7 +420,7 @@ let (
|
|||
* `NSURLSession` extensions now return `Observable<(NSData!, NSHTTPURLResponse)>` instead of `Observable<(NSData!, NSURLResponse!)>`.
|
||||
* Optimizes consecutive map operators. For example `map(validate1).map(validate2).map(parse)` is now internally optimized to one `map` operator.
|
||||
* Adds overloads for `just`, `sequenceOf`, `toObservable` that accept scheduler.
|
||||
* Deprecates `asObservable` extension of `SequenceType` in favor of `toObservable`.
|
||||
* Deprecates `asObservable` extension of `Sequence` in favor of `toObservable`.
|
||||
* Adds `toObservable` extension to `Array`.
|
||||
* Improves table view animated data source example.
|
||||
* Polishing of `RxDataSourceStarterKit`
|
||||
|
|
@ -507,7 +532,7 @@ let (
|
|||
* Renames `ScopedDispose` to `ScopedDisposable`
|
||||
* Deprecates `observeSingleOn` in favor of `observeOn`
|
||||
* Adds inline documentation
|
||||
* Renames `from` to `asObservable` extension method on `SequenceType`
|
||||
* Renames `from` to `asObservable` extension method on `Sequence`
|
||||
* Renames `catchErrorResumeNext` in favor of `catchErrorJustReturn`
|
||||
* Deprecates `catchErrorToResult`, the preferred way is to use Swift `do/try/catch` mechanism.
|
||||
* Deprecates `RxResult`, the preferred way is to use Swift `do/try/catch` mechanism.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Warn about develop branch
|
||||
current_branch = env.request_source.pr_json["base"]["ref"]
|
||||
warn("Please target PRs to `develop` branch") if current_branch != "develop"
|
||||
warn("Please target PRs to `develop` branch") if current_branch != "develop" && current_branch != "swift-3.0"
|
||||
|
||||
# Sometimes it's a README fix, or something like that - which isn't relevant for
|
||||
# including in a project's CHANGELOG for example
|
||||
|
|
|
|||
|
|
@ -102,13 +102,13 @@ Creating new operators is also pretty straightforward.
|
|||
|
||||
```swift
|
||||
|
||||
extension NSObject {
|
||||
extension Reactive where Base: NSObject {
|
||||
|
||||
public var rx_deallocated: Observable<Void> {}
|
||||
public var deallocated: Observable<Void> {}
|
||||
|
||||
#if !DISABLE_SWIZZLING
|
||||
|
||||
public var rx_deallocating: Observable<Void> {}
|
||||
public var deallocating: Observable<Void> {}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -118,9 +118,9 @@ extension NSObject {
|
|||
|
||||
|
||||
```swift
|
||||
extension NSObject {
|
||||
extension Reactive where Base: NSObject {
|
||||
|
||||
public func rx_observe<Element>(
|
||||
public func observe<Element>(
|
||||
type: E.Type,
|
||||
_ keyPath: String,
|
||||
options: NSKeyValueObservingOptions = .New | .Initial,
|
||||
|
|
@ -129,7 +129,7 @@ extension NSObject {
|
|||
|
||||
#if !DISABLE_SWIZZLING
|
||||
|
||||
public func rx_observeWeakly<Element>(
|
||||
public func observeWeakly<Element>(
|
||||
type: E.Type,
|
||||
_ keyPath: String,
|
||||
options: NSKeyValueObservingOptions = .New | .Initial
|
||||
|
|
@ -140,23 +140,23 @@ extension NSObject {
|
|||
```
|
||||
|
||||
```swift
|
||||
extension NSURLSession {
|
||||
extension Reactive where Base: NSURLSession {
|
||||
|
||||
public func rx_response(request: NSURLRequest) -> Observable<(NSData, NSURLResponse)> {}
|
||||
public func response(request: NSURLRequest) -> Observable<(NSData, NSURLResponse)> {}
|
||||
|
||||
public func rx_data(request: NSURLRequest) -> Observable<NSData> {}
|
||||
public func data(request: NSURLRequest) -> Observable<NSData> {}
|
||||
|
||||
public func rx_JSON(request: NSURLRequest) -> Observable<AnyObject> {}
|
||||
public func JSON(request: NSURLRequest) -> Observable<AnyObject> {}
|
||||
|
||||
public func rx_JSON(URL: NSURL) -> Observable<AnyObject> {}
|
||||
public func JSON(URL: NSURL) -> Observable<AnyObject> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension NSNotificationCenter {
|
||||
extension Reactive where Base: NSNotificationCenter {
|
||||
|
||||
public func rx_notification(name: String, object: AnyObject?) -> Observable<NSNotification> {}
|
||||
public func notification(name: String, object: AnyObject?) -> Observable<NSNotification> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
|
@ -170,39 +170,39 @@ class DelegateProxy {
|
|||
```
|
||||
|
||||
```swift
|
||||
extension CLLocationManager {
|
||||
extension Reactive where Base: CLLocationManager {
|
||||
|
||||
public var rx_delegate: DelegateProxy {}
|
||||
public var delegate: DelegateProxy {}
|
||||
|
||||
public var rx_didUpdateLocations: Observable<[CLLocation]> {}
|
||||
public var didUpdateLocations: Observable<[CLLocation]> {}
|
||||
|
||||
public var rx_didFailWithError: Observable<NSError> {}
|
||||
public var didFailWithError: Observable<NSError> {}
|
||||
|
||||
public var rx_didFinishDeferredUpdatesWithError: Observable<NSError> {}
|
||||
public var didFinishDeferredUpdatesWithError: Observable<NSError> {}
|
||||
|
||||
public var rx_didPauseLocationUpdates: Observable<Void> {}
|
||||
public var didPauseLocationUpdates: Observable<Void> {}
|
||||
|
||||
public var rx_didResumeLocationUpdates: Observable<Void> {}
|
||||
public var didResumeLocationUpdates: Observable<Void> {}
|
||||
|
||||
public var rx_didUpdateHeading: Observable<CLHeading> {}
|
||||
public var didUpdateHeading: Observable<CLHeading> {}
|
||||
|
||||
public var rx_didEnterRegion: Observable<CLRegion> {}
|
||||
public var didEnterRegion: Observable<CLRegion> {}
|
||||
|
||||
public var rx_didExitRegion: Observable<CLRegion> {}
|
||||
public var didExitRegion: Observable<CLRegion> {}
|
||||
|
||||
public var rx_didDetermineStateForRegion: Observable<(state: CLRegionState, region: CLRegion)> {}
|
||||
public var didDetermineStateForRegion: Observable<(state: CLRegionState, region: CLRegion)> {}
|
||||
|
||||
public var rx_monitoringDidFailForRegionWithError: Observable<(region: CLRegion?, error: NSError)> {}
|
||||
public var monitoringDidFailForRegionWithError: Observable<(region: CLRegion?, error: NSError)> {}
|
||||
|
||||
public var rx_didStartMonitoringForRegion: Observable<CLRegion> {}
|
||||
public var didStartMonitoringForRegion: Observable<CLRegion> {}
|
||||
|
||||
public var rx_didRangeBeaconsInRegion: Observable<(beacons: [CLBeacon], region: CLBeaconRegion)> {}
|
||||
public var didRangeBeaconsInRegion: Observable<(beacons: [CLBeacon], region: CLBeaconRegion)> {}
|
||||
|
||||
public var rx_rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion, error: NSError)> {}
|
||||
public var rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion, error: NSError)> {}
|
||||
|
||||
public var rx_didVisit: Observable<CLVisit> {}
|
||||
public var didVisit: Observable<CLVisit> {}
|
||||
|
||||
public var rx_didChangeAuthorizationStatus: Observable<CLAuthorizationStatus> {}
|
||||
public var didChangeAuthorizationStatus: Observable<CLAuthorizationStatus> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
|
@ -211,281 +211,281 @@ extension CLLocationManager {
|
|||
|
||||
```swift
|
||||
|
||||
extension UIControl {
|
||||
extension Reactive where Base: UIControl {
|
||||
|
||||
public func rx_controlEvent(controlEvents: UIControlEvents) -> ControlEvent<Void> {}
|
||||
public func controlEvent(controlEvents: UIControlEvents) -> ControlEvent<Void> {}
|
||||
|
||||
public var rx_enabled: ObserverOf<Bool> {}
|
||||
public var enabled: ObserverOf<Bool> {}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIButton {
|
||||
extension Reactive where Base: UIButton {
|
||||
|
||||
public var rx_tap: ControlEvent<Void> {}
|
||||
public var tap: ControlEvent<Void> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UITextField {
|
||||
extension Reactive where Base: UITextField {
|
||||
|
||||
public var rx_text: ControlProperty<String> {}
|
||||
public var text: ControlProperty<String> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UITextView {
|
||||
extension Reactive where Base: UITextView {
|
||||
|
||||
override func rx_createDelegateProxy() -> RxScrollViewDelegateProxy {}
|
||||
override func createDelegateProxy() -> RxScrollViewDelegateProxy {}
|
||||
|
||||
public var rx_text: ControlProperty<String> {}
|
||||
public var text: ControlProperty<String> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UISearchBar {
|
||||
extension Reactive where Base: UISearchBar {
|
||||
|
||||
public var rx_delegate: DelegateProxy {}
|
||||
public var delegate: DelegateProxy {}
|
||||
|
||||
public var rx_searchText: ControlProperty<String> {}
|
||||
public var searchText: ControlProperty<String> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UILabel {
|
||||
extension Reactive where Base: UILabel {
|
||||
|
||||
public var rx_text: ObserverOf<String> {}
|
||||
public var text: ObserverOf<String> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIDatePicker {
|
||||
extension Reactive where Base: UIDatePicker {
|
||||
|
||||
public var rx_date: ControlProperty<NSDate> {}
|
||||
public var date: ControlProperty<NSDate> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIImageView {
|
||||
extension Reactive where Base: UIImageView {
|
||||
|
||||
public var rx_image: ObserverOf<UIImage!> {}
|
||||
public var image: ObserverOf<UIImage!> {}
|
||||
|
||||
public func rx_imageAnimated(transitionType: String?) -> AnyObserver<UIImage?>
|
||||
public func imageAnimated(transitionType: String?) -> AnyObserver<UIImage?>
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIScrollView {
|
||||
extension Reactive where Base: UIScrollView {
|
||||
|
||||
public var rx_delegate: DelegateProxy {}
|
||||
public var delegate: DelegateProxy {}
|
||||
|
||||
public func rx_setDelegate(delegate: UIScrollViewDelegate) {}
|
||||
public func setDelegate(delegate: UIScrollViewDelegate) {}
|
||||
|
||||
public var rx_contentOffset: ControlProperty<CGPoint> {}
|
||||
public var contentOffset: ControlProperty<CGPoint> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIBarButtonItem {
|
||||
extension Reactive where Base: UIBarButtonItem {
|
||||
|
||||
public var rx_tap: ControlEvent<Void> {}
|
||||
public var tap: ControlEvent<Void> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UISlider {
|
||||
extension Reactive where Base: UISlider {
|
||||
|
||||
public var rx_value: ControlProperty<Float> {}
|
||||
public var value: ControlProperty<Float> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UITableView {
|
||||
extension Reactive where Base: UITableView {
|
||||
|
||||
public var rx_dataSource: DelegateProxy {}
|
||||
public var dataSource: DelegateProxy {}
|
||||
|
||||
public func rx_setDataSource(dataSource: UITableViewDataSource) -> Disposable {}
|
||||
public func setDataSource(dataSource: UITableViewDataSource) -> Disposable {}
|
||||
|
||||
public func rx_itemsWithCellFactory(source: O)(cellFactory: (UITableView, Int, S.Generator.Element) -> UITableViewCell) -> Disposable {}
|
||||
public func itemsWithCellFactory(source: O)(cellFactory: (UITableView, Int, S.Iterator.Element) -> UITableViewCell) -> Disposable {}
|
||||
|
||||
public func rx_itemsWithCellIdentifier(cellIdentifier: String, cellType: Cell.Type = Cell.self)(source: O)(configureCell: (Int, S.Generator.Element, Cell) -> Void) -> Disposable {}
|
||||
public func itemsWithCellIdentifier(cellIdentifier: String, cellType: Cell.Type = Cell.self)(source: O)(configureCell: (Int, S.Iterator.Element, Cell) -> Void) -> Disposable {}
|
||||
|
||||
public func rx_itemsWithDataSource(dataSource: DataSource)(source: O) -> Disposable {}
|
||||
public func itemsWithDataSource(dataSource: DataSource)(source: O) -> Disposable {}
|
||||
|
||||
public var rx_itemSelected: ControlEvent<NSIndexPath> {}
|
||||
public var itemSelected: ControlEvent<IndexPath> {}
|
||||
|
||||
public var rx_itemDeselected: ControlEvent<NSIndexPath> {}
|
||||
public var itemDeselected: ControlEvent<IndexPath> {}
|
||||
|
||||
public var rx_itemInserted: ControlEvent<NSIndexPath> {}
|
||||
public var itemInserted: ControlEvent<IndexPath> {}
|
||||
|
||||
public var rx_itemDeleted: ControlEvent<NSIndexPath> {}
|
||||
public var itemDeleted: ControlEvent<IndexPath> {}
|
||||
|
||||
public var rx_itemMoved: ControlEvent<ItemMovedEvent> {}
|
||||
public var itemMoved: ControlEvent<ItemMovedEvent> {}
|
||||
|
||||
// This method only works in case one of the `rx_itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func rx_modelSelected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
// This method only works in case one of the `rx.itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func modelSelected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
|
||||
// This method only works in case one of the `rx_itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func rx_modelDeselected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
// This method only works in case one of the `rx.itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func modelDeselected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UICollectionView {
|
||||
extension Reactive where Base: UICollectionView {
|
||||
|
||||
public var rx_dataSource: DelegateProxy {}
|
||||
public var dataSource: DelegateProxy {}
|
||||
|
||||
public func rx_setDataSource(dataSource: UICollectionViewDataSource) -> Disposable {}
|
||||
public func setDataSource(dataSource: UICollectionViewDataSource) -> Disposable {}
|
||||
|
||||
public func rx_itemsWithCellFactory(source: O)(cellFactory: (UICollectionView, Int, S.Generator.Element) -> UICollectionViewCell) -> Disposable {}
|
||||
public func itemsWithCellFactory(source: O)(cellFactory: (UICollectionView, Int, S.Iterator.Element) -> UICollectionViewCell) -> Disposable {}
|
||||
|
||||
public func rx_itemsWithCellIdentifier(cellIdentifier: String, cellType: Cell.Type = Cell.self)(source: O)(configureCell: (Int, S.Generator.Element, Cell) -> Void) -> Disposable {}
|
||||
public func itemsWithCellIdentifier(cellIdentifier: String, cellType: Cell.Type = Cell.self)(source: O)(configureCell: (Int, S.Iterator.Element, Cell) -> Void) -> Disposable {}
|
||||
|
||||
public func rx_itemsWithDataSource(dataSource: DataSource)(source: O) -> Disposable {}
|
||||
public func itemsWithDataSource(dataSource: DataSource)(source: O) -> Disposable {}
|
||||
|
||||
public var rx_itemSelected: ControlEvent<NSIndexPath> {}
|
||||
public var itemSelected: ControlEvent<IndexPath> {}
|
||||
|
||||
public var rx_itemDeselected: ControlEvent<NSIndexPath> {}
|
||||
public var itemDeselected: ControlEvent<IndexPath> {}
|
||||
|
||||
// This method only works in case one of the `rx_itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func rx_modelSelected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
// This method only works in case one of the `rx.itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func modelSelected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
|
||||
// This method only works in case one of the `rx_itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func rx_modelSelected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
// This method only works in case one of the `rx.itemsWith*` methods was used, or data source implements `SectionedViewDataSourceType`
|
||||
public func modelSelected<T>(modelType: T.Type) -> ControlEvent<T> {}
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIGestureRecognizer {
|
||||
extension Reactive where Base: UIGestureRecognizer {
|
||||
|
||||
public var rx_event: ControlEvent<UIGestureRecognizer> {}
|
||||
public var event: ControlEvent<UIGestureRecognizer> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIImagePickerController {
|
||||
extension Reactive where Base: UIImagePickerController {
|
||||
|
||||
public var rx_didFinishPickingMediaWithInfo: Observable<[String : AnyObject]> {}
|
||||
public var didFinishPickingMediaWithInfo: Observable<[String : AnyObject]> {}
|
||||
|
||||
public var rx_didCancel: Observable<()> {}
|
||||
public var didCancel: Observable<()> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UISegmentedControl {
|
||||
extension Reactive where Base: UISegmentedControl {
|
||||
|
||||
public var rx_value: ControlProperty<Int> {}
|
||||
public var value: ControlProperty<Int> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UISwitch {
|
||||
extension Reactive where Base: UISwitch {
|
||||
|
||||
public var rx_value: ControlProperty<Bool> {}
|
||||
public var value: ControlProperty<Bool> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UIActivityIndicatorView {
|
||||
extension Reactive where Base: UIActivityIndicatorView {
|
||||
|
||||
public var rx_animating: AnyObserver<Bool> {}
|
||||
public var animating: AnyObserver<Bool> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UINavigationItem {
|
||||
extension Reactive where Base: UINavigationItem {
|
||||
|
||||
public var rx_title: AnyObserver<String?> {}
|
||||
public var title: AnyObserver<String?> {}
|
||||
}
|
||||
```
|
||||
|
||||
**OSX**
|
||||
|
||||
```swift
|
||||
extension NSControl {
|
||||
extension Reactive where Base: NSControl {
|
||||
|
||||
public var rx_controlEvent: ControlEvent<()> {}
|
||||
public var controlEvent: ControlEvent<()> {}
|
||||
|
||||
public var rx_enabled: AnyObserver<Bool> {}
|
||||
public var enabled: AnyObserver<Bool> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
|
||||
extension NSSlider {
|
||||
extension Reactive where Base: NSSlider {
|
||||
|
||||
public var rx_value: ControlProperty<Double> {}
|
||||
public var value: ControlProperty<Double> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension NSButton {
|
||||
extension Reactive where Base: NSButton {
|
||||
|
||||
public var rx_tap: ControlEvent<Void> {}
|
||||
public var tap: ControlEvent<Void> {}
|
||||
|
||||
public var rx_state: ControlProperty<Int> {}
|
||||
public var state: ControlProperty<Int> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension NSImageView {
|
||||
extension Reactive where Base: NSImageView {
|
||||
|
||||
public var rx_image: ObserverOf<NSImage?> {}
|
||||
public var image: ObserverOf<NSImage?> {}
|
||||
|
||||
public func rx_imageAnimated(transitionType: String?) -> AnyObserver<NSImage?>
|
||||
public func imageAnimated(transitionType: String?) -> AnyObserver<NSImage?>
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension NSTextField {
|
||||
extension Reactive where Base: NSTextField {
|
||||
|
||||
public var rx_delegate: DelegateProxy {}
|
||||
public var delegate: DelegateProxy {}
|
||||
|
||||
public var rx_text: ControlProperty<String> {}
|
||||
public var text: ControlProperty<String> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UITabBarItem {
|
||||
extension Reactive where Base: UITabBarItem {
|
||||
|
||||
public var rx_badgeValue: AnyObserver<String?> {}
|
||||
public var badgeValue: AnyObserver<String?> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```swift
|
||||
extension UITabBar {
|
||||
extension Reactive where Base: UITabBar {
|
||||
|
||||
public var rx_didSelectItem: ControlEvent<UITabBarItem> {}
|
||||
public var didSelectItem: ControlEvent<UITabBarItem> {}
|
||||
|
||||
public var rx_willBeginCustomizing: ControlEvent<[UITabBarItem]> {}
|
||||
public var willBeginCustomizing: ControlEvent<[UITabBarItem]> {}
|
||||
|
||||
public var rx_didBeginCustomizing: ControlEvent<[UITabBarItem]> {}
|
||||
public var didBeginCustomizing: ControlEvent<[UITabBarItem]> {}
|
||||
|
||||
public var rx_willEndCustomizing: ControlEvent<(items: [UITabBarItem], changed: Bool)> {}
|
||||
public var willEndCustomizing: ControlEvent<(items: [UITabBarItem], changed: Bool)> {}
|
||||
|
||||
public var rx_didEndCustomizing: ControlEvent<(items: [UITabBarItem], changed: Bool)> {}
|
||||
public var didEndCustomizing: ControlEvent<(items: [UITabBarItem], changed: Bool)> {}
|
||||
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ let c = Observable.combineLatest(a.asObservable(), b.asObservable()) { $0 + $1 }
|
|||
// 1 + 2 = 3 which is >= 0, so `c` is initially equal to "3 is positive"
|
||||
|
||||
// To pull values out of the Rx `Observable` `c`, subscribe to values from `c`.
|
||||
// `subscribeNext` means subscribe to the next (fresh) values of `c`.
|
||||
// `subscribe(onNext:)` means subscribe to the next (fresh) values of `c`.
|
||||
// That also includes the initial value "3 is positive".
|
||||
c.subscribeNext { print($0) } // prints: "3 is positive"
|
||||
c.subscribe(onNext: { print($0) }) // prints: "3 is positive"
|
||||
|
||||
// Now, let's increase the value of `a`
|
||||
a.value = 4 // prints: 6 is positive
|
||||
|
|
@ -72,17 +72,17 @@ b.value = -8 // doesn't print anything
|
|||
|
||||
## Simple UI bindings
|
||||
|
||||
* Instead of binding to variables, let's bind to `UITextField` values using the `rx_text` property
|
||||
* Instead of binding to variables, let's bind to `UITextField` values using the `rx.text` property
|
||||
* Next, `map` the `String` into an `Int` and determine if the number is prime using an async API
|
||||
* If the text is changed before the async call completes, a new async call will replace it via `concat`
|
||||
* Bind the results to a `UILabel`
|
||||
|
||||
```swift
|
||||
let subscription/*: Disposable */ = primeTextField.rx_text // type is Observable<String>
|
||||
let subscription/*: Disposable */ = primeTextField.rx.text // type is Observable<String>
|
||||
.map { WolframAlphaIsPrime(Int($0) ?? 0) } // type is Observable<Observable<Prime>>
|
||||
.concat() // type is Observable<Prime>
|
||||
.map { "number \($0.n) is prime? \($0.isPrime)" } // type is Observable<String>
|
||||
.bindTo(resultLabel.rx_text) // return Disposable that can be used to unbind everything
|
||||
.bindTo(resultLabel.rx.text) // return Disposable that can be used to unbind everything
|
||||
|
||||
// This will set `resultLabel.text` to "number 43 is prime? true" after
|
||||
// server call completes.
|
||||
|
|
@ -108,7 +108,7 @@ Let's give it a shot.
|
|||
```swift
|
||||
// bind UI control values directly
|
||||
// use username from `usernameOutlet` as username values source
|
||||
self.usernameOutlet.rx_text
|
||||
self.usernameOutlet.rx.text
|
||||
.map { username in
|
||||
|
||||
// synchronous validation, nothing special here
|
||||
|
|
@ -152,12 +152,12 @@ self.usernameOutlet.rx_text
|
|||
// That's what `switchLatest` does.
|
||||
.switchLatest()
|
||||
// Now we need to bind that to the user interface somehow.
|
||||
// Good old `subscribeNext` can do that.
|
||||
// Good old `subscribe(onNext:)` can do that.
|
||||
// That's the end of `Observable` chain.
|
||||
.subscribeNext { valid in
|
||||
.subscribe(onNext: { valid in
|
||||
errorLabel.textColor = validationColor(valid)
|
||||
errorLabel.text = valid.message
|
||||
}
|
||||
})
|
||||
// This will produce a `Disposable` object that can unbind everything and cancel
|
||||
// pending async operations.
|
||||
// Instead of doing it manually, which is tedious,
|
||||
|
|
|
|||
|
|
@ -67,32 +67,32 @@ These are called marble diagrams. There are more marble diagrams at [rxmarbles.c
|
|||
|
||||
If we were to specify sequence grammar as a regular expression it would look like:
|
||||
|
||||
**Next* (Error | Completed)?**
|
||||
**next* (error | completed)?**
|
||||
|
||||
This describes the following:
|
||||
|
||||
* **Sequences can have 0 or more elements.**
|
||||
* **Once an `Error` or `Completed` event is received, the sequence cannot produce any other element.**
|
||||
* **Once an `error` or `completed` event is received, the sequence cannot produce any other element.**
|
||||
|
||||
Sequences in Rx are described by a push interface (aka callback).
|
||||
|
||||
```swift
|
||||
enum Event<Element> {
|
||||
case Next(Element) // next element of a sequence
|
||||
case Error(ErrorType) // sequence failed with error
|
||||
case Completed // sequence terminated successfully
|
||||
case next(Element) // next element of a sequence
|
||||
case error(Swift.Error) // sequence failed with error
|
||||
case completed // sequence terminated successfully
|
||||
}
|
||||
|
||||
class Observable<Element> {
|
||||
func subscribe(observer: Observer<Element>) -> Disposable
|
||||
func subscribe(_ observer: Observer<Element>) -> Disposable
|
||||
}
|
||||
|
||||
protocol ObserverType {
|
||||
func on(event: Event<Element>)
|
||||
func on(_ event: Event<Element>)
|
||||
}
|
||||
```
|
||||
|
||||
**When a sequence sends the `Completed` or `Error` event all internal resources that compute sequence elements will be freed.**
|
||||
**When a sequence sends the `completed` or `error` event all internal resources that compute sequence elements will be freed.**
|
||||
|
||||
**To cancel production of sequence elements and free resources immediately, call `dispose` on the returned subscription.**
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ If a sequence does not terminate in some way, resources will be allocated perman
|
|||
|
||||
**Using dispose bags or `takeUntil` operator is a robust way of making sure resources are cleaned up. We recommend using them in production even if the sequences will terminate in finite time.**
|
||||
|
||||
In case you are curious why `ErrorType` isn't generic, you can find explanation [here](DesignRationale.md#why-error-type-isnt-generic).
|
||||
In case you are curious why `Swift.Error` isn't generic, you can find explanation [here](DesignRationale.md#why-error-type-isnt-generic).
|
||||
|
||||
## Disposing
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ let subscription = Observable<Int>.interval(0.3, scheduler: scheduler)
|
|||
print(event)
|
||||
}
|
||||
|
||||
NSThread.sleepForTimeInterval(2)
|
||||
NSThread.sleep(forTimeInterval: 2.0)
|
||||
|
||||
subscription.dispose()
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ This will print:
|
|||
5
|
||||
```
|
||||
|
||||
Note the you usually do not want to manually call `dispose`; this is only educational example. Calling dispose manually is usually a bad code smell. There are better ways to dispose subscriptions. We can use `DisposeBag`, the `takeUntil` operator, or some other mechanism.
|
||||
Note that you usually do not want to manually call `dispose`; this is only educational example. Calling dispose manually is usually a bad code smell. There are better ways to dispose subscriptions. We can use `DisposeBag`, the `takeUntil` operator, or some other mechanism.
|
||||
|
||||
So can this code print something after the `dispose` call executed? The answer is: it depends.
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ Additional way to automatically dispose subscription on dealloc is to use `takeU
|
|||
|
||||
```swift
|
||||
sequence
|
||||
.takeUntil(self.rx_deallocated)
|
||||
.takeUntil(self.rx.deallocated)
|
||||
.subscribe {
|
||||
print($0)
|
||||
}
|
||||
|
|
@ -218,9 +218,9 @@ sequence
|
|||
|
||||
There is also a couple of additional guarantees that all sequence producers (`Observable`s) must honor.
|
||||
|
||||
It doesn't matter on which thread they produce elements, but if they generate one element and send it to the observer `observer.on(.Next(nextElement))`, they can't send next element until `observer.on` method has finished execution.
|
||||
It doesn't matter on which thread they produce elements, but if they generate one element and send it to the observer `observer.on(.next(nextElement))`, they can't send next element until `observer.on` method has finished execution.
|
||||
|
||||
Producers also cannot send terminating `.Completed` or `.Error` in case `.Next` event hasn't finished.
|
||||
Producers also cannot send terminating `.completed` or `.error` in case `.next` event hasn't finished.
|
||||
|
||||
In short, consider this example:
|
||||
|
||||
|
|
@ -276,9 +276,9 @@ let searchForMe = searchWikipedia("me")
|
|||
|
||||
let cancel = searchForMe
|
||||
// sequence generation starts now, URL requests are fired
|
||||
.subscribeNext { results in
|
||||
.subscribe(onNext: { results in
|
||||
print(results)
|
||||
}
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -291,16 +291,16 @@ Let's create a function which creates a sequence that returns one element upon s
|
|||
```swift
|
||||
func myJust<E>(element: E) -> Observable<E> {
|
||||
return Observable.create { observer in
|
||||
observer.on(.Next(element))
|
||||
observer.on(.Completed)
|
||||
return NopDisposable.instance
|
||||
observer.on(.next(element))
|
||||
observer.on(.completed)
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
myJust(0)
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print(n)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
this will print:
|
||||
|
|
@ -325,11 +325,11 @@ Lets now create an observable that returns elements from an array.
|
|||
func myFrom<E>(sequence: [E]) -> Observable<E> {
|
||||
return Observable.create { observer in
|
||||
for element in sequence {
|
||||
observer.on(.Next(element))
|
||||
observer.on(.next(element))
|
||||
}
|
||||
|
||||
observer.on(.Completed)
|
||||
return NopDisposable.instance
|
||||
observer.on(.completed)
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -339,17 +339,17 @@ print("Started ----")
|
|||
|
||||
// first time
|
||||
stringCounter
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print(n)
|
||||
}
|
||||
})
|
||||
|
||||
print("----")
|
||||
|
||||
// again
|
||||
stringCounter
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print(n)
|
||||
}
|
||||
})
|
||||
|
||||
print("Ended ----")
|
||||
```
|
||||
|
|
@ -382,15 +382,15 @@ func myInterval(interval: NSTimeInterval) -> Observable<Int> {
|
|||
var next = 0
|
||||
|
||||
dispatch_source_set_timer(timer, 0, UInt64(interval * Double(NSEC_PER_SEC)), 0)
|
||||
let cancel = AnonymousDisposable {
|
||||
let cancel = Disposables.create {
|
||||
print("Disposed")
|
||||
dispatch_source_cancel(timer)
|
||||
}
|
||||
dispatch_source_set_event_handler(timer, {
|
||||
if cancel.disposed {
|
||||
if cancel.isDisposed {
|
||||
return
|
||||
}
|
||||
observer.on(.Next(next))
|
||||
observer.on(.next(next))
|
||||
next += 1
|
||||
})
|
||||
dispatch_resume(timer)
|
||||
|
|
@ -406,11 +406,12 @@ let counter = myInterval(0.1)
|
|||
print("Started ----")
|
||||
|
||||
let subscription = counter
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print(n)
|
||||
}
|
||||
})
|
||||
|
||||
NSThread.sleepForTimeInterval(0.5)
|
||||
|
||||
NSThread.sleep(forTimeInterval: 0.5)
|
||||
|
||||
subscription.dispose()
|
||||
|
||||
|
|
@ -438,19 +439,19 @@ let counter = myInterval(0.1)
|
|||
print("Started ----")
|
||||
|
||||
let subscription1 = counter
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print("First \(n)")
|
||||
}
|
||||
})
|
||||
let subscription2 = counter
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print("Second \(n)")
|
||||
}
|
||||
})
|
||||
|
||||
NSThread.sleepForTimeInterval(0.5)
|
||||
NSThread.sleep(forTimeInterval: 0.5)
|
||||
|
||||
subscription1.dispose()
|
||||
|
||||
NSThread.sleepForTimeInterval(0.5)
|
||||
NSThread.sleep(forTimeInterval: 0.5)
|
||||
|
||||
subscription2.dispose()
|
||||
|
||||
|
|
@ -503,13 +504,13 @@ let counter = myInterval(0.1)
|
|||
print("Started ----")
|
||||
|
||||
let subscription1 = counter
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print("First \(n)")
|
||||
}
|
||||
})
|
||||
let subscription2 = counter
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print("Second \(n)")
|
||||
}
|
||||
})
|
||||
|
||||
NSThread.sleepForTimeInterval(0.5)
|
||||
|
||||
|
|
@ -554,27 +555,27 @@ Behavior for URL observables is equivalent.
|
|||
This is how HTTP requests are wrapped in Rx. It's pretty much the same pattern like the `interval` operator.
|
||||
|
||||
```swift
|
||||
extension NSURLSession {
|
||||
public func rx_response(request: NSURLRequest) -> Observable<(NSData, NSURLResponse)> {
|
||||
extension Reactive where Base: NSURLSession {
|
||||
public func response(request: NSURLRequest) -> Observable<(NSData, NSURLResponse)> {
|
||||
return Observable.create { observer in
|
||||
let task = self.dataTaskWithRequest(request) { (data, response, error) in
|
||||
guard let response = response, data = data else {
|
||||
observer.on(.Error(error ?? RxCocoaURLError.Unknown))
|
||||
observer.on(.error(error ?? RxCocoaURLError.Unknown))
|
||||
return
|
||||
}
|
||||
|
||||
guard let httpResponse = response as? NSHTTPURLResponse else {
|
||||
observer.on(.Error(RxCocoaURLError.NonHTTPResponse(response: response)))
|
||||
observer.on(.error(RxCocoaURLError.nonHTTPResponse(response: response)))
|
||||
return
|
||||
}
|
||||
|
||||
observer.on(.Next(data, httpResponse))
|
||||
observer.on(.Completed)
|
||||
observer.on(.next(data, httpResponse))
|
||||
observer.on(.completed)
|
||||
}
|
||||
|
||||
task.resume()
|
||||
|
||||
return AnonymousDisposable {
|
||||
return Disposables.create {
|
||||
task.cancel()
|
||||
}
|
||||
}
|
||||
|
|
@ -614,13 +615,13 @@ extension ObservableType {
|
|||
return Observable.create { observer in
|
||||
let subscription = self.subscribe { e in
|
||||
switch e {
|
||||
case .Next(let value):
|
||||
case .next(let value):
|
||||
let result = transform(value)
|
||||
observer.on(.Next(result))
|
||||
case .Error(let error):
|
||||
observer.on(.Error(error))
|
||||
case .Completed:
|
||||
observer.on(.Completed)
|
||||
observer.on(.next(result))
|
||||
case .error(let error):
|
||||
observer.on(.error(error))
|
||||
case .completed:
|
||||
observer.on(.completed)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -637,9 +638,9 @@ let subscription = myInterval(0.1)
|
|||
.myMap { e in
|
||||
return "This is simply \(e)"
|
||||
}
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print(n)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
and this will print
|
||||
|
|
@ -668,9 +669,9 @@ This isn't something that should be practiced often, and is a bad code smell, bu
|
|||
let magicBeings: Observable<MagicBeing> = summonFromMiddleEarth()
|
||||
|
||||
magicBeings
|
||||
.subscribeNext { being in // exit the Rx monad
|
||||
.subscribe(onNext: { being in // exit the Rx monad
|
||||
self.doSomeStateMagic(being)
|
||||
}
|
||||
})
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
//
|
||||
|
|
@ -680,7 +681,7 @@ This isn't something that should be practiced often, and is a bad code smell, bu
|
|||
being,
|
||||
UIApplication.delegate.dataSomething.attendees
|
||||
)
|
||||
kittens.on(.Next(kitten)) // send result back to rx
|
||||
kittens.on(.next(kitten)) // send result back to rx
|
||||
//
|
||||
// Another mess
|
||||
//
|
||||
|
|
@ -698,9 +699,9 @@ Every time you do this, somebody will probably write this code somewhere
|
|||
|
||||
```swift
|
||||
kittens
|
||||
.subscribeNext { kitten in
|
||||
.subscribe(onNext: { kitten in
|
||||
// so something with kitten
|
||||
}
|
||||
})
|
||||
.addDisposableTo(disposeBag)
|
||||
```
|
||||
|
||||
|
|
@ -716,7 +717,7 @@ If you are unsure how exactly some of the operators work, [playgrounds](../Rx.pl
|
|||
|
||||
## Error handling
|
||||
|
||||
The are two error mechanisms.
|
||||
There are two error mechanisms.
|
||||
|
||||
### Asynchronous error handling mechanism in observables
|
||||
|
||||
|
|
@ -783,9 +784,9 @@ let subscription = myInterval(0.1)
|
|||
.map { e in
|
||||
return "This is simply \(e)"
|
||||
}
|
||||
.subscribeNext { n in
|
||||
.subscribe(onNext: { n in
|
||||
print(n)
|
||||
}
|
||||
})
|
||||
|
||||
NSThread.sleepForTimeInterval(0.5)
|
||||
|
||||
|
|
@ -797,15 +798,15 @@ will print
|
|||
```
|
||||
[my probe] subscribed
|
||||
Subscribed
|
||||
[my probe] -> Event Next(Box(0))
|
||||
[my probe] -> Event next(Box(0))
|
||||
This is simply 0
|
||||
[my probe] -> Event Next(Box(1))
|
||||
[my probe] -> Event next(Box(1))
|
||||
This is simply 1
|
||||
[my probe] -> Event Next(Box(2))
|
||||
[my probe] -> Event next(Box(2))
|
||||
This is simply 2
|
||||
[my probe] -> Event Next(Box(3))
|
||||
[my probe] -> Event next(Box(3))
|
||||
This is simply 3
|
||||
[my probe] -> Event Next(Box(4))
|
||||
[my probe] -> Event next(Box(4))
|
||||
This is simply 4
|
||||
[my probe] dispose
|
||||
Disposed
|
||||
|
|
@ -821,17 +822,17 @@ extension ObservableType {
|
|||
let subscription = self.subscribe { e in
|
||||
print("event \(identifier) \(e)")
|
||||
switch e {
|
||||
case .Next(let value):
|
||||
observer.on(.Next(value))
|
||||
case .next(let value):
|
||||
observer.on(.next(value))
|
||||
|
||||
case .Error(let error):
|
||||
observer.on(.Error(error))
|
||||
case .error(let error):
|
||||
observer.on(.error(error))
|
||||
|
||||
case .Completed:
|
||||
observer.on(.Completed)
|
||||
case .completed:
|
||||
observer.on(.completed)
|
||||
}
|
||||
}
|
||||
return AnonymousDisposable {
|
||||
return Disposables.create {
|
||||
print("disposing \(identifier)")
|
||||
subscription.dispose()
|
||||
}
|
||||
|
|
@ -851,9 +852,9 @@ In case you want to have some resource leak detection logic, the simplest method
|
|||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
|
||||
*/
|
||||
_ = Observable<Int>.interval(1, scheduler: MainScheduler.instance)
|
||||
.subscribeNext { _ in
|
||||
print("Resource count \(RxSwift.resourceCount)")
|
||||
}
|
||||
.subscribe(onNext: { _ in
|
||||
print("Resource count \(RxSwift.resourceCount)")
|
||||
})
|
||||
```
|
||||
|
||||
Most efficient way to test for memory leaks is:
|
||||
|
|
@ -933,14 +934,14 @@ There are two built in ways this library supports KVO.
|
|||
|
||||
```swift
|
||||
// KVO
|
||||
extension NSObject {
|
||||
public func rx_observe<E>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions, retainSelf: Bool = true) -> Observable<E?> {}
|
||||
extension Reactive where Base: NSObject {
|
||||
public func observe<E>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions, retainSelf: Bool = true) -> Observable<E?> {}
|
||||
}
|
||||
|
||||
#if !DISABLE_SWIZZLING
|
||||
// KVO
|
||||
extension NSObject {
|
||||
public func rx_observeWeakly<E>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions) -> Observable<E?> {}
|
||||
extension Reactive where Base: NSObject {
|
||||
public func observeWeakly<E>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions) -> Observable<E?> {}
|
||||
}
|
||||
#endif
|
||||
```
|
||||
|
|
@ -951,25 +952,25 @@ Example how to observe frame of `UIView`.
|
|||
|
||||
```swift
|
||||
view
|
||||
.rx_observe(CGRect.self, "frame")
|
||||
.subscribeNext { frame in
|
||||
.rx.observe(CGRect.self, "frame")
|
||||
.subscribe(onNext: { frame in
|
||||
...
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```swift
|
||||
view
|
||||
.rx_observeWeakly(CGRect.self, "frame")
|
||||
.subscribeNext { frame in
|
||||
.rx.observeWeakly(CGRect.self, "frame")
|
||||
.subscribe(onNext: { frame in
|
||||
...
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### `rx_observe`
|
||||
### `rx.observe`
|
||||
|
||||
`rx_observe` is more performant because it's just a simple wrapper around KVO mechanism, but it has more limited usage scenarios
|
||||
`rx.observe` is more performant because it's just a simple wrapper around KVO mechanism, but it has more limited usage scenarios
|
||||
|
||||
* it can be used to observe paths starting from `self` or from ancestors in ownership graph (`retainSelf = false`)
|
||||
* it can be used to observe paths starting from descendants in ownership graph (`retainSelf = true`)
|
||||
|
|
@ -978,14 +979,14 @@ view
|
|||
E.g.
|
||||
|
||||
```swift
|
||||
self.rx_observe(CGRect.self, "view.frame", retainSelf: false)
|
||||
self.rx.observe(CGRect.self, "view.frame", retainSelf: false)
|
||||
```
|
||||
|
||||
### `rx_observeWeakly`
|
||||
### `rx.observeWeakly`
|
||||
|
||||
`rx_observeWeakly` has somewhat slower than `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
|
||||
It can be used in all cases where `rx.observe` can be used and additionally
|
||||
|
||||
* because it won't retain observed target, it can be used to observe arbitrary object graph whose ownership relation is unknown
|
||||
* it can be used to observe `weak` properties
|
||||
|
|
@ -993,7 +994,7 @@ It can be used in all cases where `rx_observe` can be used and additionally
|
|||
E.g.
|
||||
|
||||
```swift
|
||||
someSuspiciousViewController.rx_observeWeakly(Bool.self, "behavingOk")
|
||||
someSuspiciousViewController.rx.observeWeakly(Bool.self, "behavingOk")
|
||||
```
|
||||
|
||||
### Observing structs
|
||||
|
|
@ -1004,7 +1005,7 @@ KVO is an Objective-C mechanism so it relies heavily on `NSValue`.
|
|||
|
||||
When observing some other structures it is necessary to extract those structures from `NSValue` manually.
|
||||
|
||||
[Here](../RxCocoa/Common/KVORepresentable+CoreGraphics.swift) are examples how to extend KVO observing mechanism and `rx_observe*` methods for other structs by implementing `KVORepresentable` protocol.
|
||||
[Here](../RxCocoa/Common/KVORepresentable+CoreGraphics.swift) are examples how to extend KVO observing mechanism and `rx.observe*` methods for other structs by implementing `KVORepresentable` protocol.
|
||||
|
||||
## UI layer tips
|
||||
|
||||
|
|
@ -1070,18 +1071,18 @@ let request = NSURLRequest(URL: NSURL(string: "http://en.wikipedia.org/w/api.php
|
|||
If you want to just execute that request outside of composition with other observables, this is what needs to be done.
|
||||
|
||||
```swift
|
||||
let responseJSON = NSURLSession.sharedSession().rx_JSON(request)
|
||||
let responseJSON = NSURLSession.sharedSession().rx.JSON(request)
|
||||
|
||||
// no requests will be performed up to this point
|
||||
// `responseJSON` is just a description how to fetch the response
|
||||
|
||||
let cancelRequest = responseJSON
|
||||
// this will fire the request
|
||||
.subscribeNext { json in
|
||||
.subscribe(onNext: { json in
|
||||
print(json)
|
||||
}
|
||||
})
|
||||
|
||||
NSThread.sleepForTimeInterval(3)
|
||||
NSThread.sleep(forTimeInterval: 3.0)
|
||||
|
||||
// if you want to cancel request after 3 seconds have passed just call
|
||||
cancelRequest.dispose()
|
||||
|
|
@ -1093,7 +1094,7 @@ cancelRequest.dispose()
|
|||
In case you want a more low level access to response, you can use:
|
||||
|
||||
```swift
|
||||
NSURLSession.sharedSession().rx_response(myNSURLRequest)
|
||||
NSURLSession.shared.rx.response(myNSURLRequest)
|
||||
.debug("my request") // this will print out information to console
|
||||
.flatMap { (data: NSData!, response: NSURLResponse!) -> Observable<String> in
|
||||
if let response = response as? NSHTTPURLResponse {
|
||||
|
|
|
|||
|
|
@ -28,4 +28,4 @@ What works:
|
|||
What doesn't work:
|
||||
* Schedulers - because they are dependent on https://github.com/apple/swift-corelibs-libdispatch and it still hasn't been released
|
||||
* Multithreading - still no access to c11 locks
|
||||
* For some reason it looks like Swift compiler generates wrong code when using `ErrorType` on `Linux`, so don't use errors, otherwise you can get weird crashes.
|
||||
* For some reason it looks like Swift compiler generates wrong code when using `Swift.Error` on `Linux`, so don't use errors, otherwise you can get weird crashes.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ There are two main operators that work with schedulers, `observeOn` and `subscri
|
|||
|
||||
If you want to perform work on a different scheduler just use `observeOn(scheduler)` operator.
|
||||
|
||||
You would usually use `observeOn` a lot more often then `subscribeOn`.
|
||||
You would usually use `observeOn` a lot more often than `subscribeOn`.
|
||||
|
||||
In case `observeOn` isn't explicitly specified, work will be performed on whichever thread/scheduler elements are generated.
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ sequence1
|
|||
|
||||
If you want to start sequence generation (`subscribe` method) and call dispose on a specific scheduler, use `subscribeOn(scheduler)`.
|
||||
|
||||
In case `subscribeOn` isn't explicitly specified, the `subscribe` method will be called on the same thread/scheduler on which `subscribeNext` or `subscribe` is called.
|
||||
In case `subscribeOn` isn't explicitly specified, the `subscribe` method will be called on the same thread/scheduler on which `subscribe(onNext:)` or `subscribe` is called.
|
||||
|
||||
In case `subscribeOn` isn't explicitly specified, the `dispose` method will be called on the same thread/scheduler that initiated disposing.
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ E.g.
|
|||
This is a typical beginner example.
|
||||
|
||||
```swift
|
||||
let results = query.rx_text
|
||||
let results = query.rx.text
|
||||
.throttle(0.3, scheduler: MainScheduler.instance)
|
||||
.flatMapLatest { query in
|
||||
fetchAutoCompleteItems(query)
|
||||
|
|
@ -172,11 +172,11 @@ let results = query.rx_text
|
|||
|
||||
results
|
||||
.map { "\($0.count)" }
|
||||
.bindTo(resultCount.rx_text)
|
||||
.bindTo(resultCount.rx.text)
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
results
|
||||
.bindTo(resultsTableView.rx_itemsWithCellIdentifier("Cell")) { (_, result, cell) in
|
||||
.bindTo(resultsTableView.rx.itemsWithCellIdentifier("Cell")) { (_, result, cell) in
|
||||
cell.textLabel?.text = "\(result)"
|
||||
}
|
||||
.addDisposableTo(disposeBag)
|
||||
|
|
@ -195,7 +195,7 @@ So, what are the problems with this code?:
|
|||
A more appropriate version of the code would look like this:
|
||||
|
||||
```swift
|
||||
let results = query.rx_text
|
||||
let results = query.rx.text
|
||||
.throttle(0.3, scheduler: MainScheduler.instance)
|
||||
.flatMapLatest { query in
|
||||
fetchAutoCompleteItems(query)
|
||||
|
|
@ -207,11 +207,11 @@ let results = query.rx_text
|
|||
|
||||
results
|
||||
.map { "\($0.count)" }
|
||||
.bindTo(resultCount.rx_text)
|
||||
.bindTo(resultCount.rx.text)
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
results
|
||||
.bindTo(resultTableView.rx_itemsWithCellIdentifier("Cell")) { (_, result, cell) in
|
||||
.bindTo(resultTableView.rx.itemsWithCellIdentifier("Cell")) { (_, result, cell) in
|
||||
cell.textLabel?.text = "\(result)"
|
||||
}
|
||||
.addDisposableTo(disposeBag)
|
||||
|
|
@ -222,7 +222,7 @@ Making sure all of these requirements are properly handled in large systems can
|
|||
The following code looks almost the same:
|
||||
|
||||
```swift
|
||||
let results = query.rx_text.asDriver() // This converts a normal sequence into a `Driver` sequence.
|
||||
let results = query.rx.text.asDriver() // This converts a normal sequence into a `Driver` sequence.
|
||||
.throttle(0.3, scheduler: MainScheduler.instance)
|
||||
.flatMapLatest { query in
|
||||
fetchAutoCompleteItems(query)
|
||||
|
|
@ -231,11 +231,11 @@ let results = query.rx_text.asDriver() // This converts a normal sequence
|
|||
|
||||
results
|
||||
.map { "\($0.count)" }
|
||||
.drive(resultCount.rx_text) // If there is a `drive` method available instead of `bindTo`,
|
||||
.drive(resultCount.rx.text) // If there is a `drive` method available instead of `bindTo`,
|
||||
.addDisposableTo(disposeBag) // that means that the compiler has proven that all properties
|
||||
// are satisfied.
|
||||
results
|
||||
.drive(resultTableView.rx_itemsWithCellIdentifier("Cell")) { (_, result, cell) in
|
||||
.drive(resultTableView.rx.itemsWithCellIdentifier("Cell")) { (_, result, cell) in
|
||||
cell.textLabel?.text = "\(result)"
|
||||
}
|
||||
.addDisposableTo(disposeBag)
|
||||
|
|
@ -246,7 +246,7 @@ So what is happening here?
|
|||
This first `asDriver` method converts the `ControlProperty` unit to a `Driver` unit.
|
||||
|
||||
```swift
|
||||
query.rx_text.asDriver()
|
||||
query.rx.text.asDriver()
|
||||
```
|
||||
|
||||
Notice that there wasn't anything special that needed to be done. `Driver` has all of the properties of the `ControlProperty` unit, plus some more. The underlying observable sequence is just wrapped as a `Driver` unit, and that's it.
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ _ = xs
|
|||
.filter { ... }
|
||||
.map { ... }
|
||||
.switchLatest()
|
||||
.takeUntil(someObject.rx_deallocated) // <-- note the `takeUntil` operator
|
||||
.takeUntil(someObject.deallocated) // <-- note the `takeUntil` operator
|
||||
.subscribe(onNext: {
|
||||
...
|
||||
}, onError: {
|
||||
|
|
@ -114,9 +114,9 @@ let disposeBag = DisposeBag()
|
|||
xs
|
||||
.filter { ... }
|
||||
.map { ... }
|
||||
.subscribeNext { nextElement in // <-- note the `subscribe*` method
|
||||
.subscribe(onNext: { nextElement in // <-- note the `subscribe*` method
|
||||
// use the element
|
||||
print(nextElement)
|
||||
}
|
||||
})
|
||||
.addDisposableTo(disposeBag)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
**Please copy the following template [here](https://github.com/ReactiveX/RxSwift/issues/new) and fill in the missing fields so we can help you as soon as possible.**
|
||||
|
||||
**If you don't have something to report in the following format, it will probably be easier and faster to ask in the [slack channel](http://http://slack.rxswift.org/) first.**
|
||||
:warning: If you don't have something to report in the following format, it will probably be easier and faster to ask in the [slack channel](http://http://slack.rxswift.org/) first. :warning:
|
||||
|
||||
```
|
||||
*Short description*:
|
||||
**Short description of the issue**:
|
||||
|
||||
description here
|
||||
_description here_
|
||||
|
||||
*Self contained code example that reproduces the issue*:
|
||||
**Self contained code example that reproduces the issue**:
|
||||
|
||||
```swift
|
||||
code goes here
|
||||
|
||||
// If we can't get a self contained code example that reproduces the issue, there is a big chance we won't be able
|
||||
|
|
@ -16,36 +15,37 @@
|
|||
// `Self contained code example` means:
|
||||
// * that we should be able to just run the provided code without changing it.
|
||||
// * that it will reproduce the issue upon running
|
||||
```
|
||||
|
||||
*Xcode version*:
|
||||
**Xcode version**:
|
||||
|
||||
```
|
||||
Xcode version goes here
|
||||
```
|
||||
|
||||
*Expected outcome*:
|
||||
**Expected outcome**:
|
||||
|
||||
what you expect to happen goes here
|
||||
_what you expect to happen goes here_
|
||||
|
||||
*What actually happens*:
|
||||
**What actually happens**:
|
||||
|
||||
what actually happens goes here
|
||||
_what actually happens goes here_
|
||||
|
||||
// filling in additional information below is optional, but resolving your issue could potentially be a lot faster
|
||||
:warning: Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. :warning:
|
||||
|
||||
*Installation method*:
|
||||
(so we don't waste time investigating an incorrect integration)
|
||||
* CocoaPods
|
||||
* Carthage
|
||||
* Git submodules
|
||||
**Installation method**:
|
||||
- [ ] CocoaPods
|
||||
- [ ] Carthage
|
||||
- [ ] Git submodules
|
||||
|
||||
*I have multiple versions of Xcode installed*:
|
||||
**I have multiple versions of Xcode installed**:
|
||||
(so we can know if this is a potential cause of your issue)
|
||||
* yes (which ones)
|
||||
* no
|
||||
- [ ] yes (which ones)
|
||||
- [ ] no
|
||||
|
||||
*Level of RxSwift knowledge*:
|
||||
**Level of RxSwift knowledge**:
|
||||
(this is so we can understand your level of knowledge
|
||||
and formulate the response in an appropriate manner)
|
||||
* just starting
|
||||
* I have a small code base
|
||||
* I have a significant code base
|
||||
```
|
||||
- [ ] just starting
|
||||
- [ ] I have a small code base
|
||||
- [ ] I have a significant code base
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@ import PackageDescription
|
|||
#if os(OSX)
|
||||
let package = Package(
|
||||
name: "RxSwift",
|
||||
exclude: [
|
||||
"Sources/RxCocoa",
|
||||
"Sources/RxTests",
|
||||
"Sources/AllTests"
|
||||
],
|
||||
targets: [
|
||||
Target(
|
||||
name: "RxSwift"
|
||||
|
|
@ -32,14 +27,16 @@ let package = Package(
|
|||
.Target(name: "RxTests")
|
||||
]
|
||||
)
|
||||
],
|
||||
exclude: [
|
||||
"Sources/RxCocoa",
|
||||
"Sources/RxTests",
|
||||
"Sources/AllTests"
|
||||
]
|
||||
)
|
||||
#elseif os(Linux)
|
||||
let package = Package(
|
||||
name: "RxSwift",
|
||||
exclude: [
|
||||
"Sources/RxCocoa",
|
||||
],
|
||||
targets: [
|
||||
Target(
|
||||
name: "RxSwift"
|
||||
|
|
@ -64,6 +61,9 @@ let package = Package(
|
|||
.Target(name: "RxTests")
|
||||
]
|
||||
)
|
||||
],
|
||||
exclude: [
|
||||
"Sources/RxCocoa",
|
||||
]
|
||||
)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@
|
|||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
|
@ -201,6 +202,7 @@
|
|||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,28 +16,29 @@ if Process.argc != 3 {
|
|||
let sourceFilesRoot = Process.arguments[1]
|
||||
let derivedData = Process.arguments[2]
|
||||
|
||||
let fileManager = NSFileManager()
|
||||
let fileManager = FileManager()
|
||||
|
||||
func escape(value: String) -> String {
|
||||
let escapedString = value.stringByReplacingOccurrencesOfString("\n", withString: "\\n")
|
||||
let escapedString1 = escapedString.stringByReplacingOccurrencesOfString("\r", withString: "\\r")
|
||||
let escapedString2 = escapedString1.stringByReplacingOccurrencesOfString("\"", withString: "\\\"")
|
||||
let escapedString = value.replacingOccurrences(of: "\n", with: "\\n")
|
||||
let escapedString1 = escapedString.replacingOccurrences(of: "\r", with: "\\r")
|
||||
let escapedString2 = escapedString1.replacingOccurrences(of: "\"", with: "\\\"")
|
||||
|
||||
return "\"\(escapedString2)\""
|
||||
}
|
||||
|
||||
func processFile(path: String, outputPath: String) -> String {
|
||||
let rawContent = NSData(contentsOfFile: path)!
|
||||
let content = NSString(data: rawContent, encoding: NSUTF8StringEncoding)! as String
|
||||
let url = URL(fileURLWithPath: path)
|
||||
let rawContent = try! Data(contentsOf: url)
|
||||
let content = String(data: rawContent, encoding: String.Encoding.utf8)
|
||||
|
||||
let components = content.componentsSeparatedByString("<%")
|
||||
guard let components = content?.components(separatedBy: "<%") else { return "" }
|
||||
|
||||
var functionContentComponents: [String] = []
|
||||
functionContentComponents.append("var components: [String] = [\"// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \\n\"]\n")
|
||||
functionContentComponents.append("components.append(\(escape(components[0])))\n")
|
||||
functionContentComponents.append("components.append(\(escape(value: components[0])))\n")
|
||||
|
||||
for codePlusSuffix in (components[1 ..< components.count]) {
|
||||
let codePlusSuffixSeparated = codePlusSuffix.componentsSeparatedByString("%>")
|
||||
let codePlusSuffixSeparated = codePlusSuffix.components(separatedBy: "%>")
|
||||
if codePlusSuffixSeparated.count != 2 {
|
||||
fatalError("Error in \(path) near \(codePlusSuffix)")
|
||||
}
|
||||
|
|
@ -46,24 +47,24 @@ func processFile(path: String, outputPath: String) -> String {
|
|||
let suffix = codePlusSuffixSeparated[1]
|
||||
|
||||
if code.hasPrefix("=") {
|
||||
functionContentComponents.append("components.append(String(\(code.substringFromIndex(code.startIndex.successor()))))\n")
|
||||
functionContentComponents.append("components.append(String(\(code.substring(from: code.index(after: code.startIndex)))))\n")
|
||||
}
|
||||
else {
|
||||
functionContentComponents.append("\(code)\n")
|
||||
}
|
||||
|
||||
functionContentComponents.append("components.append(\(escape(suffix)));\n")
|
||||
functionContentComponents.append("components.append(\(escape(value: suffix)));\n")
|
||||
}
|
||||
|
||||
functionContentComponents.append("try! components.joinWithSeparator(\"\").writeToFile(\"\(outputPath)\", atomically: false, encoding: NSUTF8StringEncoding)")
|
||||
functionContentComponents.append("try! components.joined(separator:\"\").write(toFile:\"\(outputPath)\", atomically: false, encoding: String.Encoding.utf8)")
|
||||
|
||||
return functionContentComponents.joinWithSeparator("")
|
||||
return functionContentComponents.joined(separator: "")
|
||||
}
|
||||
|
||||
func runCommand(path: String) {
|
||||
_ = NSProcessInfo().processIdentifier
|
||||
_ = ProcessInfo().processIdentifier
|
||||
|
||||
let task = NSTask()
|
||||
let task = Task()
|
||||
task.launchPath = "/bin/bash"
|
||||
task.arguments = ["-c", "xcrun swift \"\(path)\""]
|
||||
|
||||
|
|
@ -71,34 +72,34 @@ func runCommand(path: String) {
|
|||
|
||||
task.waitUntilExit()
|
||||
|
||||
if task.terminationReason != NSTaskTerminationReason.Exit {
|
||||
if task.terminationReason != Task.TerminationReason.exit {
|
||||
exit(-1)
|
||||
}
|
||||
}
|
||||
|
||||
let files = fileManager.subpathsAtPath(sourceFilesRoot)
|
||||
let files = try fileManager.subpathsOfDirectory(atPath: sourceFilesRoot)
|
||||
|
||||
var generateAllFiles = ["// Generated code\n", "import Foundation\n"]
|
||||
|
||||
for file in files! {
|
||||
for file in files {
|
||||
if ((file as NSString).pathExtension ?? "") != "tt" {
|
||||
continue
|
||||
}
|
||||
|
||||
print(file)
|
||||
|
||||
let path = (sourceFilesRoot as NSString).stringByAppendingPathComponent(file as String)
|
||||
let path = (sourceFilesRoot as NSString).appendingPathComponent(file as String)
|
||||
let endIndex = path.index(before: path.index(before: path.index(before: path.endIndex)))
|
||||
let outputPath = path.substring(to: endIndex) + ".swift"
|
||||
|
||||
let outputPath = path.substringToIndex(path.endIndex.predecessor().predecessor().predecessor()) + ".swift"
|
||||
|
||||
generateAllFiles.append("_ = { () -> Void in\n\(processFile(path, outputPath: outputPath))\n}()\n")
|
||||
generateAllFiles.append("_ = { () -> Void in\n\(processFile(path: path, outputPath: outputPath))\n}()\n")
|
||||
}
|
||||
|
||||
let script = generateAllFiles.joinWithSeparator("")
|
||||
let scriptPath = (derivedData as NSString).stringByAppendingPathComponent("_preprocessor.sh")
|
||||
let script = generateAllFiles.joined(separator: "")
|
||||
let scriptPath = (derivedData as NSString).appendingPathComponent("_preprocessor.sh")
|
||||
|
||||
do {
|
||||
try script.writeToFile(scriptPath, atomically: true, encoding: NSUTF8StringEncoding)
|
||||
try script.write(toFile: scriptPath, atomically: true, encoding: String.Encoding.utf8)
|
||||
} catch _ {
|
||||
}
|
||||
runCommand(scriptPath)
|
||||
runCommand(path: scriptPath)
|
||||
|
|
|
|||
53
README.md
53
README.md
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
[](https://travis-ci.org/ReactiveX/RxSwift)   [](https://github.com/Carthage/Carthage)
|
||||
|
||||
Xcode 7.3 Swift 2.2 required
|
||||
|
||||
## About Rx
|
||||
|
||||
**:warning: This readme describes RxSwift 3.0 version that requires Swift 3.0:warning:**
|
||||
|
||||
**:warning: If you are looking for Swift 2.3 compatible version, please take a look at RxSwift ~> 2.0 versions and [swift-2.3](https://github.com/ReactiveX/RxSwift/tree/rxswift-2.0) branch :warning:**
|
||||
|
||||
Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable<Element>` interface.
|
||||
|
||||
This is a Swift version of [Rx](https://github.com/Reactive-Extensions/Rx.NET).
|
||||
|
|
@ -33,6 +35,7 @@ KVO observing, async operations and streams are all unified under [abstraction o
|
|||
* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md)
|
||||
* [what does the the public API look like?](Documentation/API.md)
|
||||
|
||||
|
||||
###### ... install
|
||||
|
||||
* Integrate RxSwift/RxCocoa with my app. [Installation Guide](Documentation/Installation.md)
|
||||
|
|
@ -77,7 +80,7 @@ KVO observing, async operations and streams are all unified under [abstraction o
|
|||
</tr>
|
||||
<tr>
|
||||
<td><div class="highlight highlight-source-swift"><pre>
|
||||
let searchResults = searchBar.rx_text
|
||||
let searchResults = searchBar.rx.text
|
||||
.throttle(0.3, scheduler: MainScheduler.instance)
|
||||
.distinctUntilChanged()
|
||||
.flatMapLatest { query -> Observable<[Repository]> in
|
||||
|
|
@ -96,7 +99,7 @@ let searchResults = searchBar.rx_text
|
|||
<tr>
|
||||
<td width="30%"><div class="highlight highlight-source-swift"><pre>
|
||||
searchResults
|
||||
.bindTo(tableView.rx_itemsWithCellIdentifier("Cell")) {
|
||||
.bindTo(tableView.rx.items(cellIdentifier: "Cell")) {
|
||||
(index, repository: Repository, cell) in
|
||||
cell.textLabel?.text = repository.name
|
||||
cell.detailTextLabel?.text = repository.url
|
||||
|
|
@ -106,6 +109,16 @@ searchResults
|
|||
</table>
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
* Xcode 8.0 beta 6 (8S201h)
|
||||
* Swift 3.0
|
||||
|
||||
* iOS 8.0+
|
||||
* Mac OS X 10.10+
|
||||
* tvOS 9.0+
|
||||
* watchOS 2.0+
|
||||
|
||||
## Installation
|
||||
|
||||
Rx doesn't contain any external dependencies.
|
||||
|
|
@ -118,38 +131,36 @@ Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build ever
|
|||
|
||||
### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
|
||||
|
||||
**:warning: IMPORTANT! For tvOS support, CocoaPods `0.39` is required. :warning:**
|
||||
|
||||
```
|
||||
# Podfile
|
||||
use_frameworks!
|
||||
|
||||
target 'YOUR_TARGET_NAME' do
|
||||
pod 'RxSwift', '~> 2.0'
|
||||
pod 'RxCocoa', '~> 2.0'
|
||||
pod 'RxSwift', '~> 3.0.0.alpha.1'
|
||||
pod 'RxCocoa', '~> 3.0.0.alpha.1'
|
||||
end
|
||||
|
||||
# RxTests and RxBlocking make the most sense in the context of unit/integration tests
|
||||
target 'YOUR_TESTING_TARGET' do
|
||||
pod 'RxBlocking', '~> 2.0'
|
||||
pod 'RxTests', '~> 2.0'
|
||||
pod 'RxBlocking', '~> 3.0.0.alpha.1'
|
||||
pod 'RxTests', '~> 3.0.0.alpha.1'
|
||||
end
|
||||
```
|
||||
|
||||
Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:
|
||||
|
||||
**:warning: If you want to use CocoaPods with Xcode 8.0 beta and Swift 2.3, you might need to add the following
|
||||
**:warning: If you want to use CocoaPods with Xcode 8.0 beta and Swift 3.0, you might need to add the following
|
||||
lines to your podfile: :warning:**
|
||||
|
||||
```
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings['SWIFT_VERSION'] = '2.3'
|
||||
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.10'
|
||||
end
|
||||
end
|
||||
end
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings['SWIFT_VERSION'] = '3.0'
|
||||
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.10'
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
```
|
||||
|
|
@ -158,12 +169,10 @@ $ pod install
|
|||
|
||||
### [Carthage](https://github.com/Carthage/Carthage)
|
||||
|
||||
**Xcode 7.1 required**
|
||||
|
||||
Add this to `Cartfile`
|
||||
|
||||
```
|
||||
github "ReactiveX/RxSwift" ~> 2.0
|
||||
github "ReactiveX/RxSwift" "3.0.0.alpha.1"
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ example("startWith") {
|
|||
.startWith("1️⃣")
|
||||
.startWith("2️⃣")
|
||||
.startWith("3️⃣", "🅰️", "🅱️")
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -40,7 +40,7 @@ example("merge") {
|
|||
|
||||
Observable.of(subject1, subject2)
|
||||
.merge()
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
subject1.onNext("🅰️")
|
||||
|
|
@ -70,7 +70,7 @@ example("zip") {
|
|||
Observable.zip(stringSubject, intSubject) { stringElement, intElement in
|
||||
"\(stringElement) \(intElement)"
|
||||
}
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
stringSubject.onNext("🅰️")
|
||||
|
|
@ -98,7 +98,7 @@ example("combineLatest") {
|
|||
Observable.combineLatest(stringSubject, intSubject) { stringElement, intElement in
|
||||
"\(stringElement) \(intElement)"
|
||||
}
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
stringSubject.onNext("🅰️")
|
||||
|
|
@ -115,13 +115,13 @@ example("Array.combineLatest") {
|
|||
let disposeBag = DisposeBag()
|
||||
|
||||
let stringObservable = Observable.just("❤️")
|
||||
let fruitObservable = ["🍎", "🍐", "🍊"].toObservable()
|
||||
let fruitObservable = Observable.from(["🍎", "🍐", "🍊"])
|
||||
let animalObservable = Observable.of("🐶", "🐱", "🐭", "🐹")
|
||||
|
||||
[stringObservable, fruitObservable, animalObservable].combineLatest {
|
||||
"\($0[0]) \($0[1]) \($0[2])"
|
||||
}
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -141,7 +141,7 @@ example("switchLatest") {
|
|||
|
||||
variable.asObservable()
|
||||
.switchLatest()
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
subject1.onNext("🏈")
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ func sampleWithoutConnectableOperators() {
|
|||
let interval = Observable<Int>.interval(1, scheduler: MainScheduler.instance)
|
||||
|
||||
_ = interval
|
||||
.subscribeNext { print("Subscription: 1, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription: 1, Event: \($0)") })
|
||||
|
||||
delay(5) {
|
||||
_ = interval
|
||||
.subscribeNext { print("Subscription: 2, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription: 2, Event: \($0)") })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -47,18 +47,18 @@ func sampleWithPublish() {
|
|||
.publish()
|
||||
|
||||
_ = intSequence
|
||||
.subscribeNext { print("Subscription 1:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription 1:, Event: \($0)") })
|
||||
|
||||
delay(2) { intSequence.connect() }
|
||||
delay(2) { _ = intSequence.connect() }
|
||||
|
||||
delay(4) {
|
||||
_ = intSequence
|
||||
.subscribeNext { print("Subscription 2:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription 2:, Event: \($0)") })
|
||||
}
|
||||
|
||||
delay(6) {
|
||||
_ = intSequence
|
||||
.subscribeNext { print("Subscription 3:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription 3:, Event: \($0)") })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,18 +79,18 @@ func sampleWithReplayBuffer() {
|
|||
.replay(5)
|
||||
|
||||
_ = intSequence
|
||||
.subscribeNext { print("Subscription 1:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription 1:, Event: \($0)") })
|
||||
|
||||
delay(2) { intSequence.connect() }
|
||||
delay(2) { _ = intSequence.connect() }
|
||||
|
||||
delay(4) {
|
||||
_ = intSequence
|
||||
.subscribeNext { print("Subscription 2:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription 2:, Event: \($0)") })
|
||||
}
|
||||
|
||||
delay(8) {
|
||||
_ = intSequence
|
||||
.subscribeNext { print("Subscription 3:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("Subscription 3:, Event: \($0)") })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,24 +107,24 @@ func sampleWithMulticast() {
|
|||
let subject = PublishSubject<Int>()
|
||||
|
||||
_ = subject
|
||||
.subscribeNext { print("Subject: \($0)") }
|
||||
.subscribe(onNext: { print("Subject: \($0)") })
|
||||
|
||||
let intSequence = Observable<Int>.interval(1, scheduler: MainScheduler.instance)
|
||||
.multicast(subject)
|
||||
|
||||
_ = intSequence
|
||||
.subscribeNext { print("\tSubscription 1:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("\tSubscription 1:, Event: \($0)") })
|
||||
|
||||
delay(2) { intSequence.connect() }
|
||||
delay(2) { _ = intSequence.connect() }
|
||||
|
||||
delay(4) {
|
||||
_ = intSequence
|
||||
.subscribeNext { print("\tSubscription 2:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("\tSubscription 2:, Event: \($0)") })
|
||||
}
|
||||
|
||||
delay(6) {
|
||||
_ = intSequence
|
||||
.subscribeNext { print("\tSubscription 3:, Event: \($0)") }
|
||||
.subscribe(onNext: { print("\tSubscription 3:, Event: \($0)") })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,13 +63,13 @@ example("of") {
|
|||
let disposeBag = DisposeBag()
|
||||
|
||||
Observable.of("🐶", "🐱", "🐭", "🐹")
|
||||
.subscribeNext { element in
|
||||
.subscribe(onNext: { element in
|
||||
print(element)
|
||||
}
|
||||
})
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
> This example also introduces using the `subscribeNext(_:)` convenience method. Unlike `subscribe(_:)`, which subscribes an _event_ handler for all event types (Next, Error, and Completed), `subscribeNext(_:)` subscribes an _element_ handler that will ignore Error and Completed events and only produce Next event elements. There are also `subscribeError(_:)` and `subscribeCompleted(_:)` convenience methods, should you only want to subscribe to those event types. And there is a `subscribe(onNext:onError:onCompleted:onDisposed:)` method, which allows you to react to one or more event types and when the subscription is terminated for any reason, or disposed, in a single call:
|
||||
> This example also introduces using the `subscribe(onNext:)` convenience method. Unlike `subscribe(_:)`, which subscribes an _event_ handler for all event types (Next, Error, and Completed), `subscribe(onNext:)` subscribes an _element_ handler that will ignore Error and Completed events and only produce Next event elements. There are also `subscribe(onError:)` and `subscribe(onCompleted:)` convenience methods, should you only want to subscribe to those event types. And there is a `subscribe(onNext:onError:onCompleted:onDisposed:)` method, which allows you to react to one or more event types and when the subscription is terminated for any reason, or disposed, in a single call:
|
||||
```
|
||||
someObservable.subscribe(
|
||||
onNext: { print("Element:", $0) },
|
||||
|
|
@ -79,14 +79,14 @@ example("of") {
|
|||
)
|
||||
```
|
||||
----
|
||||
## toObservable
|
||||
## from
|
||||
Creates an `Observable` sequence from a `SequenceType`, such as an `Array`, `Dictionary`, or `Set`.
|
||||
*/
|
||||
example("toObservable") {
|
||||
example("from") {
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
["🐶", "🐱", "🐭", "🐹"].toObservable()
|
||||
.subscribeNext { print($0) }
|
||||
Observable.from(["🐶", "🐱", "🐭", "🐹"])
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -100,9 +100,9 @@ example("create") {
|
|||
|
||||
let myJust = { (element: String) -> Observable<String> in
|
||||
return Observable.create { observer in
|
||||
observer.on(.Next(element))
|
||||
observer.on(.Completed)
|
||||
return NopDisposable.instance
|
||||
observer.on(.next(element))
|
||||
observer.on(.completed)
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ example("repeatElement") {
|
|||
|
||||
Observable.repeatElement("🔴")
|
||||
.take(3)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -149,7 +149,7 @@ example("generate") {
|
|||
condition: { $0 < 3 },
|
||||
iterate: { $0 + 1 }
|
||||
)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -170,16 +170,16 @@ example("deferred") {
|
|||
observer.onNext("🐶")
|
||||
observer.onNext("🐱")
|
||||
observer.onNext("🐵")
|
||||
return NopDisposable.instance
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
deferredSequence
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
deferredSequence
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -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)
|
||||
}
|
||||
|
|
@ -203,8 +203,8 @@ example("doOn") {
|
|||
let disposeBag = DisposeBag()
|
||||
|
||||
Observable.of("🍎", "🍐", "🍊", "🍋")
|
||||
.doOn { print("Intercepted:", $0) }
|
||||
.subscribeNext { print($0) }
|
||||
.do(onNext: { print("Intercepted:", $0) }, onError: { print("Intercepted error:", $0) }, onCompleted: { print("Completed") })
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
//: > There are also `doOnNext(_:)`, `doOnError(_:)`, and `doOnCompleted(_:)` convenience methods to intercept those specific events, and `doOn(onNext:onError:onCompleted:)` to intercept one or more events in a single call.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ example("debug") {
|
|||
observer.onNext("🍊")
|
||||
|
||||
if count < 5 {
|
||||
observer.onError(Error.Test)
|
||||
observer.onError(TestError.test)
|
||||
print("Error encountered")
|
||||
count += 1
|
||||
}
|
||||
|
|
@ -34,13 +34,13 @@ example("debug") {
|
|||
observer.onNext("🐭")
|
||||
observer.onCompleted()
|
||||
|
||||
return NopDisposable.instance
|
||||
return Disposables.create()
|
||||
}
|
||||
|
||||
sequenceThatErrors
|
||||
.retry(3)
|
||||
.debug()
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -59,11 +59,11 @@ example("RxSwift.resourceCount") {
|
|||
|
||||
let variable = Variable("🍎")
|
||||
|
||||
let subscription1 = variable.asObservable().subscribeNext { print($0) }
|
||||
let subscription1 = variable.asObservable().subscribe(onNext: { print($0) })
|
||||
|
||||
print(RxSwift.resourceCount)
|
||||
|
||||
let subscription2 = variable.asObservable().subscribeNext { print($0) }
|
||||
let subscription2 = variable.asObservable().subscribe(onNext: { print($0) })
|
||||
|
||||
print(RxSwift.resourceCount)
|
||||
|
||||
|
|
@ -80,4 +80,4 @@ print(RxSwift.resourceCount)
|
|||
#endif
|
||||
//: > `RxSwift.resourceCount` is not enabled by default, and should generally not be enabled in Release builds. [Click here](Enable_RxSwift.resourceCount) for instructions on how to enable it.
|
||||
|
||||
//: [Table of Contents](Table_of_Contents)
|
||||
//: [Next](@next) - [Table of Contents](Table_of_Contents)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -85,12 +85,12 @@ example("retry") {
|
|||
observer.onNext("🐭")
|
||||
observer.onCompleted()
|
||||
|
||||
return NopDisposable.instance
|
||||
return Disposables.create()
|
||||
}
|
||||
|
||||
sequenceThatErrors
|
||||
.retry()
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -119,12 +119,12 @@ example("retry maxAttemptCount") {
|
|||
observer.onNext("🐭")
|
||||
observer.onCompleted()
|
||||
|
||||
return NopDisposable.instance
|
||||
return Disposables.create()
|
||||
}
|
||||
|
||||
sequenceThatErrors
|
||||
.retry(3)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ example("filter") {
|
|||
.filter {
|
||||
$0 == "🐱"
|
||||
}
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -39,7 +39,7 @@ example("distinctUntilChanged") {
|
|||
|
||||
Observable.of("🐱", "🐷", "🐱", "🐱", "🐱", "🐵", "🐱")
|
||||
.distinctUntilChanged()
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -53,7 +53,7 @@ example("elementAt") {
|
|||
|
||||
Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵")
|
||||
.elementAt(3)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -66,7 +66,7 @@ example("single") {
|
|||
|
||||
Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵")
|
||||
.single()
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ example("take") {
|
|||
|
||||
Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵")
|
||||
.take(3)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -113,7 +113,7 @@ example("takeLast") {
|
|||
|
||||
Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵")
|
||||
.takeLast(3)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -127,7 +127,7 @@ example("takeWhile") {
|
|||
|
||||
Observable.of(1, 2, 3, 4, 5, 6)
|
||||
.takeWhile { $0 < 4 }
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -168,7 +168,7 @@ example("skip") {
|
|||
|
||||
Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵")
|
||||
.skip(2)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -182,7 +182,7 @@ example("skipWhile") {
|
|||
|
||||
Observable.of(1, 2, 3, 4, 5, 6)
|
||||
.skipWhile { $0 < 4 }
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -197,7 +197,7 @@ example("skipWhileWithIndex") {
|
|||
.skipWhileWithIndex { element, index in
|
||||
index < 3
|
||||
}
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -214,7 +214,7 @@ example("skipUntil") {
|
|||
|
||||
sourceSequence
|
||||
.skipUntil(referenceSequence)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
sourceSequence.onNext("🐱")
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
----
|
||||
[Previous](@previous)
|
||||
*/
|
||||
|
||||
import RxSwift
|
||||
|
||||
/*:
|
||||
# Introduction
|
||||
|
||||
|
|
@ -30,11 +32,11 @@ All of these various systems makes our code needlessly complex. Wouldn't it be b
|
|||
* `ObservableType.subscribe(_:)` takes an observer (`ObserverType`) parameter, which will be subscribed to automatically receive sequence events and elements emitted by the `Observable`, instead of manually calling `next()` on the returned generator.
|
||||
*/
|
||||
/*:
|
||||
If an `Observable` emits a Next event (`Event.Next(Element)`), it can continue to emit more events. However, if the `Observable` emits either an Error event (`Event.Error(ErrorType)`) or a Completed event (`Event.Completed`), the `Observable` sequence cannot emit additional events to the subscriber.
|
||||
If an `Observable` emits a next event (`Event.next(Element)`), it can continue to emit more events. However, if the `Observable` emits either an error event (`Event.error(ErrorType)`) or a completed event (`Event.completed`), the `Observable` sequence cannot emit additional events to the subscriber.
|
||||
|
||||
Sequence grammar explains this more concisely:
|
||||
|
||||
`Next* (Error | Completed)?`
|
||||
`next* (error | completed)?`
|
||||
|
||||
And this can also be explained more visually using diagrams:
|
||||
|
||||
|
|
@ -54,9 +56,9 @@ All of these various systems makes our code needlessly complex. Wouldn't it be b
|
|||
example("Observable with no subscribers") {
|
||||
_ = Observable<String>.create { observerOfString -> Disposable in
|
||||
print("This will never be printed")
|
||||
observerOfString.on(.Next("😬"))
|
||||
observerOfString.on(.Completed)
|
||||
return NopDisposable.instance
|
||||
observerOfString.on(.next("😬"))
|
||||
observerOfString.on(.completed)
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
/*:
|
||||
|
|
@ -64,11 +66,11 @@ example("Observable with no subscribers") {
|
|||
In the following example, the closure will be executed when `subscribe(_:)` is called:
|
||||
*/
|
||||
example("Observable with subscriber") {
|
||||
_ = Observable<String>.create { observerOfString in
|
||||
_ = Observable<String>.create { observerOfString in
|
||||
print("Observable created")
|
||||
observerOfString.on(.Next("😉"))
|
||||
observerOfString.on(.Completed)
|
||||
return NopDisposable.instance
|
||||
observerOfString.on(.next("😉"))
|
||||
observerOfString.on(.completed)
|
||||
return Disposables.create()
|
||||
}
|
||||
.subscribe { event in
|
||||
print(event)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ example("reduce") {
|
|||
|
||||
Observable.of(10, 100, 1000)
|
||||
.reduce(1, accumulator: +)
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ example("map") {
|
|||
let disposeBag = DisposeBag()
|
||||
Observable.of(1, 2, 3)
|
||||
.map { $0 * $0 }
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
/*:
|
||||
|
|
@ -42,7 +42,7 @@ example("flatMap and flatMapLatest") {
|
|||
|
||||
player.asObservable()
|
||||
.flatMap { $0.score.asObservable() } // Change flatMap to flatMapLatest and observe change in printed output
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
👦🏻.score.value = 85
|
||||
|
|
@ -71,7 +71,7 @@ example("scan") {
|
|||
.scan(1) { aggregateValue, newValue in
|
||||
aggregateValue + newValue
|
||||
}
|
||||
.subscribeNext { print($0) }
|
||||
.subscribe(onNext: { print($0) })
|
||||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) }
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ example("PublishSubject") {
|
|||
subject.onNext("🅱️")
|
||||
}
|
||||
/*:
|
||||
> This example also introduces using the `onNext(_:)` convenience method, equivalent to `on(.Next(_:)`, which causes a new Next event to be emitted to subscribers with the provided `element`. There are also `onError(_:)` and `onCompleted()` convenience methods, equivalent to `on(.Error(_:))` and `on(.Completed)`, respectively.
|
||||
> This example also introduces using the `onNext(_:)` convenience method, equivalent to `on(.next(_:)`, which causes a new Next event to be emitted to subscribers with the provided `element`. There are also `onError(_:)` and `onCompleted()` convenience methods, equivalent to `on(.error(_:))` and `on(.completed)`, respectively.
|
||||
----
|
||||
## ReplaySubject
|
||||
Broadcasts new events to all subscribers, and the specified `bufferSize` number of previous events to new subscribers.
|
||||
|
|
|
|||
|
|
@ -5,32 +5,31 @@ import Foundation
|
|||
- parameter description: example description
|
||||
- parameter action: `Void` closure
|
||||
*/
|
||||
public func example(description: String, @noescape action: Void -> Void) {
|
||||
public func example(_ description: String, action: (Void) -> Void) {
|
||||
printExampleHeader(description)
|
||||
action()
|
||||
}
|
||||
|
||||
public func printExampleHeader(description: String) {
|
||||
public func printExampleHeader(_ description: String) {
|
||||
print("\n--- \(description) example ---")
|
||||
}
|
||||
|
||||
public enum Error: ErrorType {
|
||||
case Test
|
||||
public enum TestError: Swift.Error {
|
||||
case test
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Executes `closure` on main thread after `delay` seconds.
|
||||
- parameter delay: time in seconds to wait before executing `closure`
|
||||
- parameter closure: `Void` closure
|
||||
*/
|
||||
public func delay(delay: Double, closure: Void -> Void) {
|
||||
dispatch_after(
|
||||
dispatch_time(
|
||||
DISPATCH_TIME_NOW,
|
||||
Int64(delay * Double(NSEC_PER_SEC))
|
||||
),
|
||||
dispatch_get_main_queue(),
|
||||
closure)
|
||||
public func delay(_ delay: Double, closure: @escaping (Void) -> Void) {
|
||||
|
||||
let delayTime = DispatchTime.now() + DispatchTimeInterval.seconds(Int(delay))
|
||||
DispatchQueue.main.asyncAfter(deadline: delayTime) {
|
||||
closure()
|
||||
}
|
||||
}
|
||||
|
||||
#if NOT_IN_PLAYGROUND
|
||||
|
|
@ -39,10 +38,10 @@ public func delay(delay: Double, closure: Void -> Void) {
|
|||
|
||||
#else
|
||||
|
||||
import XCPlayground
|
||||
import PlaygroundSupport
|
||||
|
||||
public func playgroundShouldContinueIndefinitely() {
|
||||
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
|
||||
PlaygroundPage.current.needsIndefiniteExecution = true
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
[
|
||||
{
|
||||
"file": "/Users/mo/Documents/OpenSource/RxSwift/Rx.playground/Sources/SupportCode.swift",
|
||||
"offset": 276,
|
||||
"remove": 9,
|
||||
},
|
||||
{
|
||||
"file": "/Users/mo/Documents/OpenSource/RxSwift/Rx.playground/Sources/SupportCode.swift",
|
||||
"offset": 733,
|
||||
"text": "@escaping ",
|
||||
}
|
||||
]
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='6.0' target-platform='osx' display-mode='rendered'>
|
||||
<playground version='6.0' target-platform='osx' display-mode='raw' last-migration='0800'>
|
||||
<pages>
|
||||
<page name='Table_of_Contents'/>
|
||||
<page name='Introduction'/>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@
|
|||
84E4D3931C9AFD3500ADFDC9 /* UISearchController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E4D3901C9AFCD500ADFDC9 /* UISearchController+Rx.swift */; };
|
||||
84E4D3941C9AFD3600ADFDC9 /* UISearchController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E4D3901C9AFCD500ADFDC9 /* UISearchController+Rx.swift */; };
|
||||
84E4D3961C9B011000ADFDC9 /* UISearchController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E4D3951C9B011000ADFDC9 /* UISearchController+RxTests.swift */; };
|
||||
87379AE01D61C6F50047CA88 /* Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2F461001CD7ABE400527B4D /* Reactive.swift */; };
|
||||
88718CFE1CE5D80000D88D60 /* UITabBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88718CFD1CE5D80000D88D60 /* UITabBar+Rx.swift */; };
|
||||
88718CFF1CE5D80000D88D60 /* UITabBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88718CFD1CE5D80000D88D60 /* UITabBar+Rx.swift */; };
|
||||
88718D011CE5DE2600D88D60 /* UITabBar+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88718D001CE5DE2500D88D60 /* UITabBar+RxTests.swift */; };
|
||||
|
|
@ -121,8 +122,6 @@
|
|||
C8093CDE1B8A72BE0088E94D /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C581B8A72BE0088E94D /* DisposeBag.swift */; };
|
||||
C8093CDF1B8A72BE0088E94D /* DisposeBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C591B8A72BE0088E94D /* DisposeBase.swift */; };
|
||||
C8093CE01B8A72BE0088E94D /* DisposeBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C591B8A72BE0088E94D /* DisposeBase.swift */; };
|
||||
C8093CE11B8A72BE0088E94D /* NAryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5A1B8A72BE0088E94D /* NAryDisposable.swift */; };
|
||||
C8093CE21B8A72BE0088E94D /* NAryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5A1B8A72BE0088E94D /* NAryDisposable.swift */; };
|
||||
C8093CE51B8A72BE0088E94D /* NopDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */; };
|
||||
C8093CE61B8A72BE0088E94D /* NopDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */; };
|
||||
C8093CE71B8A72BE0088E94D /* ScheduledDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5D1B8A72BE0088E94D /* ScheduledDisposable.swift */; };
|
||||
|
|
@ -139,8 +138,8 @@
|
|||
C8093CF61B8A72BE0088E94D /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C641B8A72BE0088E94D /* Event.swift */; };
|
||||
C8093CF71B8A72BE0088E94D /* ImmediateSchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */; };
|
||||
C8093CF81B8A72BE0088E94D /* ImmediateSchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */; };
|
||||
C8093CFB1B8A72BE0088E94D /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* Observable+Extensions.swift */; };
|
||||
C8093CFC1B8A72BE0088E94D /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* Observable+Extensions.swift */; };
|
||||
C8093CFB1B8A72BE0088E94D /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */; };
|
||||
C8093CFC1B8A72BE0088E94D /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */; };
|
||||
C8093CFD1B8A72BE0088E94D /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C681B8A72BE0088E94D /* Observable.swift */; };
|
||||
C8093CFE1B8A72BE0088E94D /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C681B8A72BE0088E94D /* Observable.swift */; };
|
||||
C8093CFF1B8A72BE0088E94D /* Amb.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C6B1B8A72BE0088E94D /* Amb.swift */; };
|
||||
|
|
@ -352,6 +351,10 @@
|
|||
C80DDEB21BCE8CA3006A1832 /* Driver+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80DDEB01BCE8CA3006A1832 /* Driver+Operators+arity.swift */; };
|
||||
C80DDEB31BCE8CA3006A1832 /* Driver+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80DDEB01BCE8CA3006A1832 /* Driver+Operators+arity.swift */; };
|
||||
C80DDEB41BCE8CA3006A1832 /* Driver+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80DDEB01BCE8CA3006A1832 /* Driver+Operators+arity.swift */; };
|
||||
C80EEC341D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */; };
|
||||
C80EEC351D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */; };
|
||||
C80EEC361D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */; };
|
||||
C80EEC371D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */; };
|
||||
C811C89D1C24D80100A2DDD4 /* DeallocObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C811C89C1C24D80100A2DDD4 /* DeallocObservable.swift */; };
|
||||
C811C89E1C24D80100A2DDD4 /* DeallocObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C811C89C1C24D80100A2DDD4 /* DeallocObservable.swift */; };
|
||||
C811C89F1C24D80100A2DDD4 /* DeallocObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C811C89C1C24D80100A2DDD4 /* DeallocObservable.swift */; };
|
||||
|
|
@ -630,6 +633,9 @@
|
|||
C86409FD1BA593F500D3C4E8 /* Range.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86409FB1BA593F500D3C4E8 /* Range.swift */; };
|
||||
C8640A031BA5B12A00D3C4E8 /* Repeat.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8640A021BA5B12A00D3C4E8 /* Repeat.swift */; };
|
||||
C8640A041BA5B12A00D3C4E8 /* Repeat.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8640A021BA5B12A00D3C4E8 /* Repeat.swift */; };
|
||||
C86B1E221D42BF5200130546 /* SchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86B1E211D42BF5200130546 /* SchedulerTests.swift */; };
|
||||
C86B1E231D42BF5200130546 /* SchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86B1E211D42BF5200130546 /* SchedulerTests.swift */; };
|
||||
C86B1E241D42BF5200130546 /* SchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86B1E211D42BF5200130546 /* SchedulerTests.swift */; };
|
||||
C88254161B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F11B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift */; };
|
||||
C88254171B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F21B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift */; };
|
||||
C88254181B8A752B00B02D69 /* ItemEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F41B8A752B00B02D69 /* ItemEvents.swift */; };
|
||||
|
|
@ -662,10 +668,10 @@
|
|||
C88E296C1BEB712E001CCB92 /* RunLoopLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88E296A1BEB712E001CCB92 /* RunLoopLock.swift */; };
|
||||
C88E296D1BEB712E001CCB92 /* RunLoopLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88E296A1BEB712E001CCB92 /* RunLoopLock.swift */; };
|
||||
C88E296E1BEB712E001CCB92 /* RunLoopLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88E296A1BEB712E001CCB92 /* RunLoopLock.swift */; };
|
||||
C88F76811CE5341700D5A014 /* RxTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* RxTextInput.swift */; };
|
||||
C88F76821CE5341700D5A014 /* RxTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* RxTextInput.swift */; };
|
||||
C88F76831CE5341700D5A014 /* RxTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* RxTextInput.swift */; };
|
||||
C88F76841CE5341700D5A014 /* RxTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* RxTextInput.swift */; };
|
||||
C88F76811CE5341700D5A014 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* TextInput.swift */; };
|
||||
C88F76821CE5341700D5A014 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* TextInput.swift */; };
|
||||
C88F76831CE5341700D5A014 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* TextInput.swift */; };
|
||||
C88F76841CE5341700D5A014 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* TextInput.swift */; };
|
||||
C8941BDF1BD5695C00A0E874 /* BlockingObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8941BDE1BD5695C00A0E874 /* BlockingObservable.swift */; };
|
||||
C8941BE01BD5695C00A0E874 /* BlockingObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8941BDE1BD5695C00A0E874 /* BlockingObservable.swift */; };
|
||||
C8941BE11BD5695C00A0E874 /* BlockingObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8941BDE1BD5695C00A0E874 /* BlockingObservable.swift */; };
|
||||
|
|
@ -803,6 +809,9 @@
|
|||
C8E7B36A1C30C6B800B34368 /* TestableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E7B3681C30C6B800B34368 /* TestableObservable.swift */; };
|
||||
C8E7B36B1C30C6B800B34368 /* TestableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E7B3681C30C6B800B34368 /* TestableObservable.swift */; };
|
||||
C8E7B36C1C30C6B800B34368 /* TestableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E7B3681C30C6B800B34368 /* TestableObservable.swift */; };
|
||||
C8E9E42B1D43B26C0049644E /* Observable+DebugTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E9E42A1D43B26C0049644E /* Observable+DebugTest.swift */; };
|
||||
C8E9E42C1D43B26C0049644E /* Observable+DebugTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E9E42A1D43B26C0049644E /* Observable+DebugTest.swift */; };
|
||||
C8E9E42D1D43B26C0049644E /* Observable+DebugTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E9E42A1D43B26C0049644E /* Observable+DebugTest.swift */; };
|
||||
C8F0BF921BBBFB8B001B112F /* Observable+Creation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C981B8A72BE0088E94D /* Observable+Creation.swift */; };
|
||||
C8F0BF931BBBFB8B001B112F /* ConnectableObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C4D1B8A72BE0088E94D /* ConnectableObservableType.swift */; };
|
||||
C8F0BF941BBBFB8B001B112F /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C3DA021B9390C4004D233E /* Just.swift */; };
|
||||
|
|
@ -826,7 +835,7 @@
|
|||
C8F0BFA61BBBFB8B001B112F /* ReplaySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CC01B8A72BE0088E94D /* ReplaySubject.swift */; };
|
||||
C8F0BFA71BBBFB8B001B112F /* Zip+CollectionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C3D9FD1B935EDF004D233E /* Zip+CollectionType.swift */; };
|
||||
C8F0BFA81BBBFB8B001B112F /* Observable+Time.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C9D1B8A72BE0088E94D /* Observable+Time.swift */; };
|
||||
C8F0BFA91BBBFB8B001B112F /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* Observable+Extensions.swift */; };
|
||||
C8F0BFA91BBBFB8B001B112F /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */; };
|
||||
C8F0BFAA1BBBFB8B001B112F /* Throttle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C901B8A72BE0088E94D /* Throttle.swift */; };
|
||||
C8F0BFAC1BBBFB8B001B112F /* Catch.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C6E1B8A72BE0088E94D /* Catch.swift */; };
|
||||
C8F0BFAD1BBBFB8B001B112F /* CombineLatest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C711B8A72BE0088E94D /* CombineLatest.swift */; };
|
||||
|
|
@ -897,7 +906,6 @@
|
|||
C8F0BFF21BBBFB8B001B112F /* ObserverType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CAB1B8A72BE0088E94D /* ObserverType.swift */; };
|
||||
C8F0BFF31BBBFB8B001B112F /* SubscribeOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C8B1B8A72BE0088E94D /* SubscribeOn.swift */; };
|
||||
C8F0BFF41BBBFB8B001B112F /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C681B8A72BE0088E94D /* Observable.swift */; };
|
||||
C8F0BFF51BBBFB8B001B112F /* NAryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5A1B8A72BE0088E94D /* NAryDisposable.swift */; };
|
||||
C8F0BFF61BBBFB8B001B112F /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5F1B8A72BE0088E94D /* SerialDisposable.swift */; };
|
||||
C8F0BFF71BBBFB8B001B112F /* Never.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C3DA0B1B93959F004D233E /* Never.swift */; };
|
||||
C8F0BFF91BBBFB8B001B112F /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C641B8A72BE0088E94D /* Event.swift */; };
|
||||
|
|
@ -1008,6 +1016,10 @@
|
|||
CBEE77201BD649A000AD584C /* ToArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEE771E1BD649A000AD584C /* ToArray.swift */; };
|
||||
CBEE77211BD649A000AD584C /* ToArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEE771E1BD649A000AD584C /* ToArray.swift */; };
|
||||
CBEE77221BD649A000AD584C /* ToArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEE771E1BD649A000AD584C /* ToArray.swift */; };
|
||||
CDDEF16A1D4FB40000CA8546 /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDEF1691D4FB40000CA8546 /* Disposables.swift */; };
|
||||
CDDEF16B1D4FB40000CA8546 /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDEF1691D4FB40000CA8546 /* Disposables.swift */; };
|
||||
CDDEF16C1D4FB40000CA8546 /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDEF1691D4FB40000CA8546 /* Disposables.swift */; };
|
||||
CDDEF16D1D4FB40000CA8546 /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDEF1691D4FB40000CA8546 /* Disposables.swift */; };
|
||||
D203C4F31BB9C4CA00D02D00 /* RxCollectionViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F11B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift */; };
|
||||
D203C4F41BB9C52400D02D00 /* RxTableViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F21B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift */; };
|
||||
D203C4F51BB9C52900D02D00 /* ItemEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F41B8A752B00B02D69 /* ItemEvents.swift */; };
|
||||
|
|
@ -1079,7 +1091,7 @@
|
|||
D2EBEAE01BB9B697003A27DC /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C641B8A72BE0088E94D /* Event.swift */; };
|
||||
D2EBEAE11BB9B697003A27DC /* ImmediateSchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */; };
|
||||
D2EBEAE21BB9B697003A27DC /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C681B8A72BE0088E94D /* Observable.swift */; };
|
||||
D2EBEAE31BB9B697003A27DC /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* Observable+Extensions.swift */; };
|
||||
D2EBEAE31BB9B697003A27DC /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */; };
|
||||
D2EBEAE41BB9B697003A27DC /* ObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C9E1B8A72BE0088E94D /* ObservableType.swift */; };
|
||||
D2EBEAE51BB9B697003A27DC /* AnyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CA01B8A72BE0088E94D /* AnyObserver.swift */; };
|
||||
D2EBEAE61BB9B697003A27DC /* ObserverType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CAB1B8A72BE0088E94D /* ObserverType.swift */; };
|
||||
|
|
@ -1096,7 +1108,6 @@
|
|||
D2EBEAF21BB9B6AE003A27DC /* CompositeDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C571B8A72BE0088E94D /* CompositeDisposable.swift */; };
|
||||
D2EBEAF31BB9B6AE003A27DC /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C581B8A72BE0088E94D /* DisposeBag.swift */; };
|
||||
D2EBEAF41BB9B6AE003A27DC /* DisposeBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C591B8A72BE0088E94D /* DisposeBase.swift */; };
|
||||
D2EBEAF51BB9B6AE003A27DC /* NAryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5A1B8A72BE0088E94D /* NAryDisposable.swift */; };
|
||||
D2EBEAF61BB9B6B2003A27DC /* NopDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */; };
|
||||
D2EBEAF71BB9B6B2003A27DC /* ScheduledDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5D1B8A72BE0088E94D /* ScheduledDisposable.swift */; };
|
||||
D2EBEAF91BB9B6B2003A27DC /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5F1B8A72BE0088E94D /* SerialDisposable.swift */; };
|
||||
|
|
@ -1405,9 +1416,9 @@
|
|||
84C225A21C33F00B008724EC /* RxTextStorageDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTextStorageDelegateProxy.swift; sourceTree = "<group>"; };
|
||||
84E4D3901C9AFCD500ADFDC9 /* UISearchController+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISearchController+Rx.swift"; sourceTree = "<group>"; };
|
||||
84E4D3951C9B011000ADFDC9 /* UISearchController+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISearchController+RxTests.swift"; sourceTree = "<group>"; };
|
||||
88718CFD1CE5D80000D88D60 /* UITabBar+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBar+Rx.swift"; sourceTree = "<group>"; };
|
||||
88718CFD1CE5D80000D88D60 /* UITabBar+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UITabBar+Rx.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
88718D001CE5DE2500D88D60 /* UITabBar+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBar+RxTests.swift"; sourceTree = "<group>"; };
|
||||
88D98F2D1CE7549A00D50457 /* RxTabBarDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTabBarDelegateProxy.swift; sourceTree = "<group>"; };
|
||||
88D98F2D1CE7549A00D50457 /* RxTabBarDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxTabBarDelegateProxy.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
914FCD661CCDB82E0058B304 /* UIPageControl+RxTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIPageControl+RxTest.swift"; sourceTree = "<group>"; };
|
||||
91BE429B1CBF7EC000F6B062 /* UIPageControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIPageControl+Rx.swift"; sourceTree = "<group>"; };
|
||||
9BA1CBD11C0F7C0A0044B50A /* UIActivityIndicatorView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIActivityIndicatorView+Rx.swift"; sourceTree = "<group>"; };
|
||||
|
|
@ -1433,8 +1444,6 @@
|
|||
C8093C571B8A72BE0088E94D /* CompositeDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompositeDisposable.swift; sourceTree = "<group>"; };
|
||||
C8093C581B8A72BE0088E94D /* DisposeBag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisposeBag.swift; sourceTree = "<group>"; };
|
||||
C8093C591B8A72BE0088E94D /* DisposeBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisposeBase.swift; sourceTree = "<group>"; };
|
||||
C8093C5A1B8A72BE0088E94D /* NAryDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NAryDisposable.swift; sourceTree = "<group>"; };
|
||||
C8093C5B1B8A72BE0088E94D /* NAryDisposable.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NAryDisposable.tt; sourceTree = "<group>"; };
|
||||
C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NopDisposable.swift; sourceTree = "<group>"; };
|
||||
C8093C5D1B8A72BE0088E94D /* ScheduledDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduledDisposable.swift; sourceTree = "<group>"; };
|
||||
C8093C5F1B8A72BE0088E94D /* SerialDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SerialDisposable.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1444,7 +1453,7 @@
|
|||
C8093C641B8A72BE0088E94D /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = "<group>"; };
|
||||
C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateSchedulerType.swift; sourceTree = "<group>"; };
|
||||
C8093C661B8A72BE0088E94D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
C8093C671B8A72BE0088E94D /* Observable+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Extensions.swift"; sourceTree = "<group>"; };
|
||||
C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "ObservableType+Extensions.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C8093C681B8A72BE0088E94D /* Observable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = "<group>"; };
|
||||
C8093C6B1B8A72BE0088E94D /* Amb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Amb.swift; sourceTree = "<group>"; };
|
||||
C8093C6E1B8A72BE0088E94D /* Catch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Catch.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1452,7 +1461,7 @@
|
|||
C8093C701B8A72BE0088E94D /* CombineLatest+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "CombineLatest+arity.tt"; sourceTree = "<group>"; };
|
||||
C8093C711B8A72BE0088E94D /* CombineLatest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombineLatest.swift; sourceTree = "<group>"; };
|
||||
C8093C721B8A72BE0088E94D /* Concat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Concat.swift; sourceTree = "<group>"; };
|
||||
C8093C741B8A72BE0088E94D /* ConnectableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectableObservable.swift; sourceTree = "<group>"; };
|
||||
C8093C741B8A72BE0088E94D /* ConnectableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConnectableObservable.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C8093C751B8A72BE0088E94D /* Debug.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debug.swift; sourceTree = "<group>"; };
|
||||
C8093C761B8A72BE0088E94D /* Deferred.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deferred.swift; sourceTree = "<group>"; };
|
||||
C8093C771B8A72BE0088E94D /* DelaySubscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelaySubscription.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1500,7 +1509,7 @@
|
|||
C8093CAF1B8A72BE0088E94D /* Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Rx.swift; sourceTree = "<group>"; };
|
||||
C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxMutableBox.swift; sourceTree = "<group>"; };
|
||||
C8093CB31B8A72BE0088E94D /* SchedulerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulerType.swift; sourceTree = "<group>"; };
|
||||
C8093CB51B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConcurrentDispatchQueueScheduler.swift; sourceTree = "<group>"; };
|
||||
C8093CB51B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConcurrentDispatchQueueScheduler.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C8093CB71B8A72BE0088E94D /* MainScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainScheduler.swift; sourceTree = "<group>"; };
|
||||
C8093CB81B8A72BE0088E94D /* OperationQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationQueueScheduler.swift; sourceTree = "<group>"; };
|
||||
C8093CB91B8A72BE0088E94D /* RecursiveScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecursiveScheduler.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1518,7 +1527,7 @@
|
|||
C8093E861B8A732E0088E94D /* _RXKVOObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RXKVOObserver.h; sourceTree = "<group>"; };
|
||||
C8093E871B8A732E0088E94D /* _RXKVOObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RXKVOObserver.m; sourceTree = "<group>"; };
|
||||
C8093E8A1B8A732E0088E94D /* CLLocationManager+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CLLocationManager+Rx.swift"; sourceTree = "<group>"; };
|
||||
C8093E8B1B8A732E0088E94D /* DelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateProxy.swift; sourceTree = "<group>"; };
|
||||
C8093E8B1B8A732E0088E94D /* DelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DelegateProxy.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C8093E8C1B8A732E0088E94D /* DelegateProxyType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateProxyType.swift; sourceTree = "<group>"; };
|
||||
C8093E8D1B8A732E0088E94D /* Logging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logging.swift; sourceTree = "<group>"; };
|
||||
C8093E901B8A732E0088E94D /* ControlTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlTarget.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1539,7 +1548,7 @@
|
|||
C8093ECB1B8A732E0088E94D /* RxCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RxCocoa.h; sourceTree = "<group>"; };
|
||||
C8093F581B8A73A20088E94D /* ObservableConvertibleType+Blocking.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+Blocking.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C8093F591B8A73A20088E94D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
C80D338E1B91EF9E0014629D /* Observable+Bind.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Bind.swift"; sourceTree = "<group>"; };
|
||||
C80D338E1B91EF9E0014629D /* Observable+Bind.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "Observable+Bind.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C80D33931B922FB00014629D /* ControlEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlEvent.swift; sourceTree = "<group>"; };
|
||||
C80D33941B922FB00014629D /* ControlProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ControlProperty.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C80D342D1B9245A40014629D /* CombineLatest+CollectionType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "CombineLatest+CollectionType.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
|
|
@ -1551,6 +1560,7 @@
|
|||
C80DDE921BCE69BA006A1832 /* ObservableConvertibleType+Driver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+Driver.swift"; sourceTree = "<group>"; };
|
||||
C80DDEAB1BCE83B2006A1832 /* Driver+Operators+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Driver+Operators+arity.tt"; sourceTree = "<group>"; };
|
||||
C80DDEB01BCE8CA3006A1832 /* Driver+Operators+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Driver+Operators+arity.swift"; sourceTree = "<group>"; };
|
||||
C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchQueueConfiguration.swift; sourceTree = "<group>"; };
|
||||
C811C89C1C24D80100A2DDD4 /* DeallocObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeallocObservable.swift; sourceTree = "<group>"; };
|
||||
C821DBA11BA4DCAB008F3809 /* Buffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Buffer.swift; sourceTree = "<group>"; };
|
||||
C83100631BF7D51600AAE3CD /* Sequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sequence.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1564,8 +1574,8 @@
|
|||
C83508DC1C38706D0027C24C /* Control+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Control+RxTests.swift"; sourceTree = "<group>"; };
|
||||
C83508DD1C38706D0027C24C /* ControlEventTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlEventTests.swift; sourceTree = "<group>"; };
|
||||
C83508DE1C38706D0027C24C /* ControlPropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlPropertyTests.swift; sourceTree = "<group>"; };
|
||||
C83508DF1C38706D0027C24C /* DelegateProxyTest+Cocoa.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DelegateProxyTest+Cocoa.swift"; sourceTree = "<group>"; };
|
||||
C83508E01C38706D0027C24C /* DelegateProxyTest+UIKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DelegateProxyTest+UIKit.swift"; sourceTree = "<group>"; };
|
||||
C83508DF1C38706D0027C24C /* DelegateProxyTest+Cocoa.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "DelegateProxyTest+Cocoa.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C83508E01C38706D0027C24C /* DelegateProxyTest+UIKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "DelegateProxyTest+UIKit.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C83508E11C38706D0027C24C /* DelegateProxyTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateProxyTest.swift; sourceTree = "<group>"; };
|
||||
C83508E21C38706D0027C24C /* Driver+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Driver+Extensions.swift"; sourceTree = "<group>"; };
|
||||
C83508E31C38706D0027C24C /* Driver+Test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Driver+Test.swift"; sourceTree = "<group>"; };
|
||||
|
|
@ -1652,37 +1662,38 @@
|
|||
C85BA04B1C3878740075D68E /* PerformanceTests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PerformanceTests.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C86409FB1BA593F500D3C4E8 /* Range.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Range.swift; sourceTree = "<group>"; };
|
||||
C8640A021BA5B12A00D3C4E8 /* Repeat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repeat.swift; sourceTree = "<group>"; };
|
||||
C86B1E211D42BF5200130546 /* SchedulerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulerTests.swift; sourceTree = "<group>"; };
|
||||
C88253F11B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewReactiveArrayDataSource.swift; sourceTree = "<group>"; };
|
||||
C88253F21B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewReactiveArrayDataSource.swift; sourceTree = "<group>"; };
|
||||
C88253F41B8A752B00B02D69 /* ItemEvents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemEvents.swift; sourceTree = "<group>"; };
|
||||
C88253F71B8A752B00B02D69 /* RxCollectionViewDataSourceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDataSourceType.swift; sourceTree = "<group>"; };
|
||||
C88253F81B8A752B00B02D69 /* RxTableViewDataSourceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewDataSourceType.swift; sourceTree = "<group>"; };
|
||||
C88253FC1B8A752B00B02D69 /* RxCollectionViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDataSourceProxy.swift; sourceTree = "<group>"; };
|
||||
C88253FC1B8A752B00B02D69 /* RxCollectionViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxCollectionViewDataSourceProxy.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88253FD1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDelegateProxy.swift; sourceTree = "<group>"; };
|
||||
C88253FE1B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxScrollViewDelegateProxy.swift; sourceTree = "<group>"; };
|
||||
C88253FF1B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxSearchBarDelegateProxy.swift; sourceTree = "<group>"; };
|
||||
C88254001B8A752B00B02D69 /* RxTableViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewDataSourceProxy.swift; sourceTree = "<group>"; };
|
||||
C88253FE1B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxScrollViewDelegateProxy.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88253FF1B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxSearchBarDelegateProxy.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88254001B8A752B00B02D69 /* RxTableViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxTableViewDataSourceProxy.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88254011B8A752B00B02D69 /* RxTableViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewDelegateProxy.swift; sourceTree = "<group>"; };
|
||||
C88254021B8A752B00B02D69 /* RxTextViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTextViewDelegateProxy.swift; sourceTree = "<group>"; };
|
||||
C88254051B8A752B00B02D69 /* UIBarButtonItem+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UIBarButtonItem+Rx.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88254061B8A752B00B02D69 /* UIButton+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254071B8A752B00B02D69 /* UICollectionView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UICollectionView+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254071B8A752B00B02D69 /* UICollectionView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UICollectionView+Rx.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88254081B8A752B00B02D69 /* UIControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UIControl+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254091B8A752B00B02D69 /* UIDatePicker+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDatePicker+Rx.swift"; sourceTree = "<group>"; };
|
||||
C882540A1B8A752B00B02D69 /* UIGestureRecognizer+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIGestureRecognizer+Rx.swift"; sourceTree = "<group>"; };
|
||||
C882540B1B8A752B00B02D69 /* UIImageView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImageView+Rx.swift"; sourceTree = "<group>"; };
|
||||
C882540C1B8A752B00B02D69 /* UILabel+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+Rx.swift"; sourceTree = "<group>"; };
|
||||
C882540D1B8A752B00B02D69 /* UIScrollView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIScrollView+Rx.swift"; sourceTree = "<group>"; };
|
||||
C882540E1B8A752B00B02D69 /* UISearchBar+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISearchBar+Rx.swift"; sourceTree = "<group>"; };
|
||||
C882540D1B8A752B00B02D69 /* UIScrollView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UIScrollView+Rx.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C882540E1B8A752B00B02D69 /* UISearchBar+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UISearchBar+Rx.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C882540F1B8A752B00B02D69 /* UISegmentedControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISegmentedControl+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254101B8A752B00B02D69 /* UISlider+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISlider+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254111B8A752B00B02D69 /* UISwitch+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISwitch+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254121B8A752B00B02D69 /* UITableView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableView+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254121B8A752B00B02D69 /* UITableView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UITableView+Rx.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88254131B8A752B00B02D69 /* UITextField+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextField+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254141B8A752B00B02D69 /* UITextView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextView+Rx.swift"; sourceTree = "<group>"; };
|
||||
C88254141B8A752B00B02D69 /* UITextView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UITextView+Rx.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C88BB8711B07E5ED0064D411 /* RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C88E296A1BEB712E001CCB92 /* RunLoopLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopLock.swift; sourceTree = "<group>"; };
|
||||
C88F76801CE5341700D5A014 /* RxTextInput.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTextInput.swift; sourceTree = "<group>"; };
|
||||
C88F76801CE5341700D5A014 /* TextInput.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextInput.swift; sourceTree = "<group>"; };
|
||||
C88FA50C1C25C44800CCFEA4 /* RxTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C88FA51D1C25C4B500CCFEA4 /* RxTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C88FA52E1C25C4C000CCFEA4 /* RxTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
|
@ -1708,7 +1719,7 @@
|
|||
C8C3DA051B9393AC004D233E /* Empty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = "<group>"; };
|
||||
C8C3DA081B93941E004D233E /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = "<group>"; };
|
||||
C8C3DA0B1B93959F004D233E /* Never.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Never.swift; sourceTree = "<group>"; };
|
||||
C8C3DA0E1B939767004D233E /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentThreadScheduler.swift; sourceTree = "<group>"; };
|
||||
C8C3DA0E1B939767004D233E /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CurrentThreadScheduler.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C8C3DA111B93A3EA004D233E /* AnonymousObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AnonymousObservable.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
C8C4B4A71C17722400828BD5 /* _RXObjCRuntime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RXObjCRuntime.m; sourceTree = "<group>"; };
|
||||
C8C4B4A81C17722400828BD5 /* _RXObjCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RXObjCRuntime.h; sourceTree = "<group>"; };
|
||||
|
|
@ -1732,6 +1743,7 @@
|
|||
C8E3A7301C2606A900643FE6 /* Event+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Event+Equatable.swift"; sourceTree = "<group>"; };
|
||||
C8E3A7351C26088C00643FE6 /* Any+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Any+Equatable.swift"; sourceTree = "<group>"; };
|
||||
C8E7B3681C30C6B800B34368 /* TestableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestableObservable.swift; sourceTree = "<group>"; };
|
||||
C8E9E42A1D43B26C0049644E /* Observable+DebugTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DebugTest.swift"; sourceTree = "<group>"; };
|
||||
C8F0C0021BBBFB8B001B112F /* RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C8F0C04B1BBBFBB9001B112F /* RxCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C8F0C0581BBBFBCE001B112F /* RxBlocking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxBlocking.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
|
@ -1750,6 +1762,7 @@
|
|||
CB883B441BE256D4000AC2EE /* BooleanDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BooleanDisposable.swift; sourceTree = "<group>"; };
|
||||
CB883B491BE369AA000AC2EE /* AddRef.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddRef.swift; sourceTree = "<group>"; };
|
||||
CBEE771E1BD649A000AD584C /* ToArray.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToArray.swift; sourceTree = "<group>"; };
|
||||
CDDEF1691D4FB40000CA8546 /* Disposables.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Disposables.swift; sourceTree = "<group>"; };
|
||||
D2138C751BB9BE9800339B5C /* RxCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D2245A1A1BD5657300E7146F /* WithLatestFrom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WithLatestFrom.swift; sourceTree = "<group>"; };
|
||||
D22B6D251BC8504A00BCE0AB /* SkipWhile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkipWhile.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1919,7 +1932,7 @@
|
|||
C8093C641B8A72BE0088E94D /* Event.swift */,
|
||||
C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */,
|
||||
C8093C681B8A72BE0088E94D /* Observable.swift */,
|
||||
C8093C671B8A72BE0088E94D /* Observable+Extensions.swift */,
|
||||
C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */,
|
||||
C849BE2A1BAB5D070019AD27 /* ObservableConvertibleType.swift */,
|
||||
C8093C9E1B8A72BE0088E94D /* ObservableType.swift */,
|
||||
C8093CA01B8A72BE0088E94D /* AnyObserver.swift */,
|
||||
|
|
@ -1975,14 +1988,13 @@
|
|||
C8093C581B8A72BE0088E94D /* DisposeBag.swift */,
|
||||
C8093C591B8A72BE0088E94D /* DisposeBase.swift */,
|
||||
C84CC5661BDD08A500E06A64 /* SubscriptionDisposable.swift */,
|
||||
C8093C5A1B8A72BE0088E94D /* NAryDisposable.swift */,
|
||||
C8093C5B1B8A72BE0088E94D /* NAryDisposable.tt */,
|
||||
C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */,
|
||||
CB883B3F1BE24C15000AC2EE /* RefCountDisposable.swift */,
|
||||
C8093C5D1B8A72BE0088E94D /* ScheduledDisposable.swift */,
|
||||
C8093C5F1B8A72BE0088E94D /* SerialDisposable.swift */,
|
||||
C8093C601B8A72BE0088E94D /* SingleAssignmentDisposable.swift */,
|
||||
C8093C611B8A72BE0088E94D /* StableCompositeDisposable.swift */,
|
||||
CDDEF1691D4FB40000CA8546 /* Disposables.swift */,
|
||||
);
|
||||
path = Disposables;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -2156,7 +2168,7 @@
|
|||
C8BCD3F31C14B6D1005F1280 /* NSLayoutConstraint+Rx.swift */,
|
||||
C8D132431C42D15E00B59FFF /* SectionedViewDataSourceType.swift */,
|
||||
D2F461001CD7ABE400527B4D /* Reactive.swift */,
|
||||
C88F76801CE5341700D5A014 /* RxTextInput.swift */,
|
||||
C88F76801CE5341700D5A014 /* TextInput.swift */,
|
||||
);
|
||||
path = Common;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -2371,6 +2383,7 @@
|
|||
C835090C1C38706D0027C24C /* Observable+BlockingTest.swift */,
|
||||
C835090D1C38706D0027C24C /* Observable+ConcurrencyTest.swift */,
|
||||
C835090E1C38706D0027C24C /* Observable+CreationTest.swift */,
|
||||
C8E9E42A1D43B26C0049644E /* Observable+DebugTest.swift */,
|
||||
C83509131C38706D0027C24C /* Observable+MultipleTest.swift */,
|
||||
C835090F1C38706D0027C24C /* Observable+MultipleTest+CombineLatest.swift */,
|
||||
C83509101C38706D0027C24C /* Observable+MultipleTest+CombineLatest.tt */,
|
||||
|
|
@ -2387,6 +2400,7 @@
|
|||
C835091A1C38706D0027C24C /* SubjectConcurrencyTest.swift */,
|
||||
C835091B1C38706D0027C24C /* VariableTest.swift */,
|
||||
C835091C1C38706D0027C24C /* VirtualSchedulerTest.swift */,
|
||||
C86B1E211D42BF5200130546 /* SchedulerTests.swift */,
|
||||
);
|
||||
path = Tests;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -2411,6 +2425,7 @@
|
|||
C83D73B51C1DBAEE003DC470 /* InvocableType.swift */,
|
||||
C83D73B61C1DBAEE003DC470 /* ScheduledItem.swift */,
|
||||
C83D73B71C1DBAEE003DC470 /* ScheduledItemType.swift */,
|
||||
C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */,
|
||||
);
|
||||
path = Internal;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -3125,23 +3140,48 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0720;
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = "Krunoslav Zaher";
|
||||
TargetAttributes = {
|
||||
C80938F51B8A71760088E94D = {
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C809396F1B8A71840088E94D = {
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C8093B4B1B8A71F00088E94D = {
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C8093BC91B8A71FC0088E94D = {
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C83508C21C386F6F0027C24C = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C83509831C38740E0027C24C = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
};
|
||||
C83509931C38742C0027C24C = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C85BA04A1C3878740075D68E = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C88BB81A1B07E5ED0064D411 = {
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C88FA4FD1C25C44800CCFEA4 = {
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C88FA50E1C25C4B500CCFEA4 = {
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
C8A56AD61AD7424700B4673B = {
|
||||
CreatedOnToolsVersion = 6.3;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
D2138C741BB9BE9800339B5C = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
|
|
@ -3374,7 +3414,7 @@
|
|||
C882541F1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift in Sources */,
|
||||
46307D4E1CDE77D800E47A1C /* UIAlertAction+Rx.swift in Sources */,
|
||||
C88254201B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift in Sources */,
|
||||
C88F76811CE5341700D5A014 /* RxTextInput.swift in Sources */,
|
||||
C88F76811CE5341700D5A014 /* TextInput.swift in Sources */,
|
||||
C882542E1B8A752B00B02D69 /* UILabel+Rx.swift in Sources */,
|
||||
54D2138E1CE0824E0028D5B4 /* UINavigationItem+Rx.swift in Sources */,
|
||||
91BE429C1CBF7EC000F6B062 /* UIPageControl+Rx.swift in Sources */,
|
||||
|
|
@ -3442,7 +3482,7 @@
|
|||
C8093EE41B8A732E0088E94D /* DelegateProxyType.swift in Sources */,
|
||||
C8093F481B8A732E0088E94D /* NSControl+Rx.swift in Sources */,
|
||||
C8093F4E1B8A732E0088E94D /* NSTextField+Rx.swift in Sources */,
|
||||
C88F76821CE5341700D5A014 /* RxTextInput.swift in Sources */,
|
||||
C88F76821CE5341700D5A014 /* TextInput.swift in Sources */,
|
||||
C8DB967F1BF7496C0084BD53 /* KVORepresentable.swift in Sources */,
|
||||
C8093EFE1B8A732E0088E94D /* RxTarget.swift in Sources */,
|
||||
C8093ED21B8A732E0088E94D /* _RX.m in Sources */,
|
||||
|
|
@ -3522,6 +3562,7 @@
|
|||
C83509531C38706E0027C24C /* Observable+AggregateTest.swift in Sources */,
|
||||
C8B290891C94D64600E923D0 /* RxTest+Controls.swift in Sources */,
|
||||
C83509291C38706E0027C24C /* PerformanceTools.swift in Sources */,
|
||||
C8E9E42B1D43B26C0049644E /* Observable+DebugTest.swift in Sources */,
|
||||
C835096A1C38706E0027C24C /* TestErrors.swift in Sources */,
|
||||
1AF67DA61CED430100C310FA /* ReplaySubjectTest.swift in Sources */,
|
||||
C83509561C38706E0027C24C /* Observable+ConcurrencyTest.swift in Sources */,
|
||||
|
|
@ -3532,6 +3573,7 @@
|
|||
C83509351C38706E0027C24C /* KVOObservableTests.swift in Sources */,
|
||||
C83509421C38706E0027C24C /* MainThreadPrimitiveHotObservable.swift in Sources */,
|
||||
C835093A1C38706E0027C24C /* RuntimeStateSnapshot.swift in Sources */,
|
||||
C86B1E221D42BF5200130546 /* SchedulerTests.swift in Sources */,
|
||||
C83509441C38706E0027C24C /* MySubject.swift in Sources */,
|
||||
C835095F1C38706E0027C24C /* Observable+SubscriptionTest.swift in Sources */,
|
||||
C8C217D71CB710200038A2E6 /* UICollectionView+RxTests.swift in Sources */,
|
||||
|
|
@ -3625,6 +3667,7 @@
|
|||
C83509EC1C3875580027C24C /* MockDisposable.swift in Sources */,
|
||||
1AF67DA31CED427D00C310FA /* PublishSubjectTest.swift in Sources */,
|
||||
C8350A111C38756A0027C24C /* Observable+SingleTest.swift in Sources */,
|
||||
C8E9E42C1D43B26C0049644E /* Observable+DebugTest.swift in Sources */,
|
||||
C8350A2A1C3875B50027C24C /* RxMutableBox.swift in Sources */,
|
||||
C8350A151C38756A0027C24C /* ObserverTests.swift in Sources */,
|
||||
C83509B11C3874E20027C24C /* PerformanceTools.swift in Sources */,
|
||||
|
|
@ -3672,6 +3715,7 @@
|
|||
C83509AF1C3874DC0027C24C /* RxTest.swift in Sources */,
|
||||
C83509F41C38755D0027C24C /* BagTest.swift in Sources */,
|
||||
C8F27DC11CE68DA700D5FB4F /* UITextView+RxTests.swift in Sources */,
|
||||
C86B1E231D42BF5200130546 /* SchedulerTests.swift in Sources */,
|
||||
C860EC961C42E26100A664B3 /* SectionedViewDataSourceMock.swift in Sources */,
|
||||
C8350A0F1C3875630027C24C /* Observable+MultipleTest+Zip.swift in Sources */,
|
||||
);
|
||||
|
|
@ -3693,6 +3737,7 @@
|
|||
C8350A071C38755E0027C24C /* MainSchedulerTests.swift in Sources */,
|
||||
C83509B81C38750D0027C24C /* ControlEventTests.swift in Sources */,
|
||||
C83509CB1C3875230027C24C /* KVOObservableTests.swift in Sources */,
|
||||
C8E9E42D1D43B26C0049644E /* Observable+DebugTest.swift in Sources */,
|
||||
C83509AD1C3874D70027C24C /* Foundation+Extensions.swift in Sources */,
|
||||
C83509C81C3875230027C24C /* DelegateProxyTest.swift in Sources */,
|
||||
C8350A0D1C38755E0027C24C /* Observable+MultipleTest+CombineLatest.swift in Sources */,
|
||||
|
|
@ -3704,6 +3749,7 @@
|
|||
C83509A71C3874D10027C24C /* TestErrors.swift in Sources */,
|
||||
C83509D61C3875420027C24C /* SentMessageTest.swift in Sources */,
|
||||
C8350A021C38755E0027C24C /* BagTest.swift in Sources */,
|
||||
C86B1E241D42BF5200130546 /* SchedulerTests.swift in Sources */,
|
||||
C8350A081C38755E0027C24C /* Observable+AggregateTest.swift in Sources */,
|
||||
C83509E81C3875580027C24C /* PrimitiveMockObserver.swift in Sources */,
|
||||
C83509BE1C3875100027C24C /* DelegateProxyTest+Cocoa.swift in Sources */,
|
||||
|
|
@ -3773,6 +3819,7 @@
|
|||
C849BE2C1BAB5D070019AD27 /* ObservableConvertibleType.swift in Sources */,
|
||||
C8C3DA0A1B93941E004D233E /* Error.swift in Sources */,
|
||||
C8093D9C1B8A72BE0088E94D /* SchedulerServices+Emulation.swift in Sources */,
|
||||
C80EEC351D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */,
|
||||
C80DA3391C30B20B00C588B9 /* VirtualTimeScheduler.swift in Sources */,
|
||||
C8093D6A1B8A72BE0088E94D /* AnyObserver.swift in Sources */,
|
||||
C8093D3C1B8A72BE0088E94D /* Skip.swift in Sources */,
|
||||
|
|
@ -3795,7 +3842,7 @@
|
|||
C8093DA41B8A72BE0088E94D /* ReplaySubject.swift in Sources */,
|
||||
C8C3D9FF1B935EDF004D233E /* Zip+CollectionType.swift in Sources */,
|
||||
C8093D641B8A72BE0088E94D /* Observable+Time.swift in Sources */,
|
||||
C8093CFC1B8A72BE0088E94D /* Observable+Extensions.swift in Sources */,
|
||||
C8093CFC1B8A72BE0088E94D /* ObservableType+Extensions.swift in Sources */,
|
||||
C8093D4A1B8A72BE0088E94D /* Throttle.swift in Sources */,
|
||||
C8B145011BD2D80100267DCE /* ImmediateScheduler.swift in Sources */,
|
||||
C8093D061B8A72BE0088E94D /* Catch.swift in Sources */,
|
||||
|
|
@ -3871,6 +3918,7 @@
|
|||
C8093D9E1B8A72BE0088E94D /* SerialDispatchQueueScheduler.swift in Sources */,
|
||||
C8093D341B8A72BE0088E94D /* RefCount.swift in Sources */,
|
||||
C8093D0E1B8A72BE0088E94D /* Concat.swift in Sources */,
|
||||
CDDEF16B1D4FB40000CA8546 /* Disposables.swift in Sources */,
|
||||
C8093CCA1B8A72BE0088E94D /* Lock.swift in Sources */,
|
||||
C8093D441B8A72BE0088E94D /* Take.swift in Sources */,
|
||||
C84CC5591BDCF51200E06A64 /* SynchronizedSubscribeType.swift in Sources */,
|
||||
|
|
@ -3895,7 +3943,6 @@
|
|||
CBEE77201BD649A000AD584C /* ToArray.swift in Sources */,
|
||||
C8093CFE1B8A72BE0088E94D /* Observable.swift in Sources */,
|
||||
C84CC55E1BDD010800E06A64 /* SynchronizedUnsubscribeType.swift in Sources */,
|
||||
C8093CE21B8A72BE0088E94D /* NAryDisposable.swift in Sources */,
|
||||
C8093CEC1B8A72BE0088E94D /* SerialDisposable.swift in Sources */,
|
||||
C8C3DA0D1B93959F004D233E /* Never.swift in Sources */,
|
||||
C84CC5681BDD08A500E06A64 /* SubscriptionDisposable.swift in Sources */,
|
||||
|
|
@ -3995,6 +4042,7 @@
|
|||
C849BE2B1BAB5D070019AD27 /* ObservableConvertibleType.swift in Sources */,
|
||||
C8C3DA091B93941E004D233E /* Error.swift in Sources */,
|
||||
C8093D9B1B8A72BE0088E94D /* SchedulerServices+Emulation.swift in Sources */,
|
||||
C80EEC341D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */,
|
||||
C8093D691B8A72BE0088E94D /* AnyObserver.swift in Sources */,
|
||||
C8093D3B1B8A72BE0088E94D /* Skip.swift in Sources */,
|
||||
C8B144FB1BD2D44500267DCE /* ConcurrentMainScheduler.swift in Sources */,
|
||||
|
|
@ -4016,7 +4064,7 @@
|
|||
C8093DA31B8A72BE0088E94D /* ReplaySubject.swift in Sources */,
|
||||
C8C3D9FE1B935EDF004D233E /* Zip+CollectionType.swift in Sources */,
|
||||
C8093D631B8A72BE0088E94D /* Observable+Time.swift in Sources */,
|
||||
C8093CFB1B8A72BE0088E94D /* Observable+Extensions.swift in Sources */,
|
||||
C8093CFB1B8A72BE0088E94D /* ObservableType+Extensions.swift in Sources */,
|
||||
C8093D491B8A72BE0088E94D /* Throttle.swift in Sources */,
|
||||
C8B145001BD2D80100267DCE /* ImmediateScheduler.swift in Sources */,
|
||||
C8093D051B8A72BE0088E94D /* Catch.swift in Sources */,
|
||||
|
|
@ -4093,6 +4141,7 @@
|
|||
C8093D9D1B8A72BE0088E94D /* SerialDispatchQueueScheduler.swift in Sources */,
|
||||
C8093D331B8A72BE0088E94D /* RefCount.swift in Sources */,
|
||||
C8093D0D1B8A72BE0088E94D /* Concat.swift in Sources */,
|
||||
CDDEF16A1D4FB40000CA8546 /* Disposables.swift in Sources */,
|
||||
C8093CC91B8A72BE0088E94D /* Lock.swift in Sources */,
|
||||
C8093D431B8A72BE0088E94D /* Take.swift in Sources */,
|
||||
C84CC5581BDCF51200E06A64 /* SynchronizedSubscribeType.swift in Sources */,
|
||||
|
|
@ -4117,7 +4166,6 @@
|
|||
CBEE771F1BD649A000AD584C /* ToArray.swift in Sources */,
|
||||
C8093CFD1B8A72BE0088E94D /* Observable.swift in Sources */,
|
||||
C84CC55D1BDD010800E06A64 /* SynchronizedUnsubscribeType.swift in Sources */,
|
||||
C8093CE11B8A72BE0088E94D /* NAryDisposable.swift in Sources */,
|
||||
C8093CEB1B8A72BE0088E94D /* SerialDisposable.swift in Sources */,
|
||||
C8C3DA0C1B93959F004D233E /* Never.swift in Sources */,
|
||||
C84CC5671BDD08A500E06A64 /* SubscriptionDisposable.swift in Sources */,
|
||||
|
|
@ -4141,6 +4189,7 @@
|
|||
C89461751BC6C1210055219D /* ObservableConvertibleType.swift in Sources */,
|
||||
C8F0BF981BBBFB8B001B112F /* Error.swift in Sources */,
|
||||
C8F0BF991BBBFB8B001B112F /* SchedulerServices+Emulation.swift in Sources */,
|
||||
C80EEC371D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */,
|
||||
C80DA33B1C30B20C00C588B9 /* VirtualTimeScheduler.swift in Sources */,
|
||||
C8F0BF9A1BBBFB8B001B112F /* AnyObserver.swift in Sources */,
|
||||
C8F0BF9B1BBBFB8B001B112F /* Skip.swift in Sources */,
|
||||
|
|
@ -4163,7 +4212,7 @@
|
|||
C8F0BFA61BBBFB8B001B112F /* ReplaySubject.swift in Sources */,
|
||||
C8F0BFA71BBBFB8B001B112F /* Zip+CollectionType.swift in Sources */,
|
||||
C8F0BFA81BBBFB8B001B112F /* Observable+Time.swift in Sources */,
|
||||
C8F0BFA91BBBFB8B001B112F /* Observable+Extensions.swift in Sources */,
|
||||
C8F0BFA91BBBFB8B001B112F /* ObservableType+Extensions.swift in Sources */,
|
||||
C8F0BFAA1BBBFB8B001B112F /* Throttle.swift in Sources */,
|
||||
C8B145031BD2D80100267DCE /* ImmediateScheduler.swift in Sources */,
|
||||
C8F0BFAC1BBBFB8B001B112F /* Catch.swift in Sources */,
|
||||
|
|
@ -4239,6 +4288,7 @@
|
|||
C8F0BFE01BBBFB8B001B112F /* SerialDispatchQueueScheduler.swift in Sources */,
|
||||
C8F0BFE11BBBFB8B001B112F /* RefCount.swift in Sources */,
|
||||
C8F0BFE21BBBFB8B001B112F /* Concat.swift in Sources */,
|
||||
CDDEF16D1D4FB40000CA8546 /* Disposables.swift in Sources */,
|
||||
C8F0BFE31BBBFB8B001B112F /* Lock.swift in Sources */,
|
||||
C8F0BFE41BBBFB8B001B112F /* Take.swift in Sources */,
|
||||
C84CC55B1BDCF51200E06A64 /* SynchronizedSubscribeType.swift in Sources */,
|
||||
|
|
@ -4263,7 +4313,6 @@
|
|||
CBEE77221BD649A000AD584C /* ToArray.swift in Sources */,
|
||||
C8F0BFF41BBBFB8B001B112F /* Observable.swift in Sources */,
|
||||
C84CC5601BDD010800E06A64 /* SynchronizedUnsubscribeType.swift in Sources */,
|
||||
C8F0BFF51BBBFB8B001B112F /* NAryDisposable.swift in Sources */,
|
||||
C8F0BFF61BBBFB8B001B112F /* SerialDisposable.swift in Sources */,
|
||||
C8F0BFF71BBBFB8B001B112F /* Never.swift in Sources */,
|
||||
C84CC56A1BDD08A500E06A64 /* SubscriptionDisposable.swift in Sources */,
|
||||
|
|
@ -4328,6 +4377,7 @@
|
|||
C8F0C0261BBBFBB9001B112F /* _RXDelegateProxy.m in Sources */,
|
||||
C8F0C0271BBBFBB9001B112F /* NSObject+Rx.swift in Sources */,
|
||||
9BA1CBFE1C0F84C40044B50A /* UIActivityIndicatorView+Rx.swift in Sources */,
|
||||
87379AE01D61C6F50047CA88 /* Reactive.swift in Sources */,
|
||||
842A5A2E1C357F94003568D5 /* NSTextStorage+Rx.swift in Sources */,
|
||||
C8F0C0281BBBFBB9001B112F /* RxTextViewDelegateProxy.swift in Sources */,
|
||||
C8F0C0291BBBFBB9001B112F /* UIBarButtonItem+Rx.swift in Sources */,
|
||||
|
|
@ -4352,7 +4402,7 @@
|
|||
C8F0C0381BBBFBB9001B112F /* UITextField+Rx.swift in Sources */,
|
||||
C8F0C0391BBBFBB9001B112F /* NSURLSession+Rx.swift in Sources */,
|
||||
C8F0C03A1BBBFBB9001B112F /* ControlTarget.swift in Sources */,
|
||||
C88F76841CE5341700D5A014 /* RxTextInput.swift in Sources */,
|
||||
C88F76841CE5341700D5A014 /* TextInput.swift in Sources */,
|
||||
C8F0C03B1BBBFBB9001B112F /* UISearchBar+Rx.swift in Sources */,
|
||||
C8F0C03C1BBBFBB9001B112F /* ItemEvents.swift in Sources */,
|
||||
7EDBAEBF1C89B9B7006CBE67 /* UITabBarItem+Rx.swift in Sources */,
|
||||
|
|
@ -4417,7 +4467,7 @@
|
|||
C80DDEA91BCE69BA006A1832 /* ObservableConvertibleType+Driver.swift in Sources */,
|
||||
C80DDEA11BCE69BA006A1832 /* Driver+Subscription.swift in Sources */,
|
||||
D2138C891BB9BEBE00339B5C /* DelegateProxyType.swift in Sources */,
|
||||
C88F76831CE5341700D5A014 /* RxTextInput.swift in Sources */,
|
||||
C88F76831CE5341700D5A014 /* TextInput.swift in Sources */,
|
||||
C811C89F1C24D80100A2DDD4 /* DeallocObservable.swift in Sources */,
|
||||
54D213921CE08D0C0028D5B4 /* UINavigationItem+Rx.swift in Sources */,
|
||||
D2F461041CD7AC2100527B4D /* Reactive.swift in Sources */,
|
||||
|
|
@ -4481,6 +4531,7 @@
|
|||
C89461761BC6C1220055219D /* ObservableConvertibleType.swift in Sources */,
|
||||
D2EBEAF71BB9B6B2003A27DC /* ScheduledDisposable.swift in Sources */,
|
||||
D2EBEAE11BB9B697003A27DC /* ImmediateSchedulerType.swift in Sources */,
|
||||
C80EEC361D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */,
|
||||
C80DA33A1C30B20B00C588B9 /* VirtualTimeScheduler.swift in Sources */,
|
||||
D2EBEB0B1BB9B6C1003A27DC /* Empty.swift in Sources */,
|
||||
D2EBEAF11BB9B6AE003A27DC /* BinaryDisposable.swift in Sources */,
|
||||
|
|
@ -4556,7 +4607,6 @@
|
|||
D2EBEAF61BB9B6B2003A27DC /* NopDisposable.swift in Sources */,
|
||||
CB30D9EB1BF0E3500084C1C0 /* SingleAsync.swift in Sources */,
|
||||
D2EBEAFF1BB9B6BA003A27DC /* Buffer.swift in Sources */,
|
||||
D2EBEAF51BB9B6AE003A27DC /* NAryDisposable.swift in Sources */,
|
||||
D2EBEB1D1BB9B6C1003A27DC /* Scan.swift in Sources */,
|
||||
D2EBEB261BB9B6C1003A27DC /* Throttle.swift in Sources */,
|
||||
D2EBEAE81BB9B697003A27DC /* Rx.swift in Sources */,
|
||||
|
|
@ -4572,7 +4622,7 @@
|
|||
D2EBEAE91BB9B697003A27DC /* RxMutableBox.swift in Sources */,
|
||||
D2EBEAFC1BB9B6BA003A27DC /* Amb.swift in Sources */,
|
||||
D2EBEB231BB9B6C1003A27DC /* Take.swift in Sources */,
|
||||
D2EBEAE31BB9B697003A27DC /* Observable+Extensions.swift in Sources */,
|
||||
D2EBEAE31BB9B697003A27DC /* ObservableType+Extensions.swift in Sources */,
|
||||
B1D899911BF653410027B05C /* Timeout.swift in Sources */,
|
||||
D2EBEB121BB9B6C1003A27DC /* Merge.swift in Sources */,
|
||||
D2EBEAEF1BB9B6A4003A27DC /* Queue.swift in Sources */,
|
||||
|
|
@ -4580,6 +4630,7 @@
|
|||
D2EBEB2B1BB9B6CA003A27DC /* Observable+Aggregate.swift in Sources */,
|
||||
D2EBEB291BB9B6C1003A27DC /* Zip+arity.swift in Sources */,
|
||||
D2EBEB241BB9B6C1003A27DC /* TakeUntil.swift in Sources */,
|
||||
CDDEF16C1D4FB40000CA8546 /* Disposables.swift in Sources */,
|
||||
C84CC55A1BDCF51200E06A64 /* SynchronizedSubscribeType.swift in Sources */,
|
||||
D2EBEB3B1BB9B6D8003A27DC /* OperationQueueScheduler.swift in Sources */,
|
||||
D2EBEAE51BB9B697003A27DC /* AnyObserver.swift in Sources */,
|
||||
|
|
@ -5194,8 +5245,10 @@
|
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
|
@ -5205,6 +5258,7 @@
|
|||
ENABLE_BITCODE = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "TRACE_RESOURCES=1";
|
||||
|
|
@ -5221,7 +5275,7 @@
|
|||
OTHER_SWIFT_FLAGS = "-D TRACE_RESOURCES";
|
||||
SDKROOT = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 2.3;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
|
@ -5589,8 +5643,10 @@
|
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
|
@ -5623,7 +5679,7 @@
|
|||
OTHER_SWIFT_FLAGS = "-D TRACE_RESOURCES -D DEBUG";
|
||||
SDKROOT = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 2.3;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
|
|
@ -5646,8 +5702,10 @@
|
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
|
@ -5657,6 +5715,7 @@
|
|||
ENABLE_BITCODE = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
|
|
@ -5672,7 +5731,7 @@
|
|||
OTHER_SWIFT_FLAGS = "-D RELEASE";
|
||||
SDKROOT = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 2.3;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Rx.playground">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Package.swift">
|
||||
</FileRef>
|
||||
|
|
@ -35,37 +38,9 @@
|
|||
<Group
|
||||
location = "group:scripts"
|
||||
name = "scripts">
|
||||
<Group
|
||||
location = "group:automation-tests"
|
||||
name = "automation-tests">
|
||||
<FileRef
|
||||
location = "group:01_githubSignUp.js">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:02_searchWikipedia.js">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:03_masterDetail.js">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:04_controlsTests.js">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:05_reactivePartialUpdates.js">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:common.js">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:main.js">
|
||||
</FileRef>
|
||||
</Group>
|
||||
<FileRef
|
||||
location = "group:all-tests.sh">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:automation-tests.sh">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:common.sh">
|
||||
</FileRef>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "RxBlocking"
|
||||
s.version = "2.6.0"
|
||||
s.version = "3.0.0.alpha.1"
|
||||
s.summary = "RxSwift Blocking operatos"
|
||||
s.description = <<-DESC
|
||||
Set of blocking operators for RxSwift. These operators are mostly intended for unit/integration tests
|
||||
|
|
@ -18,11 +18,11 @@ Waiting for observable sequence to complete before exiting command line applicat
|
|||
s.requires_arc = true
|
||||
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.9'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.watchos.deployment_target = '2.0'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
|
||||
s.source_files = 'RxBlocking/**/*.swift'
|
||||
|
||||
s.dependency 'RxSwift', '~> 2.5'
|
||||
s.dependency 'RxSwift', '~> 3.0.0.alpha.1'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ extension BlockingObservable {
|
|||
public func toArray() throws -> [E] {
|
||||
var elements: [E] = Array<E>()
|
||||
|
||||
var error: ErrorType?
|
||||
var error: Swift.Error?
|
||||
|
||||
let lock = RunLoopLock()
|
||||
|
||||
|
|
@ -30,17 +30,17 @@ extension BlockingObservable {
|
|||
|
||||
lock.dispatch {
|
||||
d.disposable = self.source.subscribe { e in
|
||||
if d.disposed {
|
||||
if d.isDisposed {
|
||||
return
|
||||
}
|
||||
switch e {
|
||||
case .Next(let element):
|
||||
case .next(let element):
|
||||
elements.append(element)
|
||||
case .Error(let e):
|
||||
case .error(let e):
|
||||
error = e
|
||||
d.dispose()
|
||||
lock.stop()
|
||||
case .Completed:
|
||||
case .completed:
|
||||
d.dispose()
|
||||
lock.stop()
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ extension BlockingObservable {
|
|||
public func first() throws -> E? {
|
||||
var element: E?
|
||||
|
||||
var error: ErrorType?
|
||||
var error: Swift.Error?
|
||||
|
||||
let d = SingleAssignmentDisposable()
|
||||
|
||||
|
|
@ -78,17 +78,17 @@ extension BlockingObservable {
|
|||
|
||||
lock.dispatch {
|
||||
d.disposable = self.source.subscribe { e in
|
||||
if d.disposed {
|
||||
if d.isDisposed {
|
||||
return
|
||||
}
|
||||
|
||||
switch e {
|
||||
case .Next(let e):
|
||||
case .next(let e):
|
||||
if element == nil {
|
||||
element = e
|
||||
}
|
||||
break
|
||||
case .Error(let e):
|
||||
case .error(let e):
|
||||
error = e
|
||||
default:
|
||||
break
|
||||
|
|
@ -122,7 +122,7 @@ extension BlockingObservable {
|
|||
public func last() throws -> E? {
|
||||
var element: E?
|
||||
|
||||
var error: ErrorType?
|
||||
var error: Swift.Error?
|
||||
|
||||
let d = SingleAssignmentDisposable()
|
||||
|
||||
|
|
@ -130,14 +130,14 @@ extension BlockingObservable {
|
|||
|
||||
lock.dispatch {
|
||||
d.disposable = self.source.subscribe { e in
|
||||
if d.disposed {
|
||||
if d.isDisposed {
|
||||
return
|
||||
}
|
||||
switch e {
|
||||
case .Next(let e):
|
||||
case .next(let e):
|
||||
element = e
|
||||
return
|
||||
case .Error(let e):
|
||||
case .error(let e):
|
||||
error = e
|
||||
default:
|
||||
break
|
||||
|
|
@ -180,10 +180,10 @@ extension BlockingObservable {
|
|||
- parameter predicate: A function to test each source element for a condition.
|
||||
- returns: Returns the only element of an sequence that satisfies the condition in the predicate, and reports an error if there is not exactly one element in the sequence.
|
||||
*/
|
||||
public func single(predicate: (E) throws -> Bool) throws -> E? {
|
||||
public func single(_ predicate: @escaping (E) throws -> Bool) throws -> E? {
|
||||
var element: E?
|
||||
|
||||
var error: ErrorType?
|
||||
var error: Swift.Error?
|
||||
|
||||
let d = SingleAssignmentDisposable()
|
||||
|
||||
|
|
@ -191,11 +191,11 @@ extension BlockingObservable {
|
|||
|
||||
lock.dispatch {
|
||||
d.disposable = self.source.subscribe { e in
|
||||
if d.disposed {
|
||||
if d.isDisposed {
|
||||
return
|
||||
}
|
||||
switch e {
|
||||
case .Next(let e):
|
||||
case .next(let e):
|
||||
do {
|
||||
if try !predicate(e) {
|
||||
return
|
||||
|
|
@ -203,7 +203,7 @@ extension BlockingObservable {
|
|||
if element == nil {
|
||||
element = e
|
||||
} else {
|
||||
throw RxError.MoreThanOneElement
|
||||
throw RxError.moreThanOneElement
|
||||
}
|
||||
} catch (let err) {
|
||||
error = err
|
||||
|
|
@ -211,11 +211,11 @@ extension BlockingObservable {
|
|||
lock.stop()
|
||||
}
|
||||
return
|
||||
case .Error(let e):
|
||||
case .error(let e):
|
||||
error = e
|
||||
case .Completed:
|
||||
case .completed:
|
||||
if element == nil {
|
||||
error = RxError.NoElements
|
||||
error = RxError.noElements
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -17,8 +17,8 @@ extension ObservableConvertibleType {
|
|||
|
||||
- returns: `BlockingObservable` version of `self`
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func toBlocking() -> BlockingObservable<E> {
|
||||
return BlockingObservable(source: self.asObservable())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ typealias AtomicInt = Int32
|
|||
#endif
|
||||
|
||||
class RunLoopLock {
|
||||
let currentRunLoop: CFRunLoopRef
|
||||
let currentRunLoop: CFRunLoop
|
||||
|
||||
var calledRun: AtomicInt = 0
|
||||
var calledStop: AtomicInt = 0
|
||||
|
|
@ -38,12 +38,12 @@ class RunLoopLock {
|
|||
currentRunLoop = CFRunLoopGetCurrent()
|
||||
}
|
||||
|
||||
func dispatch(action: () -> ()) {
|
||||
CFRunLoopPerformBlock(currentRunLoop, kCFRunLoopDefaultMode) {
|
||||
func dispatch(_ action: @escaping () -> ()) {
|
||||
CFRunLoopPerformBlock(currentRunLoop, CFRunLoopMode.defaultMode.rawValue) {
|
||||
if CurrentThreadScheduler.isScheduleRequired {
|
||||
CurrentThreadScheduler.instance.schedule(()) { _ in
|
||||
_ = CurrentThreadScheduler.instance.schedule(()) { _ in
|
||||
action()
|
||||
return NopDisposable.instance
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -57,7 +57,7 @@ class RunLoopLock {
|
|||
if AtomicIncrement(&calledStop) != 1 {
|
||||
return
|
||||
}
|
||||
CFRunLoopPerformBlock(currentRunLoop, kCFRunLoopDefaultMode) {
|
||||
CFRunLoopPerformBlock(currentRunLoop, CFRunLoopMode.defaultMode.rawValue) {
|
||||
CFRunLoopStop(self.currentRunLoop)
|
||||
}
|
||||
CFRunLoopWakeUp(currentRunLoop)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "RxCocoa"
|
||||
s.version = "2.6.0"
|
||||
s.version = "3.0.0.alpha.1"
|
||||
s.summary = "RxSwift Cocoa extensions"
|
||||
s.description = <<-DESC
|
||||
* UI extensions
|
||||
|
|
@ -15,7 +15,7 @@ Pod::Spec.new do |s|
|
|||
s.requires_arc = true
|
||||
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.9'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.watchos.deployment_target = '2.0'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
|
||||
|
|
@ -25,5 +25,5 @@ Pod::Spec.new do |s|
|
|||
s.watchos.source_files = 'RxCocoa/iOS/**/*.swift'
|
||||
s.tvos.source_files = 'RxCocoa/iOS/**/*.swift'
|
||||
|
||||
s.dependency 'RxSwift', '~> 2.5'
|
||||
s.dependency 'RxSwift', '~> 3.0.0.alpha.1'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ import RxSwift
|
|||
#endif
|
||||
|
||||
|
||||
extension CLLocationManager {
|
||||
extension Reactive where Base: CLLocationManager {
|
||||
|
||||
/**
|
||||
Reactive wrapper for `delegate`.
|
||||
|
||||
For more information take a look at `DelegateProxyType` protocol documentation.
|
||||
*/
|
||||
public var rx_delegate: DelegateProxy {
|
||||
return RxCLLocationManagerDelegateProxy.proxyForObject(self)
|
||||
public var delegate: DelegateProxy {
|
||||
return RxCLLocationManagerDelegateProxy.proxyForObject(base)
|
||||
}
|
||||
|
||||
// MARK: Responding to Location Events
|
||||
|
|
@ -28,8 +28,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didUpdateLocations: Observable<[CLLocation]> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didUpdateLocations:)))
|
||||
public var didUpdateLocations: Observable<[CLLocation]> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didUpdateLocations:)))
|
||||
.map { a in
|
||||
return try castOrThrow([CLLocation].self, a[1])
|
||||
}
|
||||
|
|
@ -38,8 +38,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didFailWithError: Observable<NSError> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didFailWithError:)))
|
||||
public var didFailWithError: Observable<NSError> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didFailWithError:)))
|
||||
.map { a in
|
||||
return try castOrThrow(NSError.self, a[1])
|
||||
}
|
||||
|
|
@ -49,8 +49,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didFinishDeferredUpdatesWithError: Observable<NSError?> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didFinishDeferredUpdatesWithError:)))
|
||||
public var didFinishDeferredUpdatesWithError: Observable<NSError?> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didFinishDeferredUpdatesWithError:)))
|
||||
.map { a in
|
||||
return try castOptionalOrThrow(NSError.self, a[1])
|
||||
}
|
||||
|
|
@ -64,8 +64,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didPauseLocationUpdates: Observable<Void> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManagerDidPauseLocationUpdates(_:)))
|
||||
public var didPauseLocationUpdates: Observable<Void> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManagerDidPauseLocationUpdates(_:)))
|
||||
.map { _ in
|
||||
return ()
|
||||
}
|
||||
|
|
@ -74,8 +74,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didResumeLocationUpdates: Observable<Void> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManagerDidResumeLocationUpdates(_:)))
|
||||
public var didResumeLocationUpdates: Observable<Void> {
|
||||
return delegate.observe( #selector(CLLocationManagerDelegate.locationManagerDidResumeLocationUpdates(_:)))
|
||||
.map { _ in
|
||||
return ()
|
||||
}
|
||||
|
|
@ -86,8 +86,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didUpdateHeading: Observable<CLHeading> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didUpdateHeading:)))
|
||||
public var didUpdateHeading: Observable<CLHeading> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didUpdateHeading:)))
|
||||
.map { a in
|
||||
return try castOrThrow(CLHeading.self, a[1])
|
||||
}
|
||||
|
|
@ -98,8 +98,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didEnterRegion: Observable<CLRegion> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didEnterRegion:)))
|
||||
public var didEnterRegion: Observable<CLRegion> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didEnterRegion:)))
|
||||
.map { a in
|
||||
return try castOrThrow(CLRegion.self, a[1])
|
||||
}
|
||||
|
|
@ -108,8 +108,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didExitRegion: Observable<CLRegion> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didExitRegion:)))
|
||||
public var didExitRegion: Observable<CLRegion> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didExitRegion:)))
|
||||
.map { a in
|
||||
return try castOrThrow(CLRegion.self, a[1])
|
||||
}
|
||||
|
|
@ -123,11 +123,11 @@ extension CLLocationManager {
|
|||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
@available(OSX 10.10, *)
|
||||
public var rx_didDetermineStateForRegion: Observable<(state: CLRegionState, region: CLRegion)> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didDetermineState:forRegion:)))
|
||||
public var didDetermineStateForRegion: Observable<(state: CLRegionState, region: CLRegion)> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didDetermineState:for:)))
|
||||
.map { a in
|
||||
let stateNumber = try castOrThrow(NSNumber.self, a[1])
|
||||
let state = CLRegionState(rawValue: stateNumber.integerValue) ?? CLRegionState.Unknown
|
||||
let state = CLRegionState(rawValue: stateNumber.intValue) ?? CLRegionState.unknown
|
||||
let region = try castOrThrow(CLRegion.self, a[2])
|
||||
return (state: state, region: region)
|
||||
}
|
||||
|
|
@ -136,8 +136,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_monitoringDidFailForRegionWithError: Observable<(region: CLRegion?, error: NSError)> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:monitoringDidFailForRegion:withError:)))
|
||||
public var monitoringDidFailForRegionWithError: Observable<(region: CLRegion?, error: NSError)> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:monitoringDidFailFor:withError:)))
|
||||
.map { a in
|
||||
let region = try castOptionalOrThrow(CLRegion.self, a[1])
|
||||
let error = try castOrThrow(NSError.self, a[2])
|
||||
|
|
@ -148,8 +148,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didStartMonitoringForRegion: Observable<CLRegion> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didStartMonitoringForRegion:)))
|
||||
public var didStartMonitoringForRegion: Observable<CLRegion> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didStartMonitoringFor:)))
|
||||
.map { a in
|
||||
return try castOrThrow(CLRegion.self, a[1])
|
||||
}
|
||||
|
|
@ -164,8 +164,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didRangeBeaconsInRegion: Observable<(beacons: [CLBeacon], region: CLBeaconRegion)> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didRangeBeacons:inRegion:)))
|
||||
public var didRangeBeaconsInRegion: Observable<(beacons: [CLBeacon], region: CLBeaconRegion)> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didRangeBeacons:in:)))
|
||||
.map { a in
|
||||
let beacons = try castOrThrow([CLBeacon].self, a[1])
|
||||
let region = try castOrThrow(CLBeaconRegion.self, a[2])
|
||||
|
|
@ -176,8 +176,8 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion, error: NSError)> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:rangingBeaconsDidFailForRegion:withError:)))
|
||||
public var rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion, error: NSError)> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:rangingBeaconsDidFailFor:withError:)))
|
||||
.map { a in
|
||||
let region = try castOrThrow(CLBeaconRegion.self, a[1])
|
||||
let error = try castOrThrow(NSError.self, a[2])
|
||||
|
|
@ -191,8 +191,8 @@ extension CLLocationManager {
|
|||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
@available(iOS 8.0, *)
|
||||
public var rx_didVisit: Observable<CLVisit> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didVisit:)))
|
||||
public var didVisit: Observable<CLVisit> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didVisit:)))
|
||||
.map { a in
|
||||
return try castOrThrow(CLVisit.self, a[1])
|
||||
}
|
||||
|
|
@ -205,11 +205,11 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didChangeAuthorizationStatus: Observable<CLAuthorizationStatus> {
|
||||
return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didChangeAuthorizationStatus:)))
|
||||
public var didChangeAuthorizationStatus: Observable<CLAuthorizationStatus> {
|
||||
return delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didChangeAuthorization:)))
|
||||
.map { a in
|
||||
let number = try castOrThrow(NSNumber.self, a[1])
|
||||
return CLAuthorizationStatus(rawValue: Int32(number.integerValue)) ?? .NotDetermined
|
||||
return CLAuthorizationStatus(rawValue: Int32(number.intValue)) ?? .notDetermined
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public struct ControlEvent<PropertyType> : ControlEventType {
|
|||
- parameter events: Observable sequence that represents events.
|
||||
- returns: Control event created with a observable sequence of events.
|
||||
*/
|
||||
public init<Ev: ObservableType where Ev.E == E>(events: Ev) {
|
||||
public init<Ev: ObservableType>(events: Ev) where Ev.E == E {
|
||||
_events = events.subscribeOn(ConcurrentMainScheduler.instance)
|
||||
}
|
||||
|
||||
|
|
@ -64,14 +64,14 @@ public struct ControlEvent<PropertyType> : ControlEventType {
|
|||
- parameter observer: Observer to subscribe to events.
|
||||
- returns: Disposable object that can be used to unsubscribe the observer from receiving control events.
|
||||
*/
|
||||
public func subscribe<O : ObserverType where O.E == E>(observer: O) -> Disposable {
|
||||
public func subscribe<O : ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
return _events.subscribe(observer)
|
||||
}
|
||||
|
||||
/**
|
||||
- returns: `Observable` interface.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asObservable() -> Observable<E> {
|
||||
return _events
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ public struct ControlEvent<PropertyType> : ControlEventType {
|
|||
/**
|
||||
- returns: `ControlEvent` interface.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asControlEvent() -> ControlEvent<E> {
|
||||
return self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public struct ControlProperty<PropertyType> : ControlPropertyType {
|
|||
- returns: Control property created with a observable sequence of values and an observer that enables binding values
|
||||
to property.
|
||||
*/
|
||||
public init<V: ObservableType, S: ObserverType where E == V.E, E == S.E>(values: V, valueSink: S) {
|
||||
public init<V: ObservableType, S: ObserverType>(values: V, valueSink: S) where E == V.E, E == S.E {
|
||||
_values = values.subscribeOn(ConcurrentMainScheduler.instance)
|
||||
_valueSink = valueSink.asObserver()
|
||||
}
|
||||
|
|
@ -70,14 +70,14 @@ public struct ControlProperty<PropertyType> : ControlPropertyType {
|
|||
- parameter observer: Observer to subscribe to property values.
|
||||
- returns: Disposable object that can be used to unsubscribe the observer from receiving control property values.
|
||||
*/
|
||||
public func subscribe<O : ObserverType where O.E == E>(observer: O) -> Disposable {
|
||||
public func subscribe<O : ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
return _values.subscribe(observer)
|
||||
}
|
||||
|
||||
/**
|
||||
- returns: `Observable` interface.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asObservable() -> Observable<E> {
|
||||
return _values
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ public struct ControlProperty<PropertyType> : ControlPropertyType {
|
|||
/**
|
||||
- returns: `ControlProperty` interface.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asControlProperty() -> ControlProperty<E> {
|
||||
return self
|
||||
}
|
||||
|
|
@ -97,13 +97,13 @@ public struct ControlProperty<PropertyType> : ControlPropertyType {
|
|||
- In case error is received, DEBUG buids raise fatal error, RELEASE builds log event to standard output.
|
||||
- In case sequence completes, nothing happens.
|
||||
*/
|
||||
public func on(event: Event<E>) {
|
||||
public func on(_ event: Event<E>) {
|
||||
switch event {
|
||||
case .Error(let error):
|
||||
case .error(let error):
|
||||
bindingErrorToInterface(error)
|
||||
case .Next:
|
||||
case .next:
|
||||
_valueSink.on(event)
|
||||
case .Completed:
|
||||
case .completed:
|
||||
_valueSink.on(event)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ extension ControlEvent {
|
|||
|
||||
`ControlEvent` already can't fail, so no special case needs to be handled.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asDriver() -> Driver<E> {
|
||||
return self.asDriver { (error) -> Driver<E> in
|
||||
#if DEBUG
|
||||
|
|
@ -27,4 +27,4 @@ extension ControlEvent {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ extension ControlProperty {
|
|||
|
||||
`ControlProperty` already can't fail, so no special case needs to be handled.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asDriver() -> Driver<E> {
|
||||
return self.asDriver { (error) -> Driver<E> in
|
||||
#if DEBUG
|
||||
|
|
@ -27,4 +27,4 @@ extension ControlProperty {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<O1: DriverConvertibleType, O2: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(),
|
||||
|
|
@ -43,9 +43,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<O1: DriverConvertibleType, O2: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(),
|
||||
|
|
@ -67,9 +67,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(),
|
||||
|
|
@ -87,9 +87,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(),
|
||||
|
|
@ -111,9 +111,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(),
|
||||
|
|
@ -131,9 +131,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(),
|
||||
|
|
@ -155,9 +155,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(),
|
||||
|
|
@ -175,9 +175,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(),
|
||||
|
|
@ -199,9 +199,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType, O6: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(),
|
||||
|
|
@ -219,9 +219,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType, O6: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(),
|
||||
|
|
@ -243,9 +243,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType, O6: DriverConvertibleType, O7: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(),
|
||||
|
|
@ -263,9 +263,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType, O6: DriverConvertibleType, O7: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(),
|
||||
|
|
@ -287,9 +287,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType, O6: DriverConvertibleType, O7: DriverConvertibleType, O8: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(), source8.asDriver().asObservable(),
|
||||
|
|
@ -307,9 +307,9 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<O1: DriverConvertibleType, O2: DriverConvertibleType, O3: DriverConvertibleType, O4: DriverConvertibleType, O5: DriverConvertibleType, O6: DriverConvertibleType, O7: DriverConvertibleType, O8: DriverConvertibleType>
|
||||
(source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E)
|
||||
(_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), source7.asDriver().asObservable(), source8.asDriver().asObservable(),
|
||||
|
|
@ -320,3 +320,4 @@ extension Driver {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public static func zip<<%= (Array(1...i).map { "O\($0): DriverConvertibleType" }).joinWithSeparator(", ") %>>
|
||||
(<%= (Array(1...i).map { "source\($0): O\($0)" }).joinWithSeparator(", _ ") %>, resultSelector: (<%= (Array(1...i).map { "O\($0).E" }).joinWithSeparator(", ") %>) throws -> E)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func zip<<%= (Array(1...i).map { "O\($0): DriverConvertibleType" }).joined(separator: ", ") %>>
|
||||
(<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).E" }).joined(separator: ", ") %>) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.zip(
|
||||
<%= (Array(1...i).map { "source\($0).asDriver().asObservable()" }).joinWithSeparator(", ") %>,
|
||||
<%= (Array(1...i).map { "source\($0).asDriver().asObservable()" }).joined(separator: ", ") %>,
|
||||
resultSelector: resultSelector
|
||||
)
|
||||
|
||||
|
|
@ -42,12 +42,12 @@ extension Driver {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public static func combineLatest<<%= (Array(1...i).map { "O\($0): DriverConvertibleType" }).joinWithSeparator(", ") %>>
|
||||
(<%= (Array(1...i).map { "source\($0): O\($0)" }).joinWithSeparator(", _ ") %>, resultSelector: (<%= (Array(1...i).map { "O\($0).E" }).joinWithSeparator(", ") %>) throws -> E)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func combineLatest<<%= (Array(1...i).map { "O\($0): DriverConvertibleType" }).joined(separator: ", ") %>>
|
||||
(<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).E" }).joined(separator: ", ") %>) throws -> E)
|
||||
-> Driver<E> {
|
||||
let source = Observable.combineLatest(
|
||||
<%= (Array(1...i).map { "source\($0).asDriver().asObservable()" }).joinWithSeparator(", ") %>,
|
||||
<%= (Array(1...i).map { "source\($0).asDriver().asObservable()" }).joined(separator: ", ") %>,
|
||||
resultSelector: resultSelector
|
||||
)
|
||||
|
||||
|
|
@ -55,4 +55,4 @@ extension Driver {
|
|||
}
|
||||
}
|
||||
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ extension DriverConvertibleType {
|
|||
- parameter selector: A transform function to apply to each source element.
|
||||
- returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func map<R>(selector: E -> R) -> Driver<R> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func map<R>(_ selector: @escaping (E) -> R) -> Driver<R> {
|
||||
let source = self
|
||||
.asObservable()
|
||||
.map(selector)
|
||||
|
|
@ -37,8 +37,8 @@ extension DriverConvertibleType {
|
|||
- parameter predicate: A function to test each source element for a condition.
|
||||
- returns: An observable sequence that contains elements from the input sequence that satisfy the condition.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func filter(predicate: (E) -> Bool) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func filter(_ predicate: @escaping (E) -> Bool) -> Driver<E> {
|
||||
let source = self
|
||||
.asObservable()
|
||||
.filter(predicate)
|
||||
|
|
@ -58,7 +58,7 @@ extension DriverConvertibleType where E : DriverConvertibleType {
|
|||
|
||||
- returns: The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func switchLatest() -> Driver<E.E> {
|
||||
let source: Observable<E.E> = self
|
||||
.asObservable()
|
||||
|
|
@ -80,8 +80,8 @@ extension DriverConvertibleType {
|
|||
- returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an
|
||||
Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func flatMapLatest<R>(selector: (E) -> Driver<R>)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func flatMapLatest<R>(_ selector: @escaping (E) -> Driver<R>)
|
||||
-> Driver<R> {
|
||||
let source: Observable<R> = self
|
||||
.asObservable()
|
||||
|
|
@ -100,8 +100,8 @@ extension DriverConvertibleType {
|
|||
- parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel.
|
||||
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func flatMapFirst<R>(selector: (E) -> Driver<R>)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func flatMapFirst<R>(_ selector: @escaping (E) -> Driver<R>)
|
||||
-> Driver<R> {
|
||||
let source: Observable<R> = self
|
||||
.asObservable()
|
||||
|
|
@ -119,11 +119,12 @@ extension DriverConvertibleType {
|
|||
- parameter eventHandler: Action to invoke for each event in the observable sequence.
|
||||
- returns: The source sequence with the side-effecting behavior applied.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func doOn(eventHandler: (Event<E>) -> Void)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
@available(*, deprecated, renamed: "do(onNext:onError:onCompleted:)")
|
||||
public func doOn(_ eventHandler: @escaping (Event<E>) -> Void)
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.doOn(eventHandler)
|
||||
.doOn(eventHandler)
|
||||
|
||||
return Driver(source)
|
||||
}
|
||||
|
|
@ -136,8 +137,9 @@ extension DriverConvertibleType {
|
|||
- parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.
|
||||
- returns: The source sequence with the side-effecting behavior applied.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func doOn(onNext onNext: (E -> Void)? = nil, onError: (ErrorType -> Void)? = nil, onCompleted: (() -> Void)? = nil)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
@available(*, deprecated, renamed: "do(onNext:onError:onCompleted:)")
|
||||
public func doOn(onNext: ((E) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil)
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.doOn(onNext: onNext, onError: onError, onCompleted: onCompleted)
|
||||
|
|
@ -151,10 +153,11 @@ extension DriverConvertibleType {
|
|||
- parameter onNext: Action to invoke for each element in the observable sequence.
|
||||
- returns: The source sequence with the side-effecting behavior applied.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func doOnNext(onNext: (E -> Void))
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
@available(*, deprecated, renamed: "do(onNext:)")
|
||||
public func doOnNext(_ onNext: @escaping (E) -> Void)
|
||||
-> Driver<E> {
|
||||
return self.doOn(onNext: onNext)
|
||||
return self.do(onNext: onNext)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -163,10 +166,30 @@ extension DriverConvertibleType {
|
|||
- parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.
|
||||
- returns: The source sequence with the side-effecting behavior applied.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func doOnCompleted(onCompleted: (() -> Void))
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
@available(*, deprecated, renamed: "do(onCompleted:)")
|
||||
public func doOnCompleted(_ onCompleted: @escaping () -> Void)
|
||||
-> Driver<E> {
|
||||
return self.doOn(onCompleted: onCompleted)
|
||||
return self.do(onCompleted: onCompleted)
|
||||
}
|
||||
|
||||
/**
|
||||
Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.
|
||||
|
||||
- parameter onNext: Action to invoke for each element in the observable sequence.
|
||||
- parameter onError: Action to invoke upon errored termination of the observable sequence. This callback will never be invoked since driver can't error out.
|
||||
- parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.
|
||||
- parameter onSubscribe: Action to invoke before subscribing to source observable sequence.
|
||||
- parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.
|
||||
- returns: The source sequence with the side-effecting behavior applied.
|
||||
*/
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func `do`(onNext: ((E) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onSubscribe: (() -> ())? = nil, onDispose: (() -> ())? = nil)
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.do(onNext: onNext, onError: onError, onCompleted: onCompleted, onSubscribe: onSubscribe, onDispose: onDispose)
|
||||
|
||||
return Driver(source)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,8 +202,8 @@ extension DriverConvertibleType {
|
|||
- parameter identifier: Identifier that is printed together with event description to standard output.
|
||||
- returns: An observable sequence whose events are printed to standard output.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func debug(identifier: String? = nil, file: String = #file, line: UInt = #line, function: String = #function) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func debug(_ identifier: String? = nil, file: String = #file, line: UInt = #line, function: String = #function) -> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.debug(identifier, file: file, line: line, function: function)
|
||||
return Driver(source)
|
||||
|
|
@ -195,7 +218,7 @@ extension DriverConvertibleType where E: Equatable {
|
|||
|
||||
- returns: An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func distinctUntilChanged()
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
|
|
@ -213,8 +236,8 @@ extension DriverConvertibleType {
|
|||
- parameter keySelector: A function to compute the comparison key for each element.
|
||||
- returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func distinctUntilChanged<K: Equatable>(keySelector: (E) -> K) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func distinctUntilChanged<K: Equatable>(_ keySelector: @escaping (E) -> K) -> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.distinctUntilChanged(keySelector, comparer: { $0 == $1 })
|
||||
return Driver(source)
|
||||
|
|
@ -226,8 +249,8 @@ extension DriverConvertibleType {
|
|||
- parameter comparer: Equality comparer for computed key values.
|
||||
- returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func distinctUntilChanged(comparer: (lhs: E, rhs: E) -> Bool) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func distinctUntilChanged(_ comparer: @escaping (E, E) -> Bool) -> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.distinctUntilChanged({ $0 }, comparer: comparer)
|
||||
return Driver(source)
|
||||
|
|
@ -240,8 +263,8 @@ extension DriverConvertibleType {
|
|||
- parameter comparer: Equality comparer for computed key values.
|
||||
- returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func distinctUntilChanged<K>(keySelector: (E) -> K, comparer: (lhs: K, rhs: K) -> Bool) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func distinctUntilChanged<K>(_ keySelector: @escaping (E) -> K, comparer: @escaping (K, K) -> Bool) -> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.distinctUntilChanged(keySelector, comparer: comparer)
|
||||
return Driver(source)
|
||||
|
|
@ -258,8 +281,8 @@ extension DriverConvertibleType {
|
|||
- parameter selector: A transform function to apply to each element.
|
||||
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func flatMap<R>(selector: (E) -> Driver<R>) -> Driver<R> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func flatMap<R>(_ selector: @escaping (E) -> Driver<R>) -> Driver<R> {
|
||||
let source = self.asObservable()
|
||||
.flatMap(selector)
|
||||
|
||||
|
|
@ -276,7 +299,7 @@ extension DriverConvertibleType where E : DriverConvertibleType {
|
|||
- parameter maxConcurrent: Maximum number of inner observable sequences being subscribed to concurrently.
|
||||
- returns: The observable sequence that merges the elements of the observable sequences.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func merge() -> Driver<E.E> {
|
||||
let source = self.asObservable()
|
||||
.map { $0.asDriver() }
|
||||
|
|
@ -289,8 +312,8 @@ extension DriverConvertibleType where E : DriverConvertibleType {
|
|||
|
||||
- returns: The observable sequence that merges the elements of the inner sequences.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func merge(maxConcurrent maxConcurrent: Int)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func merge(maxConcurrent: Int)
|
||||
-> Driver<E.E> {
|
||||
let source = self.asObservable()
|
||||
.map { $0.asDriver() }
|
||||
|
|
@ -310,8 +333,8 @@ extension DriverConvertibleType {
|
|||
- parameter dueTime: Throttling duration for each element.
|
||||
- returns: The throttled sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func throttle(dueTime: RxTimeInterval)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func throttle(_ dueTime: RxTimeInterval)
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.throttle(dueTime, scheduler: driverObserveOnScheduler)
|
||||
|
|
@ -327,8 +350,8 @@ extension DriverConvertibleType {
|
|||
- parameter dueTime: Throttling duration for each element.
|
||||
- returns: The throttled sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func debounce(dueTime: RxTimeInterval)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func debounce(_ dueTime: RxTimeInterval)
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.debounce(dueTime, scheduler: driverObserveOnScheduler)
|
||||
|
|
@ -348,8 +371,8 @@ extension DriverConvertibleType {
|
|||
- parameter accumulator: An accumulator function to be invoked on each element.
|
||||
- returns: An observable sequence containing the accumulated values.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func scan<A>(seed: A, accumulator: (A, E) -> A)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func scan<A>(_ seed: A, accumulator: @escaping (A, E) -> A)
|
||||
-> Driver<A> {
|
||||
let source = self.asObservable()
|
||||
.scan(seed, accumulator: accumulator)
|
||||
|
|
@ -358,29 +381,29 @@ extension DriverConvertibleType {
|
|||
}
|
||||
|
||||
// MARK: concat
|
||||
extension SequenceType where Generator.Element : DriverConvertibleType {
|
||||
extension Sequence where Iterator.Element : DriverConvertibleType {
|
||||
|
||||
/**
|
||||
Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.
|
||||
|
||||
- returns: An observable sequence that contains the elements of each given sequence, in sequential order.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func concat()
|
||||
-> Driver<Generator.Element.E> {
|
||||
-> Driver<Iterator.Element.E> {
|
||||
let source = self.lazy.map { $0.asDriver().asObservable() }.concat()
|
||||
return Driver<Generator.Element.E>(source)
|
||||
return Driver<Iterator.Element.E>(source)
|
||||
}
|
||||
}
|
||||
|
||||
extension CollectionType where Generator.Element : DriverConvertibleType {
|
||||
extension Collection where Iterator.Element : DriverConvertibleType {
|
||||
|
||||
/**
|
||||
Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.
|
||||
|
||||
- returns: An observable sequence that contains the elements of each given sequence, in sequential order.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func concat()
|
||||
-> Driver<Generator.Element.E> {
|
||||
let source = self.map { $0.asDriver().asObservable() }.concat()
|
||||
|
|
@ -389,7 +412,7 @@ extension CollectionType where Generator.Element : DriverConvertibleType {
|
|||
}
|
||||
|
||||
// MARK: zip
|
||||
extension CollectionType where Generator.Element : DriverConvertibleType {
|
||||
extension Collection where Iterator.Element : DriverConvertibleType {
|
||||
|
||||
/**
|
||||
Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
|
||||
|
|
@ -397,15 +420,15 @@ extension CollectionType where Generator.Element : DriverConvertibleType {
|
|||
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func zip<R>(resultSelector: [Generator.Element.E] throws -> R) -> Driver<R> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func zip<R>(_ resultSelector: @escaping ([Generator.Element.E]) throws -> R) -> Driver<R> {
|
||||
let source = self.map { $0.asDriver().asObservable() }.zip(resultSelector)
|
||||
return Driver<R>(source)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: combineLatest
|
||||
extension CollectionType where Generator.Element : DriverConvertibleType {
|
||||
extension Collection where Iterator.Element : DriverConvertibleType {
|
||||
|
||||
/**
|
||||
Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
|
||||
|
|
@ -413,8 +436,8 @@ extension CollectionType where Generator.Element : DriverConvertibleType {
|
|||
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
|
||||
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func combineLatest<R>(resultSelector: [Generator.Element.E] throws -> R) -> Driver<R> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func combineLatest<R>(_ resultSelector: @escaping ([Generator.Element.E]) throws -> R) -> Driver<R> {
|
||||
let source = self.map { $0.asDriver().asObservable() }.combineLatest(resultSelector)
|
||||
return Driver<R>(source)
|
||||
}
|
||||
|
|
@ -430,7 +453,7 @@ extension DriverConvertibleType {
|
|||
- parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.
|
||||
- returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function.
|
||||
*/
|
||||
public func withLatestFrom<SecondO: DriverConvertibleType, ResultType>(second: SecondO, resultSelector: (E, SecondO.E) -> ResultType) -> Driver<ResultType> {
|
||||
public func withLatestFrom<SecondO: DriverConvertibleType, ResultType>(_ second: SecondO, resultSelector: @escaping (E, SecondO.E) -> ResultType) -> Driver<ResultType> {
|
||||
let source = self.asObservable()
|
||||
.withLatestFrom(second.asDriver(), resultSelector: resultSelector)
|
||||
|
||||
|
|
@ -443,7 +466,7 @@ extension DriverConvertibleType {
|
|||
- parameter second: Second observable source.
|
||||
- returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function.
|
||||
*/
|
||||
public func withLatestFrom<SecondO: DriverConvertibleType>(second: SecondO) -> Driver<SecondO.E> {
|
||||
public func withLatestFrom<SecondO: DriverConvertibleType>(_ second: SecondO) -> Driver<SecondO.E> {
|
||||
let source = self.asObservable()
|
||||
.withLatestFrom(second.asDriver())
|
||||
|
||||
|
|
@ -462,8 +485,8 @@ extension DriverConvertibleType {
|
|||
- parameter count: The number of elements to skip before returning the remaining elements.
|
||||
- returns: An observable sequence that contains the elements that occur after the specified index in the input sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func skip(count: Int)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func skip(_ count: Int)
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.skip(count)
|
||||
|
|
@ -482,12 +505,12 @@ extension DriverConvertibleType {
|
|||
- parameter element: Element to prepend to the specified sequence.
|
||||
- returns: The source sequence prepended with the specified values.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func startWith(element: E)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func startWith(_ element: E)
|
||||
-> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.startWith(element)
|
||||
|
||||
return Driver(source)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ extension DriverConvertibleType {
|
|||
- parameter observer: Observer that receives events.
|
||||
- returns: Disposable object that can be used to unsubscribe the observer from the subject.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func drive<O: ObserverType where O.E == E>(observer: O) -> Disposable {
|
||||
MainScheduler.ensureExecutingOnScheduler(driverErrorMessage)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.ud")
|
||||
public func drive<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
|
||||
return self.asObservable().subscribe(observer)
|
||||
}
|
||||
|
||||
|
|
@ -37,9 +37,9 @@ extension DriverConvertibleType {
|
|||
- parameter variable: Target variable for sequence elements.
|
||||
- returns: Disposable object that can be used to unsubscribe the observer from the variable.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func drive(variable: Variable<E>) -> Disposable {
|
||||
MainScheduler.ensureExecutingOnScheduler(driverErrorMessage)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.ud")
|
||||
public func drive(_ variable: Variable<E>) -> Disposable {
|
||||
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
|
||||
return drive(onNext: { e in
|
||||
variable.value = e
|
||||
})
|
||||
|
|
@ -52,9 +52,9 @@ extension DriverConvertibleType {
|
|||
- parameter with: Function used to bind elements from `self`.
|
||||
- returns: Object representing subscription.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func drive<R>(transformation: Observable<E> -> R) -> R {
|
||||
MainScheduler.ensureExecutingOnScheduler(driverErrorMessage)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.ud")
|
||||
public func drive<R>(_ transformation: (Observable<E>) -> R) -> R {
|
||||
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
|
||||
return transformation(self.asObservable())
|
||||
}
|
||||
|
||||
|
|
@ -72,9 +72,9 @@ extension DriverConvertibleType {
|
|||
- parameter curriedArgument: Final argument passed to `binder` to finish binding process.
|
||||
- returns: Object representing subscription.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func drive<R1, R2>(with: Observable<E> -> R1 -> R2, curriedArgument: R1) -> R2 {
|
||||
MainScheduler.ensureExecutingOnScheduler(driverErrorMessage)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.ud")
|
||||
public func drive<R1, R2>(_ with: (Observable<E>) -> (R1) -> R2, curriedArgument: R1) -> R2 {
|
||||
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
|
||||
return with(self.asObservable())(curriedArgument)
|
||||
}
|
||||
|
||||
|
|
@ -91,9 +91,9 @@ extension DriverConvertibleType {
|
|||
gracefully completed, errored, or if the generation is cancelled by disposing subscription)
|
||||
- returns: Subscription object used to unsubscribe from the observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func drive(onNext onNext: ((E) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) -> Disposable {
|
||||
MainScheduler.ensureExecutingOnScheduler(driverErrorMessage)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.ud")
|
||||
public func drive(onNext: ((E) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) -> Disposable {
|
||||
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
|
||||
return self.asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed)
|
||||
}
|
||||
|
||||
|
|
@ -104,10 +104,11 @@ extension DriverConvertibleType {
|
|||
- parameter onNext: Action to invoke for each element in the observable sequence.
|
||||
- returns: Subscription object used to unsubscribe from the observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func driveNext(onNext: E -> Void) -> Disposable {
|
||||
MainScheduler.ensureExecutingOnScheduler(driverErrorMessage)
|
||||
return self.asObservable().subscribeNext(onNext)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.ud")
|
||||
@available(*, deprecated, renamed: "drive(onNext:)")
|
||||
public func driveNext(_ onNext: @escaping (E) -> Void) -> Disposable {
|
||||
MainScheduler.ensureExecutingOnScheduler(errorMessage: driverErrorMessage)
|
||||
return self.asObservable().subscribe(onNext: onNext)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ public protocol DriverConvertibleType : ObservableConvertibleType {
|
|||
/**
|
||||
Converts self to `Driver`.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
func asDriver() -> Driver<E>
|
||||
}
|
||||
|
||||
extension DriverConvertibleType {
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asObservable() -> Observable<E> {
|
||||
return asDriver().asObservable()
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ public struct Driver<Element> : DriverConvertibleType {
|
|||
/**
|
||||
- returns: Built observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asObservable() -> Observable<E> {
|
||||
return _source
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ public struct Driver<Element> : DriverConvertibleType {
|
|||
/**
|
||||
- returns: `self`
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asDriver() -> Driver<E> {
|
||||
return self
|
||||
}
|
||||
|
|
@ -97,9 +97,9 @@ extension Driver {
|
|||
|
||||
- returns: An observable sequence with no elements.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func empty() -> Driver<E> {
|
||||
return Driver(raw: Observable.empty().subscribeOn(driverSubscribeOnScheduler))
|
||||
return Driver(Observable.empty().subscribeOn(driverSubscribeOnScheduler))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -107,9 +107,9 @@ extension Driver {
|
|||
|
||||
- returns: An observable sequence whose observers will never get called.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func never() -> Driver<E> {
|
||||
return Driver(raw: Observable.never().subscribeOn(driverSubscribeOnScheduler))
|
||||
return Driver(Observable.never().subscribeOn(driverSubscribeOnScheduler))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -118,9 +118,9 @@ extension Driver {
|
|||
- parameter element: Single element in the resulting observable sequence.
|
||||
- returns: An observable sequence containing the single specified element.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public static func just(element: E) -> Driver<E> {
|
||||
return Driver(raw: Observable.just(element).subscribeOn(driverSubscribeOnScheduler))
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func just(_ element: E) -> Driver<E> {
|
||||
return Driver(Observable.just(element).subscribeOn(driverSubscribeOnScheduler))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -129,8 +129,8 @@ extension Driver {
|
|||
- parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence.
|
||||
- returns: An observable sequence whose observers trigger an invocation of the given observable factory function.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public static func deferred(observableFactory: () -> Driver<E>)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func deferred(_ observableFactory: @escaping () -> Driver<E>)
|
||||
-> Driver<E> {
|
||||
return Driver(Observable.deferred { observableFactory().asObservable() })
|
||||
}
|
||||
|
|
@ -143,14 +143,14 @@ extension Driver {
|
|||
- parameter elements: Elements to generate.
|
||||
- returns: The observable sequence whose elements are pulled from the given arguments.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public static func of(elements: E ...) -> Driver<E> {
|
||||
let source = elements.toObservable(driverSubscribeOnScheduler)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func of(_ elements: E ...) -> Driver<E> {
|
||||
let source = Observable.from(elements, scheduler: driverSubscribeOnScheduler)
|
||||
return Driver(raw: source)
|
||||
}
|
||||
}
|
||||
|
||||
extension Driver where Element : SignedIntegerType {
|
||||
extension Driver where Element : SignedInteger {
|
||||
/**
|
||||
Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.
|
||||
|
||||
|
|
@ -159,8 +159,8 @@ extension Driver where Element : SignedIntegerType {
|
|||
- parameter period: Period for producing the values in the resulting sequence.
|
||||
- returns: An observable sequence that produces a value after each period.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public static func interval(period: RxTimeInterval)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func interval(_ period: RxTimeInterval)
|
||||
-> Driver<E> {
|
||||
return Driver(Observable.interval(period, scheduler: driverObserveOnScheduler))
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ extension Driver where Element : SignedIntegerType {
|
|||
|
||||
// MARK: timer
|
||||
|
||||
extension Driver where Element: SignedIntegerType {
|
||||
extension Driver where Element: SignedInteger {
|
||||
/**
|
||||
Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.
|
||||
|
||||
|
|
@ -178,8 +178,8 @@ extension Driver where Element: SignedIntegerType {
|
|||
- parameter period: Period to produce subsequent values.
|
||||
- returns: An observable sequence that produces a value after due time has elapsed and then each period.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public static func timer(dueTime: RxTimeInterval, period: RxTimeInterval)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval)
|
||||
-> Driver<E> {
|
||||
return Driver(Observable.timer(dueTime, period: period, scheduler: driverObserveOnScheduler))
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ extension Driver where Element: SignedIntegerType {
|
|||
|
||||
**This shouldn't be used in normal release builds.**
|
||||
*/
|
||||
public func driveOnScheduler(scheduler: SchedulerType, action: () -> ()) {
|
||||
public func driveOnScheduler(_ scheduler: SchedulerType, action: () -> ()) {
|
||||
let originalObserveOnScheduler = driverObserveOnScheduler
|
||||
let originalSubscribeOnScheduler = driverSubscribeOnScheduler
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ public func driveOnScheduler(scheduler: SchedulerType, action: () -> ()) {
|
|||
driverSubscribeOnScheduler = originalSubscribeOnScheduler
|
||||
}
|
||||
|
||||
func _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(scheduler: SchedulerType) {
|
||||
func _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(_ scheduler: SchedulerType) {
|
||||
let a: Int32 = 1
|
||||
let b = 314 + Int32(arc4random() & 1)
|
||||
if a == b {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ extension ObservableConvertibleType {
|
|||
- parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence.
|
||||
- returns: Driving observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func asDriver(onErrorJustReturn onErrorJustReturn: E) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asDriver(onErrorJustReturn: E) -> Driver<E> {
|
||||
let source = self
|
||||
.asObservable()
|
||||
.observeOn(driverObserveOnScheduler)
|
||||
|
|
@ -33,8 +33,8 @@ extension ObservableConvertibleType {
|
|||
- parameter onErrorDriveWith: Driver that continues to drive the sequence in case of error.
|
||||
- returns: Driving observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func asDriver(onErrorDriveWith onErrorDriveWith: Driver<E>) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asDriver(onErrorDriveWith: Driver<E>) -> Driver<E> {
|
||||
let source = self
|
||||
.asObservable()
|
||||
.observeOn(driverObserveOnScheduler)
|
||||
|
|
@ -50,14 +50,14 @@ extension ObservableConvertibleType {
|
|||
- parameter onErrorRecover: Calculates driver that continues to drive the sequence in case of error.
|
||||
- returns: Driving observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func asDriver(onErrorRecover onErrorRecover: (error: ErrorType) -> Driver<E>) -> Driver<E> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asDriver(onErrorRecover: @escaping (_ error: Swift.Error) -> Driver<E>) -> Driver<E> {
|
||||
let source = self
|
||||
.asObservable()
|
||||
.observeOn(driverObserveOnScheduler)
|
||||
.catchError { error in
|
||||
onErrorRecover(error: error).asObservable()
|
||||
onErrorRecover(error).asObservable()
|
||||
}
|
||||
return Driver(source)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ extension Variable {
|
|||
|
||||
- returns: Driving observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func asDriver() -> Driver<E> {
|
||||
let source = self.asObservable()
|
||||
.observeOn(driverObserveOnScheduler)
|
||||
return Driver(source)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Observer that enforces interface binding rules:
|
|||
|
||||
`UIBindingObserver` doesn't retain target interface and in case owned interface element is released, element isn't bound.
|
||||
*/
|
||||
public class UIBindingObserver<UIElementType, Value where UIElementType: AnyObject> : ObserverType {
|
||||
public class UIBindingObserver<UIElementType, Value> : ObserverType where UIElementType: AnyObject {
|
||||
public typealias E = Value
|
||||
|
||||
weak var UIElement: UIElementType?
|
||||
|
|
@ -28,7 +28,7 @@ public class UIBindingObserver<UIElementType, Value where UIElementType: AnyObje
|
|||
/**
|
||||
Initializes `ViewBindingObserver` using
|
||||
*/
|
||||
public init(UIElement: UIElementType, binding: (UIElementType, Value) -> Void) {
|
||||
public init(UIElement: UIElementType, binding: @escaping (UIElementType, Value) -> Void) {
|
||||
self.UIElement = UIElement
|
||||
self.binding = binding
|
||||
}
|
||||
|
|
@ -36,17 +36,17 @@ public class UIBindingObserver<UIElementType, Value where UIElementType: AnyObje
|
|||
/**
|
||||
Binds next element to owner view as described in `binding`.
|
||||
*/
|
||||
public func on(event: Event<Value>) {
|
||||
MainScheduler.ensureExecutingOnScheduler("Element can be bound to user interface only on MainThread.")
|
||||
public func on(_ event: Event<Value>) {
|
||||
MainScheduler.ensureExecutingOnScheduler(errorMessage: "Element can be bound to user interface only on MainThread.")
|
||||
|
||||
switch event {
|
||||
case .Next(let element):
|
||||
case .next(let element):
|
||||
if let view = self.UIElement {
|
||||
binding(view, element)
|
||||
}
|
||||
case .Error(let error):
|
||||
case .error(let error):
|
||||
bindingErrorToInterface(error)
|
||||
case .Completed:
|
||||
case .completed:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Base class for `DelegateProxyType` protocol.
|
|||
|
||||
This implementation is not thread safe and can be used only from one thread (Main thread).
|
||||
*/
|
||||
public class DelegateProxy : _RXDelegateProxy {
|
||||
open class DelegateProxy : _RXDelegateProxy {
|
||||
|
||||
private var subjectsForSelector = [Selector: PublishSubject<[AnyObject]>]()
|
||||
|
||||
|
|
@ -66,15 +66,15 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
let internalSubject = PublishSubject<CGPoint>
|
||||
|
||||
public func requiredDelegateMethod(scrollView: UIScrollView, arg1: CGPoint) -> Bool {
|
||||
internalSubject.on(.Next(arg1))
|
||||
internalSubject.on(.next(arg1))
|
||||
return self._forwardToDelegate?.requiredDelegateMethod?(scrollView, arg1: arg1) ?? defaultReturnValue
|
||||
}
|
||||
|
||||
....
|
||||
|
||||
// reactive property implementation in a real class (`UIScrollView`)
|
||||
public var rx_property: Observable<CGPoint> {
|
||||
let proxy = RxScrollViewDelegateProxy.proxyForObject(self)
|
||||
public var property: Observable<CGPoint> {
|
||||
let proxy = RxScrollViewDelegateProxy.proxyForObject(base)
|
||||
return proxy.internalSubject.asObservable()
|
||||
}
|
||||
|
||||
|
|
@ -85,12 +85,12 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
- parameter selector: Selector used to filter observed invocations of delegate methods.
|
||||
- returns: Observable sequence of arguments passed to `selector` method.
|
||||
*/
|
||||
public func observe(selector: Selector) -> Observable<[AnyObject]> {
|
||||
if hasWiredImplementationForSelector(selector) {
|
||||
public func observe(_ selector: Selector) -> Observable<[AnyObject]> {
|
||||
if hasWiredImplementation(for: selector) {
|
||||
print("Delegate proxy is already implementing `\(selector)`, a more performant way of registering might exist.")
|
||||
}
|
||||
|
||||
if !self.respondsToSelector(selector) {
|
||||
if !self.responds(to: selector) {
|
||||
rxFatalError("This class doesn't respond to selector \(selector)")
|
||||
}
|
||||
|
||||
|
|
@ -108,8 +108,8 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
|
||||
// proxy
|
||||
|
||||
public override func interceptedSelector(selector: Selector, withArguments arguments: [AnyObject]!) {
|
||||
subjectsForSelector[selector]?.on(.Next(arguments))
|
||||
open override func interceptedSelector(_ selector: Selector, withArguments arguments: [Any]) {
|
||||
subjectsForSelector[selector]?.on(.next(arguments as [AnyObject]))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -117,7 +117,7 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
|
||||
- returns: Associated object tag.
|
||||
*/
|
||||
public class func delegateAssociatedObjectTag() -> UnsafePointer<Void> {
|
||||
public class func delegateAssociatedObjectTag() -> UnsafeRawPointer {
|
||||
return _pointer(&delegateAssociatedTag)
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
|
||||
- returns: Initialized instance of `self`.
|
||||
*/
|
||||
public class func createProxyForObject(object: AnyObject) -> AnyObject {
|
||||
public class func createProxyForObject(_ object: AnyObject) -> AnyObject {
|
||||
return self.init(parentObject: object)
|
||||
}
|
||||
|
||||
|
|
@ -136,9 +136,9 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
- parameter object: Object that can have assigned delegate proxy.
|
||||
- returns: Assigned delegate proxy or `nil` if no delegate proxy is assigned.
|
||||
*/
|
||||
public class func assignedProxyFor(object: AnyObject) -> AnyObject? {
|
||||
let maybeDelegate: AnyObject? = objc_getAssociatedObject(object, self.delegateAssociatedObjectTag())
|
||||
return castOptionalOrFatalError(maybeDelegate)
|
||||
public class func assignedProxyFor(_ object: AnyObject) -> AnyObject? {
|
||||
let maybeDelegate = objc_getAssociatedObject(object, self.delegateAssociatedObjectTag())
|
||||
return castOptionalOrFatalError(maybeDelegate.map { $0 as AnyObject })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -147,8 +147,8 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
- parameter object: Object that can have assigned delegate proxy.
|
||||
- parameter proxy: Delegate proxy object to assign to `object`.
|
||||
*/
|
||||
public class func assignProxy(proxy: AnyObject, toObject object: AnyObject) {
|
||||
precondition(proxy.isKindOfClass(self.classForCoder()))
|
||||
public class func assignProxy(_ proxy: AnyObject, toObject object: AnyObject) {
|
||||
precondition(proxy.isKind(of: self.classForCoder()))
|
||||
|
||||
objc_setAssociatedObject(object, self.delegateAssociatedObjectTag(), proxy, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
|
|
@ -160,8 +160,8 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
- parameter forwardToDelegate: Reference of delegate that receives all messages through `self`.
|
||||
- parameter retainDelegate: Should `self` retain `forwardToDelegate`.
|
||||
*/
|
||||
public func setForwardToDelegate(delegate: AnyObject?, retainDelegate: Bool) {
|
||||
self._setForwardToDelegate(delegate, retainDelegate: retainDelegate)
|
||||
public func setForwardToDelegate(_ delegate: AnyObject?, retainDelegate: Bool) {
|
||||
self._setForward(toDelegate: delegate, retainDelegate: retainDelegate)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -176,7 +176,7 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
|
||||
deinit {
|
||||
for v in subjectsForSelector.values {
|
||||
v.on(.Completed)
|
||||
v.on(.completed)
|
||||
}
|
||||
#if TRACE_RESOURCES
|
||||
OSAtomicDecrement32(&resourceCount)
|
||||
|
|
@ -185,7 +185,7 @@ public class DelegateProxy : _RXDelegateProxy {
|
|||
|
||||
// MARK: Pointer
|
||||
|
||||
class func _pointer(p: UnsafePointer<Void>) -> UnsafePointer<Void> {
|
||||
class func _pointer(_ p: UnsafeRawPointer) -> UnsafeRawPointer {
|
||||
return p
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ every view has a corresponding delegate virtual factory method.
|
|||
In case of UITableView / UIScrollView, there is
|
||||
|
||||
extension UIScrollView {
|
||||
public func rx_createDelegateProxy() -> RxScrollViewDelegateProxy {
|
||||
return RxScrollViewDelegateProxy(parentObject: self)
|
||||
public func createRxDelegateProxy() -> RxScrollViewDelegateProxy {
|
||||
return RxScrollViewDelegateProxy(parentObject: base)
|
||||
}
|
||||
....
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ In case of UITableView / UIScrollView, there is
|
|||
and override in UITableView
|
||||
|
||||
extension UITableView {
|
||||
public override func rx_createDelegateProxy() -> RxScrollViewDelegateProxy {
|
||||
public override func createRxDelegateProxy() -> RxScrollViewDelegateProxy {
|
||||
....
|
||||
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public protocol DelegateProxyType : AnyObject {
|
|||
/**
|
||||
Creates new proxy for target object.
|
||||
*/
|
||||
static func createProxyForObject(object: AnyObject) -> AnyObject
|
||||
static func createProxyForObject(_ object: AnyObject) -> AnyObject
|
||||
|
||||
/**
|
||||
Returns assigned proxy for object.
|
||||
|
|
@ -95,7 +95,7 @@ public protocol DelegateProxyType : AnyObject {
|
|||
- parameter object: Object that can have assigned delegate proxy.
|
||||
- returns: Assigned delegate proxy or `nil` if no delegate proxy is assigned.
|
||||
*/
|
||||
static func assignedProxyFor(object: AnyObject) -> AnyObject?
|
||||
static func assignedProxyFor(_ object: AnyObject) -> AnyObject?
|
||||
|
||||
/**
|
||||
Assigns proxy to object.
|
||||
|
|
@ -103,7 +103,7 @@ public protocol DelegateProxyType : AnyObject {
|
|||
- parameter object: Object that can have assigned delegate proxy.
|
||||
- parameter proxy: Delegate proxy object to assign to `object`.
|
||||
*/
|
||||
static func assignProxy(proxy: AnyObject, toObject object: AnyObject)
|
||||
static func assignProxy(_ proxy: AnyObject, toObject object: AnyObject)
|
||||
|
||||
/**
|
||||
Returns designated delegate property for object.
|
||||
|
|
@ -115,7 +115,7 @@ public protocol DelegateProxyType : AnyObject {
|
|||
- parameter object: Object that has delegate property.
|
||||
- returns: Value of delegate property.
|
||||
*/
|
||||
static func currentDelegateFor(object: AnyObject) -> AnyObject?
|
||||
static func currentDelegateFor(_ object: AnyObject) -> AnyObject?
|
||||
|
||||
/**
|
||||
Sets designated delegate property for object.
|
||||
|
|
@ -127,7 +127,7 @@ public protocol DelegateProxyType : AnyObject {
|
|||
- parameter toObject: Object that has delegate property.
|
||||
- parameter delegate: Delegate value.
|
||||
*/
|
||||
static func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject)
|
||||
static func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject)
|
||||
|
||||
/**
|
||||
Returns reference of normal delegate that receives all forwarded messages
|
||||
|
|
@ -144,11 +144,11 @@ public protocol DelegateProxyType : AnyObject {
|
|||
- parameter forwardToDelegate: Reference of delegate that receives all messages through `self`.
|
||||
- parameter retainDelegate: Should `self` retain `forwardToDelegate`.
|
||||
*/
|
||||
func setForwardToDelegate(forwardToDelegate: AnyObject?, retainDelegate: Bool)
|
||||
func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool)
|
||||
}
|
||||
|
||||
@available(*, deprecated=2.5, renamed="DelegateProxyType.proxyForObject", message="You can just use normal static protocol extension. E.g. `RxScrollViewDelegateProxy.proxyForObject`")
|
||||
public func proxyForObject<P: DelegateProxyType>(type: P.Type, _ object: AnyObject) -> P {
|
||||
@available(*, deprecated:2.5, renamed:"DelegateProxyType.proxyForObject", message:"You can just use normal static protocol extension. E.g. `RxScrollViewDelegateProxy.proxyForObject`")
|
||||
public func proxyForObject<P: DelegateProxyType>(_ type: P.Type, _ object: AnyObject) -> P {
|
||||
return P.proxyForObject(object)
|
||||
}
|
||||
|
||||
|
|
@ -160,37 +160,38 @@ extension DelegateProxyType {
|
|||
- returns: Installed instance of delegate proxy.
|
||||
|
||||
|
||||
extension UISearchBar {
|
||||
extension Reactive where Base: UISearchBar {
|
||||
|
||||
public var rx_delegate: DelegateProxy {
|
||||
return RxSearchBarDelegateProxy.proxyForObject(self)
|
||||
public var delegate: DelegateProxy {
|
||||
return RxSearchBarDelegateProxy.proxyForObject(base)
|
||||
}
|
||||
|
||||
public var rx_text: ControlProperty<String> {
|
||||
let source: Observable<String> = self.rx_delegate.observe(#selector(UISearchBarDelegate.searchBar(_:textDidChange:)))
|
||||
public var text: ControlProperty<String> {
|
||||
let source: Observable<String> = self.delegate.observe(#selector(UISearchBarDelegate.searchBar(_:textDidChange:)))
|
||||
...
|
||||
}
|
||||
}
|
||||
*/
|
||||
public static func proxyForObject(object: AnyObject) -> Self {
|
||||
public static func proxyForObject(_ object: AnyObject) -> Self {
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
|
||||
let maybeProxy = Self.assignedProxyFor(object) as? Self
|
||||
|
||||
let proxy: Self
|
||||
if maybeProxy == nil {
|
||||
if let existingProxy = maybeProxy {
|
||||
proxy = existingProxy
|
||||
}
|
||||
else {
|
||||
proxy = Self.createProxyForObject(object) as! Self
|
||||
Self.assignProxy(proxy, toObject: object)
|
||||
assert(Self.assignedProxyFor(object) === proxy)
|
||||
}
|
||||
else {
|
||||
proxy = maybeProxy!
|
||||
}
|
||||
|
||||
let currentDelegate: AnyObject? = Self.currentDelegateFor(object)
|
||||
|
||||
if currentDelegate !== proxy {
|
||||
proxy.setForwardToDelegate(currentDelegate, retainDelegate: false)
|
||||
assert(proxy.forwardToDelegate() === currentDelegate)
|
||||
Self.setCurrentDelegate(proxy, toObject: object)
|
||||
assert(Self.currentDelegateFor(object) === proxy)
|
||||
assert(proxy.forwardToDelegate() === currentDelegate)
|
||||
|
|
@ -208,7 +209,7 @@ extension DelegateProxyType {
|
|||
- parameter onProxyForObject: Object that has `delegate` property.
|
||||
- returns: Disposable object that can be used to clear forward delegate.
|
||||
*/
|
||||
public static func installForwardDelegate(forwardDelegate: AnyObject, retainDelegate: Bool, onProxyForObject object: AnyObject) -> Disposable {
|
||||
public static func installForwardDelegate(_ forwardDelegate: AnyObject, retainDelegate: Bool, onProxyForObject object: AnyObject) -> Disposable {
|
||||
weak var weakForwardDelegate: AnyObject? = forwardDelegate
|
||||
|
||||
let proxy = Self.proxyForObject(object)
|
||||
|
|
@ -226,9 +227,9 @@ extension DelegateProxyType {
|
|||
Self.setCurrentDelegate(nil, toObject: object)
|
||||
Self.setCurrentDelegate(proxy, toObject: object)
|
||||
|
||||
assert(proxy.forwardToDelegate() === forwardDelegate, "Setting of delegate failed")
|
||||
assert(proxy.forwardToDelegate() === forwardDelegate, "Setting of delegate failed:\ncurrent:\n\(proxy.forwardToDelegate())\nexpected:\n\(forwardDelegate)")
|
||||
|
||||
return AnonymousDisposable {
|
||||
return Disposables.create {
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
|
||||
let delegate: AnyObject? = weakForwardDelegate
|
||||
|
|
@ -241,7 +242,7 @@ extension DelegateProxyType {
|
|||
}
|
||||
|
||||
extension ObservableType {
|
||||
func subscribeProxyDataSourceForObject<P: DelegateProxyType>(object: AnyObject, dataSource: AnyObject, retainDataSource: Bool, binding: (P, Event<E>) -> Void)
|
||||
func subscribeProxyDataSource<P: DelegateProxyType>(ofObject object: AnyObject, dataSource: AnyObject, retainDataSource: Bool, binding: @escaping (P, Event<E>) -> Void)
|
||||
-> Disposable {
|
||||
let proxy = P.proxyForObject(object)
|
||||
let disposable = P.installForwardDelegate(dataSource, retainDelegate: retainDataSource, onProxyForObject: object)
|
||||
|
|
@ -263,16 +264,16 @@ extension ObservableType {
|
|||
binding(proxy, event)
|
||||
|
||||
switch event {
|
||||
case .Error(let error):
|
||||
case .error(let error):
|
||||
bindingErrorToInterface(error)
|
||||
disposable.dispose()
|
||||
case .Completed:
|
||||
case .completed:
|
||||
disposable.dispose()
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return CompositeDisposable(subscription, disposable)
|
||||
return Disposables.create(subscription, disposable)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ extension Int : KVORepresentable {
|
|||
Constructs `Self` using KVO value.
|
||||
*/
|
||||
public init?(KVOValue: KVOType) {
|
||||
self.init(KVOValue.integerValue)
|
||||
self.init(KVOValue.int32Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ extension Int32 : KVORepresentable {
|
|||
Constructs `Self` using KVO value.
|
||||
*/
|
||||
public init?(KVOValue: KVOType) {
|
||||
self.init(KVOValue.intValue)
|
||||
self.init(KVOValue.int32Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ extension Int64 : KVORepresentable {
|
|||
Constructs `Self` using KVO value.
|
||||
*/
|
||||
public init?(KVOValue: KVOType) {
|
||||
self.init(KVOValue.longLongValue)
|
||||
self.init(KVOValue.int64Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ extension UInt : KVORepresentable {
|
|||
Constructs `Self` using KVO value.
|
||||
*/
|
||||
public init?(KVOValue: KVOType) {
|
||||
self.init(KVOValue.unsignedLongValue)
|
||||
self.init(KVOValue.uintValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ extension UInt32 : KVORepresentable {
|
|||
Constructs `Self` using KVO value.
|
||||
*/
|
||||
public init?(KVOValue: KVOType) {
|
||||
self.init(KVOValue.unsignedIntValue)
|
||||
self.init(KVOValue.uint32Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ extension UInt64 : KVORepresentable {
|
|||
Constructs `Self` using KVO value.
|
||||
*/
|
||||
public init?(KVOValue: KVOType) {
|
||||
self.init(KVOValue.unsignedLongLongValue)
|
||||
self.init(KVOValue.uint64Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,4 +90,4 @@ extension RawRepresentable where RawValue: KVORepresentable {
|
|||
|
||||
self.init(rawValue: rawValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import Foundation
|
|||
Simple logging settings for RxCocoa library.
|
||||
*/
|
||||
public struct Logging {
|
||||
public typealias LogURLRequest = (NSURLRequest) -> Bool
|
||||
public typealias LogURLRequest = (URLRequest) -> Bool
|
||||
|
||||
/**
|
||||
Log URL requests to standard output in curl format.
|
||||
|
|
@ -24,4 +24,4 @@ public struct Logging {
|
|||
return false
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ import RxSwift
|
|||
#endif
|
||||
|
||||
#if os(iOS) || os(OSX) || os(tvOS)
|
||||
extension NSLayoutConstraint {
|
||||
extension Reactive where Base: NSLayoutConstraint {
|
||||
/**
|
||||
Bindable sink for `constant` property.
|
||||
*/
|
||||
public var rx_constant: AnyObserver<CGFloat> {
|
||||
return UIBindingObserver(UIElement: self) { constraint, constant in
|
||||
public var constant: AnyObserver<CGFloat> {
|
||||
return UIBindingObserver(UIElement: self.base) { constraint, constant in
|
||||
constraint.constant = constant
|
||||
}.asObserver()
|
||||
}
|
||||
|
|
@ -33,9 +33,9 @@ extension NSLayoutConstraint {
|
|||
Bindable sink for `active` property.
|
||||
*/
|
||||
@available(iOS 8, OSX 10.10, *)
|
||||
public var rx_active: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self) { constraint, value in
|
||||
constraint.active = value
|
||||
public var active: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self.base) { constraint, value in
|
||||
constraint.isActive = value
|
||||
}.asObserver()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ extension ObservableType {
|
|||
- parameter observer: Observer that receives events.
|
||||
- returns: Disposable object that can be used to unsubscribe the observer.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func bindTo<O: ObserverType where O.E == E>(observer: O) -> Disposable {
|
||||
// @warn_unused_result(message: "http://git.io/rxs.ud")
|
||||
public func bindTo<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
return self.subscribe(observer)
|
||||
}
|
||||
|
||||
|
|
@ -36,20 +36,20 @@ extension ObservableType {
|
|||
- parameter variable: Target variable for sequence elements.
|
||||
- returns: Disposable object that can be used to unsubscribe the observer.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func bindTo(variable: Variable<E>) -> Disposable {
|
||||
// @warn_unused_result(message: "http://git.io/rxs.ud")
|
||||
public func bindTo(_ variable: Variable<E>) -> Disposable {
|
||||
return subscribe { e in
|
||||
switch e {
|
||||
case let .Next(element):
|
||||
case let .next(element):
|
||||
variable.value = element
|
||||
case let .Error(error):
|
||||
case let .error(error):
|
||||
let error = "Binding error to variable: \(error)"
|
||||
#if DEBUG
|
||||
rxFatalError(error)
|
||||
#else
|
||||
print(error)
|
||||
#endif
|
||||
case .Completed:
|
||||
case .completed:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
@ -61,8 +61,8 @@ extension ObservableType {
|
|||
- parameter binder: Function used to bind elements from `self`.
|
||||
- returns: Object representing subscription.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func bindTo<R>(binder: Self -> R) -> R {
|
||||
// @warn_unused_result(message: "http://git.io/rxs.ud")
|
||||
public func bindTo<R>(_ binder: (Self) -> R) -> R {
|
||||
return binder(self)
|
||||
}
|
||||
|
||||
|
|
@ -78,8 +78,8 @@ extension ObservableType {
|
|||
- parameter curriedArgument: Final argument passed to `binder` to finish binding process.
|
||||
- returns: Object representing subscription.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func bindTo<R1, R2>(binder: Self -> R1 -> R2, curriedArgument: R1) -> R2 {
|
||||
// @warn_unused_result(message: "http://git.io/rxs.ud")
|
||||
public func bindTo<R1, R2>(_ binder: (Self) -> (R1) -> R2, curriedArgument: R1) -> R2 {
|
||||
return binder(self)(curriedArgument)
|
||||
}
|
||||
|
||||
|
|
@ -93,8 +93,8 @@ extension ObservableType {
|
|||
- parameter onNext: Action to invoke for each element in the observable sequence.
|
||||
- returns: Subscription object used to unsubscribe from the observable sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.ud")
|
||||
public func bindNext(onNext: E -> Void) -> Disposable {
|
||||
// @warn_unused_result(message: "http://git.io/rxs.ud")
|
||||
public func bindNext(_ onNext: @escaping (E) -> Void) -> Disposable {
|
||||
return subscribe(onNext: onNext, onError: { error in
|
||||
let error = "Binding error: \(error)"
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ class ControlTarget: RxTarget {
|
|||
|
||||
super.init()
|
||||
|
||||
control.addTarget(self, action: selector, forControlEvents: controlEvents)
|
||||
control.addTarget(self, action: selector, for: controlEvents)
|
||||
|
||||
let method = self.methodForSelector(selector)
|
||||
let method = self.method(for: selector)
|
||||
if method == nil {
|
||||
rxFatalError("Can't find method")
|
||||
}
|
||||
|
|
@ -64,15 +64,15 @@ class ControlTarget: RxTarget {
|
|||
control.target = self
|
||||
control.action = selector
|
||||
|
||||
let method = self.methodForSelector(selector)
|
||||
let method = self.method(for: selector)
|
||||
if method == nil {
|
||||
rxFatalError("Can't find method")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func eventHandler(sender: Control!) {
|
||||
if let callback = self.callback, control = self.control {
|
||||
func eventHandler(_ sender: Control!) {
|
||||
if let callback = self.callback, let control = self.control {
|
||||
callback(control)
|
||||
}
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ class ControlTarget: RxTarget {
|
|||
override func dispose() {
|
||||
super.dispose()
|
||||
#if os(iOS) || os(tvOS)
|
||||
self.control?.removeTarget(self, action: self.selector, forControlEvents: self.controlEvents)
|
||||
self.control?.removeTarget(self, action: self.selector, for: self.controlEvents)
|
||||
#elseif os(OSX)
|
||||
self.control?.target = nil
|
||||
self.control?.action = nil
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ import RxSwift
|
|||
#endif
|
||||
|
||||
class DeallocObservable {
|
||||
let _subject = ReplaySubject<Void>.create(bufferSize: 1)
|
||||
let _subject = ReplaySubject<Void>.create(bufferSize:1)
|
||||
|
||||
init() {
|
||||
}
|
||||
|
||||
deinit {
|
||||
_subject.on(.Next(()))
|
||||
_subject.on(.Completed)
|
||||
_subject.on(.next(()))
|
||||
_subject.on(.completed)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,29 +33,29 @@ class KVOObservable<Element>
|
|||
}
|
||||
}
|
||||
|
||||
func subscribe<O : ObserverType where O.E == Element?>(observer: O) -> Disposable {
|
||||
func subscribe<O : ObserverType>(_ observer: O) -> Disposable where O.E == Element? {
|
||||
let observer = KVOObserver(parent: self) { (value) in
|
||||
if value as? NSNull != nil {
|
||||
observer.on(.Next(nil))
|
||||
observer.on(.next(nil))
|
||||
return
|
||||
}
|
||||
observer.on(.Next(value as? Element))
|
||||
observer.on(.next(value as? Element))
|
||||
}
|
||||
|
||||
return AnonymousDisposable(observer.dispose)
|
||||
return Disposables.create(with: observer.dispose)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !DISABLE_SWIZZLING
|
||||
|
||||
func observeWeaklyKeyPathFor(target: NSObject, keyPath: String, options: NSKeyValueObservingOptions) -> Observable<AnyObject?> {
|
||||
let components = keyPath.componentsSeparatedByString(".").filter { $0 != "self" }
|
||||
func observeWeaklyKeyPathFor(_ target: NSObject, keyPath: String, options: NSKeyValueObservingOptions) -> Observable<AnyObject?> {
|
||||
let components = keyPath.components(separatedBy: ".").filter { $0 != "self" }
|
||||
|
||||
let observable = observeWeaklyKeyPathFor(target, keyPathSections: components, options: options)
|
||||
.finishWithNilWhenDealloc(target)
|
||||
|
||||
if !options.intersect(.Initial).isEmpty {
|
||||
if !options.intersection(.initial).isEmpty {
|
||||
return observable
|
||||
}
|
||||
else {
|
||||
|
|
@ -68,14 +68,14 @@ func observeWeaklyKeyPathFor(target: NSObject, keyPath: String, options: NSKeyVa
|
|||
// Identifiers can't contain `,`, so the only place where `,` can appear
|
||||
// is as a delimiter.
|
||||
// This means there is `W` as element in an array of property attributes.
|
||||
func isWeakProperty(properyRuntimeInfo: String) -> Bool {
|
||||
return properyRuntimeInfo.rangeOfString(",W,") != nil
|
||||
func isWeakProperty(_ properyRuntimeInfo: String) -> Bool {
|
||||
return properyRuntimeInfo.range(of: ",W,") != nil
|
||||
}
|
||||
|
||||
extension ObservableType where E == AnyObject? {
|
||||
func finishWithNilWhenDealloc(target: NSObject)
|
||||
func finishWithNilWhenDealloc(_ target: NSObject)
|
||||
-> Observable<AnyObject?> {
|
||||
let deallocating = target.rx_deallocating
|
||||
let deallocating = target.rx.deallocating
|
||||
|
||||
return deallocating
|
||||
.map { _ in
|
||||
|
|
@ -87,7 +87,7 @@ extension ObservableType where E == AnyObject? {
|
|||
}
|
||||
|
||||
func observeWeaklyKeyPathFor(
|
||||
target: NSObject,
|
||||
_ target: NSObject,
|
||||
keyPathSections: [String],
|
||||
options: NSKeyValueObservingOptions
|
||||
) -> Observable<AnyObject?> {
|
||||
|
|
@ -99,13 +99,13 @@ func observeWeaklyKeyPathFor(
|
|||
|
||||
let property = class_getProperty(object_getClass(target), propertyName)
|
||||
if property == nil {
|
||||
return Observable.error(RxCocoaError.InvalidPropertyName(object: target, propertyName: propertyName))
|
||||
return Observable.error(RxCocoaError.invalidPropertyName(object: target, propertyName: propertyName))
|
||||
}
|
||||
let propertyAttributes = property_getAttributes(property)
|
||||
|
||||
// should dealloc hook be in place if week property, or just create strong reference because it doesn't matter
|
||||
let isWeak = isWeakProperty(String.fromCString(propertyAttributes) ?? "")
|
||||
let propertyObservable = KVOObservable(object: target, keyPath: propertyName, options: options.union(.Initial), retainTarget: false) as KVOObservable<AnyObject>
|
||||
let isWeak = isWeakProperty(propertyAttributes.map(String.init) ?? "")
|
||||
let propertyObservable = KVOObservable(object: target, keyPath: propertyName, options: options.union(.initial), retainTarget: false) as KVOObservable<AnyObject>
|
||||
|
||||
// KVO recursion for value changes
|
||||
return propertyObservable
|
||||
|
|
@ -118,7 +118,7 @@ func observeWeaklyKeyPathFor(
|
|||
let strongTarget: AnyObject? = weakTarget
|
||||
|
||||
if nextObject == nil {
|
||||
return Observable.error(RxCocoaError.InvalidObjectOnKeyPath(object: nextTarget!, sourceObject: strongTarget ?? NSNull(), propertyName: propertyName))
|
||||
return Observable.error(RxCocoaError.invalidObjectOnKeyPath(object: nextTarget!, sourceObject: strongTarget ?? NSNull(), propertyName: propertyName))
|
||||
}
|
||||
|
||||
// if target is alive, then send change
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ protocol KVOObservableProtocol {
|
|||
|
||||
class KVOObserver : _RXKVOObserver
|
||||
, Disposable {
|
||||
typealias Callback = (AnyObject?) -> Void
|
||||
typealias Callback = @escaping (Any?) -> Void
|
||||
|
||||
var retainSelf: KVOObserver? = nil
|
||||
|
||||
|
|
@ -43,4 +43,4 @@ class KVOObserver : _RXKVOObserver
|
|||
OSAtomicDecrement32(&resourceCount)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ import Foundation
|
|||
init() {
|
||||
}
|
||||
|
||||
@objc func messageSentWithParameters(parameters: [AnyObject]) -> Void {
|
||||
_subject.on(.Next())
|
||||
@objc func messageSent(withParameters parameters: [Any]) -> Void {
|
||||
_subject.on(.next())
|
||||
}
|
||||
|
||||
func asObservable() -> Observable<()> {
|
||||
|
|
@ -38,7 +38,7 @@ import Foundation
|
|||
}
|
||||
|
||||
deinit {
|
||||
_subject.on(.Completed)
|
||||
_subject.on(.completed)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -58,8 +58,8 @@ import Foundation
|
|||
init() {
|
||||
}
|
||||
|
||||
@objc func messageSentWithParameters(parameters: [AnyObject]) -> Void {
|
||||
_subject.on(.Next(parameters))
|
||||
@objc func messageSent(withParameters parameters: [Any]) -> Void {
|
||||
_subject.on(.next(parameters as [AnyObject]))
|
||||
}
|
||||
|
||||
func asObservable() -> Observable<[AnyObject]> {
|
||||
|
|
@ -67,7 +67,7 @@ import Foundation
|
|||
}
|
||||
|
||||
deinit {
|
||||
_subject.on(.Completed)
|
||||
_subject.on(.completed)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import Foundation
|
|||
import RxSwift
|
||||
#endif
|
||||
|
||||
extension NSNotificationCenter {
|
||||
extension Reactive where Base: NotificationCenter {
|
||||
/**
|
||||
Transforms notifications posted to notification center to observable sequence of notifications.
|
||||
|
||||
|
|
@ -19,16 +19,16 @@ extension NSNotificationCenter {
|
|||
- parameter object: Optional object used to filter notifications.
|
||||
- returns: Observable sequence of posted notifications.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_notification(name: String?, object: AnyObject? = nil) -> Observable<NSNotification> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func notification(_ name: Notification.Name, object: AnyObject? = nil) -> Observable<Notification> {
|
||||
return Observable.create { [weak object] observer in
|
||||
let nsObserver = self.addObserverForName(name, object: object, queue: nil) { notification in
|
||||
observer.on(.Next(notification))
|
||||
let nsObserver = self.base.addObserver(forName: name, object: object, queue: nil) { notification in
|
||||
observer.on(.next(notification))
|
||||
}
|
||||
|
||||
return AnonymousDisposable {
|
||||
self.removeObserver(nsObserver)
|
||||
return Disposables.create {
|
||||
self.base.removeObserver(nsObserver)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,34 +11,34 @@ import Foundation
|
|||
import RxSwift
|
||||
#endif
|
||||
|
||||
extension NSObject {
|
||||
extension Reactive where Base: NSObject {
|
||||
|
||||
/**
|
||||
Specialization of generic `rx_observe` method.
|
||||
Specialization of generic `observe` method.
|
||||
|
||||
This is a special overload because to observe values of some type (for example `Int`), first values of KVO type
|
||||
need to be observed (`NSNumber`), and then converted to result type.
|
||||
|
||||
For more information take a look at `rx_observe` method.
|
||||
For more information take a look at `observe` method.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_observe<E: KVORepresentable>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable<E?> {
|
||||
return rx_observe(E.KVOType.self, keyPath, options: options, retainSelf: retainSelf)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func observe<E: KVORepresentable>(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable<E?> {
|
||||
return observe(E.KVOType.self, keyPath, options: options, retainSelf: retainSelf)
|
||||
.map(E.init)
|
||||
}
|
||||
}
|
||||
|
||||
#if !DISABLE_SWIZZLING
|
||||
// KVO
|
||||
extension NSObject {
|
||||
extension Reactive where Base: NSObject {
|
||||
/**
|
||||
Specialization of generic `rx_observeWeakly` method.
|
||||
Specialization of generic `observeWeakly` method.
|
||||
|
||||
For more information take a look at `rx_observeWeakly` method.
|
||||
For more information take a look at `observeWeakly` method.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_observeWeakly<E: KVORepresentable>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable<E?> {
|
||||
return rx_observeWeakly(E.KVOType.self, keyPath, options: options)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func observeWeakly<E: KVORepresentable>(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial]) -> Observable<E?> {
|
||||
return observeWeakly(E.KVOType.self, keyPath, options: options)
|
||||
.map(E.init)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,40 +11,40 @@ import Foundation
|
|||
import RxSwift
|
||||
#endif
|
||||
|
||||
extension NSObject {
|
||||
extension Reactive where Base: NSObject {
|
||||
/**
|
||||
Specialization of generic `rx_observe` method.
|
||||
Specialization of generic `observe` method.
|
||||
|
||||
This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value.
|
||||
|
||||
It is useful for observing bridged ObjC enum values.
|
||||
|
||||
For more information take a look at `rx_observe` method.
|
||||
For more information take a look at `observe` method.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_observe<E: RawRepresentable where E.RawValue: KVORepresentable>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable<E?> {
|
||||
return rx_observe(E.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func observe<E: RawRepresentable>(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable<E?> where E.RawValue: KVORepresentable {
|
||||
return observe(E.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf)
|
||||
.map(E.init)
|
||||
}
|
||||
}
|
||||
|
||||
#if !DISABLE_SWIZZLING
|
||||
|
||||
// rx_observeWeakly + RawRepresentable
|
||||
extension NSObject {
|
||||
// observeWeakly + RawRepresentable
|
||||
extension Reactive where Base: NSObject {
|
||||
|
||||
/**
|
||||
Specialization of generic `rx_observeWeakly` method.
|
||||
Specialization of generic `observeWeakly` method.
|
||||
|
||||
This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value.
|
||||
|
||||
It is useful for observing bridged ObjC enum values.
|
||||
|
||||
For more information take a look at `rx_observeWeakly` method.
|
||||
For more information take a look at `observeWeakly` method.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_observeWeakly<E: RawRepresentable where E.RawValue: KVORepresentable>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable<E?> {
|
||||
return rx_observeWeakly(E.RawValue.KVOType.self, keyPath, options: options)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func observeWeakly<E: RawRepresentable>(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial]) -> Observable<E?> where E.RawValue: KVORepresentable {
|
||||
return observeWeakly(E.RawValue.KVOType.self, keyPath, options: options)
|
||||
.map(E.init)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,39 +38,39 @@ Both approaches can fail in certain scenarios:
|
|||
Second approach is chosen. It can fail in case there are multiple libraries dynamically trying
|
||||
to replace dealloc method. In case that isn't the case, it should be ok.
|
||||
*/
|
||||
extension NSObject {
|
||||
extension Reactive where Base: NSObject {
|
||||
|
||||
|
||||
/**
|
||||
Observes values on `keyPath` starting from `self` with `options` and retains `self` if `retainSelf` is set.
|
||||
|
||||
`rx_observe` is just a simple and performant wrapper around KVO mechanism.
|
||||
`observe` is just a simple and performant wrapper around KVO mechanism.
|
||||
|
||||
* it can be used to observe paths starting from `self` or from ancestors in ownership graph (`retainSelf = false`)
|
||||
* it can be used to observe paths starting from descendants in ownership graph (`retainSelf = true`)
|
||||
* the paths have to consist only of `strong` properties, otherwise you are risking crashing the system by not unregistering KVO observer before dealloc.
|
||||
|
||||
If support for weak properties is needed or observing arbitrary or unknown relationships in the
|
||||
ownership tree, `rx_observeWeakly` is the preferred option.
|
||||
ownership tree, `observeWeakly` is the preferred option.
|
||||
|
||||
- parameter keyPath: Key path of property names to observe.
|
||||
- parameter options: KVO mechanism notification options.
|
||||
- parameter retainSelf: Retains self during observation if set `true`.
|
||||
- returns: Observable sequence of objects on `keyPath`.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_observe<E>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable<E?> {
|
||||
return KVOObservable(object: self, keyPath: keyPath, options: options, retainTarget: retainSelf).asObservable()
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func observe<E>(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable<E?> {
|
||||
return KVOObservable(object: base, keyPath: keyPath, options: options, retainTarget: retainSelf).asObservable()
|
||||
}
|
||||
}
|
||||
|
||||
#if !DISABLE_SWIZZLING
|
||||
// KVO
|
||||
extension NSObject {
|
||||
extension Reactive where Base: NSObject {
|
||||
/**
|
||||
Observes values on `keyPath` starting from `self` with `options` and doesn't retain `self`.
|
||||
|
||||
It can be used in all cases where `rx_observe` can be used and additionally
|
||||
It can be used in all cases where `observe` can be used and additionally
|
||||
|
||||
* because it won't retain observed target, it can be used to observe arbitrary object graph whose ownership relation is unknown
|
||||
* it can be used to observe `weak` properties
|
||||
|
|
@ -81,9 +81,9 @@ extension NSObject {
|
|||
- parameter options: KVO mechanism notification options.
|
||||
- returns: Observable sequence of objects on `keyPath`.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_observeWeakly<E>(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable<E?> {
|
||||
return observeWeaklyKeyPathFor(self, keyPath: keyPath, options: options)
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func observeWeakly<E>(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial]) -> Observable<E?> {
|
||||
return observeWeaklyKeyPathFor(base, keyPath: keyPath, options: options)
|
||||
.map { n in
|
||||
return n as? E
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ extension NSObject {
|
|||
#endif
|
||||
|
||||
// Dealloc
|
||||
extension NSObject {
|
||||
extension Reactive where Base: AnyObject {
|
||||
|
||||
/**
|
||||
Observable sequence of object deallocated events.
|
||||
|
|
@ -101,15 +101,15 @@ extension NSObject {
|
|||
|
||||
- returns: Observable sequence of object deallocated events.
|
||||
*/
|
||||
public var rx_deallocated: Observable<Void> {
|
||||
return rx_synchronized {
|
||||
if let deallocObservable = objc_getAssociatedObject(self, &deallocatedSubjectContext) as? DeallocObservable {
|
||||
public var deallocated: Observable<Void> {
|
||||
return synchronized {
|
||||
if let deallocObservable = objc_getAssociatedObject(base, &deallocatedSubjectContext) as? DeallocObservable {
|
||||
return deallocObservable._subject
|
||||
}
|
||||
|
||||
let deallocObservable = DeallocObservable()
|
||||
|
||||
objc_setAssociatedObject(self, &deallocatedSubjectContext, deallocObservable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||
objc_setAssociatedObject(base, &deallocatedSubjectContext, deallocObservable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||
return deallocObservable._subject
|
||||
}
|
||||
}
|
||||
|
|
@ -125,24 +125,24 @@ extension NSObject {
|
|||
|
||||
- returns: Observable sequence of object deallocating events.
|
||||
*/
|
||||
public func rx_sentMessage(selector: Selector) -> Observable<[AnyObject]> {
|
||||
return rx_synchronized {
|
||||
public func sentMessage(_ selector: Selector) -> Observable<[AnyObject]> {
|
||||
return synchronized {
|
||||
// in case of dealloc selector replay subject behavior needs to be used
|
||||
if selector == deallocSelector {
|
||||
return rx_deallocating.map { _ in [] }
|
||||
return deallocating.map { _ in [] }
|
||||
}
|
||||
|
||||
let rxSelector = RX_selector(selector)
|
||||
let selectorReference = RX_reference_from_selector(rxSelector)
|
||||
|
||||
let subject: MessageSentObservable
|
||||
if let existingSubject = objc_getAssociatedObject(self, selectorReference) as? MessageSentObservable {
|
||||
if let existingSubject = objc_getAssociatedObject(base, selectorReference) as? MessageSentObservable {
|
||||
subject = existingSubject
|
||||
}
|
||||
else {
|
||||
subject = MessageSentObservable()
|
||||
objc_setAssociatedObject(
|
||||
self,
|
||||
base,
|
||||
selectorReference,
|
||||
subject,
|
||||
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
||||
|
|
@ -150,17 +150,16 @@ extension NSObject {
|
|||
}
|
||||
|
||||
if subject.isActive {
|
||||
return subject.asObservable()
|
||||
return subject.asObservable().map { $0 }
|
||||
}
|
||||
|
||||
var error: NSError?
|
||||
let targetImplementation = RX_ensure_observing(self, selector, &error)
|
||||
if targetImplementation == nil {
|
||||
return Observable.error(error?.rxCocoaErrorForTarget(self) ?? RxCocoaError.Unknown)
|
||||
guard let targetImplementation = RX_ensure_observing(base, selector, &error) else {
|
||||
return Observable.error(error?.rxCocoaErrorForTarget(base) ?? RxCocoaError.unknown)
|
||||
}
|
||||
|
||||
subject.targetImplementation = targetImplementation
|
||||
return subject.asObservable()
|
||||
return subject.asObservable().map { $0 }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -174,17 +173,17 @@ extension NSObject {
|
|||
|
||||
- returns: Observable sequence of object deallocating events.
|
||||
*/
|
||||
public var rx_deallocating: Observable<()> {
|
||||
return rx_synchronized {
|
||||
public var deallocating: Observable<()> {
|
||||
return synchronized {
|
||||
|
||||
let subject: DeallocatingObservable
|
||||
if let existingSubject = objc_getAssociatedObject(self, rxDeallocatingSelectorReference) as? DeallocatingObservable {
|
||||
if let existingSubject = objc_getAssociatedObject(base, rxDeallocatingSelectorReference) as? DeallocatingObservable {
|
||||
subject = existingSubject
|
||||
}
|
||||
else {
|
||||
subject = DeallocatingObservable()
|
||||
objc_setAssociatedObject(
|
||||
self,
|
||||
base,
|
||||
rxDeallocatingSelectorReference,
|
||||
subject,
|
||||
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
||||
|
|
@ -196,12 +195,12 @@ extension NSObject {
|
|||
}
|
||||
|
||||
var error: NSError?
|
||||
let targetImplementation = RX_ensure_observing(self, deallocSelector, &error)
|
||||
let targetImplementation = RX_ensure_observing(base, deallocSelector, &error)
|
||||
if targetImplementation == nil {
|
||||
return Observable.error(error?.rxCocoaErrorForTarget(self) ?? RxCocoaError.Unknown)
|
||||
return Observable.error(error?.rxCocoaErrorForTarget(base) ?? RxCocoaError.unknown)
|
||||
}
|
||||
|
||||
subject.targetImplementation = targetImplementation
|
||||
subject.targetImplementation = targetImplementation!
|
||||
return subject.asObservable()
|
||||
}
|
||||
}
|
||||
|
|
@ -212,29 +211,29 @@ let deallocSelector = NSSelectorFromString("dealloc")
|
|||
let rxDeallocatingSelector = RX_selector(deallocSelector)
|
||||
let rxDeallocatingSelectorReference = RX_reference_from_selector(rxDeallocatingSelector)
|
||||
|
||||
extension NSObject {
|
||||
func rx_synchronized<T>(@noescape action: () -> T) -> T {
|
||||
objc_sync_enter(self)
|
||||
extension Reactive where Base: AnyObject {
|
||||
func synchronized<T>( _ action: () -> T) -> T {
|
||||
objc_sync_enter(self.base)
|
||||
let result = action()
|
||||
objc_sync_exit(self)
|
||||
objc_sync_exit(self.base)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
extension NSObject {
|
||||
extension Reactive where Base: AnyObject {
|
||||
/**
|
||||
Helper to make sure that `Observable` returned from `createCachedObservable` is only created once.
|
||||
This is important because there is only one `target` and `action` properties on `NSControl` or `UIBarButtonItem`.
|
||||
*/
|
||||
func rx_lazyInstanceObservable<T: AnyObject>(key: UnsafePointer<Void>, createCachedObservable: () -> T) -> T {
|
||||
if let value = objc_getAssociatedObject(self, key) {
|
||||
func lazyInstanceObservable<T: AnyObject>(_ key: UnsafeRawPointer, createCachedObservable: () -> T) -> T {
|
||||
if let value = objc_getAssociatedObject(base, key) {
|
||||
return value as! T
|
||||
}
|
||||
|
||||
let observable = createCachedObservable()
|
||||
|
||||
objc_setAssociatedObject(self, key, observable, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||
objc_setAssociatedObject(base, key, observable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||
|
||||
return observable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,24 +15,24 @@ import RxSwift
|
|||
RxCocoa URL errors.
|
||||
*/
|
||||
public enum RxCocoaURLError
|
||||
: ErrorType
|
||||
: Swift.Error
|
||||
, CustomDebugStringConvertible {
|
||||
/**
|
||||
Unknown error occurred.
|
||||
*/
|
||||
case Unknown
|
||||
case unknown
|
||||
/**
|
||||
Response is not NSHTTPURLResponse
|
||||
*/
|
||||
case NonHTTPResponse(response: NSURLResponse)
|
||||
case nonHTTPResponse(response: URLResponse)
|
||||
/**
|
||||
Response is not successful. (not in `200 ..< 300` range)
|
||||
*/
|
||||
case HTTPRequestFailed(response: NSHTTPURLResponse, data: NSData?)
|
||||
case httpRequestFailed(response: HTTPURLResponse, data: Data?)
|
||||
/**
|
||||
Deserialization error.
|
||||
*/
|
||||
case DeserializationError(error: ErrorType)
|
||||
case deserializationError(error: Swift.Error)
|
||||
}
|
||||
|
||||
public extension RxCocoaURLError {
|
||||
|
|
@ -41,40 +41,40 @@ public extension RxCocoaURLError {
|
|||
*/
|
||||
public var debugDescription: String {
|
||||
switch self {
|
||||
case .Unknown:
|
||||
case .unknown:
|
||||
return "Unknown error has occurred."
|
||||
case let .NonHTTPResponse(response):
|
||||
case let .nonHTTPResponse(response):
|
||||
return "Response is not NSHTTPURLResponse `\(response)`."
|
||||
case let .HTTPRequestFailed(response, _):
|
||||
case let .httpRequestFailed(response, _):
|
||||
return "HTTP request failed with `\(response.statusCode)`."
|
||||
case let .DeserializationError(error):
|
||||
case let .deserializationError(error):
|
||||
return "Error during deserialization of the response: \(error)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func escapeTerminalString(value: String) -> String {
|
||||
return value.stringByReplacingOccurrencesOfString("\"", withString: "\\\"", options:[], range: nil)
|
||||
func escapeTerminalString(_ value: String) -> String {
|
||||
return value.replacingOccurrences(of: "\"", with: "\\\"", options:[], range: nil)
|
||||
}
|
||||
|
||||
func convertURLRequestToCurlCommand(request: NSURLRequest) -> String {
|
||||
let method = request.HTTPMethod ?? "GET"
|
||||
func convertURLRequestToCurlCommand(_ request: URLRequest) -> String {
|
||||
let method = request.httpMethod ?? "GET"
|
||||
var returnValue = "curl -X \(method) "
|
||||
|
||||
if request.HTTPMethod == "POST" && request.HTTPBody != nil {
|
||||
let maybeBody = NSString(data: request.HTTPBody!, encoding: NSUTF8StringEncoding) as? String
|
||||
if request.httpMethod == "POST" && request.httpBody != nil {
|
||||
let maybeBody = NSString(data: request.httpBody!, encoding: String.Encoding.utf8.rawValue) as? String
|
||||
if let body = maybeBody {
|
||||
returnValue += "-d \"\(escapeTerminalString(body))\" "
|
||||
}
|
||||
}
|
||||
|
||||
for (key, value) in request.allHTTPHeaderFields ?? [:] {
|
||||
let escapedKey = escapeTerminalString((key as String) ?? "")
|
||||
let escapedValue = escapeTerminalString((value as String) ?? "")
|
||||
let escapedKey = escapeTerminalString(key as String)
|
||||
let escapedValue = escapeTerminalString(value as String)
|
||||
returnValue += "\n -H \"\(escapedKey): \(escapedValue)\" "
|
||||
}
|
||||
|
||||
let URLString = request.URL?.absoluteString ?? "<unknown url>"
|
||||
let URLString = request.url?.absoluteString ?? "<unknown url>"
|
||||
|
||||
returnValue += "\n\"\(escapeTerminalString(URLString))\""
|
||||
|
||||
|
|
@ -83,10 +83,10 @@ func convertURLRequestToCurlCommand(request: NSURLRequest) -> String {
|
|||
return returnValue
|
||||
}
|
||||
|
||||
func convertResponseToString(data: NSData!, _ response: NSURLResponse!, _ error: NSError!, _ interval: NSTimeInterval) -> String {
|
||||
func convertResponseToString(_ data: Data!, _ response: URLResponse!, _ error: NSError!, _ interval: TimeInterval) -> String {
|
||||
let ms = Int(interval * 1000)
|
||||
|
||||
if let response = response as? NSHTTPURLResponse {
|
||||
if let response = response as? HTTPURLResponse {
|
||||
if 200 ..< 300 ~= response.statusCode {
|
||||
return "Success (\(ms)ms): Status \(response.statusCode)"
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ func convertResponseToString(data: NSData!, _ response: NSURLResponse!, _ error:
|
|||
return "<Unhandled response from server>"
|
||||
}
|
||||
|
||||
extension NSURLSession {
|
||||
extension Reactive where Base: URLSession {
|
||||
/**
|
||||
Observable sequence of responses for URL request.
|
||||
|
||||
|
|
@ -118,44 +118,44 @@ extension NSURLSession {
|
|||
- parameter request: URL request.
|
||||
- returns: Observable sequence of URL responses.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_response(request: NSURLRequest) -> Observable<(NSData, NSHTTPURLResponse)> {
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func response(_ request: URLRequest) -> Observable<(Data, HTTPURLResponse)> {
|
||||
return Observable.create { observer in
|
||||
|
||||
// smart compiler should be able to optimize this out
|
||||
var d: NSDate?
|
||||
var d: Date?
|
||||
|
||||
if Logging.URLRequests(request) {
|
||||
d = NSDate()
|
||||
d = Date()
|
||||
}
|
||||
|
||||
let task = self.dataTaskWithRequest(request) { (data, response, error) in
|
||||
let task = self.base.dataTask(with: request) { (data, response, error) in
|
||||
|
||||
if Logging.URLRequests(request) {
|
||||
let interval = NSDate().timeIntervalSinceDate(d ?? NSDate())
|
||||
let interval = Date().timeIntervalSince(d ?? Date())
|
||||
print(convertURLRequestToCurlCommand(request))
|
||||
print(convertResponseToString(data, response, error, interval))
|
||||
print(convertResponseToString(data, response, error as NSError!, interval))
|
||||
}
|
||||
|
||||
guard let response = response, data = data else {
|
||||
observer.on(.Error(error ?? RxCocoaURLError.Unknown))
|
||||
guard let response = response, let data = data else {
|
||||
observer.on(.error(error ?? RxCocoaURLError.unknown))
|
||||
return
|
||||
}
|
||||
|
||||
guard let httpResponse = response as? NSHTTPURLResponse else {
|
||||
observer.on(.Error(RxCocoaURLError.NonHTTPResponse(response: response)))
|
||||
guard let httpResponse = response as? HTTPURLResponse else {
|
||||
observer.on(.error(RxCocoaURLError.nonHTTPResponse(response: response)))
|
||||
return
|
||||
}
|
||||
|
||||
observer.on(.Next(data, httpResponse))
|
||||
observer.on(.Completed)
|
||||
observer.on(.next(data, httpResponse))
|
||||
observer.on(.completed)
|
||||
}
|
||||
|
||||
|
||||
let t = task
|
||||
t.resume()
|
||||
|
||||
return AnonymousDisposable(task.cancel)
|
||||
return Disposables.create(with: task.cancel)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -174,14 +174,14 @@ extension NSURLSession {
|
|||
- parameter request: URL request.
|
||||
- returns: Observable sequence of response data.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_data(request: NSURLRequest) -> Observable<NSData> {
|
||||
return rx_response(request).map { (data, response) -> NSData in
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func data(_ request: URLRequest) -> Observable<Data> {
|
||||
return response(request).map { (data, response) -> Data in
|
||||
if 200 ..< 300 ~= response.statusCode {
|
||||
return data
|
||||
}
|
||||
else {
|
||||
throw RxCocoaURLError.HTTPRequestFailed(response: response, data: data)
|
||||
throw RxCocoaURLError.httpRequestFailed(response: response, data: data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -203,13 +203,13 @@ extension NSURLSession {
|
|||
- parameter request: URL request.
|
||||
- returns: Observable sequence of response JSON.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_JSON(request: NSURLRequest) -> Observable<AnyObject> {
|
||||
return rx_data(request).map { (data) -> AnyObject in
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func JSON(_ request: URLRequest) -> Observable<AnyObject> {
|
||||
return data(request).map { (data) -> AnyObject in
|
||||
do {
|
||||
return try NSJSONSerialization.JSONObjectWithData(data, options: [])
|
||||
return try JSONSerialization.jsonObject(with: data, options: []) as AnyObject
|
||||
} catch let error {
|
||||
throw RxCocoaURLError.DeserializationError(error: error)
|
||||
throw RxCocoaURLError.deserializationError(error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -231,8 +231,8 @@ extension NSURLSession {
|
|||
- parameter URL: URL of `NSURLRequest` request.
|
||||
- returns: Observable sequence of response JSON.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func rx_JSON(URL: NSURL) -> Observable<AnyObject> {
|
||||
return rx_JSON(NSURLRequest(URL: URL))
|
||||
// @warn_unused_result(message:"http://git.io/rxs.uo")
|
||||
public func JSON(_ URL: Foundation.URL) -> Observable<AnyObject> {
|
||||
return JSON(URLRequest(url: URL))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ class RxCLLocationManagerDelegateProxy : DelegateProxy
|
|||
, CLLocationManagerDelegate
|
||||
, DelegateProxyType {
|
||||
|
||||
class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let locationManager: CLLocationManager = castOrFatalError(object)
|
||||
return locationManager.delegate
|
||||
}
|
||||
|
||||
class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let locationManager: CLLocationManager = castOrFatalError(object)
|
||||
locationManager.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,27 +7,52 @@
|
|||
//
|
||||
|
||||
/**
|
||||
We can use `Reactive` protocol as customization point for constrained protocol extensions.
|
||||
Use `Reactive` proxy as customization point for constrained protocol extensions.
|
||||
|
||||
General pattern would be:
|
||||
General pattern would be:
|
||||
|
||||
// 1. Extend Reactive protocol with constrain on Self
|
||||
// Read as: Reactive Extension where Self is a SomeType
|
||||
extension Reactive where Self: SomeType {
|
||||
// 2. Put any specific reactive extension for SomeType here
|
||||
}
|
||||
|
||||
// 1. Conform SomeType to Reactive protocol
|
||||
extension SomeType: Reactive {}
|
||||
With this approach we can have more specialized methods and properties using
|
||||
`Self` and not just specialized on common base type.
|
||||
|
||||
// 2. Extend Reactive protocol with constrain on Self
|
||||
// Read as: Reactive Extension where Self is a SomeType
|
||||
extension Reactive where Self: SomeType {
|
||||
// 3. Put any specific reactive extension for SomeType here
|
||||
*/
|
||||
|
||||
public struct Reactive<Base> {
|
||||
/**
|
||||
Base object to extend.
|
||||
*/
|
||||
public let base: Base
|
||||
|
||||
/**
|
||||
Creates extensions with base object.
|
||||
|
||||
- parameter base: Base object.
|
||||
*/
|
||||
public init(_ base: Base) {
|
||||
self.base = base
|
||||
}
|
||||
|
||||
|
||||
With this approach we can have more specialized methods and properties using
|
||||
`Self` and not just specialized on common base type.
|
||||
|
||||
See UIGestureRecognizer+Rx.swift as an example
|
||||
*/
|
||||
|
||||
public protocol Reactive {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
A type that has reactive extensions.
|
||||
*/
|
||||
public protocol ReactiveCompatible {
|
||||
associatedtype CompatibleType
|
||||
var rx: Reactive<CompatibleType> { get }
|
||||
}
|
||||
|
||||
public extension ReactiveCompatible {
|
||||
public var rx: Reactive<Self> {
|
||||
return Reactive(self)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Extend NSObject with `rx` proxy.
|
||||
*/
|
||||
extension NSObject: ReactiveCompatible { }
|
||||
|
|
|
|||
|
|
@ -18,36 +18,36 @@ import RxSwift
|
|||
RxCocoa errors.
|
||||
*/
|
||||
public enum RxCocoaError
|
||||
: ErrorType
|
||||
: Swift.Error
|
||||
, CustomDebugStringConvertible {
|
||||
/**
|
||||
Unknown error has occurred.
|
||||
*/
|
||||
case Unknown
|
||||
case unknown
|
||||
/**
|
||||
Invalid operation was attempted.
|
||||
*/
|
||||
case InvalidOperation(object: AnyObject)
|
||||
case invalidOperation(object: AnyObject)
|
||||
/**
|
||||
Items are not yet bound to user interface but have been requested.
|
||||
*/
|
||||
case ItemsNotYetBound(object: AnyObject)
|
||||
case itemsNotYetBound(object: AnyObject)
|
||||
/**
|
||||
Invalid KVO Path.
|
||||
*/
|
||||
case InvalidPropertyName(object: AnyObject, propertyName: String)
|
||||
case invalidPropertyName(object: AnyObject, propertyName: String)
|
||||
/**
|
||||
Invalid object on key path.
|
||||
*/
|
||||
case InvalidObjectOnKeyPath(object: AnyObject, sourceObject: AnyObject, propertyName: String)
|
||||
case invalidObjectOnKeyPath(object: AnyObject, sourceObject: AnyObject, propertyName: String)
|
||||
/**
|
||||
Error during swizzling.
|
||||
*/
|
||||
case ErrorDuringSwizzling
|
||||
case errorDuringSwizzling
|
||||
/*
|
||||
Casting error.
|
||||
*/
|
||||
case CastingError(object: AnyObject, targetType: Any.Type)
|
||||
case castingError(object: AnyObject, targetType: Any.Type)
|
||||
}
|
||||
|
||||
#if !DISABLE_SWIZZLING
|
||||
|
|
@ -58,31 +58,31 @@ public enum RxCocoaInterceptionMechanism {
|
|||
/**
|
||||
Unknown message interception mechanism.
|
||||
*/
|
||||
case Unknown
|
||||
case unknown
|
||||
/**
|
||||
Key value observing interception mechanism.
|
||||
*/
|
||||
case KVO
|
||||
case kvo
|
||||
}
|
||||
|
||||
/**
|
||||
RxCocoa ObjC runtime modification errors.
|
||||
*/
|
||||
public enum RxCocoaObjCRuntimeError
|
||||
: ErrorType
|
||||
: Swift.Error
|
||||
, CustomDebugStringConvertible {
|
||||
/**
|
||||
Unknown error has occurred.
|
||||
*/
|
||||
case Unknown(target: AnyObject)
|
||||
case unknown(target: AnyObject)
|
||||
|
||||
/**
|
||||
If the object is reporting a different class then it's real class, that means that there is probably
|
||||
already some interception mechanism in place or something weird is happening.
|
||||
|
||||
The most common case when this would happen is when using a combination of KVO (`rx_observe`) and `rx_sentMessage`.
|
||||
The most common case when this would happen is when using a combination of KVO (`observe`) and `sentMessage`.
|
||||
|
||||
This error is easily resolved by just using `rx_sentMessage` observing before `rx_observe`.
|
||||
This error is easily resolved by just using `sentMessage` observing before `observe`.
|
||||
|
||||
The reason why the other way around could create issues is because KVO will unregister it's interceptor
|
||||
class and restore original class. Unfortunately that will happen no matter was there another interceptor
|
||||
|
|
@ -90,7 +90,7 @@ public enum RxCocoaObjCRuntimeError
|
|||
|
||||
Failure scenario:
|
||||
* KVO sets class to be `__KVO__OriginalClass` (subclass of `OriginalClass`)
|
||||
* `rx_sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`)
|
||||
* `sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`)
|
||||
* then unobserving with KVO will restore class to be `OriginalClass` -> failure point (possibly a bug in KVO)
|
||||
|
||||
The reason why changing order of observing works is because any interception method on unregistration
|
||||
|
|
@ -101,12 +101,12 @@ public enum RxCocoaObjCRuntimeError
|
|||
it's highly unlikely it would have any benefit in real world use cases, and it's even more
|
||||
dangerous.
|
||||
*/
|
||||
case ObjectMessagesAlreadyBeingIntercepted(target: AnyObject, interceptionMechanism: RxCocoaInterceptionMechanism)
|
||||
case objectMessagesAlreadyBeingIntercepted(target: AnyObject, interceptionMechanism: RxCocoaInterceptionMechanism)
|
||||
|
||||
/**
|
||||
Trying to observe messages for selector that isn't implemented.
|
||||
*/
|
||||
case SelectorNotImplemented(target: AnyObject)
|
||||
case selectorNotImplemented(target: AnyObject)
|
||||
|
||||
/**
|
||||
Core Foundation classes are usually toll free bridged. Those classes crash the program in case
|
||||
|
|
@ -115,7 +115,7 @@ public enum RxCocoaObjCRuntimeError
|
|||
There is a possibility to just swizzle methods on original object, but since those won't be usual use
|
||||
cases for this library, then an error will just be reported for now.
|
||||
*/
|
||||
case CantInterceptCoreFoundationTollFreeBridgedObjects(target: AnyObject)
|
||||
case cantInterceptCoreFoundationTollFreeBridgedObjects(target: AnyObject)
|
||||
|
||||
/**
|
||||
Two libraries have simultaneously tried to modify ObjC runtime and that was detected. This can only
|
||||
|
|
@ -124,17 +124,17 @@ public enum RxCocoaObjCRuntimeError
|
|||
To synchronize other libraries intercepting messages for an object, use `synchronized` on target object and
|
||||
it's meta-class.
|
||||
*/
|
||||
case ThreadingCollisionWithOtherInterceptionMechanism(target: AnyObject)
|
||||
case threadingCollisionWithOtherInterceptionMechanism(target: AnyObject)
|
||||
|
||||
/**
|
||||
For some reason saving original method implementation under RX namespace failed.
|
||||
*/
|
||||
case SavingOriginalForwardingMethodFailed(target: AnyObject)
|
||||
case savingOriginalForwardingMethodFailed(target: AnyObject)
|
||||
|
||||
/**
|
||||
Intercepting a sent message by replacing a method implementation with `_objc_msgForward` failed for some reason.
|
||||
*/
|
||||
case ReplacingMethodWithForwardingImplementation(target: AnyObject)
|
||||
case replacingMethodWithForwardingImplementation(target: AnyObject)
|
||||
|
||||
/**
|
||||
Attempt to intercept one of the performance sensitive methods:
|
||||
|
|
@ -143,7 +143,7 @@ public enum RxCocoaObjCRuntimeError
|
|||
* methodSignatureForSelector:
|
||||
* forwardingTargetForSelector:
|
||||
*/
|
||||
case ObservingPerformanceSensitiveMessages(target: AnyObject)
|
||||
case observingPerformanceSensitiveMessages(target: AnyObject)
|
||||
|
||||
/**
|
||||
Message implementation has unsupported return type (for example large struct). The reason why this is a error
|
||||
|
|
@ -152,7 +152,7 @@ public enum RxCocoaObjCRuntimeError
|
|||
|
||||
The unsupported cases should be fairly uncommon.
|
||||
*/
|
||||
case ObservingMessagesWithUnsupportedReturnType(target: AnyObject)
|
||||
case observingMessagesWithUnsupportedReturnType(target: AnyObject)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -165,19 +165,19 @@ public extension RxCocoaError {
|
|||
*/
|
||||
public var debugDescription: String {
|
||||
switch self {
|
||||
case .Unknown:
|
||||
case .unknown:
|
||||
return "Unknown error occurred."
|
||||
case let .InvalidOperation(object):
|
||||
case let .invalidOperation(object):
|
||||
return "Invalid operation was attempted on `\(object)`."
|
||||
case let .ItemsNotYetBound(object):
|
||||
case let .itemsNotYetBound(object):
|
||||
return "Data source is set, but items are not yet bound to user interface for `\(object)`."
|
||||
case let .InvalidPropertyName(object, propertyName):
|
||||
case let .invalidPropertyName(object, propertyName):
|
||||
return "Object `\(object)` dosn't have a property named `\(propertyName)`."
|
||||
case let .InvalidObjectOnKeyPath(object, sourceObject, propertyName):
|
||||
case let .invalidObjectOnKeyPath(object, sourceObject, propertyName):
|
||||
return "Unobservable object `\(object)` was observed as `\(propertyName)` of `\(sourceObject)`."
|
||||
case .ErrorDuringSwizzling:
|
||||
case .errorDuringSwizzling:
|
||||
return "Error during swizzling."
|
||||
case .CastingError(let object, let targetType):
|
||||
case .castingError(let object, let targetType):
|
||||
return "Error casting `\(object)` to `\(targetType)`"
|
||||
}
|
||||
}
|
||||
|
|
@ -191,25 +191,25 @@ public extension RxCocoaObjCRuntimeError {
|
|||
*/
|
||||
public var debugDescription: String {
|
||||
switch self {
|
||||
case let .Unknown(target):
|
||||
case let .unknown(target):
|
||||
return "Unknown error occurred.\nTarget: `\(target)`"
|
||||
case let ObjectMessagesAlreadyBeingIntercepted(target, interceptionMechanism):
|
||||
let interceptionMechanismDescription = interceptionMechanism == .KVO ? "KVO" : "other interception mechanism"
|
||||
case let .objectMessagesAlreadyBeingIntercepted(target, interceptionMechanism):
|
||||
let interceptionMechanismDescription = interceptionMechanism == .kvo ? "KVO" : "other interception mechanism"
|
||||
return "Collision between RxCocoa interception mechanism and \(interceptionMechanismDescription)."
|
||||
+ " To resolve this conflict please use this interception mechanism first.\nTarget: \(target)"
|
||||
case let SelectorNotImplemented(target):
|
||||
case let .selectorNotImplemented(target):
|
||||
return "Trying to observe messages for selector that isn't implemented.\nTarget: \(target)"
|
||||
case let CantInterceptCoreFoundationTollFreeBridgedObjects(target):
|
||||
case let .cantInterceptCoreFoundationTollFreeBridgedObjects(target):
|
||||
return "Interception of messages sent to Core Foundation isn't supported.\nTarget: \(target)"
|
||||
case let ThreadingCollisionWithOtherInterceptionMechanism(target):
|
||||
case let .threadingCollisionWithOtherInterceptionMechanism(target):
|
||||
return "Detected a conflict while modifying ObjC runtime.\nTarget: \(target)"
|
||||
case let SavingOriginalForwardingMethodFailed(target):
|
||||
case let .savingOriginalForwardingMethodFailed(target):
|
||||
return "Saving original method implementation failed.\nTarget: \(target)"
|
||||
case let ReplacingMethodWithForwardingImplementation(target):
|
||||
case let .replacingMethodWithForwardingImplementation(target):
|
||||
return "Intercepting a sent message by replacing a method implementation with `_objc_msgForward` failed for some reason.\nTarget: \(target)"
|
||||
case let ObservingPerformanceSensitiveMessages(target):
|
||||
case let .observingPerformanceSensitiveMessages(target):
|
||||
return "Attempt to intercept one of the performance sensitive methods. \nTarget: \(target)"
|
||||
case let ObservingMessagesWithUnsupportedReturnType(target):
|
||||
case let .observingMessagesWithUnsupportedReturnType(target):
|
||||
return "Attempt to intercept a method with unsupported return type. \nTarget: \(target)"
|
||||
}
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ public extension RxCocoaObjCRuntimeError {
|
|||
|
||||
// MARK: Error binding policies
|
||||
|
||||
func bindingErrorToInterface(error: ErrorType) {
|
||||
func bindingErrorToInterface(_ error: Swift.Error) {
|
||||
let error = "Binding error to UI: \(error)"
|
||||
#if DEBUG
|
||||
rxFatalError(error)
|
||||
|
|
@ -230,18 +230,18 @@ func bindingErrorToInterface(error: ErrorType) {
|
|||
|
||||
// MARK: Abstract methods
|
||||
|
||||
@noreturn func rxAbstractMethodWithMessage(message: String) {
|
||||
func rxAbstractMethodWithMessage(_ message: String) -> Swift.Never {
|
||||
rxFatalError(message)
|
||||
}
|
||||
|
||||
@noreturn func rxAbstractMethod() {
|
||||
func rxAbstractMethod() -> Swift.Never {
|
||||
rxFatalError("Abstract method")
|
||||
}
|
||||
|
||||
// MARK: casts or fatal error
|
||||
|
||||
// workaround for Swift compiler bug, cheers compiler team :)
|
||||
func castOptionalOrFatalError<T>(value: AnyObject?) -> T? {
|
||||
func castOptionalOrFatalError<T>(_ value: AnyObject?) -> T? {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -249,27 +249,27 @@ func castOptionalOrFatalError<T>(value: AnyObject?) -> T? {
|
|||
return v
|
||||
}
|
||||
|
||||
func castOrThrow<T>(resultType: T.Type, _ object: AnyObject) throws -> T {
|
||||
func castOrThrow<T>(_ resultType: T.Type, _ object: AnyObject) throws -> T {
|
||||
guard let returnValue = object as? T else {
|
||||
throw RxCocoaError.CastingError(object: object, targetType: resultType)
|
||||
throw RxCocoaError.castingError(object: object, targetType: resultType)
|
||||
}
|
||||
|
||||
return returnValue
|
||||
}
|
||||
|
||||
func castOptionalOrThrow<T>(resultType: T.Type, _ object: AnyObject) throws -> T? {
|
||||
func castOptionalOrThrow<T>(_ resultType: T.Type, _ object: AnyObject) throws -> T? {
|
||||
if NSNull().isEqual(object) {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let returnValue = object as? T else {
|
||||
throw RxCocoaError.CastingError(object: object, targetType: resultType)
|
||||
throw RxCocoaError.castingError(object: object, targetType: resultType)
|
||||
}
|
||||
|
||||
return returnValue
|
||||
}
|
||||
|
||||
func castOrFatalError<T>(value: AnyObject!, message: String) -> T {
|
||||
func castOrFatalError<T>(_ value: AnyObject!, message: String) -> T {
|
||||
let maybeResult: T? = value as? T
|
||||
guard let result = maybeResult else {
|
||||
rxFatalError(message)
|
||||
|
|
@ -278,7 +278,7 @@ func castOrFatalError<T>(value: AnyObject!, message: String) -> T {
|
|||
return result
|
||||
}
|
||||
|
||||
func castOrFatalError<T>(value: Any!) -> T {
|
||||
func castOrFatalError<T>(_ value: Any!) -> T {
|
||||
let maybeResult: T? = value as? T
|
||||
guard let result = maybeResult else {
|
||||
rxFatalError("Failure converting from \(value) to \(T.self)")
|
||||
|
|
@ -296,35 +296,37 @@ let delegateNotSet = "Delegate not set"
|
|||
|
||||
// MARK: Conversions `NSError` > `RxCocoaObjCRuntimeError`
|
||||
|
||||
extension NSError {
|
||||
func rxCocoaErrorForTarget(target: AnyObject) -> RxCocoaObjCRuntimeError {
|
||||
if domain == RXObjCRuntimeErrorDomain {
|
||||
let errorCode = RXObjCRuntimeError(rawValue: self.code) ?? .Unknown
|
||||
|
||||
extension Error {
|
||||
func rxCocoaErrorForTarget(_ target: AnyObject) -> RxCocoaObjCRuntimeError {
|
||||
let error = self as NSError
|
||||
|
||||
if error.domain == RXObjCRuntimeErrorDomain {
|
||||
let errorCode = RXObjCRuntimeError(rawValue: error.code) ?? .unknown
|
||||
|
||||
switch errorCode {
|
||||
case .Unknown:
|
||||
return .Unknown(target: target)
|
||||
case .ObjectMessagesAlreadyBeingIntercepted:
|
||||
let isKVO = (self.userInfo[RXObjCRuntimeErrorIsKVOKey] as? NSNumber)?.boolValue ?? false
|
||||
return .ObjectMessagesAlreadyBeingIntercepted(target: target, interceptionMechanism: isKVO ? .KVO : .Unknown)
|
||||
case .SelectorNotImplemented:
|
||||
return .SelectorNotImplemented(target: target)
|
||||
case .CantInterceptCoreFoundationTollFreeBridgedObjects:
|
||||
return .CantInterceptCoreFoundationTollFreeBridgedObjects(target: target)
|
||||
case .ThreadingCollisionWithOtherInterceptionMechanism:
|
||||
return .ThreadingCollisionWithOtherInterceptionMechanism(target: target)
|
||||
case .SavingOriginalForwardingMethodFailed:
|
||||
return .SavingOriginalForwardingMethodFailed(target: target)
|
||||
case .ReplacingMethodWithForwardingImplementation:
|
||||
return .ReplacingMethodWithForwardingImplementation(target: target)
|
||||
case .ObservingPerformanceSensitiveMessages:
|
||||
return .ObservingPerformanceSensitiveMessages(target: target)
|
||||
case .ObservingMessagesWithUnsupportedReturnType:
|
||||
return .ObservingMessagesWithUnsupportedReturnType(target: target)
|
||||
case .unknown:
|
||||
return .unknown(target: target)
|
||||
case .objectMessagesAlreadyBeingIntercepted:
|
||||
let isKVO = (error.userInfo[RXObjCRuntimeErrorIsKVOKey] as? NSNumber)?.boolValue ?? false
|
||||
return .objectMessagesAlreadyBeingIntercepted(target: target, interceptionMechanism: isKVO ? .kvo : .unknown)
|
||||
case .selectorNotImplemented:
|
||||
return .selectorNotImplemented(target: target)
|
||||
case .cantInterceptCoreFoundationTollFreeBridgedObjects:
|
||||
return .cantInterceptCoreFoundationTollFreeBridgedObjects(target: target)
|
||||
case .threadingCollisionWithOtherInterceptionMechanism:
|
||||
return .threadingCollisionWithOtherInterceptionMechanism(target: target)
|
||||
case .savingOriginalForwardingMethodFailed:
|
||||
return .savingOriginalForwardingMethodFailed(target: target)
|
||||
case .replacingMethodWithForwardingImplementation:
|
||||
return .replacingMethodWithForwardingImplementation(target: target)
|
||||
case .observingPerformanceSensitiveMessages:
|
||||
return .observingPerformanceSensitiveMessages(target: target)
|
||||
case .observingMessagesWithUnsupportedReturnType:
|
||||
return .observingMessagesWithUnsupportedReturnType(target: target)
|
||||
}
|
||||
}
|
||||
|
||||
return RxCocoaObjCRuntimeError.Unknown(target: target)
|
||||
|
||||
return RxCocoaObjCRuntimeError.unknown(target: target)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +337,7 @@ extension NSError {
|
|||
|
||||
#if !RX_NO_MODULE
|
||||
|
||||
@noreturn func rxFatalError(lastMessage: String) {
|
||||
func rxFatalError(_ lastMessage: String) -> Never {
|
||||
// The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours.
|
||||
fatalError(lastMessage)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,4 +41,4 @@ class RxTarget : NSObject
|
|||
OSAtomicDecrement32(&resourceCount)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
//
|
||||
// RxTextInput.swift
|
||||
// Rx
|
||||
//
|
||||
// Created by Krunoslav Zaher on 5/12/16.
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
#if os(iOS) || os(tvOS)
|
||||
import UIKit
|
||||
|
||||
/**
|
||||
Represents text input with reactive extensions.
|
||||
*/
|
||||
public protocol RxTextInput : UITextInput {
|
||||
|
||||
/**
|
||||
Reactive wrapper for `text` property.
|
||||
*/
|
||||
var rx_text: ControlProperty<String> { get }
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(OSX)
|
||||
import Cocoa
|
||||
|
||||
/**
|
||||
Represents text input with reactive extensions.
|
||||
*/
|
||||
public protocol RxTextInput : NSTextInput {
|
||||
|
||||
/**
|
||||
Reactive wrapper for `text` property.
|
||||
*/
|
||||
var rx_text: ControlProperty<String> { get }
|
||||
}
|
||||
#endif
|
||||
|
|
@ -20,5 +20,20 @@ public protocol SectionedViewDataSourceType {
|
|||
- parameter indexPath: Model index path
|
||||
- returns: Model at index path.
|
||||
*/
|
||||
func modelAtIndexPath(indexPath: NSIndexPath) throws -> Any
|
||||
}
|
||||
func model(_ indexPath: IndexPath) throws -> Any
|
||||
}
|
||||
|
||||
extension SectionedViewDataSourceType {
|
||||
/**
|
||||
Returns model at index path.
|
||||
|
||||
In case data source doesn't contain any sections when this method is being called, `RxCocoaError.ItemsNotYetBound(object: self)` is thrown.
|
||||
|
||||
- parameter indexPath: Model index path
|
||||
- returns: Model at index path.
|
||||
*/
|
||||
@available(*, deprecated, renamed: "model(_:)")
|
||||
func model(_ indexPath: IndexPath) throws -> Any {
|
||||
return try self.model(indexPath)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,147 @@
|
|||
//
|
||||
// TextInput.swift
|
||||
// Rx
|
||||
//
|
||||
// Created by Krunoslav Zaher on 5/12/16.
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
#if os(iOS) || os(tvOS)
|
||||
import UIKit
|
||||
|
||||
/**
|
||||
Represents text input with reactive extensions.
|
||||
*/
|
||||
public struct TextInput<Base: UITextInput> {
|
||||
/**
|
||||
Base text input to extend.
|
||||
*/
|
||||
public let base: Base
|
||||
|
||||
/**
|
||||
Reactive wrapper for `text` property.
|
||||
*/
|
||||
public let text: ControlProperty<String>
|
||||
|
||||
/**
|
||||
Initializes new text input.
|
||||
|
||||
- parameter base: Base object.
|
||||
- parameter text: Textual control property.
|
||||
*/
|
||||
public init(base: Base, text: ControlProperty<String>) {
|
||||
self.base = base
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
extension Reactive where Base: UITextField {
|
||||
/**
|
||||
Reactive text input.
|
||||
*/
|
||||
public var textInput: TextInput<UITextField> {
|
||||
return TextInput(base: base, text: self.text)
|
||||
}
|
||||
}
|
||||
|
||||
extension Reactive where Base: UITextView {
|
||||
/**
|
||||
Reactive text input.
|
||||
*/
|
||||
public var textInput: TextInput<UITextView> {
|
||||
return TextInput(base: base, text: self.text)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Represents text input with reactive extensions.
|
||||
*/
|
||||
@available(*, deprecated, renamed: "TextInput")
|
||||
public protocol RxTextInput : UITextInput {
|
||||
@available(*, deprecated, renamed: "rx.textInput.text")
|
||||
var rx_text: ControlProperty<String> { get }
|
||||
}
|
||||
|
||||
extension UITextField : RxTextInput {
|
||||
@available(*, deprecated, renamed: "rx.textInput.text")
|
||||
public var rx_text: ControlProperty<String> {
|
||||
return self.rx.text
|
||||
}
|
||||
}
|
||||
|
||||
extension UITextView : RxTextInput {
|
||||
@available(*, deprecated, renamed: "rx.textInput.text")
|
||||
public var rx_text: ControlProperty<String> {
|
||||
return self.rx.text
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if os(OSX)
|
||||
import Cocoa
|
||||
|
||||
/**
|
||||
Represents text input with reactive extensions.
|
||||
*/
|
||||
public struct TextInput<Base: NSTextInput> {
|
||||
/**
|
||||
Base text input to extend.
|
||||
*/
|
||||
public let base: Base
|
||||
|
||||
/**
|
||||
Reactive wrapper for `text` property.
|
||||
*/
|
||||
public let text: ControlProperty<String>
|
||||
|
||||
/**
|
||||
Initializes new text input.
|
||||
|
||||
- parameter base: Base object.
|
||||
- parameter text: Textual control property.
|
||||
*/
|
||||
public init(base: Base, text: ControlProperty<String>) {
|
||||
self.base = base
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
extension Reactive where Base: NSTextField {
|
||||
/**
|
||||
Reactive text input.
|
||||
*/
|
||||
public var textInput: TextInput<NSTextField> {
|
||||
return TextInput(base: base, text: self.text)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Represents text input with reactive extensions.
|
||||
*/
|
||||
@available(*, deprecated, renamed: "TextInput")
|
||||
public protocol RxTextInput : NSTextInput {
|
||||
|
||||
/**
|
||||
Reactive wrapper for `text` property.
|
||||
*/
|
||||
@available(*, deprecated, renamed: "rx.textInput.text")
|
||||
var rx_text: ControlProperty<String> { get }
|
||||
}
|
||||
|
||||
extension NSTextField : RxTextInput {
|
||||
/**
|
||||
Reactive wrapper for `text` property.
|
||||
*/
|
||||
@available(*, deprecated, renamed: "rx.textInput.text")
|
||||
public var rx_text: ControlProperty<String> {
|
||||
return self.rx.text
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -8,14 +8,18 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface _RXDelegateProxy : NSObject
|
||||
|
||||
@property (nonatomic, weak, readonly) id _forwardToDelegate;
|
||||
|
||||
-(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate;
|
||||
-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate;
|
||||
|
||||
-(BOOL)hasWiredImplementationForSelector:(SEL)selector;
|
||||
|
||||
-(void)interceptedSelector:(SEL)selector withArguments:(NSArray*)arguments;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
#import "_RX.h"
|
||||
#import "_RXObjCRuntime.h"
|
||||
|
||||
@interface _RXDelegateProxy ()
|
||||
@interface _RXDelegateProxy () {
|
||||
id __weak __forwardToDelegate;
|
||||
}
|
||||
|
||||
@property (nonatomic, strong) id strongForwardDelegate;
|
||||
|
||||
|
|
@ -90,7 +92,11 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil;
|
|||
|
||||
}
|
||||
|
||||
-(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate {
|
||||
-(id)_forwardToDelegate {
|
||||
return __forwardToDelegate;
|
||||
}
|
||||
|
||||
-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate {
|
||||
__forwardToDelegate = forwardToDelegate;
|
||||
if (retainDelegate) {
|
||||
self.strongForwardDelegate = forwardToDelegate;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
################################################################################
|
||||
*/
|
||||
|
||||
typedef void (^KVOCallback)(id);
|
||||
|
||||
// Exists because if written in Swift, reading unowned is disabled during dealloc process
|
||||
@interface _RXKVOObserver : NSObject
|
||||
|
||||
|
|
@ -23,7 +21,7 @@ typedef void (^KVOCallback)(id);
|
|||
retainTarget:(BOOL)retainTarget
|
||||
keyPath:(NSString*)keyPath
|
||||
options:(NSKeyValueObservingOptions)options
|
||||
callback:(KVOCallback)callback;
|
||||
callback:(void (^)(id))callback;
|
||||
|
||||
-(void)dispose;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
@property (nonatomic, unsafe_unretained) id target;
|
||||
@property (nonatomic, strong ) id retainedTarget;
|
||||
@property (nonatomic, copy ) NSString *keyPath;
|
||||
@property (nonatomic, copy ) KVOCallback callback;
|
||||
@property (nonatomic, copy ) void (^callback)(id);
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -613,11 +613,11 @@ static NSMutableDictionary<NSString *, RXInterceptWithOptimizedObserver> *optimi
|
|||
}
|
||||
|
||||
// For `dealloc` message, original implementation will be swizzled.
|
||||
// This is a special case because observing `dealloc` message is performed when `rx_observeWeakly` is used.
|
||||
// This is a special case because observing `dealloc` message is performed when `observeWeakly` is used.
|
||||
//
|
||||
// Some toll free bridged classes don't handle `object_setClass` well and cause crashes.
|
||||
//
|
||||
// To make `rx_deallocating` as robust as possible, original implementation will be replaced.
|
||||
// To make `deallocating` as robust as possible, original implementation will be replaced.
|
||||
if (selector == deallocSelector) {
|
||||
Class __nonnull deallocSwizzingTarget = [target class];
|
||||
IMP interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:deallocSwizzingTarget];
|
||||
|
|
@ -720,9 +720,9 @@ static NSMutableDictionary<NSString *, RXInterceptWithOptimizedObserver> *optimi
|
|||
If the object is reporting a different class then what it's real class, that means that there is probably
|
||||
already some interception mechanism in place or something weird is happening.
|
||||
|
||||
Most common case when this would happen is when using KVO (`rx_observe`) and `rx_sentMessage`.
|
||||
Most common case when this would happen is when using KVO (`observe`) and `sentMessage`.
|
||||
|
||||
This error is easily resolved by just using `rx_sentMessage` observing before `rx_observe`.
|
||||
This error is easily resolved by just using `sentMessage` observing before `observe`.
|
||||
|
||||
The reason why other way around could create issues is because KVO will unregister it's interceptor
|
||||
class and restore original class. Unfortunately that will happen no matter was there another interceptor
|
||||
|
|
@ -730,7 +730,7 @@ static NSMutableDictionary<NSString *, RXInterceptWithOptimizedObserver> *optimi
|
|||
|
||||
Failure scenario:
|
||||
* KVO sets class to be `__KVO__OriginalClass` (subclass of `OriginalClass`)
|
||||
* `rx_sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`)
|
||||
* `sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`)
|
||||
* then unobserving with KVO will restore class to be `OriginalClass` -> failure point
|
||||
|
||||
The reason why changing order of observing works is because any interception method should return
|
||||
|
|
@ -1017,4 +1017,4 @@ NSInteger RX_number_of_swizzled_methods() {
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -12,21 +12,21 @@ import RxSwift
|
|||
#endif
|
||||
import Cocoa
|
||||
|
||||
extension NSButton {
|
||||
extension Reactive where Base: NSButton {
|
||||
|
||||
/**
|
||||
Reactive wrapper for control event.
|
||||
*/
|
||||
public var rx_tap: ControlEvent<Void> {
|
||||
return rx_controlEvent
|
||||
public var tap: ControlEvent<Void> {
|
||||
return controlEvent
|
||||
}
|
||||
|
||||
/**
|
||||
Reactive wrapper for `state` property`.
|
||||
*/
|
||||
public var rx_state: ControlProperty<Int> {
|
||||
return NSButton.rx_value(
|
||||
self,
|
||||
public var state: ControlProperty<Int> {
|
||||
return Reactive<NSButton>.value(
|
||||
base,
|
||||
getter: { control in
|
||||
return control.state
|
||||
}, setter: { control, state in
|
||||
|
|
@ -34,4 +34,4 @@ extension NSButton {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,29 +15,29 @@ import RxSwift
|
|||
var rx_value_key: UInt8 = 0
|
||||
var rx_control_events_key: UInt8 = 0
|
||||
|
||||
extension NSControl {
|
||||
extension Reactive where Base: NSControl {
|
||||
|
||||
/**
|
||||
Reactive wrapper for control event.
|
||||
*/
|
||||
public var rx_controlEvent: ControlEvent<Void> {
|
||||
public var controlEvent: ControlEvent<Void> {
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
|
||||
let source = rx_lazyInstanceObservable(&rx_control_events_key) { () -> Observable<Void> in
|
||||
Observable.create { [weak self] observer in
|
||||
let source = lazyInstanceObservable(&rx_control_events_key) { () -> Observable<Void> in
|
||||
Observable.create { [weak control = self.base] observer in
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
|
||||
guard let control = self else {
|
||||
observer.on(.Completed)
|
||||
return NopDisposable.instance
|
||||
guard let control = control else {
|
||||
observer.on(.completed)
|
||||
return Disposables.create()
|
||||
}
|
||||
|
||||
let observer = ControlTarget(control: control) { control in
|
||||
observer.on(.Next())
|
||||
observer.on(.next())
|
||||
}
|
||||
|
||||
return observer
|
||||
}.takeUntil(self.rx_deallocated)
|
||||
}.takeUntil(self.deallocated)
|
||||
}
|
||||
|
||||
return ControlEvent(events: source)
|
||||
|
|
@ -47,28 +47,28 @@ extension NSControl {
|
|||
You might be wondering why the ugly `as!` casts etc, well, for some reason if
|
||||
Swift compiler knows C is UIControl type and optimizations are turned on, it will crash.
|
||||
*/
|
||||
static func rx_value<C: AnyObject, T: Equatable>(control: C, getter: (C) -> T, setter: (C, T) -> Void) -> ControlProperty<T> {
|
||||
static func value<C: AnyObject, T: Equatable>(_ control: C, getter: @escaping (C) -> T, setter: @escaping (C, T) -> Void) -> ControlProperty<T> {
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
|
||||
let source = (control as! NSObject).rx_lazyInstanceObservable(&rx_value_key) { () -> Observable<T> in
|
||||
let source = (control as! NSObject).rx.lazyInstanceObservable(&rx_value_key) { () -> Observable<T> in
|
||||
return Observable.create { [weak weakControl = control] (observer: AnyObserver<T>) in
|
||||
guard let control = weakControl else {
|
||||
observer.on(.Completed)
|
||||
return NopDisposable.instance
|
||||
observer.on(.completed)
|
||||
return Disposables.create()
|
||||
}
|
||||
|
||||
observer.on(.Next(getter(control)))
|
||||
observer.on(.next(getter(control)))
|
||||
|
||||
let observer = ControlTarget(control: control as! NSControl) { _ in
|
||||
if let control = weakControl {
|
||||
observer.on(.Next(getter(control)))
|
||||
observer.on(.next(getter(control)))
|
||||
}
|
||||
}
|
||||
|
||||
return observer
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
.takeUntil((control as! NSObject).rx_deallocated)
|
||||
.takeUntil((control as! NSObject).rx.deallocated)
|
||||
}
|
||||
|
||||
let bindingObserver = UIBindingObserver(UIElement: control, binding: setter)
|
||||
|
|
@ -79,9 +79,9 @@ extension NSControl {
|
|||
/**
|
||||
Bindable sink for `enabled` property.
|
||||
*/
|
||||
public var rx_enabled: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self) { (owner, value) in
|
||||
owner.enabled = value
|
||||
public var enabled: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self.base) { (owner, value) in
|
||||
owner.isEnabled = value
|
||||
}.asObserver()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ import RxSwift
|
|||
#endif
|
||||
import Cocoa
|
||||
|
||||
extension NSImageView {
|
||||
extension Reactive where Base: NSImageView {
|
||||
|
||||
/**
|
||||
Bindable sink for `image` property.
|
||||
*/
|
||||
public var rx_image: AnyObserver<NSImage?> {
|
||||
return self.rx_imageAnimated(nil)
|
||||
public var image: AnyObserver<NSImage?> {
|
||||
return image(transitionType: nil)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -26,15 +26,39 @@ extension NSImageView {
|
|||
|
||||
- parameter transitionType: Optional transition type while setting the image (kCATransitionFade, kCATransitionMoveIn, ...)
|
||||
*/
|
||||
public func rx_imageAnimated(transitionType: String?) -> AnyObserver<NSImage?> {
|
||||
return UIBindingObserver(UIElement: self) { control, value in
|
||||
@available(*, deprecated, renamed: "image(transitionType:)")
|
||||
public func imageAnimated(_ transitionType: String?) -> AnyObserver<NSImage?> {
|
||||
return UIBindingObserver(UIElement: self.base) { control, value in
|
||||
if let transitionType = transitionType {
|
||||
if value != nil {
|
||||
let transition = CATransition()
|
||||
transition.duration = 0.25
|
||||
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
|
||||
transition.type = transitionType
|
||||
control.layer?.addAnimation(transition, forKey: kCATransition)
|
||||
control.layer?.add(transition, forKey: kCATransition)
|
||||
}
|
||||
}
|
||||
else {
|
||||
control.layer?.removeAllAnimations()
|
||||
}
|
||||
control.image = value
|
||||
}.asObserver()
|
||||
}
|
||||
|
||||
/**
|
||||
Bindable sink for `image` property.
|
||||
|
||||
- parameter transitionType: Optional transition type while setting the image (kCATransitionFade, kCATransitionMoveIn, ...)
|
||||
*/
|
||||
public func image(transitionType: String? = nil) -> AnyObserver<NSImage?> {
|
||||
return UIBindingObserver(UIElement: self.base) { control, value in
|
||||
if let transitionType = transitionType {
|
||||
if value != nil {
|
||||
let transition = CATransition()
|
||||
transition.duration = 0.25
|
||||
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
|
||||
transition.type = transitionType
|
||||
control.layer?.add(transition, forKey: kCATransition)
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -43,5 +67,4 @@ extension NSImageView {
|
|||
control.image = value
|
||||
}.asObserver()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ import RxSwift
|
|||
#endif
|
||||
import Cocoa
|
||||
|
||||
extension NSSlider {
|
||||
extension Reactive where Base: NSSlider {
|
||||
|
||||
/**
|
||||
Reactive wrapper for `value` property.
|
||||
*/
|
||||
public var rx_value: ControlProperty<Double> {
|
||||
return NSControl.rx_value(
|
||||
self,
|
||||
public var value: ControlProperty<Double> {
|
||||
return Reactive<NSControl>.value(
|
||||
base,
|
||||
getter: { control in
|
||||
return control.doubleValue
|
||||
},
|
||||
|
|
@ -29,4 +29,4 @@ extension NSSlider {
|
|||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class RxTextFieldDelegateProxy
|
|||
, NSTextFieldDelegate
|
||||
, DelegateProxyType {
|
||||
|
||||
private let textSubject = PublishSubject<String>()
|
||||
fileprivate let textSubject = PublishSubject<String>()
|
||||
|
||||
/**
|
||||
Typed parent object.
|
||||
|
|
@ -41,10 +41,10 @@ public class RxTextFieldDelegateProxy
|
|||
|
||||
// MARK: Delegate methods
|
||||
|
||||
public override func controlTextDidChange(notification: NSNotification) {
|
||||
public override func controlTextDidChange(_ notification: Notification) {
|
||||
let textField = notification.object as! NSTextField
|
||||
let nextValue = textField.stringValue
|
||||
self.textSubject.on(.Next(nextValue))
|
||||
self.textSubject.on(.next(nextValue))
|
||||
}
|
||||
|
||||
// MARK: Delegate proxy methods
|
||||
|
|
@ -52,16 +52,16 @@ public class RxTextFieldDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func createProxyForObject(object: AnyObject) -> AnyObject {
|
||||
public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
|
||||
let control = (object as! NSTextField)
|
||||
|
||||
return castOrFatalError(control.rx_createDelegateProxy())
|
||||
return castOrFatalError(control.createRxDelegateProxy())
|
||||
}
|
||||
|
||||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let textField: NSTextField = castOrFatalError(object)
|
||||
return textField.delegate
|
||||
}
|
||||
|
|
@ -69,44 +69,47 @@ public class RxTextFieldDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let textField: NSTextField = castOrFatalError(object)
|
||||
textField.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension NSTextField : RxTextInput {
|
||||
extension NSTextField {
|
||||
|
||||
/**
|
||||
Factory method that enables subclasses to implement their own `rx_delegate`.
|
||||
Factory method that enables subclasses to implement their own `delegate`.
|
||||
|
||||
- returns: Instance of delegate proxy that wraps `delegate`.
|
||||
*/
|
||||
public func rx_createDelegateProxy() -> RxTextFieldDelegateProxy {
|
||||
public func createRxDelegateProxy() -> RxTextFieldDelegateProxy {
|
||||
return RxTextFieldDelegateProxy(parentObject: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension Reactive where Base: NSTextField {
|
||||
|
||||
/**
|
||||
Reactive wrapper for `delegate`.
|
||||
|
||||
For more information take a look at `DelegateProxyType` protocol documentation.
|
||||
*/
|
||||
public var rx_delegate: DelegateProxy {
|
||||
return RxTextFieldDelegateProxy.proxyForObject(self)
|
||||
public var delegate: DelegateProxy {
|
||||
return RxTextFieldDelegateProxy.proxyForObject(base)
|
||||
}
|
||||
|
||||
/**
|
||||
Reactive wrapper for `text` property.
|
||||
*/
|
||||
public var rx_text: ControlProperty<String> {
|
||||
let delegate = RxTextFieldDelegateProxy.proxyForObject(self)
|
||||
public var text: ControlProperty<String> {
|
||||
let delegate = RxTextFieldDelegateProxy.proxyForObject(base)
|
||||
|
||||
let source = Observable.deferred { [weak self] in
|
||||
delegate.textSubject.startWith(self?.stringValue ?? "")
|
||||
}.takeUntil(rx_deallocated)
|
||||
let source = Observable.deferred { [weak textField = self.base] in
|
||||
delegate.textSubject.startWith(textField?.stringValue ?? "")
|
||||
}.takeUntil(deallocated)
|
||||
|
||||
let observer = UIBindingObserver(UIElement: self) { control, value in
|
||||
let observer = UIBindingObserver(UIElement: base) { control, value in
|
||||
control.stringValue = value
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,22 +12,22 @@ import Cocoa
|
|||
import RxSwift
|
||||
#endif
|
||||
|
||||
extension NSView {
|
||||
extension Reactive where Base: NSView {
|
||||
/**
|
||||
Bindable sink for `hidden` property.
|
||||
*/
|
||||
public var rx_hidden: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self) { view, value in
|
||||
view.hidden = value
|
||||
public var hidden: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self.base) { view, value in
|
||||
view.isHidden = value
|
||||
}.asObserver()
|
||||
}
|
||||
|
||||
/**
|
||||
Bindable sink for `alphaValue` property.
|
||||
*/
|
||||
public var rx_alpha: AnyObserver<CGFloat> {
|
||||
return UIBindingObserver(UIElement: self) { view, value in
|
||||
public var alpha: AnyObserver<CGFloat> {
|
||||
return UIBindingObserver(UIElement: self.base) { view, value in
|
||||
view.alphaValue = value
|
||||
}.asObserver()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,29 +19,30 @@ class _RxCollectionViewReactiveArrayDataSource
|
|||
: NSObject
|
||||
, UICollectionViewDataSource {
|
||||
|
||||
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
|
||||
@objc(numberOfSectionsInCollectionView:)
|
||||
func numberOfSections(in: UICollectionView) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
func _collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
func _collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return _collectionView(collectionView, numberOfItemsInSection: section)
|
||||
}
|
||||
|
||||
func _collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
fileprivate func _collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
rxAbstractMethod()
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
return _collectionView(collectionView, cellForItemAtIndexPath: indexPath)
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
return _collectionView(collectionView, cellForItemAt: indexPath)
|
||||
}
|
||||
}
|
||||
|
||||
class RxCollectionViewReactiveArrayDataSourceSequenceWrapper<S: SequenceType>
|
||||
: RxCollectionViewReactiveArrayDataSource<S.Generator.Element>
|
||||
class RxCollectionViewReactiveArrayDataSourceSequenceWrapper<S: Sequence>
|
||||
: RxCollectionViewReactiveArrayDataSource<S.Iterator.Element>
|
||||
, RxCollectionViewDataSourceType {
|
||||
typealias Element = S
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ class RxCollectionViewReactiveArrayDataSourceSequenceWrapper<S: SequenceType>
|
|||
super.init(cellFactory: cellFactory)
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, observedEvent: Event<S>) {
|
||||
func collectionView(_ collectionView: UICollectionView, observedEvent: Event<S>) {
|
||||
UIBindingObserver(UIElement: self) { collectionViewDataSource, sectionModels in
|
||||
let sections = Array(sectionModels)
|
||||
collectionViewDataSource.collectionView(collectionView, observedElements: sections)
|
||||
|
|
@ -67,14 +68,14 @@ class RxCollectionViewReactiveArrayDataSource<Element>
|
|||
|
||||
var itemModels: [Element]? = nil
|
||||
|
||||
func modelAtIndex(index: Int) -> Element? {
|
||||
func modelAtIndex(_ index: Int) -> Element? {
|
||||
return itemModels?[index]
|
||||
}
|
||||
|
||||
func modelAtIndexPath(indexPath: NSIndexPath) throws -> Any {
|
||||
func model(_ indexPath: IndexPath) throws -> Any {
|
||||
precondition(indexPath.section == 0)
|
||||
guard let item = itemModels?[indexPath.item] else {
|
||||
throw RxCocoaError.ItemsNotYetBound(object: self)
|
||||
throw RxCocoaError.itemsNotYetBound(object: self)
|
||||
}
|
||||
return item
|
||||
}
|
||||
|
|
@ -87,20 +88,20 @@ class RxCollectionViewReactiveArrayDataSource<Element>
|
|||
|
||||
// data source
|
||||
|
||||
override func _collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
override func _collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return itemModels?.count ?? 0
|
||||
}
|
||||
|
||||
override func _collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
override func _collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
return cellFactory(collectionView, indexPath.item, itemModels![indexPath.item])
|
||||
}
|
||||
|
||||
// reactive
|
||||
|
||||
func collectionView(collectionView: UICollectionView, observedElements: [Element]) {
|
||||
func collectionView(_ collectionView: UICollectionView, observedElements: [Element]) {
|
||||
self.itemModels = observedElements
|
||||
|
||||
collectionView.reloadData()
|
||||
collectionView.reloadSections(NSIndexSet(index: 0))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,30 +19,30 @@ class _RxTableViewReactiveArrayDataSource
|
|||
: NSObject
|
||||
, UITableViewDataSource {
|
||||
|
||||
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
func numberOfSections(in tableView: UITableView) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
func _tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
func _tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return _tableView(tableView, numberOfRowsInSection: section)
|
||||
}
|
||||
|
||||
func _tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
fileprivate func _tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
rxAbstractMethod()
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
return _tableView(tableView, cellForRowAtIndexPath: indexPath)
|
||||
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
return _tableView(tableView, cellForRowAt: indexPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class RxTableViewReactiveArrayDataSourceSequenceWrapper<S: SequenceType>
|
||||
: RxTableViewReactiveArrayDataSource<S.Generator.Element>
|
||||
class RxTableViewReactiveArrayDataSourceSequenceWrapper<S: Sequence>
|
||||
: RxTableViewReactiveArrayDataSource<S.Iterator.Element>
|
||||
, RxTableViewDataSourceType {
|
||||
typealias Element = S
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ class RxTableViewReactiveArrayDataSourceSequenceWrapper<S: SequenceType>
|
|||
super.init(cellFactory: cellFactory)
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, observedEvent: Event<S>) {
|
||||
func tableView(_ tableView: UITableView, observedEvent: Event<S>) {
|
||||
UIBindingObserver(UIElement: self) { tableViewDataSource, sectionModels in
|
||||
let sections = Array(sectionModels)
|
||||
tableViewDataSource.tableView(tableView, observedElements: sections)
|
||||
|
|
@ -66,14 +66,14 @@ class RxTableViewReactiveArrayDataSource<Element>
|
|||
|
||||
var itemModels: [Element]? = nil
|
||||
|
||||
func modelAtIndex(index: Int) -> Element? {
|
||||
func modelAtIndex(_ index: Int) -> Element? {
|
||||
return itemModels?[index]
|
||||
}
|
||||
|
||||
func modelAtIndexPath(indexPath: NSIndexPath) throws -> Any {
|
||||
func model(_ indexPath: IndexPath) throws -> Any {
|
||||
precondition(indexPath.section == 0)
|
||||
guard let item = itemModels?[indexPath.item] else {
|
||||
throw RxCocoaError.ItemsNotYetBound(object: self)
|
||||
throw RxCocoaError.itemsNotYetBound(object: self)
|
||||
}
|
||||
return item
|
||||
}
|
||||
|
|
@ -84,17 +84,17 @@ class RxTableViewReactiveArrayDataSource<Element>
|
|||
self.cellFactory = cellFactory
|
||||
}
|
||||
|
||||
override func _tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
override func _tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return itemModels?.count ?? 0
|
||||
}
|
||||
|
||||
override func _tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
override func _tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
return cellFactory(tableView, indexPath.item, itemModels![indexPath.row])
|
||||
}
|
||||
|
||||
// reactive
|
||||
|
||||
func tableView(tableView: UITableView, observedElements: [Element]) {
|
||||
func tableView(_ tableView: UITableView, observedElements: [Element]) {
|
||||
self.itemModels = observedElements
|
||||
|
||||
tableView.reloadData()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import Foundation
|
|||
import UIKit
|
||||
|
||||
#if os(iOS) || os(tvOS)
|
||||
public typealias ItemMovedEvent = (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath)
|
||||
public typealias WillDisplayCellEvent = (cell: UITableViewCell, indexPath: NSIndexPath)
|
||||
public typealias DidEndDisplayingCellEvent = (cell: UITableViewCell, indexPath: NSIndexPath)
|
||||
#endif
|
||||
public typealias ItemMovedEvent = (sourceIndex: IndexPath, destinationIndex: IndexPath)
|
||||
public typealias WillDisplayCellEvent = (cell: UITableViewCell, indexPath: IndexPath)
|
||||
public typealias DidEndDisplayingCellEvent = (cell: UITableViewCell, indexPath: IndexPath)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -14,22 +14,22 @@ import Foundation
|
|||
#endif
|
||||
import UIKit
|
||||
|
||||
extension NSTextStorage {
|
||||
extension Reactive where Base: NSTextStorage {
|
||||
|
||||
/**
|
||||
Reactive wrapper for `delegate`.
|
||||
|
||||
For more information take a look at `DelegateProxyType` protocol documentation.
|
||||
*/
|
||||
public var rx_delegate:DelegateProxy {
|
||||
return RxTextStorageDelegateProxy.proxyForObject(self)
|
||||
public var delegate:DelegateProxy {
|
||||
return RxTextStorageDelegateProxy.proxyForObject(base)
|
||||
}
|
||||
|
||||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didProcessEditingRangeChangeInLength: Observable<(editedMask:NSTextStorageEditActions, editedRange:NSRange, delta:Int)> {
|
||||
return rx_delegate
|
||||
public var didProcessEditingRangeChangeInLength: Observable<(editedMask:NSTextStorageEditActions, editedRange:NSRange, delta:Int)> {
|
||||
return delegate
|
||||
.observe(#selector(NSTextStorageDelegate.textStorage(_:didProcessEditing:range:changeInLength:)))
|
||||
.map { a in
|
||||
let editedMask = NSTextStorageEditActions(rawValue: try castOrThrow(UInt.self, a[1]) )
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public protocol RxCollectionViewDataSourceType /*: UICollectionViewDataSource*/
|
|||
- parameter collectionView: Bound collection view.
|
||||
- parameter observedEvent: Event
|
||||
*/
|
||||
func collectionView(collectionView: UICollectionView, observedEvent: Event<Element>) -> Void
|
||||
func collectionView(_ collectionView: UICollectionView, observedEvent: Event<Element>) -> Void
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public protocol RxTableViewDataSourceType /*: UITableViewDataSource*/ {
|
|||
- parameter tableView: Bound table view.
|
||||
- parameter observedEvent: Event
|
||||
*/
|
||||
func tableView(tableView: UITableView, observedEvent: Event<Element>) -> Void
|
||||
func tableView(_ tableView: UITableView, observedEvent: Event<Element>) -> Void
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,12 +19,14 @@ let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet()
|
|||
class CollectionViewDataSourceNotSet
|
||||
: NSObject
|
||||
, UICollectionViewDataSource {
|
||||
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
rxAbstractMethodWithMessage(dataSourceNotSet)
|
||||
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
|
||||
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
rxAbstractMethodWithMessage(dataSourceNotSet)
|
||||
}
|
||||
|
||||
|
|
@ -60,15 +62,15 @@ public class RxCollectionViewDataSourceProxy
|
|||
/**
|
||||
Required delegate method implementation.
|
||||
*/
|
||||
public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, numberOfItemsInSection: section) ?? 0
|
||||
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, numberOfItemsInSection: section)
|
||||
}
|
||||
|
||||
/**
|
||||
Required delegate method implementation.
|
||||
*/
|
||||
public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, cellForItemAtIndexPath: indexPath)
|
||||
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, cellForItemAt: indexPath)
|
||||
}
|
||||
|
||||
// MARK: proxy
|
||||
|
|
@ -76,23 +78,23 @@ public class RxCollectionViewDataSourceProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func createProxyForObject(object: AnyObject) -> AnyObject {
|
||||
public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
|
||||
let collectionView = (object as! UICollectionView)
|
||||
|
||||
return castOrFatalError(collectionView.rx_createDataSourceProxy())
|
||||
return castOrFatalError(collectionView.createRxDataSourceProxy())
|
||||
}
|
||||
|
||||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func delegateAssociatedObjectTag() -> UnsafePointer<Void> {
|
||||
public override class func delegateAssociatedObjectTag() -> UnsafeRawPointer {
|
||||
return _pointer(&dataSourceAssociatedTag)
|
||||
}
|
||||
|
||||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let collectionView: UICollectionView = castOrFatalError(object)
|
||||
collectionView.dataSource = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -100,7 +102,7 @@ public class RxCollectionViewDataSourceProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let collectionView: UICollectionView = castOrFatalError(object)
|
||||
return collectionView.dataSource
|
||||
}
|
||||
|
|
@ -108,7 +110,7 @@ public class RxCollectionViewDataSourceProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override func setForwardToDelegate(forwardToDelegate: AnyObject?, retainDelegate: Bool) {
|
||||
public override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) {
|
||||
let requiredMethodsDataSource: UICollectionViewDataSource? = castOptionalOrFatalError(forwardToDelegate)
|
||||
_requiredMethodsDataSource = requiredMethodsDataSource ?? collectionViewDataSourceNotSet
|
||||
super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class RxImagePickerDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let imagePickerController: UIImagePickerController = castOrFatalError(object)
|
||||
imagePickerController.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ public class RxImagePickerDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let imagePickerController: UIImagePickerController = castOrFatalError(object)
|
||||
return imagePickerController.delegate
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class RxPickerViewDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let pickerView: UIPickerView = castOrFatalError(object)
|
||||
pickerView.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class RxPickerViewDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let pickerView: UIPickerView = castOrFatalError(object)
|
||||
return pickerView.delegate
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,21 +22,21 @@ public class RxScrollViewDelegateProxy
|
|||
, UIScrollViewDelegate
|
||||
, DelegateProxyType {
|
||||
|
||||
private var _contentOffsetSubject: ReplaySubject<CGPoint>?
|
||||
fileprivate var _contentOffsetSubject: ReplaySubject<CGPoint>?
|
||||
|
||||
/**
|
||||
Typed parent object.
|
||||
*/
|
||||
public weak private(set) var scrollView: UIScrollView?
|
||||
public weak fileprivate(set) var scrollView: UIScrollView?
|
||||
|
||||
/**
|
||||
Optimized version used for observing content offset changes.
|
||||
*/
|
||||
internal var contentOffsetSubject: Observable<CGPoint> {
|
||||
if _contentOffsetSubject == nil {
|
||||
let replaySubject = ReplaySubject<CGPoint>.create(bufferSize: 1)
|
||||
let replaySubject = ReplaySubject<CGPoint>.create(bufferSize:1)
|
||||
_contentOffsetSubject = replaySubject
|
||||
replaySubject.on(.Next(self.scrollView?.contentOffset ?? CGPointZero))
|
||||
replaySubject.on(.next(self.scrollView?.contentOffset ?? CGPoint.zero))
|
||||
}
|
||||
|
||||
return _contentOffsetSubject!
|
||||
|
|
@ -57,9 +57,9 @@ public class RxScrollViewDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public func scrollViewDidScroll(scrollView: UIScrollView) {
|
||||
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
if let contentOffset = _contentOffsetSubject {
|
||||
contentOffset.on(.Next(scrollView.contentOffset))
|
||||
contentOffset.on(.next(scrollView.contentOffset))
|
||||
}
|
||||
self._forwardToDelegate?.scrollViewDidScroll?(scrollView)
|
||||
}
|
||||
|
|
@ -69,16 +69,16 @@ public class RxScrollViewDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func createProxyForObject(object: AnyObject) -> AnyObject {
|
||||
public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
|
||||
let scrollView = (object as! UIScrollView)
|
||||
|
||||
return castOrFatalError(scrollView.rx_createDelegateProxy())
|
||||
return castOrFatalError(scrollView.createRxDelegateProxy())
|
||||
}
|
||||
|
||||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let scrollView: UIScrollView = castOrFatalError(object)
|
||||
scrollView.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -86,14 +86,14 @@ public class RxScrollViewDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let scrollView: UIScrollView = castOrFatalError(object)
|
||||
return scrollView.delegate
|
||||
}
|
||||
|
||||
deinit {
|
||||
if let contentOffset = _contentOffsetSubject {
|
||||
contentOffset.on(.Completed)
|
||||
contentOffset.on(.completed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class RxSearchBarDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let searchBar: UISearchBar = castOrFatalError(object)
|
||||
return searchBar.delegate
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ public class RxSearchBarDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let searchBar: UISearchBar = castOrFatalError(object)
|
||||
searchBar.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -44,10 +44,10 @@ public class RxSearchBarDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func createProxyForObject(object: AnyObject) -> AnyObject {
|
||||
public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
|
||||
let searchBar = (object as! UISearchBar)
|
||||
|
||||
return castOrFatalError(searchBar.rx_createDelegateProxy())
|
||||
return castOrFatalError(searchBar.createRxDelegateProxy())
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class RxSearchControllerDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let searchController: UISearchController = castOrFatalError(object)
|
||||
searchController.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ public class RxSearchControllerDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let searchController: UISearchController = castOrFatalError(object)
|
||||
return searchController.delegate
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class RxTabBarDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let tabBar: UITabBar = castOrFatalError(object)
|
||||
return tabBar.delegate
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ public class RxTabBarDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let tabBar: UITabBar = castOrFatalError(object)
|
||||
tabBar.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -41,12 +41,12 @@ public class RxTabBarDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func createProxyForObject(object: AnyObject) -> AnyObject {
|
||||
public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
|
||||
let tabBar = (object as! UITabBar)
|
||||
|
||||
return castOrFatalError(tabBar.rx_createDelegateProxy())
|
||||
return castOrFatalError(tabBar.createRxDelegateProxy())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,15 +19,12 @@ let tableViewDataSourceNotSet = TableViewDataSourceNotSet()
|
|||
class TableViewDataSourceNotSet
|
||||
: NSObject
|
||||
, UITableViewDataSource {
|
||||
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
rxAbstractMethodWithMessage(dataSourceNotSet)
|
||||
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
rxAbstractMethodWithMessage(dataSourceNotSet)
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
rxAbstractMethodWithMessage(dataSourceNotSet)
|
||||
}
|
||||
}
|
||||
|
|
@ -43,9 +40,9 @@ public class RxTableViewDataSourceProxy
|
|||
/**
|
||||
Typed parent object.
|
||||
*/
|
||||
public weak private(set) var tableView: UITableView?
|
||||
public weak fileprivate(set) var tableView: UITableView?
|
||||
|
||||
private weak var _requiredMethodsDataSource: UITableViewDataSource? = tableViewDataSourceNotSet
|
||||
fileprivate weak var _requiredMethodsDataSource: UITableViewDataSource? = tableViewDataSourceNotSet
|
||||
|
||||
/**
|
||||
Initializes `RxTableViewDataSourceProxy`
|
||||
|
|
@ -62,22 +59,15 @@ public class RxTableViewDataSourceProxy
|
|||
/**
|
||||
Required delegate method implementation.
|
||||
*/
|
||||
public func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).numberOfSectionsInTableView?(tableView) ?? 1
|
||||
}
|
||||
|
||||
/**
|
||||
Required delegate method implementation.
|
||||
*/
|
||||
public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, numberOfRowsInSection: section)
|
||||
}
|
||||
|
||||
/**
|
||||
Required delegate method implementation.
|
||||
*/
|
||||
public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, cellForRowAtIndexPath: indexPath)
|
||||
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, cellForRowAt: indexPath)
|
||||
}
|
||||
|
||||
// MARK: proxy
|
||||
|
|
@ -85,23 +75,23 @@ public class RxTableViewDataSourceProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func createProxyForObject(object: AnyObject) -> AnyObject {
|
||||
public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
|
||||
let tableView = (object as! UITableView)
|
||||
|
||||
return castOrFatalError(tableView.rx_createDataSourceProxy())
|
||||
return castOrFatalError(tableView.createRxDataSourceProxy())
|
||||
}
|
||||
|
||||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override class func delegateAssociatedObjectTag() -> UnsafePointer<Void> {
|
||||
public override class func delegateAssociatedObjectTag() -> UnsafeRawPointer {
|
||||
return _pointer(&dataSourceAssociatedTag)
|
||||
}
|
||||
|
||||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let tableView: UITableView = castOrFatalError(object)
|
||||
tableView.dataSource = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -109,7 +99,7 @@ public class RxTableViewDataSourceProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let tableView: UITableView = castOrFatalError(object)
|
||||
return tableView.dataSource
|
||||
}
|
||||
|
|
@ -117,7 +107,7 @@ public class RxTableViewDataSourceProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public override func setForwardToDelegate(forwardToDelegate: AnyObject?, retainDelegate: Bool) {
|
||||
public override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) {
|
||||
let requiredMethodsDataSource: UITableViewDataSource? = castOptionalOrFatalError(forwardToDelegate)
|
||||
_requiredMethodsDataSource = requiredMethodsDataSource ?? tableViewDataSourceNotSet
|
||||
super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class RxTextStorageDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
|
||||
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
|
||||
let textStorage: NSTextStorage = castOrFatalError(object)
|
||||
textStorage.delegate = castOptionalOrFatalError(delegate)
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ public class RxTextStorageDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
|
||||
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
|
||||
let textStorage: NSTextStorage = castOrFatalError(object)
|
||||
return textStorage.delegate
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,14 +41,14 @@ public class RxTextViewDelegateProxy
|
|||
/**
|
||||
For more information take a look at `DelegateProxyType`.
|
||||
*/
|
||||
@objc public func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool {
|
||||
@objc public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
|
||||
/**
|
||||
We've had some issues with observing text changes. This is here just in case we need the same hack in future and that
|
||||
we wouldn't need to change the public interface.
|
||||
*/
|
||||
let forwardToDelegate = self.forwardToDelegate() as? UITextViewDelegate
|
||||
return forwardToDelegate?.textView?(textView,
|
||||
shouldChangeTextInRange: range,
|
||||
shouldChangeTextIn: range,
|
||||
replacementText: text) ?? true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue