From 7521a924ee459c4ee13f95abcd737ce782e088ee Mon Sep 17 00:00:00 2001 From: Mog Date: Thu, 7 Apr 2016 19:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 初始化项目文件 --- .idea/.name | 1 + .idea/dundun.iml | 472 ++ .idea/encodings.xml | 6 + .idea/misc.xml | 13 + .idea/modules.xml | 8 + .idea/workspace.xml | 219 + .idea/xcode.xml | 4 + Podfile | 7 + Podfile.lock | 17 + Pods/Headers/Private/RxCocoa/RxCocoa.h | 1 + Pods/Headers/Private/RxCocoa/_RX.h | 1 + .../Private/RxCocoa/_RXDelegateProxy.h | 1 + Pods/Headers/Private/RxCocoa/_RXKVOObserver.h | 1 + Pods/Headers/Private/RxCocoa/_RXObjCRuntime.h | 1 + Pods/Manifest.lock | 17 + Pods/Pods.xcodeproj/project.pbxproj | 7516 +++++++++++++++++ .../xcschemes/Pods.xcscheme | 60 + .../xcschemes/RxCocoa.xcscheme | 60 + .../xcschemes/RxSwift.xcscheme | 60 + .../xcschemes/SnapKit.xcscheme | 60 + .../xcschemes/xcschememanagement.plist | 52 + Pods/RxCocoa/LICENSE.md | 9 + Pods/RxCocoa/README.md | 77 + .../RxCocoa/Common/CLLocationManager+Rx.swift | 218 + .../Common/CocoaUnits/ControlEvent.swift | 86 + .../Common/CocoaUnits/ControlProperty.swift | 110 + .../Driver/ControlEvent+Driver.swift | 30 + .../Driver/ControlProperty+Driver.swift | 30 + .../Driver/Driver+Operators+arity.swift | 322 + .../CocoaUnits/Driver/Driver+Operators.swift | 493 ++ .../Driver/Driver+Subscription.swift | 90 + .../Common/CocoaUnits/Driver/Driver.swift | 221 + .../ObservableConvertibleType+Driver.swift | 63 + .../CocoaUnits/Driver/Variable+Driver.swift | 26 + .../Common/CocoaUnits/UIBindingObserver.swift | 63 + .../RxCocoa/Common/DelegateProxy.swift | 155 + .../RxCocoa/Common/DelegateProxyType.swift | 252 + .../KVORepresentable+CoreGraphics.swift | 71 + .../Common/KVORepresentable+Swift.swift | 93 + .../RxCocoa/Common/KVORepresentable.swift | 38 + Pods/RxCocoa/RxCocoa/Common/Logging.swift | 27 + .../Common/NSLayoutConstraint+Rx.swift | 43 + .../RxCocoa/Common/Observable+Bind.swift | 107 + .../Implementations/ControlTarget.swift | 92 + .../Implementations/DeallocObservable.swift | 24 + .../Implementations/KVOObservable.swift | 147 + .../Implementations/KVOObserver.swift | 46 + .../Implementations/MessageSentObserver.swift | 74 + .../Observables/NSNotificationCenter+Rx.swift | 34 + .../NSObject+Rx+KVORepresentable.swift | 45 + .../NSObject+Rx+RawRepresentable.swift | 51 + .../Common/Observables/NSObject+Rx.swift | 240 + .../Common/Observables/NSURLSession+Rx.swift | 240 + .../RxCLLocationManagerDelegateProxy.swift | 27 + Pods/RxCocoa/RxCocoa/Common/RxCocoa.swift | 343 + Pods/RxCocoa/RxCocoa/Common/RxTarget.swift | 44 + .../Common/SectionedViewDataSourceType.swift | 24 + Pods/RxCocoa/RxCocoa/Common/_RX.h | 133 + Pods/RxCocoa/RxCocoa/Common/_RX.m | 10 + .../RxCocoa/RxCocoa/Common/_RXDelegateProxy.h | 21 + .../RxCocoa/RxCocoa/Common/_RXDelegateProxy.m | 135 + Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.h | 30 + Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.m | 54 + Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.h | 112 + Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.m | 1022 +++ Pods/RxCocoa/RxCocoa/RxCocoa.h | 19 + ...ollectionViewReactiveArrayDataSource.swift | 107 + .../RxTableViewReactiveArrayDataSource.swift | 104 + .../RxCocoa/iOS/Events/ItemEvents.swift | 12 + .../RxCocoa/iOS/NSTextStorage+Rx.swift | 43 + .../RxCollectionViewDataSourceType.swift | 36 + .../Protocols/RxTableViewDataSourceType.swift | 36 + .../RxCollectionViewDataSourceProxy.swift | 118 + .../RxCollectionViewDelegateProxy.swift | 41 + .../Proxies/RxImagePickerDelegateProxy.swift | 41 + .../Proxies/RxScrollViewDelegateProxy.swift | 101 + .../Proxies/RxSearchBarDelegateProxy.swift | 32 + .../Proxies/RxTableViewDataSourceProxy.swift | 127 + .../Proxies/RxTableViewDelegateProxy.swift | 41 + .../Proxies/RxTextStorageDelegateProxy.swift | 41 + .../iOS/Proxies/RxTextViewDelegateProxy.swift | 56 + .../iOS/UIActivityIndicatorView+Rx.swift | 33 + .../RxCocoa/iOS/UIApplication+Rx.swift | 30 + .../RxCocoa/iOS/UIBarButtonItem+Rx.swift | 86 + Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift | 48 + .../RxCocoa/iOS/UICollectionView+Rx.swift | 234 + Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift | 100 + .../RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift | 35 + .../RxCocoa/iOS/UIGestureRecognizer+Rx.swift | 81 + .../iOS/UIImagePickerController+Rx.swift | 52 + Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift | 51 + Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift | 39 + .../RxCocoa/iOS/UIProgressView+Rx.swift | 30 + .../RxCocoa/iOS/UIRefreshControl+Rx.swift | 33 + .../RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift | 65 + Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift | 73 + .../RxCocoa/iOS/UISegmentedControl+Rx.swift | 35 + Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift | 35 + Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift | 36 + Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift | 36 + .../RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift | 30 + Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift | 291 + Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift | 35 + Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift | 65 + Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift | 37 + Pods/RxSwift/LICENSE.md | 9 + Pods/RxSwift/README.md | 77 + Pods/RxSwift/RxSwift/AnyObserver.swift | 75 + Pods/RxSwift/RxSwift/Cancelable.swift | 19 + .../RxSwift/Concurrency/AsyncLock.swift | 104 + Pods/RxSwift/RxSwift/Concurrency/Lock.swift | 119 + .../RxSwift/Concurrency/LockOwnerType.swift | 23 + .../Concurrency/SynchronizedDisposeType.swift | 20 + .../Concurrency/SynchronizedOnType.swift | 20 + .../SynchronizedSubscribeType.swift | 20 + .../SynchronizedUnsubscribeType.swift | 15 + .../RxSwift/ConnectableObservableType.swift | 21 + Pods/RxSwift/RxSwift/DataStructures/Bag.swift | 327 + .../DataStructures/InfiniteSequence.swift | 30 + .../DataStructures/PriorityQueue.swift | 120 + .../RxSwift/DataStructures/Queue.swift | 174 + Pods/RxSwift/RxSwift/Disposable.swift | 19 + .../Disposables/AnonymousDisposable.swift | 54 + .../Disposables/BinaryDisposable.swift | 54 + .../Disposables/BooleanDisposable.swift | 45 + .../Disposables/CompositeDisposable.swift | 118 + .../RxSwift/Disposables/DisposeBag.swift | 94 + .../RxSwift/Disposables/DisposeBase.swift | 26 + .../RxSwift/Disposables/NAryDisposable.swift | 10 + .../RxSwift/Disposables/NopDisposable.swift | 32 + .../Disposables/RefCountDisposable.swift | 127 + .../Disposables/ScheduledDisposable.swift | 58 + .../Disposables/SerialDisposable.swift | 85 + .../SingleAssignmentDisposable.swift | 89 + .../StableCompositeDisposable.swift | 15 + .../Disposables/SubscriptionDisposable.swift | 23 + Pods/RxSwift/RxSwift/Errors.swift | 72 + Pods/RxSwift/RxSwift/Event.swift | 81 + .../RxSwift/Extensions/String+Rx.swift | 25 + .../RxSwift/ImmediateSchedulerType.swift | 42 + .../RxSwift/Observable+Extensions.swift | 128 + Pods/RxSwift/RxSwift/Observable.swift | 51 + .../RxSwift/ObservableConvertibleType.swift | 26 + Pods/RxSwift/RxSwift/ObservableType.swift | 57 + .../Observables/Implementations/AddRef.swift | 47 + .../Observables/Implementations/Amb.swift | 122 + .../Implementations/AnonymousObservable.swift | 56 + .../Observables/Implementations/Buffer.swift | 119 + .../Observables/Implementations/Catch.swift | 162 + .../CombineLatest+CollectionType.swift | 125 + .../Implementations/CombineLatest+arity.swift | 726 ++ .../Implementations/CombineLatest.swift | 134 + .../Observables/Implementations/Concat.swift | 63 + .../ConnectableObservable.swift | 92 + .../Observables/Implementations/Debug.swift | 77 + .../Implementations/Deferred.swift | 61 + .../Implementations/DelaySubscription.swift | 52 + .../DistinctUntilChanged.swift | 70 + .../Observables/Implementations/Do.swift | 53 + .../Implementations/ElementAt.swift | 79 + .../Observables/Implementations/Empty.swift | 16 + .../Observables/Implementations/Error.swift | 22 + .../Observables/Implementations/Filter.swift | 60 + .../Implementations/Generate.swift | 71 + .../Observables/Implementations/Just.swift | 61 + .../Observables/Implementations/Map.swift | 140 + .../Observables/Implementations/Merge.swift | 424 + .../Implementations/Multicast.swift | 71 + .../Observables/Implementations/Never.swift | 15 + .../Implementations/ObserveOn.swift | 133 + .../ObserveOnSerialDispatchQueue.swift | 81 + .../Implementations/Producer.swift | 30 + .../Observables/Implementations/Range.swift | 59 + .../Observables/Implementations/Reduce.swift | 74 + .../Implementations/RefCount.swift | 84 + .../Observables/Implementations/Repeat.swift | 44 + .../Implementations/RetryWhen.swift | 150 + .../Observables/Implementations/Sample.swift | 129 + .../Observables/Implementations/Scan.swift | 64 + .../Implementations/Sequence.swift | 58 + .../Implementations/ShareReplay1.swift | 101 + .../ShareReplay1WhileConnected.swift | 92 + .../Implementations/SingleAsync.swift | 76 + .../Observables/Implementations/Sink.swift | 57 + .../Observables/Implementations/Skip.swift | 128 + .../Implementations/SkipUntil.swift | 125 + .../Implementations/SkipWhile.swift | 115 + .../Implementations/StartWith.swift | 28 + .../Implementations/SubscribeOn.swift | 60 + .../Observables/Implementations/Switch.swift | 193 + .../Observables/Implementations/Take.swift | 144 + .../Implementations/TakeLast.swift | 63 + .../Implementations/TakeUntil.swift | 120 + .../Implementations/TakeWhile.swift | 132 + .../Implementations/Throttle.swift | 104 + .../Observables/Implementations/Timeout.swift | 120 + .../Observables/Implementations/Timer.swift | 72 + .../Observables/Implementations/ToArray.swift | 50 + .../Observables/Implementations/Using.swift | 78 + .../Observables/Implementations/Window.swift | 152 + .../Implementations/WithLatestFrom.swift | 122 + .../Implementations/Zip+CollectionType.swift | 137 + .../Implementations/Zip+arity.swift | 830 ++ .../Observables/Implementations/Zip.swift | 157 + .../Observables/Observable+Aggregate.swift | 64 + .../Observables/Observable+Binding.swift | 190 + .../Observables/Observable+Concurrency.swift | 62 + .../Observables/Observable+Creation.swift | 219 + .../Observables/Observable+Debug.swift | 28 + .../Observables/Observable+Multiple.swift | 330 + .../Observables/Observable+Single.swift | 258 + ...Observable+StandardSequenceOperators.swift | 323 + .../RxSwift/Observables/Observable+Time.swift | 274 + Pods/RxSwift/RxSwift/ObserverType.swift | 56 + .../RxSwift/Observers/AnonymousObserver.swift | 34 + .../RxSwift/Observers/ObserverBase.swift | 39 + .../RxSwift/Observers/TailRecursiveSink.swift | 152 + .../RxSwift/Platform/Platform.Darwin.swift | 45 + .../RxSwift/Platform/Platform.Linux.swift | 222 + Pods/RxSwift/RxSwift/Rx.swift | 47 + Pods/RxSwift/RxSwift/RxMutableBox.swift | 37 + Pods/RxSwift/RxSwift/SchedulerType.swift | 80 + .../ConcurrentDispatchQueueScheduler.swift | 147 + .../Schedulers/ConcurrentMainScheduler.swift | 90 + .../Schedulers/CurrentThreadScheduler.swift | 149 + .../DispatchQueueSchedulerQOS.swift | 54 + .../Schedulers/HistoricalScheduler.swift | 25 + .../HistoricalSchedulerTimeConverter.swift | 83 + .../Schedulers/ImmediateScheduler.swift | 39 + .../Internal/AnonymousInvocable.swift | 21 + .../Internal/InvocableScheduledItem.swift | 24 + .../Schedulers/Internal/InvocableType.swift | 19 + .../Schedulers/Internal/ScheduledItem.swift | 37 + .../Internal/ScheduledItemType.swift | 15 + .../RxSwift/Schedulers/MainScheduler.swift | 73 + .../Schedulers/OperationQueueScheduler.swift | 59 + .../Schedulers/RecursiveScheduler.swift | 193 + .../SchedulerServices+Emulation.swift | 63 + .../SerialDispatchQueueScheduler.swift | 184 + .../Schedulers/VirtualTimeConverterType.swift | 127 + .../Schedulers/VirtualTimeScheduler.swift | 292 + .../RxSwift/Subjects/BehaviorSubject.swift | 153 + .../RxSwift/Subjects/PublishSubject.swift | 131 + .../RxSwift/Subjects/ReplaySubject.swift | 255 + .../RxSwift/Subjects/SubjectType.swift | 28 + Pods/RxSwift/RxSwift/Subjects/Variable.swift | 69 + Pods/SnapKit/LICENSE | 19 + Pods/SnapKit/README.md | 37 + Pods/SnapKit/Source/Constraint.swift | 504 ++ .../SnapKit/Source/ConstraintAttributes.swift | 182 + .../Source/ConstraintDescription.swift | 606 ++ Pods/SnapKit/Source/ConstraintItem.swift | 68 + Pods/SnapKit/Source/ConstraintMaker.swift | 196 + Pods/SnapKit/Source/ConstraintRelation.swift | 48 + Pods/SnapKit/Source/Debugging.swift | 196 + Pods/SnapKit/Source/EdgeInsets.swift | 38 + Pods/SnapKit/Source/LayoutConstraint.swift | 63 + Pods/SnapKit/Source/SnapKit.swift | 42 + Pods/SnapKit/Source/View+SnapKit.swift | 183 + .../Source/ViewController+SnapKit.swift | 45 + Pods/Target Support Files/Pods/Info.plist | 26 + .../Pods/Pods-acknowledgements.markdown | 50 + .../Pods/Pods-acknowledgements.plist | 88 + Pods/Target Support Files/Pods/Pods-dummy.m | 5 + .../Pods/Pods-frameworks.sh | 95 + .../Pods/Pods-resources.sh | 95 + .../Target Support Files/Pods/Pods-umbrella.h | 6 + .../Pods/Pods.debug.xcconfig | 8 + Pods/Target Support Files/Pods/Pods.modulemap | 6 + .../Pods/Pods.release.xcconfig | 8 + Pods/Target Support Files/RxCocoa/Info.plist | 26 + .../RxCocoa/RxCocoa-dummy.m | 5 + .../RxCocoa/RxCocoa-prefix.pch | 4 + .../RxCocoa/RxCocoa-umbrella.h | 11 + .../RxCocoa/RxCocoa.modulemap | 6 + .../RxCocoa/RxCocoa.xcconfig | 5 + Pods/Target Support Files/RxSwift/Info.plist | 26 + .../RxSwift/RxSwift-dummy.m | 5 + .../RxSwift/RxSwift-prefix.pch | 4 + .../RxSwift/RxSwift-umbrella.h | 6 + .../RxSwift/RxSwift.modulemap | 6 + .../RxSwift/RxSwift.xcconfig | 5 + Pods/Target Support Files/SnapKit/Info.plist | 26 + .../SnapKit/SnapKit-dummy.m | 5 + .../SnapKit/SnapKit-prefix.pch | 4 + .../SnapKit/SnapKit-umbrella.h | 6 + .../SnapKit/SnapKit.modulemap | 6 + .../SnapKit/SnapKit.xcconfig | 5 + dundun.xcodeproj/project.pbxproj | 715 ++ .../contents.xcworkspacedata | 7 + .../UserInterfaceState.xcuserstate | Bin 0 -> 8370 bytes .../xcschemes/dundun.xcscheme | 111 + .../xcschemes/xcschememanagement.plist | 32 + dundun.xcworkspace/contents.xcworkspacedata | 10 + .../UserInterfaceState.xcuserstate | Bin 0 -> 19803 bytes dundun/AppDelegate.swift | 46 + .../AppIcon.appiconset/Contents.json | 38 + dundun/Assets.xcassets/Contents.json | 6 + .../nav_back.imageset/Contents.json | 23 + .../nav_back.imageset/nav_back.png | Bin 0 -> 593 bytes .../nav_back.imageset/nav_back@2x.png | Bin 0 -> 1333 bytes .../nav_back.imageset/nav_back@3x.png | Bin 0 -> 2751 bytes .../tx_pho.imageset/Contents.json | 23 + .../tx_pho.imageset/tx_pho.png | Bin 0 -> 3756 bytes .../tx_pho.imageset/tx_pho@2x.png | Bin 0 -> 4590 bytes .../tx_pho.imageset/tx_pho@3x.png | Bin 0 -> 6042 bytes .../tx_psd.imageset/Contents.json | 23 + .../tx_psd.imageset/tx_psd.png | Bin 0 -> 4259 bytes .../tx_psd.imageset/tx_psd@2x.png | Bin 0 -> 6273 bytes .../tx_psd.imageset/tx_psd@3x.png | Bin 0 -> 9336 bytes .../tx_sms.imageset/Contents.json | 23 + .../tx_sms.imageset/tx_sms.png | Bin 0 -> 4242 bytes .../tx_sms.imageset/tx_sms@2x.png | Bin 0 -> 6455 bytes .../tx_sms.imageset/tx_sms@3x.png | Bin 0 -> 9749 bytes dundun/Base.lproj/LaunchScreen.storyboard | 27 + dundun/Base.lproj/Main.storyboard | 46 + dundun/ExtensionUIviewController.swift | 25 + dundun/Info.plist | 40 + dundun/LoginTextField.swift | 64 + dundun/RegistViewController.swift | 120 + dundun/ViewController.swift | 33 + dundunTests/Info.plist | 24 + dundunTests/dundunTests.swift | 36 + dundunUITests/Info.plist | 24 + dundunUITests/dundunUITests.swift | 36 + 325 files changed, 35375 insertions(+) create mode 100644 .idea/.name create mode 100644 .idea/dundun.iml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/workspace.xml create mode 100644 .idea/xcode.xml create mode 100644 Podfile create mode 100644 Podfile.lock create mode 120000 Pods/Headers/Private/RxCocoa/RxCocoa.h create mode 120000 Pods/Headers/Private/RxCocoa/_RX.h create mode 120000 Pods/Headers/Private/RxCocoa/_RXDelegateProxy.h create mode 120000 Pods/Headers/Private/RxCocoa/_RXKVOObserver.h create mode 120000 Pods/Headers/Private/RxCocoa/_RXObjCRuntime.h create mode 100644 Pods/Manifest.lock create mode 100644 Pods/Pods.xcodeproj/project.pbxproj create mode 100644 Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/Pods.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxCocoa.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxSwift.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/SnapKit.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 Pods/RxCocoa/LICENSE.md create mode 100644 Pods/RxCocoa/README.md create mode 100644 Pods/RxCocoa/RxCocoa/Common/CLLocationManager+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlEvent.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlProperty.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlEvent+Driver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlProperty+Driver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Variable+Driver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/KVORepresentable+CoreGraphics.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/KVORepresentable+Swift.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/KVORepresentable.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Logging.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/ControlTarget.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/DeallocObservable.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObservable.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObserver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+KVORepresentable.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+RawRepresentable.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Observables/NSURLSession+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/Proxies/RxCLLocationManagerDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/RxCocoa.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/RxTarget.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RX.h create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RX.m create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.h create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.m create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.h create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.m create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.h create mode 100644 Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.m create mode 100644 Pods/RxCocoa/RxCocoa/RxCocoa.h create mode 100644 Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIImagePickerController+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift create mode 100644 Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift create mode 100644 Pods/RxSwift/LICENSE.md create mode 100644 Pods/RxSwift/README.md create mode 100644 Pods/RxSwift/RxSwift/AnyObserver.swift create mode 100644 Pods/RxSwift/RxSwift/Cancelable.swift create mode 100644 Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift create mode 100644 Pods/RxSwift/RxSwift/Concurrency/Lock.swift create mode 100644 Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift create mode 100644 Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift create mode 100644 Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift create mode 100644 Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift create mode 100644 Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift create mode 100644 Pods/RxSwift/RxSwift/ConnectableObservableType.swift create mode 100644 Pods/RxSwift/RxSwift/DataStructures/Bag.swift create mode 100644 Pods/RxSwift/RxSwift/DataStructures/InfiniteSequence.swift create mode 100644 Pods/RxSwift/RxSwift/DataStructures/PriorityQueue.swift create mode 100644 Pods/RxSwift/RxSwift/DataStructures/Queue.swift create mode 100644 Pods/RxSwift/RxSwift/Disposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/NAryDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/StableCompositeDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift create mode 100644 Pods/RxSwift/RxSwift/Errors.swift create mode 100644 Pods/RxSwift/RxSwift/Event.swift create mode 100644 Pods/RxSwift/RxSwift/Extensions/String+Rx.swift create mode 100644 Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift create mode 100644 Pods/RxSwift/RxSwift/Observable+Extensions.swift create mode 100644 Pods/RxSwift/RxSwift/Observable.swift create mode 100644 Pods/RxSwift/RxSwift/ObservableConvertibleType.swift create mode 100644 Pods/RxSwift/RxSwift/ObservableType.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/AddRef.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Amb.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Buffer.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Catch.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+CollectionType.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+arity.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Concat.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/ConnectableObservable.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Debug.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Deferred.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/DelaySubscription.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/DistinctUntilChanged.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Do.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/ElementAt.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Empty.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Error.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Filter.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Generate.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Just.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Map.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Merge.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Multicast.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Never.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOn.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOnSerialDispatchQueue.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Producer.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Range.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Reduce.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/RefCount.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Repeat.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/RetryWhen.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Sample.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Scan.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Sequence.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1WhileConnected.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/SingleAsync.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Skip.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/SkipUntil.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/SkipWhile.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/StartWith.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/SubscribeOn.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Switch.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Take.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/TakeLast.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/TakeUntil.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/TakeWhile.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Throttle.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Timeout.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Timer.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/ToArray.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Using.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Window.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/WithLatestFrom.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Zip+CollectionType.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Zip+arity.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Implementations/Zip.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Aggregate.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Binding.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Concurrency.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Creation.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Debug.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Multiple.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Single.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+StandardSequenceOperators.swift create mode 100644 Pods/RxSwift/RxSwift/Observables/Observable+Time.swift create mode 100644 Pods/RxSwift/RxSwift/ObserverType.swift create mode 100644 Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift create mode 100644 Pods/RxSwift/RxSwift/Observers/ObserverBase.swift create mode 100644 Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift create mode 100644 Pods/RxSwift/RxSwift/Platform/Platform.Darwin.swift create mode 100644 Pods/RxSwift/RxSwift/Platform/Platform.Linux.swift create mode 100644 Pods/RxSwift/RxSwift/Rx.swift create mode 100644 Pods/RxSwift/RxSwift/RxMutableBox.swift create mode 100644 Pods/RxSwift/RxSwift/SchedulerType.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/DispatchQueueSchedulerQOS.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift create mode 100644 Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift create mode 100644 Pods/RxSwift/RxSwift/Subjects/BehaviorSubject.swift create mode 100644 Pods/RxSwift/RxSwift/Subjects/PublishSubject.swift create mode 100644 Pods/RxSwift/RxSwift/Subjects/ReplaySubject.swift create mode 100644 Pods/RxSwift/RxSwift/Subjects/SubjectType.swift create mode 100644 Pods/RxSwift/RxSwift/Subjects/Variable.swift create mode 100644 Pods/SnapKit/LICENSE create mode 100644 Pods/SnapKit/README.md create mode 100644 Pods/SnapKit/Source/Constraint.swift create mode 100644 Pods/SnapKit/Source/ConstraintAttributes.swift create mode 100644 Pods/SnapKit/Source/ConstraintDescription.swift create mode 100644 Pods/SnapKit/Source/ConstraintItem.swift create mode 100644 Pods/SnapKit/Source/ConstraintMaker.swift create mode 100644 Pods/SnapKit/Source/ConstraintRelation.swift create mode 100644 Pods/SnapKit/Source/Debugging.swift create mode 100644 Pods/SnapKit/Source/EdgeInsets.swift create mode 100644 Pods/SnapKit/Source/LayoutConstraint.swift create mode 100644 Pods/SnapKit/Source/SnapKit.swift create mode 100644 Pods/SnapKit/Source/View+SnapKit.swift create mode 100644 Pods/SnapKit/Source/ViewController+SnapKit.swift create mode 100644 Pods/Target Support Files/Pods/Info.plist create mode 100644 Pods/Target Support Files/Pods/Pods-acknowledgements.markdown create mode 100644 Pods/Target Support Files/Pods/Pods-acknowledgements.plist create mode 100644 Pods/Target Support Files/Pods/Pods-dummy.m create mode 100755 Pods/Target Support Files/Pods/Pods-frameworks.sh create mode 100755 Pods/Target Support Files/Pods/Pods-resources.sh create mode 100644 Pods/Target Support Files/Pods/Pods-umbrella.h create mode 100644 Pods/Target Support Files/Pods/Pods.debug.xcconfig create mode 100644 Pods/Target Support Files/Pods/Pods.modulemap create mode 100644 Pods/Target Support Files/Pods/Pods.release.xcconfig create mode 100644 Pods/Target Support Files/RxCocoa/Info.plist create mode 100644 Pods/Target Support Files/RxCocoa/RxCocoa-dummy.m create mode 100644 Pods/Target Support Files/RxCocoa/RxCocoa-prefix.pch create mode 100644 Pods/Target Support Files/RxCocoa/RxCocoa-umbrella.h create mode 100644 Pods/Target Support Files/RxCocoa/RxCocoa.modulemap create mode 100644 Pods/Target Support Files/RxCocoa/RxCocoa.xcconfig create mode 100644 Pods/Target Support Files/RxSwift/Info.plist create mode 100644 Pods/Target Support Files/RxSwift/RxSwift-dummy.m create mode 100644 Pods/Target Support Files/RxSwift/RxSwift-prefix.pch create mode 100644 Pods/Target Support Files/RxSwift/RxSwift-umbrella.h create mode 100644 Pods/Target Support Files/RxSwift/RxSwift.modulemap create mode 100644 Pods/Target Support Files/RxSwift/RxSwift.xcconfig create mode 100644 Pods/Target Support Files/SnapKit/Info.plist create mode 100644 Pods/Target Support Files/SnapKit/SnapKit-dummy.m create mode 100644 Pods/Target Support Files/SnapKit/SnapKit-prefix.pch create mode 100644 Pods/Target Support Files/SnapKit/SnapKit-umbrella.h create mode 100644 Pods/Target Support Files/SnapKit/SnapKit.modulemap create mode 100644 Pods/Target Support Files/SnapKit/SnapKit.xcconfig create mode 100644 dundun.xcodeproj/project.pbxproj create mode 100644 dundun.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 dundun.xcodeproj/project.xcworkspace/xcuserdata/liurong.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 dundun.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/dundun.xcscheme create mode 100644 dundun.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 dundun.xcworkspace/contents.xcworkspacedata create mode 100644 dundun.xcworkspace/xcuserdata/liurong.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 dundun/AppDelegate.swift create mode 100644 dundun/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 dundun/Assets.xcassets/Contents.json create mode 100644 dundun/Assets.xcassets/nav_back.imageset/Contents.json create mode 100644 dundun/Assets.xcassets/nav_back.imageset/nav_back.png create mode 100644 dundun/Assets.xcassets/nav_back.imageset/nav_back@2x.png create mode 100644 dundun/Assets.xcassets/nav_back.imageset/nav_back@3x.png create mode 100644 dundun/Assets.xcassets/tx_pho.imageset/Contents.json create mode 100644 dundun/Assets.xcassets/tx_pho.imageset/tx_pho.png create mode 100644 dundun/Assets.xcassets/tx_pho.imageset/tx_pho@2x.png create mode 100644 dundun/Assets.xcassets/tx_pho.imageset/tx_pho@3x.png create mode 100644 dundun/Assets.xcassets/tx_psd.imageset/Contents.json create mode 100644 dundun/Assets.xcassets/tx_psd.imageset/tx_psd.png create mode 100644 dundun/Assets.xcassets/tx_psd.imageset/tx_psd@2x.png create mode 100644 dundun/Assets.xcassets/tx_psd.imageset/tx_psd@3x.png create mode 100644 dundun/Assets.xcassets/tx_sms.imageset/Contents.json create mode 100644 dundun/Assets.xcassets/tx_sms.imageset/tx_sms.png create mode 100644 dundun/Assets.xcassets/tx_sms.imageset/tx_sms@2x.png create mode 100644 dundun/Assets.xcassets/tx_sms.imageset/tx_sms@3x.png create mode 100644 dundun/Base.lproj/LaunchScreen.storyboard create mode 100644 dundun/Base.lproj/Main.storyboard create mode 100644 dundun/ExtensionUIviewController.swift create mode 100644 dundun/Info.plist create mode 100644 dundun/LoginTextField.swift create mode 100644 dundun/RegistViewController.swift create mode 100644 dundun/ViewController.swift create mode 100644 dundunTests/Info.plist create mode 100644 dundunTests/dundunTests.swift create mode 100644 dundunUITests/Info.plist create mode 100644 dundunUITests/dundunUITests.swift diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..69491ae --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +dundun \ No newline at end of file diff --git a/.idea/dundun.iml b/.idea/dundun.iml new file mode 100644 index 0000000..0355bbd --- /dev/null +++ b/.idea/dundun.iml @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..72abef0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..91b1735 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..2b73d04 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1460019588063 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/xcode.xml b/.idea/xcode.xml new file mode 100644 index 0000000..feaf577 --- /dev/null +++ b/.idea/xcode.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..1944557 --- /dev/null +++ b/Podfile @@ -0,0 +1,7 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' +use_frameworks! + +pod ‘SnapKit’ +pod ‘RxSwift’ +pod ‘RxCocoa’ diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..0292bf3 --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,17 @@ +PODS: + - RxCocoa (2.3.1): + - RxSwift (~> 2.3.1) + - RxSwift (2.3.1) + - SnapKit (0.20.0) + +DEPENDENCIES: + - RxCocoa + - RxSwift + - SnapKit + +SPEC CHECKSUMS: + RxCocoa: a2baaf3462b989559a51dce59d78fbebb8fe0afa + RxSwift: 829b2843e9eddc77a02cb3f5117f0d55f8f646f1 + SnapKit: 5fce3c1bbbf1fbd31de9aa92f33eb9fa03f15650 + +COCOAPODS: 0.39.0 diff --git a/Pods/Headers/Private/RxCocoa/RxCocoa.h b/Pods/Headers/Private/RxCocoa/RxCocoa.h new file mode 120000 index 0000000..88bcd66 --- /dev/null +++ b/Pods/Headers/Private/RxCocoa/RxCocoa.h @@ -0,0 +1 @@ +../../../RxCocoa/RxCocoa/RxCocoa.h \ No newline at end of file diff --git a/Pods/Headers/Private/RxCocoa/_RX.h b/Pods/Headers/Private/RxCocoa/_RX.h new file mode 120000 index 0000000..a62f4a1 --- /dev/null +++ b/Pods/Headers/Private/RxCocoa/_RX.h @@ -0,0 +1 @@ +../../../RxCocoa/RxCocoa/Common/_RX.h \ No newline at end of file diff --git a/Pods/Headers/Private/RxCocoa/_RXDelegateProxy.h b/Pods/Headers/Private/RxCocoa/_RXDelegateProxy.h new file mode 120000 index 0000000..ec94d56 --- /dev/null +++ b/Pods/Headers/Private/RxCocoa/_RXDelegateProxy.h @@ -0,0 +1 @@ +../../../RxCocoa/RxCocoa/Common/_RXDelegateProxy.h \ No newline at end of file diff --git a/Pods/Headers/Private/RxCocoa/_RXKVOObserver.h b/Pods/Headers/Private/RxCocoa/_RXKVOObserver.h new file mode 120000 index 0000000..9a83c51 --- /dev/null +++ b/Pods/Headers/Private/RxCocoa/_RXKVOObserver.h @@ -0,0 +1 @@ +../../../RxCocoa/RxCocoa/Common/_RXKVOObserver.h \ No newline at end of file diff --git a/Pods/Headers/Private/RxCocoa/_RXObjCRuntime.h b/Pods/Headers/Private/RxCocoa/_RXObjCRuntime.h new file mode 120000 index 0000000..7c20497 --- /dev/null +++ b/Pods/Headers/Private/RxCocoa/_RXObjCRuntime.h @@ -0,0 +1 @@ +../../../RxCocoa/RxCocoa/Common/_RXObjCRuntime.h \ No newline at end of file diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock new file mode 100644 index 0000000..0292bf3 --- /dev/null +++ b/Pods/Manifest.lock @@ -0,0 +1,17 @@ +PODS: + - RxCocoa (2.3.1): + - RxSwift (~> 2.3.1) + - RxSwift (2.3.1) + - SnapKit (0.20.0) + +DEPENDENCIES: + - RxCocoa + - RxSwift + - SnapKit + +SPEC CHECKSUMS: + RxCocoa: a2baaf3462b989559a51dce59d78fbebb8fe0afa + RxSwift: 829b2843e9eddc77a02cb3f5117f0d55f8f646f1 + SnapKit: 5fce3c1bbbf1fbd31de9aa92f33eb9fa03f15650 + +COCOAPODS: 0.39.0 diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..8b681c1 --- /dev/null +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,7516 @@ + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 0023C9576F10E0C4EBFB584BC22717BD + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + PriorityQueue.swift + path + RxSwift/DataStructures/PriorityQueue.swift + sourceTree + <group> + + 002F7871983CFEDD6FE35E0EC78DB800 + + fileRef + 8EFD87CC8E01C471E19BAD9418044DEA + isa + PBXBuildFile + + 00418CD7AC4CB116D272EECEFA030618 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Switch.swift + path + RxSwift/Observables/Implementations/Switch.swift + sourceTree + <group> + + 01308D3386921C873DC96C12D0C80F76 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ScheduledItemType.swift + path + RxSwift/Schedulers/Internal/ScheduledItemType.swift + sourceTree + <group> + + 01466519C7C2BC355C938B4694D5579D + + fileRef + 6B0AE53698B242EB3C6E643BA87DCEFD + isa + PBXBuildFile + + 01A0D0FF0E26E601C9B0F970A86CBC2A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Producer.swift + path + RxSwift/Observables/Implementations/Producer.swift + sourceTree + <group> + + 01E65F28D5373677F5347D29572206A7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Driver.swift + path + RxCocoa/Common/CocoaUnits/Driver/Driver.swift + sourceTree + <group> + + 028FE2DBB63201A19CC6DDB63AC61C78 + + fileRef + 7D8AE06924BA20D160696C7942EA775F + isa + PBXBuildFile + + 029F09CC3AFC1AEFD9FC5917BA2838D0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Aggregate.swift + path + RxSwift/Observables/Observable+Aggregate.swift + sourceTree + <group> + + 033BF0AF9B2A00CA4ACB4D6853F1CE91 + + fileRef + 2F6B7B01566FEDCD5FBB77E39EFA64EB + isa + PBXBuildFile + + 034EA0DF9142FCC79A3DA482659336CA + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + View+SnapKit.swift + path + Source/View+SnapKit.swift + sourceTree + <group> + + 03FA082D4410F6E69067E50C751F8B89 + + fileRef + 4F7C5B2E3F0B996282BF263972D311CF + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + 0536B88F3D1500291202B201B543B3E3 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Variable.swift + path + RxSwift/Subjects/Variable.swift + sourceTree + <group> + + 057F5E8B86019FB80F6AAB6C464E402E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RecursiveScheduler.swift + path + RxSwift/Schedulers/RecursiveScheduler.swift + sourceTree + <group> + + 07B3B54C63761FE4D033626CDFE607FC + + fileRef + C70D33646152C1E86BC0BB8550CB87CA + isa + PBXBuildFile + + 084B705D32E8B7EAC9DAB878444D0068 + + fileRef + F358A84E6D0DC41A3CA4819377685154 + isa + PBXBuildFile + + 088DE14E5C10FF9C821CA3B6C787D973 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + TailRecursiveSink.swift + path + RxSwift/Observers/TailRecursiveSink.swift + sourceTree + <group> + + 090B1C9981157AF4696758F4F39FAC15 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + PublishSubject.swift + path + RxSwift/Subjects/PublishSubject.swift + sourceTree + <group> + + 09791AD581F8D07D89C6A20EEA42F5DA + + containerPortal + D41D8CD98F00B204E9800998ECF8427E + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 34164F5A92067F8A435D205F6A3EDD6C + remoteInfo + RxCocoa + + 0A2927C946CB8935ABA6F0134B8BE497 + + buildConfigurations + + 2AD0177F4DBEEB0C2730E80A67AFB876 + B101861F998594A754682E5006531321 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 0A912C35A25B4C6602BF08291FAE3004 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AnonymousObserver.swift + path + RxSwift/Observers/AnonymousObserver.swift + sourceTree + <group> + + 0B025F960D41663563FC11F91BA9B869 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Cancelable.swift + path + RxSwift/Cancelable.swift + sourceTree + <group> + + 0B6FEBF62DA02EA2909AA93FF11AD6AD + + fileRef + 1ECECA9B0CA37372E81875A19C1ED31D + isa + PBXBuildFile + + 0B8BC1514BC8EADED66490D64E134B8A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Platform.Darwin.swift + path + RxSwift/Platform/Platform.Darwin.swift + sourceTree + <group> + + 0BA84FB7B10E05FCF589984955E22715 + + fileRef + 6C86441EF0FD752C31EDEBC3AB2585B9 + isa + PBXBuildFile + + 0BC821B138F259BDEF47EB0EC1DA0393 + + fileRef + 3645C6AF7A2DF19E831BB51BE0E79FBC + isa + PBXBuildFile + + 0D1D66E44C281FF65C1CC3E4B07911AD + + explicitFileType + wrapper.framework + includeInIndex + 0 + isa + PBXFileReference + name + RxSwift.framework + path + RxSwift.framework + sourceTree + BUILT_PRODUCTS_DIR + + 0EB3C235F612FF548CA8D18F27104378 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Window.swift + path + RxSwift/Observables/Implementations/Window.swift + sourceTree + <group> + + 0F1EDD308A73FF476CE2B981CFCFB4D7 + + children + + 2DB27027E7D16CF4CB5E0A8CE8295EED + D1DBC6A35775A443338A956A225AA02B + 50C6F64ACDD88AA0C9E1C54E1D1EF2E3 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + 0F25B77F6C2E840E73EBDF1FA82C04FB + + fileRef + 3A060231C86DA5DD9FA2EBEAE84F3D86 + isa + PBXBuildFile + + 0F949519548BA8FAA52CBFB652E79C4A + + fileRef + 9AC52F95B0A858BAEDB7B1CD5B4BDBB6 + isa + PBXBuildFile + + 0FA6D7F0F7DB305EDE91525657B7459A + + fileRef + 029F09CC3AFC1AEFD9FC5917BA2838D0 + isa + PBXBuildFile + + 0FFEA9A4B315E9B31B73A6710745D103 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NopDisposable.swift + path + RxSwift/Disposables/NopDisposable.swift + sourceTree + <group> + + 1118A9ACF1A71293D7A77F2E47562D79 + + fileRef + 4B8669EC184CBA3164600B930089C05B + isa + PBXBuildFile + + 11CC5121FFA3658EB2EB4E82F9B9B82B + + fileRef + F923CF20AEFAD5202875DDD7C0202354 + isa + PBXBuildFile + + 11F3A7374F889FA31FB84852A70C9E0E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + _RXDelegateProxy.h + path + RxCocoa/Common/_RXDelegateProxy.h + sourceTree + <group> + + 125B65A6DFCB7864AC715ACAEA8BD5DD + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SkipWhile.swift + path + RxSwift/Observables/Implementations/SkipWhile.swift + sourceTree + <group> + + 13452471F0BD4D22B6C338882D3DE71A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + KVORepresentable+CoreGraphics.swift + path + RxCocoa/Common/KVORepresentable+CoreGraphics.swift + sourceTree + <group> + + 135C1F7A49ECBDE68B7BB0B8E8A3E9B4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Logging.swift + path + RxCocoa/Common/Logging.swift + sourceTree + <group> + + 137884C04F56A2571162207524BE30E3 + + fileRef + C28B0125E327306B3BF97AB7B845DCF3 + isa + PBXBuildFile + + 13C4726B477B80CF182C8A5D570E9B92 + + fileRef + E91F950DD3D257CF82FC24ABEC76D904 + isa + PBXBuildFile + + 1421B62B13D51AACF3F94B4B2B50B663 + + fileRef + D1EAA37957D3936571AB4D8A3776EFF7 + isa + PBXBuildFile + + 144C55F46E9D68745B625164F4635B38 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Binding.swift + path + RxSwift/Observables/Observable+Binding.swift + sourceTree + <group> + + 151B1EA97C49FFAAB10DA9202217C797 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ObserverBase.swift + path + RxSwift/Observers/ObserverBase.swift + sourceTree + <group> + + 154C86F1B4D09F57381D55B13297733B + + fileRef + E3613934F16C6EECA78AC0671E73B7A1 + isa + PBXBuildFile + + 16AE453F6FDA15E1EE365985A3B1A125 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Timeout.swift + path + RxSwift/Observables/Implementations/Timeout.swift + sourceTree + <group> + + 172A197BA3A42B0FD4CC2CC39E9EAA2C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Queue.swift + path + RxSwift/DataStructures/Queue.swift + sourceTree + <group> + + 1743ACDA42299F910916959336409434 + + fileRef + 0B8BC1514BC8EADED66490D64E134B8A + isa + PBXBuildFile + + 17FB140647BB76D23D59FFBF6C5DD92A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConstraintMaker.swift + path + Source/ConstraintMaker.swift + sourceTree + <group> + + 183261C7A2F61BC0FA4D44B4CB401367 + + fileRef + 26C998BA0C9F3D400CA831881C074270 + isa + PBXBuildFile + + 19FDB2D893DFACDE96465C14639A2E70 + + fileRef + E445DD04AFF19161A70059117511BCB1 + isa + PBXBuildFile + + 1A7A69BEC95BE785B1EC17BCCFF3DB06 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIButton+Rx.swift + path + RxCocoa/iOS/UIButton+Rx.swift + sourceTree + <group> + + 1B0D208ADDAB8367417562E32EAE8874 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIScrollView+Rx.swift + path + RxCocoa/iOS/UIScrollView+Rx.swift + sourceTree + <group> + + 1BE948F15D64E20CEF56BA1D4FC1E33C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + CurrentThreadScheduler.swift + path + RxSwift/Schedulers/CurrentThreadScheduler.swift + sourceTree + <group> + + 1BF2075B6A7B8D36B209AE38CBF0AC8D + + fileRef + 01E65F28D5373677F5347D29572206A7 + isa + PBXBuildFile + + 1C6258EFD35B3F8138DFF9B89D81A245 + + fileRef + 225D1B10ABE8FE9AD4494DB45467505B + isa + PBXBuildFile + + 1CDEFC3678FE3B3F2D7413ACA9D11962 + + fileRef + 00418CD7AC4CB116D272EECEFA030618 + isa + PBXBuildFile + + 1D47FDC509CC6012F58CBB02FB3C1597 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RetryWhen.swift + path + RxSwift/Observables/Implementations/RetryWhen.swift + sourceTree + <group> + + 1D8CB0E97E751F57688918CB1F2EE415 + + fileRef + 8DEC3E68907858B696D3837F9F58603F + isa + PBXBuildFile + + 1DD41BF77EE81882A43E26572ACE10EB + + containerPortal + D41D8CD98F00B204E9800998ECF8427E + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 25F9F1D9857DDA8501939EF8F297A6C9 + remoteInfo + RxSwift + + 1E374FC0B87F0F3A5A22AEC27DA905F5 + + fileRef + F82BF66280845DC03E439ED911D4C9E6 + isa + PBXBuildFile + + 1E3BE982D2E06E17011C1DCBE2693EB8 + + fileRef + 58256B9C5980899CACE4DC7159C528C5 + isa + PBXBuildFile + + 1E68D5BD90F32098FF97E1AB9C744E84 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ElementAt.swift + path + RxSwift/Observables/Implementations/ElementAt.swift + sourceTree + <group> + + 1E8D18E2366E3F8F2F40361F651A0617 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + TakeLast.swift + path + RxSwift/Observables/Implementations/TakeLast.swift + sourceTree + <group> + + 1EB350527B1AE776CD73D2511C86D3E7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + BehaviorSubject.swift + path + RxSwift/Subjects/BehaviorSubject.swift + sourceTree + <group> + + 1ECBF5CAC16F304DA6AE6348B18F850B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ControlEvent+Driver.swift + path + RxCocoa/Common/CocoaUnits/Driver/ControlEvent+Driver.swift + sourceTree + <group> + + 1ECECA9B0CA37372E81875A19C1ED31D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UISearchBar+Rx.swift + path + RxCocoa/iOS/UISearchBar+Rx.swift + sourceTree + <group> + + 1F7BB96673200695A2A0B90770469BAA + + fileRef + D4722CAAE200E4B0411054AB70B0C303 + isa + PBXBuildFile + + 1FBB7E6E956C2F293B72404553C2351C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ToArray.swift + path + RxSwift/Observables/Implementations/ToArray.swift + sourceTree + <group> + + 200A48E02C33A1F61F5063E95650C30F + + fileRef + 894E5DA93A9F359521A89826BE6DA777 + isa + PBXBuildFile + + 225D1B10ABE8FE9AD4494DB45467505B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Concurrency.swift + path + RxSwift/Observables/Observable+Concurrency.swift + sourceTree + <group> + + 22A9DAE56DE0B4FB45E9CA48BD0502EC + + fileRef + 4260C809B7FEE07923736187C9AE79B7 + isa + PBXBuildFile + + 232099316E5E397A762EB8B9ABC28E23 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SerialDispatchQueueScheduler.swift + path + RxSwift/Schedulers/SerialDispatchQueueScheduler.swift + sourceTree + <group> + + 2367AD90CC1DA97D46AFFDC1F05920E0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SnapKit.swift + path + Source/SnapKit.swift + sourceTree + <group> + + 23C76CC570D86E45DF5CD5D0E317192C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Time.swift + path + RxSwift/Observables/Observable+Time.swift + sourceTree + <group> + + 23C79AB6DC5168096DE2982B2BD64033 + + fileRef + 4279C9D2D05C19941158717F0F559DEA + isa + PBXBuildFile + + 24D88C6930116D13ACCDE2C1FAB37979 + + fileRef + 596C25F05AB6F4BBB8C3C825C371BF33 + isa + PBXBuildFile + + 2536B3EAF58421C002D79C4699185445 + + fileRef + 232099316E5E397A762EB8B9ABC28E23 + isa + PBXBuildFile + + 25A15AE0289AE51B47A95D0CA6A70B7E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIImageView+Rx.swift + path + RxCocoa/iOS/UIImageView+Rx.swift + sourceTree + <group> + + 25AE24C70DF8EB9A7E6047B2DC250D80 + + fileRef + 725A9925BFB71866DB60B41000151594 + isa + PBXBuildFile + + 25BD0B96B9FD73AA02777C39601AB852 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RefCountDisposable.swift + path + RxSwift/Disposables/RefCountDisposable.swift + sourceTree + <group> + + 25F9F1D9857DDA8501939EF8F297A6C9 + + buildConfigurationList + B472CD6F2DBB7AF7CC47A7878FA24FEC + buildPhases + + F2837B9A8EAEF829432B670CC750D605 + E6A2C2F8D5B2D9682595721EFB16F878 + AB750C823DEAC3BC2306BFEA9090905E + + buildRules + + dependencies + + isa + PBXNativeTarget + name + RxSwift + productName + RxSwift + productReference + 0D1D66E44C281FF65C1CC3E4B07911AD + productType + com.apple.product-type.framework + + 2656084E270E0953B6E3A73D2B29F48D + + fileRef + 6388C94123A9D09ED3C40B373B139843 + isa + PBXBuildFile + + 267653F95D77385C430885AD58D0C383 + + fileRef + D353A47E6CD7E5E8DAF7C34F121B5A54 + isa + PBXBuildFile + + 26810A9296460BACEB70D9F717E6731B + + fileRef + EB20D0D091DF7A77CED3ED8FC7C03732 + isa + PBXBuildFile + + 26ABF4A217D670548D97D184175EE76B + + fileRef + D5D5B715FF96EB5C3C76E3001C745146 + isa + PBXBuildFile + + 26C998BA0C9F3D400CA831881C074270 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AsyncLock.swift + path + RxSwift/Concurrency/AsyncLock.swift + sourceTree + <group> + + 27145393C5A6574A4E14AE19282FD975 + + fileRef + 70400A80C14CDF888E4F39A959B5A630 + isa + PBXBuildFile + + 274B6C5B22E61C81A0284170F06BE497 + + fileRef + A8945F5242E27F483D412447B5CD237B + isa + PBXBuildFile + + 278B26B7DAB8B0C975F06B67844467EF + + fileRef + B51B6FCA8FEEC0A32E3B8A70CBB196BE + isa + PBXBuildFile + + 280E9DFDA1908748134CAFB9A82E1741 + + buildConfigurations + + CE4AEEB83610F9879D468525B7F822C7 + FDA882FC01CB4EDCAF66D964E9D7FA20 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 290A3018DB69C5AB9C319DC4F5080507 + + fileRef + 7003E31B9341D6FA7A9620556AC85306 + isa + PBXBuildFile + + 29AE75D5483AA509E236ACF96DA4C552 + + fileRef + E8CB4E60187ECDDE3B5987C6E7A6AF10 + isa + PBXBuildFile + + 29B33C639137C1D34787FF28DFAE3B20 + + fileRef + A206B4AD3900E7F4D1A7AE065E35CED4 + isa + PBXBuildFile + + 29E5241C08609363E6F1AAC9C5F42CEC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + RxCocoa-dummy.m + sourceTree + <group> + + 2A12A995F09098AB3C520E44A7F21B39 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxCollectionViewDelegateProxy.swift + path + RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift + sourceTree + <group> + + 2A3AD23D4564863C29CF25E044AAF2E7 + + fileRef + 805559038456D6B897A4BAD350F5499F + isa + PBXBuildFile + + 2A4E7B2CB9DFD37BCC9FDB2B8E095FB6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ObserveOn.swift + path + RxSwift/Observables/Implementations/ObserveOn.swift + sourceTree + <group> + + 2AAD4AA94984312A2C005BD623D029E7 + + fileRef + C2DD2AE55FD5B025F8A4EA3A898D13DE + isa + PBXBuildFile + + 2AD0177F4DBEEB0C2730E80A67AFB876 + + baseConfigurationReference + 41F79207858684F92C20060C6A01CC7F + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_PREFIX_HEADER + Target Support Files/SnapKit/SnapKit-prefix.pch + INFOPLIST_FILE + Target Support Files/SnapKit/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MODULEMAP_FILE + Target Support Files/SnapKit/SnapKit.modulemap + MTL_ENABLE_DEBUG_INFO + YES + PRODUCT_NAME + SnapKit + SDKROOT + iphoneos + SKIP_INSTALL + YES + SWIFT_OPTIMIZATION_LEVEL + -Onone + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Debug + + 2BB425AF4DAFF941F13219A5FA8178BB + + fileRef + 2BCC458FDD5F692BBB2BFC64BB5701FC + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + 2BBCD9C1A6965262791E06A94D3F3F62 + + fileRef + 11F3A7374F889FA31FB84852A70C9E0E + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + 2BCC458FDD5F692BBB2BFC64BB5701FC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-umbrella.h + sourceTree + <group> + + 2C15FF1C605FDB57A8A2C72FE84ACF15 + + fileRef + BCE6B0570138EFE5FF6B9234C86CFBD9 + isa + PBXBuildFile + + 2C2541E19C7304A7845BAE7E02C80669 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + CLLocationManager+Rx.swift + path + RxCocoa/Common/CLLocationManager+Rx.swift + sourceTree + <group> + + 2D8E8EC45A3A1A1D94AE762CB5028504 + + buildConfigurations + + A70CDAD61F90AC503C7D04CC22DA2923 + FB45FFD90572718D82AB9092B750F0CA + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 2DB27027E7D16CF4CB5E0A8CE8295EED + + children + + 4F7C5B2E3F0B996282BF263972D311CF + 75BE88EF9FA4962ECD0D87A2AF9CB14F + 11F3A7374F889FA31FB84852A70C9E0E + EF339BD67C3BFF8D67A8C136007EB45A + 3CA58CD9CF58BF25FA3CFC6C6C9540B9 + 805559038456D6B897A4BAD350F5499F + B5A6CB7B2004EB3238A61F7A2781F36E + FEF7A1F40355BD9CF8794C28B7DD51B0 + 2C2541E19C7304A7845BAE7E02C80669 + 4661F85204A4AAEC17BB5A447AA5BB0C + 1ECBF5CAC16F304DA6AE6348B18F850B + 56A673F8A6FD0EC00108F9432A1CC417 + DDE22FAE3553669F602B2ECC317D74D3 + 43850E8BC0A032C2AB3CB7750EB79A41 + A8945F5242E27F483D412447B5CD237B + 725A9925BFB71866DB60B41000151594 + 2EA0E9C5462A28EB7B882E51C1C411DD + 01E65F28D5373677F5347D29572206A7 + 68A437BB73459DBB22EE2D4D5A3938C0 + B590B94974631BBB1F364E4287764689 + E6695FFBDFD7B74A5B6792093C1534DA + 5FCCE8A11DAF98AEB98955B0189CBF5F + 4E8302DED0E361E4109E3148F5F7FB59 + 6388C94123A9D09ED3C40B373B139843 + FF63F315CCBF6EC394C4641D831497CE + 13452471F0BD4D22B6C338882D3DE71A + D1CEDCE925310C77A210F636713C1441 + 135C1F7A49ECBDE68B7BB0B8E8A3E9B4 + E91F950DD3D257CF82FC24ABEC76D904 + F510BBE322B14D44AC9C1F59A43830A8 + A1880610B7DBCFD54FD897F24E6AB3A6 + 6D2C1CCF641FAD4D417D89D074F46F58 + 37A4DFED0A41C03849803CFACEF319EE + A25855C175813132567578E27CEBB058 + 3609429F7B9CF1D9ECA7F0E798457283 + C19622B8FAD7A971E1979B163A4B4716 + DAE96B9DC7873FC574E7C64371F40283 + 4C1E9287B7FE83EBDD2EACC8B8B4AA46 + 9AC52F95B0A858BAEDB7B1CD5B4BDBB6 + 7759B133FEF8792909C44A4CC3DC9516 + AA87832AC58AD98B0749F4A88600E8DB + 34FB3798707BF7068EF1896AAA2732FE + 3C5A958785AF0570387AC40E20D8E92F + 2A12A995F09098AB3C520E44A7F21B39 + E8CB4E60187ECDDE3B5987C6E7A6AF10 + D42819AC6D2B8C931BBD8D363CB7BD19 + C28B0125E327306B3BF97AB7B845DCF3 + EE223FA8862F01F60FC69E89064647A8 + EB20D0D091DF7A77CED3ED8FC7C03732 + F543860A7601469F48CC82CAAC47784D + 40ED50992E312A1879D63866CE397D75 + FFA0699393CDD4772FEE63E9556F679F + 9A96BCD9A584BD6AD6D0DA476D30B6EB + B8E3470124B5487055D30A4C0984C209 + F6B70D809894D72C378E8A936DF1574E + 71E1AA5037BB297CCE59DB00AAB9D65A + F1DE74F7C05BDBF8BA973F6ABF9EE5B4 + D879A8F052BEBEB92FB683A3A898A429 + A0A643397C9D3F6D2F74E8E0DB77D2E0 + C9A868CC07FDB9C5D9EC50E044971237 + 1A7A69BEC95BE785B1EC17BCCFF3DB06 + CAC858DFAB2574B6467C911758116E8A + 4E86886CCE2546401C8AC708E1B141F0 + 4C3946D6D434BD44EE3A468A750DD0D3 + E7367FA065AC51AB9F2C507DDCDF12BF + 8D19ACB01585EEE418438C8C87461780 + 25A15AE0289AE51B47A95D0CA6A70B7E + 3E555CA3D5176FDB77979C2B182F900E + E97A4EF64A15485B2E669F47D9AA38A3 + 8CF18C51C0C634E8064881A59783F867 + 1B0D208ADDAB8367417562E32EAE8874 + 1ECECA9B0CA37372E81875A19C1ED31D + 384B81FB8EAB95AD79965D049722E8C6 + 6C86441EF0FD752C31EDEBC3AB2585B9 + E3613934F16C6EECA78AC0671E73B7A1 + 40947D5AAA92DF60CCB1896FA1D4106D + 96F2DD0668EA3052B65BE4BA033023BB + 37A13530B58EA30B61168992F42D6859 + 783C5BE07458635066381BCBE6BED402 + FDEB042BC99357B7D2809594005D5F8B + 528D3EA23ED9E6EF1D9C575E25A49FB6 + B2B725263D78213E128E00A5CF791723 + E5B22FE3B83FEDAFB8CAFD8E723AC7BA + + isa + PBXGroup + name + RxCocoa + path + RxCocoa + sourceTree + <group> + + 2E44A654DD376DFBD71824196F86F7F1 + + fileRef + EB90A2864C486A816F2284843A112286 + isa + PBXBuildFile + + 2E6D95BA9B545E171178308F97876E17 + + fileRef + 5B0293D24DD3877F68F85D299BD1AB72 + isa + PBXBuildFile + + 2EA0E9C5462A28EB7B882E51C1C411DD + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DelegateProxyType.swift + path + RxCocoa/Common/DelegateProxyType.swift + sourceTree + <group> + + 2EA778EB3C7BCA91DB1FD5ADB97195B0 + + fileRef + 384B81FB8EAB95AD79965D049722E8C6 + isa + PBXBuildFile + + 2F3061C7229DF25C7C1FD989C98101C2 + + fileRef + 499C6E6FCE62FEDFBFE49220143CF552 + isa + PBXBuildFile + + 2F3F6FE87F30CF989EB24FACB49310AA + + fileRef + 56A673F8A6FD0EC00108F9432A1CC417 + isa + PBXBuildFile + + 2F6B7B01566FEDCD5FBB77E39EFA64EB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + HistoricalScheduler.swift + path + RxSwift/Schedulers/HistoricalScheduler.swift + sourceTree + <group> + + 307B4A60663187B3AAFEA450C2EA612E + + fileRef + 1A7A69BEC95BE785B1EC17BCCFF3DB06 + isa + PBXBuildFile + + 3092DCE78346B190383777BF8DEA8ED4 + + fileRef + 4F5A9AE2E69A6209334BD8D719313300 + isa + PBXBuildFile + + 311DD11B104F16D0E43B37E820BA87A5 + + fileRef + 783C5BE07458635066381BCBE6BED402 + isa + PBXBuildFile + + 314DCDB0850EF3AF6348A7CD6F60E999 + + fileRef + 5588B4DCF94DC925DC127773ECD50B51 + isa + PBXBuildFile + + 316D33A0E415DD4627E335AE62BB4EBB + + fileRef + 090B1C9981157AF4696758F4F39FAC15 + isa + PBXBuildFile + + 32CB01AC3AF4BCA714C974314E4A8A4A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SingleAsync.swift + path + RxSwift/Observables/Implementations/SingleAsync.swift + sourceTree + <group> + + 33D27665D9A5692B4B29032109535976 + + buildConfigurations + + F591200744D88BFFE606274DCA0176B0 + EFE67D1CBFBF76AFC315D8FE0B22E360 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 34164F5A92067F8A435D205F6A3EDD6C + + buildConfigurationList + 33D27665D9A5692B4B29032109535976 + buildPhases + + 65CF64B520C3A43EC4D5B502C2884E26 + 539E06D2D1271E55EA1FA19260CB7F18 + 6EC2B963093939C27310A7AC33C4DDF3 + + buildRules + + dependencies + + E5AF3CEAB96D9E182A80F7B8F4BA9B8C + + isa + PBXNativeTarget + name + RxCocoa + productName + RxCocoa + productReference + 72CB9501BD0BC598BA2108E6B4A4936E + productType + com.apple.product-type.framework + + 34EC4ACE1D4AB848467C0002EAD0157E + + fileRef + 3C3930F9DBF25C61A5C1D179C0E7E5F6 + isa + PBXBuildFile + + 34FB3798707BF7068EF1896AAA2732FE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxCollectionViewDataSourceProxy.swift + path + RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift + sourceTree + <group> + + 35995BC7F759B47F43AE185AFAD51652 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxMutableBox.swift + path + RxSwift/RxMutableBox.swift + sourceTree + <group> + + 3609429F7B9CF1D9ECA7F0E798457283 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NSTextStorage+Rx.swift + path + RxCocoa/iOS/NSTextStorage+Rx.swift + sourceTree + <group> + + 3645C6AF7A2DF19E831BB51BE0E79FBC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Never.swift + path + RxSwift/Observables/Implementations/Never.swift + sourceTree + <group> + + 36DF3A9B762C81BCCFA014E2139A9A31 + + fileRef + EDC638D5D1F0EF4130D86FD36C718F9C + isa + PBXBuildFile + + 37A13530B58EA30B61168992F42D6859 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UITableView+Rx.swift + path + RxCocoa/iOS/UITableView+Rx.swift + sourceTree + <group> + + 37A4DFED0A41C03849803CFACEF319EE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NSObject+Rx+KVORepresentable.swift + path + RxCocoa/Common/Observables/NSObject+Rx+KVORepresentable.swift + sourceTree + <group> + + 381FF96B891F70E71F6B3E82AE34A8EE + + fileRef + E2DFDF4B45C309185DEAEA3DBB05CEA0 + isa + PBXBuildFile + + 384B81FB8EAB95AD79965D049722E8C6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UISegmentedControl+Rx.swift + path + RxCocoa/iOS/UISegmentedControl+Rx.swift + sourceTree + <group> + + 397ED6A120A7323FEFFD443352B8A3B8 + + explicitFileType + wrapper.framework + includeInIndex + 0 + isa + PBXFileReference + path + RxSwift.framework + sourceTree + BUILT_PRODUCTS_DIR + + 3984728F4471C763F32E9A5CF3C33E20 + + fileRef + 40947D5AAA92DF60CCB1896FA1D4106D + isa + PBXBuildFile + + 3A060231C86DA5DD9FA2EBEAE84F3D86 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SubscribeOn.swift + path + RxSwift/Observables/Implementations/SubscribeOn.swift + sourceTree + <group> + + 3A945514ADB5DB2FB0AACD518873FA43 + + fileRef + 0536B88F3D1500291202B201B543B3E3 + isa + PBXBuildFile + + 3C210CF6BF3541A9831656764CCF885D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Do.swift + path + RxSwift/Observables/Implementations/Do.swift + sourceTree + <group> + + 3C3930F9DBF25C61A5C1D179C0E7E5F6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AddRef.swift + path + RxSwift/Observables/Implementations/AddRef.swift + sourceTree + <group> + + 3C5A958785AF0570387AC40E20D8E92F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxCollectionViewDataSourceType.swift + path + RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift + sourceTree + <group> + + 3CA58CD9CF58BF25FA3CFC6C6C9540B9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + _RXKVOObserver.h + path + RxCocoa/Common/_RXKVOObserver.h + sourceTree + <group> + + 3CB36EBB5FC1EFA95019AB418E93C232 + + fileRef + 7B57968853CD57DEFD3960E0364964CD + isa + PBXBuildFile + + 3CCA0D8220937816FEBC670A0374490F + + fileRef + 3E555CA3D5176FDB77979C2B182F900E + isa + PBXBuildFile + + 3D9163E5D6158E7F4BF09A20179BE020 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + TakeUntil.swift + path + RxSwift/Observables/Implementations/TakeUntil.swift + sourceTree + <group> + + 3DC2077D657F05510EBA62928FEEA82B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Info.plist + sourceTree + <group> + + 3DFAE9AFE40544527F02C69CECAB76BD + + fileRef + 800FB207162559F8300CDAD6A4B600D1 + isa + PBXBuildFile + + 3E555CA3D5176FDB77979C2B182F900E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UILabel+Rx.swift + path + RxCocoa/iOS/UILabel+Rx.swift + sourceTree + <group> + + 3F803D899583DE5F2D73199C6813784F + + fileRef + E6DE8641466E02841AEEBD78475EC209 + isa + PBXBuildFile + + 40947D5AAA92DF60CCB1896FA1D4106D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UISwitch+Rx.swift + path + RxCocoa/iOS/UISwitch+Rx.swift + sourceTree + <group> + + 40ED50992E312A1879D63866CE397D75 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxTableViewDelegateProxy.swift + path + RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift + sourceTree + <group> + + 41F79207858684F92C20060C6A01CC7F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + SnapKit.xcconfig + sourceTree + <group> + + 4260C809B7FEE07923736187C9AE79B7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + LockOwnerType.swift + path + RxSwift/Concurrency/LockOwnerType.swift + sourceTree + <group> + + 4279C9D2D05C19941158717F0F559DEA + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ImmediateSchedulerType.swift + path + RxSwift/ImmediateSchedulerType.swift + sourceTree + <group> + + 433A626CA7B1C7B6BC01AE38CFCECCFB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SerialDisposable.swift + path + RxSwift/Disposables/SerialDisposable.swift + sourceTree + <group> + + 43850E8BC0A032C2AB3CB7750EB79A41 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ControlTarget.swift + path + RxCocoa/Common/Observables/Implementations/ControlTarget.swift + sourceTree + <group> + + 441DFC5ACFC6E2A5D387326C0947B277 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConnectableObservable.swift + path + RxSwift/Observables/Implementations/ConnectableObservable.swift + sourceTree + <group> + + 453F762F54BDF7DBE1721244D6A663AD + + buildActionMask + 2147483647 + files + + DE00E23FD080426B3D64BF9671E9AC44 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 4580DA105CA940BC89AB669CD5AD4F28 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + RxSwift-umbrella.h + sourceTree + <group> + + 4661F85204A4AAEC17BB5A447AA5BB0C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ControlEvent.swift + path + RxCocoa/Common/CocoaUnits/ControlEvent.swift + sourceTree + <group> + + 46F5509E31129BA86AC096A83C540BF8 + + fileRef + 144C55F46E9D68745B625164F4635B38 + isa + PBXBuildFile + + 496C59F32803DB97290F4047AFA8C664 + + fileRef + 8CF18C51C0C634E8064881A59783F867 + isa + PBXBuildFile + + 499C6E6FCE62FEDFBFE49220143CF552 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ObservableType.swift + path + RxSwift/ObservableType.swift + sourceTree + <group> + + 49CCCDEE245B18F726CD94206ECB152C + + fileRef + F510BBE322B14D44AC9C1F59A43830A8 + isa + PBXBuildFile + + 49DCDDFC41096500551C97F6967B029E + + children + + C6147276EE27AC9FE3CD46E59777FAF2 + AA7A06B3FFA9B321812468A5057C3F10 + A03C545BCEC4A498D4B6619118987DD2 + CF56ABEF76ADED7648A485CEEC5D51E0 + FB01AF1B542DAE00930A42B4265B1C32 + 4580DA105CA940BC89AB669CD5AD4F28 + + isa + PBXGroup + name + Support Files + path + ../Target Support Files/RxSwift + sourceTree + <group> + + 49F7E11EE93C572642C1B0C6A5FB6133 + + fileRef + F543860A7601469F48CC82CAAC47784D + isa + PBXBuildFile + + 4B8669EC184CBA3164600B930089C05B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DisposeBase.swift + path + RxSwift/Disposables/DisposeBase.swift + sourceTree + <group> + + 4C1E9287B7FE83EBDD2EACC8B8B4AA46 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ObservableConvertibleType+Driver.swift + path + RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift + sourceTree + <group> + + 4C3946D6D434BD44EE3A468A750DD0D3 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIDatePicker+Rx.swift + path + RxCocoa/iOS/UIDatePicker+Rx.swift + sourceTree + <group> + + 4D4421759A9859E8F9E470F42E40C189 + + fileRef + EBBE1DF3B018B3CC653E6E897B43A82B + isa + PBXBuildFile + + 4E733D1C077257B4DA3842DB2788848A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ObserveOnSerialDispatchQueue.swift + path + RxSwift/Observables/Implementations/ObserveOnSerialDispatchQueue.swift + sourceTree + <group> + + 4E8302DED0E361E4109E3148F5F7FB59 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + KVOObservable.swift + path + RxCocoa/Common/Observables/Implementations/KVOObservable.swift + sourceTree + <group> + + 4E86886CCE2546401C8AC708E1B141F0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIControl+Rx.swift + path + RxCocoa/iOS/UIControl+Rx.swift + sourceTree + <group> + + 4F147DC0445B81434F4A9DC470107C7B + + fileRef + 57985A41D21A122421ED6B2A6726E491 + isa + PBXBuildFile + + 4F5A9AE2E69A6209334BD8D719313300 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Throttle.swift + path + RxSwift/Observables/Implementations/Throttle.swift + sourceTree + <group> + + 4F7C5B2E3F0B996282BF263972D311CF + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + _RX.h + path + RxCocoa/Common/_RX.h + sourceTree + <group> + + 4FD55E5CBDCEE29F4EFED21A113DB62C + + fileRef + 0A912C35A25B4C6602BF08291FAE3004 + isa + PBXBuildFile + + 509879DD7ADC30EE0E94D98341FD06B3 + + fileRef + 5FCCE8A11DAF98AEB98955B0189CBF5F + isa + PBXBuildFile + + 50C6F64ACDD88AA0C9E1C54E1D1EF2E3 + + children + + D84795872901D017DC0415AD7944DE46 + 7B57968853CD57DEFD3960E0364964CD + F3B230EBF1F2C7A861A092F9E614C8AC + B544FF0B9876AA8866FF967AF3662364 + 17FB140647BB76D23D59FFBF6C5DD92A + E6DE8641466E02841AEEBD78475EC209 + B6D74758DF3A3779B9C6FF54BA0CCF83 + A3895A88AA9ECE0A9B3F13D46F15E6FC + BE1AE3D07AECA038C1154F8196DBD682 + 2367AD90CC1DA97D46AFFDC1F05920E0 + 034EA0DF9142FCC79A3DA482659336CA + F923CF20AEFAD5202875DDD7C0202354 + 52F921A8A5FB7616AB4ED2AA36E06121 + + isa + PBXGroup + name + SnapKit + path + SnapKit + sourceTree + <group> + + 51EF47FAB0D3FF7DB2CD6D72F7240747 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ScheduledDisposable.swift + path + RxSwift/Disposables/ScheduledDisposable.swift + sourceTree + <group> + + 528D3EA23ED9E6EF1D9C575E25A49FB6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIView+Rx.swift + path + RxCocoa/iOS/UIView+Rx.swift + sourceTree + <group> + + 52B72671CE1FBBE0B5F35769E5333E88 + + fileRef + 8489124E660E85539600413DF81D3BFB + isa + PBXBuildFile + + 52BAFA642B1D92094D22C535702468CC + + fileRef + 5457E90DF3AEE179FB36214B805FE973 + isa + PBXBuildFile + + 52F921A8A5FB7616AB4ED2AA36E06121 + + children + + 3DC2077D657F05510EBA62928FEEA82B + 5A9251A379DAB51C82B2F3571CC0DEB1 + 41F79207858684F92C20060C6A01CC7F + 6708FDF094F620C266527729B6E337B9 + 934AFED0D3EC1EBA5A1C3FB4728DDD0F + 7A2190B63C68AD46C434D06BFDB30926 + + isa + PBXGroup + name + Support Files + path + ../Target Support Files/SnapKit + sourceTree + <group> + + 5326444C9B8E1758958A0DD58883652B + + fileRef + 29E5241C08609363E6F1AAC9C5F42CEC + isa + PBXBuildFile + + 539E06D2D1271E55EA1FA19260CB7F18 + + buildActionMask + 2147483647 + files + + D4918FDB2355CAEDB8DAE07AB2E3C6F7 + DA42B0758849AF18BEC1FCEE93055B91 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 543FE138B7C10D8360FE9F60CD7CBE59 + + fileRef + 8D19ACB01585EEE418438C8C87461780 + isa + PBXBuildFile + + 5457E90DF3AEE179FB36214B805FE973 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DistinctUntilChanged.swift + path + RxSwift/Observables/Implementations/DistinctUntilChanged.swift + sourceTree + <group> + + 551092297F3E790EE61EADFDFA7F8EE9 + + fileRef + 999B44EE476358F96B295852D3121415 + isa + PBXBuildFile + + 5588B4DCF94DC925DC127773ECD50B51 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Amb.swift + path + RxSwift/Observables/Implementations/Amb.swift + sourceTree + <group> + + 56A673F8A6FD0EC00108F9432A1CC417 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ControlProperty.swift + path + RxCocoa/Common/CocoaUnits/ControlProperty.swift + sourceTree + <group> + + 56AAC762383C0CEE3853FE2668E70B61 + + buildActionMask + 2147483647 + files + + 2BB425AF4DAFF941F13219A5FA8178BB + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 56BB4DFAF273C27A852A5F37501150A1 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Range.swift + path + RxSwift/Observables/Implementations/Range.swift + sourceTree + <group> + + 56E21B787EF70CB34538D221CA0F06C5 + + fileRef + 4E733D1C077257B4DA3842DB2788848A + isa + PBXBuildFile + + 57985A41D21A122421ED6B2A6726E491 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Reduce.swift + path + RxSwift/Observables/Implementations/Reduce.swift + sourceTree + <group> + + 58256B9C5980899CACE4DC7159C528C5 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ImmediateScheduler.swift + path + RxSwift/Schedulers/ImmediateScheduler.swift + sourceTree + <group> + + 583D952E4A953749259F1BE7603CA675 + + fileRef + 6708FDF094F620C266527729B6E337B9 + isa + PBXBuildFile + + 587194D5EA3ABD10D0ABA4EE7C9F425E + + fileRef + 01308D3386921C873DC96C12D0C80F76 + isa + PBXBuildFile + + 5895AEC29F6C03C328531A8C4C57C566 + + fileRef + 70DBC6AE653E78AB74CB92B3E2F77EE8 + isa + PBXBuildFile + + 58D99810C20AD99B0D0C26CE4D1ED274 + + fileRef + 1EB350527B1AE776CD73D2511C86D3E7 + isa + PBXBuildFile + + 59333D422C627D0EE22AA612F83CBAE2 + + fileRef + 1BE948F15D64E20CEF56BA1D4FC1E33C + isa + PBXBuildFile + + 596C25F05AB6F4BBB8C3C825C371BF33 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SynchronizedUnsubscribeType.swift + path + RxSwift/Concurrency/SynchronizedUnsubscribeType.swift + sourceTree + <group> + + 5A9251A379DAB51C82B2F3571CC0DEB1 + + includeInIndex + 1 + isa + PBXFileReference + path + SnapKit.modulemap + sourceTree + <group> + + 5B0293D24DD3877F68F85D299BD1AB72 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SynchronizedDisposeType.swift + path + RxSwift/Concurrency/SynchronizedDisposeType.swift + sourceTree + <group> + + 5BC55DEDB3F194C0C8728FFC5C084DA9 + + fileRef + 6D2C1CCF641FAD4D417D89D074F46F58 + isa + PBXBuildFile + + 5CAB22A43CE32A3CE5D2676AA84E0D33 + + isa + PBXTargetDependency + name + SnapKit + target + 73218F2FA5E25FEBDC6511ADD2235F8D + targetProxy + 8537388CC66204B0EC65087114346367 + + 5CD68E79931886F23102744D9857D127 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Take.swift + path + RxSwift/Observables/Implementations/Take.swift + sourceTree + <group> + + 5D5F74F07CCD4F7BEBC754FBF3469144 + + fileRef + D42819AC6D2B8C931BBD8D363CB7BD19 + isa + PBXBuildFile + + 5D6AB6A57925FCC53C20CE5CD39C51D0 + + fileRef + F3B230EBF1F2C7A861A092F9E614C8AC + isa + PBXBuildFile + + 5F6327673E3F87097792674AD378AD52 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConcurrentDispatchQueueScheduler.swift + path + RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift + sourceTree + <group> + + 5FCCE8A11DAF98AEB98955B0189CBF5F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ItemEvents.swift + path + RxCocoa/iOS/Events/ItemEvents.swift + sourceTree + <group> + + 5FF796B62A8DCBAC70273C760FB159A0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SchedulerType.swift + path + RxSwift/SchedulerType.swift + sourceTree + <group> + + 6008EE3EABD4DB4463FD26374855C356 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Info.plist + sourceTree + <group> + + 60D027A224FDBB3AC9682CC25631D1DB + + isa + PBXTargetDependency + name + RxSwift + target + 25F9F1D9857DDA8501939EF8F297A6C9 + targetProxy + 1DD41BF77EE81882A43E26572ACE10EB + + 6110DFC8EE70B8256F4B5E3A59611447 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Map.swift + path + RxSwift/Observables/Implementations/Map.swift + sourceTree + <group> + + 615E9126937F439CD90911924BC01B0C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Sample.swift + path + RxSwift/Observables/Implementations/Sample.swift + sourceTree + <group> + + 6161F9D66427B47C103CB7958C327C96 + + fileRef + 845C026917854713292B174F2B8BDB3F + isa + PBXBuildFile + + 61846750E7CECDD77A085A538953FAAC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + InvocableType.swift + path + RxSwift/Schedulers/Internal/InvocableType.swift + sourceTree + <group> + + 61BD6D1A4BA245EDD1621CEB0E302CA2 + + fileRef + 16AE453F6FDA15E1EE365985A3B1A125 + isa + PBXBuildFile + + 620F377CE2D618C40CD050AF801780CC + + fileRef + EC0A385E8F984992617EBA5211964CD2 + isa + PBXBuildFile + + 627CB5AEFB28879686B7C06DE921A178 + + fileRef + 3609429F7B9CF1D9ECA7F0E798457283 + isa + PBXBuildFile + + 6299CB01EF53A3D0653565468584543E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Rx.swift + path + RxSwift/Rx.swift + sourceTree + <group> + + 6388C94123A9D09ED3C40B373B139843 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + KVOObserver.swift + path + RxCocoa/Common/Observables/Implementations/KVOObserver.swift + sourceTree + <group> + + 6441D87D93F2BE9837122300A742794E + + fileRef + DC5EC7F4DDD9D77BCBFB2979B736DC57 + isa + PBXBuildFile + + 644DF9B9119C15D380A50455A13FCD27 + + fileRef + 56BB4DFAF273C27A852A5F37501150A1 + isa + PBXBuildFile + + 6461F5720A098DDB0B2274E2F248EEEE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ShareReplay1.swift + path + RxSwift/Observables/Implementations/ShareReplay1.swift + sourceTree + <group> + + 64CD57E03393BD73EEECBB2C5EFAFBC9 + + fileRef + 40ED50992E312A1879D63866CE397D75 + isa + PBXBuildFile + + 6534E524AF67CE729A1459661C3D1BEC + + fileRef + 1B0D208ADDAB8367417562E32EAE8874 + isa + PBXBuildFile + + 65CF64B520C3A43EC4D5B502C2884E26 + + buildActionMask + 2147483647 + files + + 6DF332C280385BF59449A7093DA431B3 + 8280A1C58B44EC253A757764B0673891 + 2A3AD23D4564863C29CF25E044AAF2E7 + 6FE332C1EE7813FA828B95EEE8333F35 + CBB5901900E1195A5BCBC00C338696CD + F2C930ADE0DE954DBD7CDD1D92D02451 + BB71836AC14518B3E9B166FDE5C53C1E + D7BD0E4AC2980DC6DBABA7BFD154B9A3 + 2F3F6FE87F30CF989EB24FACB49310AA + BDA56366DB6BA0C6217EB295767364BE + 274B6C5B22E61C81A0284170F06BE497 + 25AE24C70DF8EB9A7E6047B2DC250D80 + D732C1A2A927D8908391B62A4F1E7688 + DA1B289F52BDC4A81842D047C91AC2E4 + B62B155CC4DEDEA6BEDD99217A8180A3 + A0D60BE78E56BCB019EEC1D59A112B4F + 1BF2075B6A7B8D36B209AE38CBF0AC8D + 509879DD7ADC30EE0E94D98341FD06B3 + AD3E5D4DBC9A849D9A2E5387784D705F + 2656084E270E0953B6E3A73D2B29F48D + F4B1B04AFAE81AC3F2E5D96BBEE9C177 + 9D3A91311DA4D0B74B8D45551A5B2EF0 + FBF63D2E50154DDEBC0DAA9B167838B7 + 906B6A758D264955326B55BFCD29B405 + 13C4726B477B80CF182C8A5D570E9B92 + 49CCCDEE245B18F726CD94206ECB152C + 95749307071536A6E86613D6B3164310 + FBC8B9C8AABDDD285AD350C35687ABD4 + B524F6492EACFD58F993AB9D93975D8F + 5BC55DEDB3F194C0C8728FFC5C084DA9 + 627CB5AEFB28879686B7C06DE921A178 + 93DCD78378FB3A33CCF998FC536334DC + B84B88FC91FAFAFF1BB5E7A803514762 + 9CF3940FE21D55A3595F8DE67A004629 + 0F949519548BA8FAA52CBFB652E79C4A + 5326444C9B8E1758958A0DD58883652B + 864B54D57FF86D8C1B427C346520CBB8 + F0CC3FE5C12A74238662EBB6B5C802FA + 8D1C01593F0DD6CB7989F48BC309D1B2 + C72A1289626AD74D4AFBA270028A4D29 + 29AE75D5483AA509E236ACF96DA4C552 + 5D5F74F07CCD4F7BEBC754FBF3469144 + 137884C04F56A2571162207524BE30E3 + D125EDAAE76FB0D1A59DD6FAC0F69544 + 26810A9296460BACEB70D9F717E6731B + 49F7E11EE93C572642C1B0C6A5FB6133 + 64CD57E03393BD73EEECBB2C5EFAFBC9 + A89C462B1050B1F2558CDA4CB8C54D0F + CA4B885B08825CA6C24810C081775439 + FB96FC2908D003D1B760BF869EE15F7D + E6B987A05470AF5BDE82773E37DE7C7A + 95D224A8C4722FD2B1F38C43323FFC52 + 78119D8EEC4C8769315B8CA814B36ED1 + CC0C13390F4C968CC85A74DFC6DCA262 + A0F39C3811B35D955721D77056DE45DD + 6FD703E659B78EC8E4B0B0EE153F971F + 307B4A60663187B3AAFEA450C2EA612E + C8086E03A30CE350440572D47C198417 + B4686FBC0FB8DD964A77B2E33B227ABB + 99CD20A5DA12F0B210D2A56B7DCFC4FD + F30B3079A2DD1841077A3E16D6C2954A + 543FE138B7C10D8360FE9F60CD7CBE59 + 73B73CDDB5554BDF16FFF464C5FEB41A + 3CCA0D8220937816FEBC670A0374490F + 8D177D2D663706A73494BC1D4487A6DB + 496C59F32803DB97290F4047AFA8C664 + 6534E524AF67CE729A1459661C3D1BEC + 0B6FEBF62DA02EA2909AA93FF11AD6AD + 2EA778EB3C7BCA91DB1FD5ADB97195B0 + 0BA84FB7B10E05FCF589984955E22715 + 154C86F1B4D09F57381D55B13297733B + 3984728F4471C763F32E9A5CF3C33E20 + 8765534A96C7B812B51CC1583F435D4B + A0B4A81B37AD5901F7647911FB6AC6D1 + 311DD11B104F16D0E43B37E820BA87A5 + 75408FC90121517C7387E30608C6EE1B + E16103E2BF9840BFD685927C807EA582 + B74F1B6A7C460018FBE18E448E3341D5 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 668AFA91410C6BF6A9602A900390FECE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Skip.swift + path + RxSwift/Observables/Implementations/Skip.swift + sourceTree + <group> + + 6708FDF094F620C266527729B6E337B9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + SnapKit-dummy.m + sourceTree + <group> + + 676DE6CFA76E39BC763BD7722317C834 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + CombineLatest+arity.swift + path + RxSwift/Observables/Implementations/CombineLatest+arity.swift + sourceTree + <group> + + 68A437BB73459DBB22EE2D4D5A3938C0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Driver+Operators.swift + path + RxCocoa/Common/CocoaUnits/Driver/Driver+Operators.swift + sourceTree + <group> + + 6A27CE966E0944B616D405F81E8DDB98 + + fileRef + 151B1EA97C49FFAAB10DA9202217C797 + isa + PBXBuildFile + + 6B0AE53698B242EB3C6E643BA87DCEFD + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ScheduledItem.swift + path + RxSwift/Schedulers/Internal/ScheduledItem.swift + sourceTree + <group> + + 6B4B6716ABC06F2E61A9984A6A546096 + + fileRef + 2A4E7B2CB9DFD37BCC9FDB2B8E095FB6 + isa + PBXBuildFile + + 6C7D2982E1BCFBEFCD55C0D92BB51463 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+StandardSequenceOperators.swift + path + RxSwift/Observables/Observable+StandardSequenceOperators.swift + sourceTree + <group> + + 6C86441EF0FD752C31EDEBC3AB2585B9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UISlider+Rx.swift + path + RxCocoa/iOS/UISlider+Rx.swift + sourceTree + <group> + + 6D2C1CCF641FAD4D417D89D074F46F58 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NSObject+Rx.swift + path + RxCocoa/Common/Observables/NSObject+Rx.swift + sourceTree + <group> + + 6D86A21B88DD9B5B309E5F12DE9AC154 + + fileRef + DBFC781397A0C69D96F10ACF3AB4F5D3 + isa + PBXBuildFile + + 6DF332C280385BF59449A7093DA431B3 + + fileRef + 75BE88EF9FA4962ECD0D87A2AF9CB14F + isa + PBXBuildFile + + 6E27FC52C51F16B139B65BCC7C84731F + + fileRef + B544FF0B9876AA8866FF967AF3662364 + isa + PBXBuildFile + + 6EC2B963093939C27310A7AC33C4DDF3 + + buildActionMask + 2147483647 + files + + 03FA082D4410F6E69067E50C751F8B89 + 2BBCD9C1A6965262791E06A94D3F3F62 + A4282FFC3D84CFABF1A6ABD29B0A10E4 + 789CE065DADE6283CEEFBAC865CC7D20 + A7F552E31059B6DAC66C95AEDCAF4A34 + CE9A03E833D81D028F85BBEEF74481E2 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6FD703E659B78EC8E4B0B0EE153F971F + + fileRef + C9A868CC07FDB9C5D9EC50E044971237 + isa + PBXBuildFile + + 6FE332C1EE7813FA828B95EEE8333F35 + + fileRef + FEF7A1F40355BD9CF8794C28B7DD51B0 + isa + PBXBuildFile + + 7003E31B9341D6FA7A9620556AC85306 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RefCount.swift + path + RxSwift/Observables/Implementations/RefCount.swift + sourceTree + <group> + + 70400A80C14CDF888E4F39A959B5A630 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + VirtualTimeConverterType.swift + path + RxSwift/Schedulers/VirtualTimeConverterType.swift + sourceTree + <group> + + 70DBC6AE653E78AB74CB92B3E2F77EE8 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + CombineLatest+CollectionType.swift + path + RxSwift/Observables/Implementations/CombineLatest+CollectionType.swift + sourceTree + <group> + + 71E1AA5037BB297CCE59DB00AAB9D65A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SectionedViewDataSourceType.swift + path + RxCocoa/Common/SectionedViewDataSourceType.swift + sourceTree + <group> + + 724A545F0915A11FEEF0407FBC21FB8A + + fileRef + B55DCD3507B2EE7803D49228FAAE1CD4 + isa + PBXBuildFile + + 725A9925BFB71866DB60B41000151594 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DelegateProxy.swift + path + RxCocoa/Common/DelegateProxy.swift + sourceTree + <group> + + 72CB9501BD0BC598BA2108E6B4A4936E + + explicitFileType + wrapper.framework + includeInIndex + 0 + isa + PBXFileReference + name + RxCocoa.framework + path + RxCocoa.framework + sourceTree + BUILT_PRODUCTS_DIR + + 73218F2FA5E25FEBDC6511ADD2235F8D + + buildConfigurationList + 0A2927C946CB8935ABA6F0134B8BE497 + buildPhases + + CFABE2D4B97ADCACD624D19561A2AE73 + BD1940FB5C925F8EDAFE592C0DC97CFF + 453F762F54BDF7DBE1721244D6A663AD + + buildRules + + dependencies + + isa + PBXNativeTarget + name + SnapKit + productName + SnapKit + productReference + 9F72194393E3FB94C46321C95CB0C0F5 + productType + com.apple.product-type.framework + + 73B73CDDB5554BDF16FFF464C5FEB41A + + fileRef + 25A15AE0289AE51B47A95D0CA6A70B7E + isa + PBXBuildFile + + 746FAD3CEA8749116EB3CE9CD031BF21 + + fileRef + CF54AA66A2FE8F6F1EC0B5C4C7F484A0 + isa + PBXBuildFile + + 74D13BBF3EC30B71F10CD6B5615D0A2C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Just.swift + path + RxSwift/Observables/Implementations/Just.swift + sourceTree + <group> + + 7515A28049150E8259C134CD10388388 + + fileRef + CB6EA11ADC74720822E6FA0A64E1272F + isa + PBXBuildFile + + 75218E5E79DD02BADE06373379EB99D5 + + fileRef + 172A197BA3A42B0FD4CC2CC39E9EAA2C + isa + PBXBuildFile + + 75408FC90121517C7387E30608C6EE1B + + fileRef + FDEB042BC99357B7D2809594005D5F8B + isa + PBXBuildFile + + 75BE88EF9FA4962ECD0D87A2AF9CB14F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + name + _RX.m + path + RxCocoa/Common/_RX.m + sourceTree + <group> + + 75D98FF52E597A11900E131B6C4E1ADA + + children + + E8446514FBAD26C0E18F24A5715AEF67 + 79A9DEDC89FE8336BF5FEDAAF75BF7FC + D0405803033A2A777B8E4DFA0C1800ED + 87B213035BAC5F75386F62D3C75D2342 + 894E5DA93A9F359521A89826BE6DA777 + E7F21354943D9F42A70697D5A5EF72E9 + CBC0F7C552B739C909B650A0F42F7F38 + 2BCC458FDD5F692BBB2BFC64BB5701FC + 977577C045EDA9D9D1F46E2598D19FC7 + DA312349A49333542E6F4B36B329960E + + isa + PBXGroup + name + Pods + path + Target Support Files/Pods + sourceTree + <group> + + 7759B133FEF8792909C44A4CC3DC9516 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + RxCocoa.h + path + RxCocoa/RxCocoa.h + sourceTree + <group> + + 78119D8EEC4C8769315B8CA814B36ED1 + + fileRef + F1DE74F7C05BDBF8BA973F6ABF9EE5B4 + isa + PBXBuildFile + + 783C5BE07458635066381BCBE6BED402 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UITextField+Rx.swift + path + RxCocoa/iOS/UITextField+Rx.swift + sourceTree + <group> + + 784BED503D8BE98732C93D0C6448153E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConcurrentMainScheduler.swift + path + RxSwift/Schedulers/ConcurrentMainScheduler.swift + sourceTree + <group> + + 789CE065DADE6283CEEFBAC865CC7D20 + + fileRef + B5A6CB7B2004EB3238A61F7A2781F36E + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + 79A9DEDC89FE8336BF5FEDAAF75BF7FC + + includeInIndex + 1 + isa + PBXFileReference + path + Pods.modulemap + sourceTree + <group> + + 7A2190B63C68AD46C434D06BFDB30926 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + SnapKit-umbrella.h + sourceTree + <group> + + 7A3BD000B1FD8E4011DC534B33BDD0E9 + + children + + 397ED6A120A7323FEFFD443352B8A3B8 + A0DD83DD4D652465A47254BD81FFBE9D + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + 7ACF3BB9B1E88A6AB6CDDA8467440DCD + + fileRef + A3895A88AA9ECE0A9B3F13D46F15E6FC + isa + PBXBuildFile + + 7B006AB09A3CFFA078739702CA64BC04 + + fileRef + 0023C9576F10E0C4EBFB584BC22717BD + isa + PBXBuildFile + + 7B57968853CD57DEFD3960E0364964CD + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConstraintAttributes.swift + path + Source/ConstraintAttributes.swift + sourceTree + <group> + + 7C0BF13D1590FE5E628B5F78BC68EDB0 + + fileRef + 5CD68E79931886F23102744D9857D127 + isa + PBXBuildFile + + 7C2660C36388E791B5934A4D4D3E2C67 + + includeInIndex + 1 + isa + PBXFileReference + path + RxCocoa.modulemap + sourceTree + <group> + + 7CB8BDC2E9765335E0DAEBA3097E6DC9 + + fileRef + F358A84E6D0DC41A3CA4819377685154 + isa + PBXBuildFile + + 7D05D320257100F18F660FB65425881A + + fileRef + 1FBB7E6E956C2F293B72404553C2351C + isa + PBXBuildFile + + 7D4015D30A583B6FD780A7BFF7DD7214 + + fileRef + DD73E4B85E9E94E50ED44E1ED67F40B5 + isa + PBXBuildFile + + 7D8AE06924BA20D160696C7942EA775F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConnectableObservableType.swift + path + RxSwift/ConnectableObservableType.swift + sourceTree + <group> + + 7DB346D0F39D3F0E887471402A8071AB + + children + + BA6428E9F66FD5A23C0A2E06ED26CD2F + 7A3BD000B1FD8E4011DC534B33BDD0E9 + 0F1EDD308A73FF476CE2B981CFCFB4D7 + E0601970BA36B69F4FB94D009DF3D2E2 + B7B80995527643776607AFFA75B91E24 + + isa + PBXGroup + sourceTree + <group> + + 7DF1914CCFB91A15DC70812FCF84E033 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Zip.swift + path + RxSwift/Observables/Implementations/Zip.swift + sourceTree + <group> + + 7F36F6B574F4DF1D5287AA32672E2DA9 + + isa + PBXTargetDependency + name + RxCocoa + target + 34164F5A92067F8A435D205F6A3EDD6C + targetProxy + 09791AD581F8D07D89C6A20EEA42F5DA + + 800FB207162559F8300CDAD6A4B600D1 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Bag.swift + path + RxSwift/DataStructures/Bag.swift + sourceTree + <group> + + 805559038456D6B897A4BAD350F5499F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + name + _RXKVOObserver.m + path + RxCocoa/Common/_RXKVOObserver.m + sourceTree + <group> + + 8280A1C58B44EC253A757764B0673891 + + fileRef + EF339BD67C3BFF8D67A8C136007EB45A + isa + PBXBuildFile + + 828A8DA1135D72924C97204694340346 + + baseConfigurationReference + A03C545BCEC4A498D4B6619118987DD2 + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_PREFIX_HEADER + Target Support Files/RxSwift/RxSwift-prefix.pch + INFOPLIST_FILE + Target Support Files/RxSwift/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MODULEMAP_FILE + Target Support Files/RxSwift/RxSwift.modulemap + MTL_ENABLE_DEBUG_INFO + YES + PRODUCT_NAME + RxSwift + SDKROOT + iphoneos + SKIP_INSTALL + YES + SWIFT_OPTIMIZATION_LEVEL + -Onone + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Debug + + 845C026917854713292B174F2B8BDB3F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AnyObserver.swift + path + RxSwift/AnyObserver.swift + sourceTree + <group> + + 8489124E660E85539600413DF81D3BFB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + StartWith.swift + path + RxSwift/Observables/Implementations/StartWith.swift + sourceTree + <group> + + 851D9AD3BE46D9537144FE2AC84A4E9C + + fileRef + 2367AD90CC1DA97D46AFFDC1F05920E0 + isa + PBXBuildFile + + 8537388CC66204B0EC65087114346367 + + containerPortal + D41D8CD98F00B204E9800998ECF8427E + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 73218F2FA5E25FEBDC6511ADD2235F8D + remoteInfo + SnapKit + + 85A40BB90176D634B0B56B08CDD1AB71 + + fileRef + 0FFEA9A4B315E9B31B73A6710745D103 + isa + PBXBuildFile + + 85A8ECCDAF7995A8B3470BCBCB983335 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Disposable.swift + path + RxSwift/Disposable.swift + sourceTree + <group> + + 85F858FDD58EB15C15E14772F5DD8ECC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Single.swift + path + RxSwift/Observables/Observable+Single.swift + sourceTree + <group> + + 864B54D57FF86D8C1B427C346520CBB8 + + fileRef + AA87832AC58AD98B0749F4A88600E8DB + isa + PBXBuildFile + + 8763124815289BB7284CF3A868839A86 + + fileRef + 32CB01AC3AF4BCA714C974314E4A8A4A + isa + PBXBuildFile + + 8765534A96C7B812B51CC1583F435D4B + + fileRef + 96F2DD0668EA3052B65BE4BA033023BB + isa + PBXBuildFile + + 876F1C7DA0E2051355E5DB973CB7780D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + InvocableScheduledItem.swift + path + RxSwift/Schedulers/Internal/InvocableScheduledItem.swift + sourceTree + <group> + + 87B213035BAC5F75386F62D3C75D2342 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Pods-acknowledgements.plist + sourceTree + <group> + + 89497B3C3E51981AE2544A152C254D19 + + fileRef + 876F1C7DA0E2051355E5DB973CB7780D + isa + PBXBuildFile + + 894E5DA93A9F359521A89826BE6DA777 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-dummy.m + sourceTree + <group> + + 8975248C641D67DC62B446E5F9DAA341 + + fileRef + B6DC713232690AAF81B17C6D66C427B9 + isa + PBXBuildFile + + 8A2DD9DA4E4315F65C3A6E66C44DF165 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + RxCocoa.xcconfig + sourceTree + <group> + + 8ADBD98751DA7F0BA48597A9A76737E7 + + fileRef + B59DA5CA4399176873A9EE010B5EA2B0 + isa + PBXBuildFile + + 8B2D5B0B49F5F75D4EBBA6B07BDF9AB9 + + fileRef + 433A626CA7B1C7B6BC01AE38CFCECCFB + isa + PBXBuildFile + + 8CF18C51C0C634E8064881A59783F867 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIRefreshControl+Rx.swift + path + RxCocoa/iOS/UIRefreshControl+Rx.swift + sourceTree + <group> + + 8D177D2D663706A73494BC1D4487A6DB + + fileRef + E97A4EF64A15485B2E669F47D9AA38A3 + isa + PBXBuildFile + + 8D19ACB01585EEE418438C8C87461780 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIImagePickerController+Rx.swift + path + RxCocoa/iOS/UIImagePickerController+Rx.swift + sourceTree + <group> + + 8D1C01593F0DD6CB7989F48BC309D1B2 + + fileRef + 3C5A958785AF0570387AC40E20D8E92F + isa + PBXBuildFile + + 8DEC3E68907858B696D3837F9F58603F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Zip+CollectionType.swift + path + RxSwift/Observables/Implementations/Zip+CollectionType.swift + sourceTree + <group> + + 8EFD87CC8E01C471E19BAD9418044DEA + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DispatchQueueSchedulerQOS.swift + path + RxSwift/Schedulers/DispatchQueueSchedulerQOS.swift + sourceTree + <group> + + 906B6A758D264955326B55BFCD29B405 + + fileRef + 135C1F7A49ECBDE68B7BB0B8E8A3E9B4 + isa + PBXBuildFile + + 9110430CC674B97291BCAF26A62C88C9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Lock.swift + path + RxSwift/Concurrency/Lock.swift + sourceTree + <group> + + 9173B28DEB22F2AF47173D9869C0DC50 + + fileRef + E1FBC01ECD62CF7C86996B784A5EEE67 + isa + PBXBuildFile + + 91C9BD0CFB1BBEB07DBBE4075922B632 + + fileRef + B6D74758DF3A3779B9C6FF54BA0CCF83 + isa + PBXBuildFile + + 91DAF59DD37D86F8E88C94C763862AA6 + + fileRef + BCE921727DC16636E0BAE377A3B0FFF3 + isa + PBXBuildFile + + 928F478E6A46C4E67CBC7C8684E000CF + + fileRef + 25BD0B96B9FD73AA02777C39601AB852 + isa + PBXBuildFile + + 92E06DCD86280F9354E6187B22FB8330 + + fileRef + 5F6327673E3F87097792674AD378AD52 + isa + PBXBuildFile + + 934AFED0D3EC1EBA5A1C3FB4728DDD0F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + SnapKit-prefix.pch + sourceTree + <group> + + 93DCD78378FB3A33CCF998FC536334DC + + fileRef + C19622B8FAD7A971E1979B163A4B4716 + isa + PBXBuildFile + + 940F33ACE585B52DF1974EFEDA737FC3 + + fileRef + BE1AE3D07AECA038C1154F8196DBD682 + isa + PBXBuildFile + + 95219771FD32FA71AEB8C3FD90017E80 + + fileRef + A2FD7878DFE437D98CECF3B9172C4FFE + isa + PBXBuildFile + + 95749307071536A6E86613D6B3164310 + + fileRef + A1880610B7DBCFD54FD897F24E6AB3A6 + isa + PBXBuildFile + + 95D224A8C4722FD2B1F38C43323FFC52 + + fileRef + 71E1AA5037BB297CCE59DB00AAB9D65A + isa + PBXBuildFile + + 96F2DD0668EA3052B65BE4BA033023BB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UITabBarItem+Rx.swift + path + RxCocoa/iOS/UITabBarItem+Rx.swift + sourceTree + <group> + + 972E047591F1CB4F35B7A9C85C4D953C + + fileRef + FABB602DCFA18ECA8E2AD8FD2A65464C + isa + PBXBuildFile + + 977577C045EDA9D9D1F46E2598D19FC7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods.debug.xcconfig + sourceTree + <group> + + 97D2C9BEFF7997DB75C9AB101A4DFCB4 + + fileRef + 3C210CF6BF3541A9831656764CCF885D + isa + PBXBuildFile + + 9838570345B9495C4D2CA80BC4975979 + + fileRef + D264068C557BF3BB2529E44B5CD0E453 + isa + PBXBuildFile + + 994646826A17BC3C12BA719D59D863D9 + + fileRef + CC732C7316E22D4ACD189E1892A436CB + isa + PBXBuildFile + + 999B44EE476358F96B295852D3121415 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Scan.swift + path + RxSwift/Observables/Implementations/Scan.swift + sourceTree + <group> + + 99CD20A5DA12F0B210D2A56B7DCFC4FD + + fileRef + 4C3946D6D434BD44EE3A468A750DD0D3 + isa + PBXBuildFile + + 99FFB5D0CAC91ACE66C4BE604287632F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Timer.swift + path + RxSwift/Observables/Implementations/Timer.swift + sourceTree + <group> + + 9A96BCD9A584BD6AD6D0DA476D30B6EB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxTarget.swift + path + RxCocoa/Common/RxTarget.swift + sourceTree + <group> + + 9AC52F95B0A858BAEDB7B1CD5B4BDBB6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxCLLocationManagerDelegateProxy.swift + path + RxCocoa/Common/Proxies/RxCLLocationManagerDelegateProxy.swift + sourceTree + <group> + + 9BC71B557027D185F0520BD31AB6D3D7 + + fileRef + CD4CAC80DC030122988117CD2ED3549D + isa + PBXBuildFile + + 9C6B0D8C4BED402F7D13CA1987D63529 + + fileRef + C3B82261175C07DBEFCD0ECDAF22AE87 + isa + PBXBuildFile + + 9CF3940FE21D55A3595F8DE67A004629 + + fileRef + 4C1E9287B7FE83EBDD2EACC8B8B4AA46 + isa + PBXBuildFile + + 9D3A91311DA4D0B74B8D45551A5B2EF0 + + fileRef + D1CEDCE925310C77A210F636713C1441 + isa + PBXBuildFile + + 9F72194393E3FB94C46321C95CB0C0F5 + + explicitFileType + wrapper.framework + includeInIndex + 0 + isa + PBXFileReference + name + SnapKit.framework + path + SnapKit.framework + sourceTree + BUILT_PRODUCTS_DIR + + 9FED317D2BABDD67EF9EA8D9E88EE3D0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + InfiniteSequence.swift + path + RxSwift/DataStructures/InfiniteSequence.swift + sourceTree + <group> + + A03C545BCEC4A498D4B6619118987DD2 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + RxSwift.xcconfig + sourceTree + <group> + + A064FC333E23C370AD63449951FE2B80 + + fileRef + 676DE6CFA76E39BC763BD7722317C834 + isa + PBXBuildFile + + A08FB0F0C4E7E1B4EC6A2622219C1796 + + fileRef + 6110DFC8EE70B8256F4B5E3A59611447 + isa + PBXBuildFile + + A0A643397C9D3F6D2F74E8E0DB77D2E0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIBarButtonItem+Rx.swift + path + RxCocoa/iOS/UIBarButtonItem+Rx.swift + sourceTree + <group> + + A0B4A81B37AD5901F7647911FB6AC6D1 + + fileRef + 37A13530B58EA30B61168992F42D6859 + isa + PBXBuildFile + + A0BF71A4044B9813E59254A740137A94 + + fileRef + 99FFB5D0CAC91ACE66C4BE604287632F + isa + PBXBuildFile + + A0D60BE78E56BCB019EEC1D59A112B4F + + fileRef + E6695FFBDFD7B74A5B6792093C1534DA + isa + PBXBuildFile + + A0DD83DD4D652465A47254BD81FFBE9D + + children + + F358A84E6D0DC41A3CA4819377685154 + + isa + PBXGroup + name + iOS + sourceTree + <group> + + A0F39C3811B35D955721D77056DE45DD + + fileRef + A0A643397C9D3F6D2F74E8E0DB77D2E0 + isa + PBXBuildFile + + A1880610B7DBCFD54FD897F24E6AB3A6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NSNotificationCenter+Rx.swift + path + RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift + sourceTree + <group> + + A206B4AD3900E7F4D1A7AE065E35CED4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DisposeBag.swift + path + RxSwift/Disposables/DisposeBag.swift + sourceTree + <group> + + A25855C175813132567578E27CEBB058 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NSObject+Rx+RawRepresentable.swift + path + RxCocoa/Common/Observables/NSObject+Rx+RawRepresentable.swift + sourceTree + <group> + + A2FD7878DFE437D98CECF3B9172C4FFE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SynchronizedSubscribeType.swift + path + RxSwift/Concurrency/SynchronizedSubscribeType.swift + sourceTree + <group> + + A3895A88AA9ECE0A9B3F13D46F15E6FC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + EdgeInsets.swift + path + Source/EdgeInsets.swift + sourceTree + <group> + + A4282FFC3D84CFABF1A6ABD29B0A10E4 + + fileRef + 3CA58CD9CF58BF25FA3CFC6C6C9540B9 + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + A5A5E97317274189276CC3DB57BFCB73 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + BooleanDisposable.swift + path + RxSwift/Disposables/BooleanDisposable.swift + sourceTree + <group> + + A70CDAD61F90AC503C7D04CC22DA2923 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + CLANG_WARN_UNREACHABLE_CODE + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + COPY_PHASE_STRIP + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + ONLY_ACTIVE_ARCH + YES + STRIP_INSTALLED_PRODUCT + NO + SYMROOT + ${SRCROOT}/../build + + isa + XCBuildConfiguration + name + Debug + + A7F552E31059B6DAC66C95AEDCAF4A34 + + fileRef + FD3FDB08AE00A509EA108C19E5DA3556 + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + A8945F5242E27F483D412447B5CD237B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DeallocObservable.swift + path + RxCocoa/Common/Observables/Implementations/DeallocObservable.swift + sourceTree + <group> + + A89C462B1050B1F2558CDA4CB8C54D0F + + fileRef + FFA0699393CDD4772FEE63E9556F679F + isa + PBXBuildFile + + A900C20F9274E0FD115FCBE5DC0EFD08 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SubscriptionDisposable.swift + path + RxSwift/Disposables/SubscriptionDisposable.swift + sourceTree + <group> + + AA7754534C21AC0934FD7D63FF5E4495 + + fileRef + 1E68D5BD90F32098FF97E1AB9C744E84 + isa + PBXBuildFile + + AA7A06B3FFA9B321812468A5057C3F10 + + includeInIndex + 1 + isa + PBXFileReference + path + RxSwift.modulemap + sourceTree + <group> + + AA87832AC58AD98B0749F4A88600E8DB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxCocoa.swift + path + RxCocoa/Common/RxCocoa.swift + sourceTree + <group> + + AB750C823DEAC3BC2306BFEA9090905E + + buildActionMask + 2147483647 + files + + EF53C92A3153BC34FF83DF0A37B958D2 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + AD3E5D4DBC9A849D9A2E5387784D705F + + fileRef + 4E8302DED0E361E4109E3148F5F7FB59 + isa + PBXBuildFile + + AE1465B27A47C3FF79B2908B3B9AC6E7 + + fileRef + CF56ABEF76ADED7648A485CEEC5D51E0 + isa + PBXBuildFile + + AF38DD7C4458C6BB575583761DFDAC03 + + fileRef + 9FED317D2BABDD67EF9EA8D9E88EE3D0 + isa + PBXBuildFile + + B101861F998594A754682E5006531321 + + baseConfigurationReference + 41F79207858684F92C20060C6A01CC7F + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_PREFIX_HEADER + Target Support Files/SnapKit/SnapKit-prefix.pch + INFOPLIST_FILE + Target Support Files/SnapKit/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MODULEMAP_FILE + Target Support Files/SnapKit/SnapKit.modulemap + MTL_ENABLE_DEBUG_INFO + NO + PRODUCT_NAME + SnapKit + SDKROOT + iphoneos + SKIP_INSTALL + YES + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Release + + B10B87316572C626AE542BEF6BF90AB8 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Errors.swift + path + RxSwift/Errors.swift + sourceTree + <group> + + B2B725263D78213E128E00A5CF791723 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Variable+Driver.swift + path + RxCocoa/Common/CocoaUnits/Driver/Variable+Driver.swift + sourceTree + <group> + + B361317740C73D3F69F1C576A9128A09 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Zip+arity.swift + path + RxSwift/Observables/Implementations/Zip+arity.swift + sourceTree + <group> + + B4686FBC0FB8DD964A77B2E33B227ABB + + fileRef + 4E86886CCE2546401C8AC708E1B141F0 + isa + PBXBuildFile + + B472CD6F2DBB7AF7CC47A7878FA24FEC + + buildConfigurations + + 828A8DA1135D72924C97204694340346 + D1A4C314413E516D8F58F418D1E6DD07 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + B4EFA4EDF3B5EE644188E2E42FCF2330 + + fileRef + 51EF47FAB0D3FF7DB2CD6D72F7240747 + isa + PBXBuildFile + + B51B6FCA8FEEC0A32E3B8A70CBB196BE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable.swift + path + RxSwift/Observable.swift + sourceTree + <group> + + B524F6492EACFD58F993AB9D93975D8F + + fileRef + A25855C175813132567578E27CEBB058 + isa + PBXBuildFile + + B544FF0B9876AA8866FF967AF3662364 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConstraintItem.swift + path + Source/ConstraintItem.swift + sourceTree + <group> + + B55DCD3507B2EE7803D49228FAAE1CD4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Concat.swift + path + RxSwift/Observables/Implementations/Concat.swift + sourceTree + <group> + + B590B94974631BBB1F364E4287764689 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Driver+Operators+arity.swift + path + RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift + sourceTree + <group> + + B59DA5CA4399176873A9EE010B5EA2B0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Buffer.swift + path + RxSwift/Observables/Implementations/Buffer.swift + sourceTree + <group> + + B5A6CB7B2004EB3238A61F7A2781F36E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + _RXObjCRuntime.h + path + RxCocoa/Common/_RXObjCRuntime.h + sourceTree + <group> + + B5B7BD570020FAD3B34492D16B5306E0 + + fileRef + 0B025F960D41663563FC11F91BA9B869 + isa + PBXBuildFile + + B62B155CC4DEDEA6BEDD99217A8180A3 + + fileRef + 68A437BB73459DBB22EE2D4D5A3938C0 + isa + PBXBuildFile + + B6D74758DF3A3779B9C6FF54BA0CCF83 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Debugging.swift + path + Source/Debugging.swift + sourceTree + <group> + + B6DC713232690AAF81B17C6D66C427B9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + String+Rx.swift + path + RxSwift/Extensions/String+Rx.swift + sourceTree + <group> + + B6FF1149D7AA0D517AA59646AEE71A79 + + fileRef + F78B7323949B2AC903E43446BF7A0D96 + isa + PBXBuildFile + + B703901D5ED3A58CB1663315023A9111 + + fileRef + 057F5E8B86019FB80F6AAB6C464E402E + isa + PBXBuildFile + + B74F1B6A7C460018FBE18E448E3341D5 + + fileRef + B2B725263D78213E128E00A5CF791723 + isa + PBXBuildFile + + B76BF8B9E71435300B76C4532EC12C49 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AnonymousDisposable.swift + path + RxSwift/Disposables/AnonymousDisposable.swift + sourceTree + <group> + + B7B80995527643776607AFFA75B91E24 + + children + + 75D98FF52E597A11900E131B6C4E1ADA + + isa + PBXGroup + name + Targets Support Files + sourceTree + <group> + + B84B88FC91FAFAFF1BB5E7A803514762 + + fileRef + DAE96B9DC7873FC574E7C64371F40283 + isa + PBXBuildFile + + B8AE099FDA15B3511041CF87AF79E813 + + explicitFileType + wrapper.framework + includeInIndex + 0 + isa + PBXFileReference + name + Pods.framework + path + Pods.framework + sourceTree + BUILT_PRODUCTS_DIR + + B8E3470124B5487055D30A4C0984C209 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxTextStorageDelegateProxy.swift + path + RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift + sourceTree + <group> + + BA47C8ADE4F91BD0EBC480532BBDC2D3 + + fileRef + D84795872901D017DC0415AD7944DE46 + isa + PBXBuildFile + + BA6428E9F66FD5A23C0A2E06ED26CD2F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + name + Podfile + path + ../Podfile + sourceTree + SOURCE_ROOT + xcLanguageSpecificationIdentifier + xcode.lang.ruby + + BAFE55ACB04182DD671B80F722415B2B + + fileRef + 35995BC7F759B47F43AE185AFAD51652 + isa + PBXBuildFile + + BB485A23AEAE115E9C9A070F697AA07A + + fileRef + 7DF1914CCFB91A15DC70812FCF84E033 + isa + PBXBuildFile + + BB71836AC14518B3E9B166FDE5C53C1E + + fileRef + 4661F85204A4AAEC17BB5A447AA5BB0C + isa + PBXBuildFile + + BBDC4A9920191C47CFA496A6DA3C1330 + + fileRef + CFD1F3CC5727C73301F80802E6551933 + isa + PBXBuildFile + + BBDE9C4CC210F52F45F6DBD56AAB108D + + fileRef + A5A5E97317274189276CC3DB57BFCB73 + isa + PBXBuildFile + + BCE6B0570138EFE5FF6B9234C86CFBD9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SynchronizedOnType.swift + path + RxSwift/Concurrency/SynchronizedOnType.swift + sourceTree + <group> + + BCE921727DC16636E0BAE377A3B0FFF3 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Deferred.swift + path + RxSwift/Observables/Implementations/Deferred.swift + sourceTree + <group> + + BD1940FB5C925F8EDAFE592C0DC97CFF + + buildActionMask + 2147483647 + files + + 7CB8BDC2E9765335E0DAEBA3097E6DC9 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + BDA56366DB6BA0C6217EB295767364BE + + fileRef + 43850E8BC0A032C2AB3CB7750EB79A41 + isa + PBXBuildFile + + BE1AE3D07AECA038C1154F8196DBD682 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + LayoutConstraint.swift + path + Source/LayoutConstraint.swift + sourceTree + <group> + + BF80996B8779B8510190168D42CE1054 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SchedulerServices+Emulation.swift + path + RxSwift/Schedulers/SchedulerServices+Emulation.swift + sourceTree + <group> + + C0B59CCA57CADF1338B1E8036D331A7E + + fileRef + 784BED503D8BE98732C93D0C6448153E + isa + PBXBuildFile + + C0E0D21C794E89280FDB29F0E10A16A7 + + fileRef + 61846750E7CECDD77A085A538953FAAC + isa + PBXBuildFile + + C0E1D0006BF8ECEB788D5D27B92B605B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + StableCompositeDisposable.swift + path + RxSwift/Disposables/StableCompositeDisposable.swift + sourceTree + <group> + + C1949AC017DB4AC50F1D545E9DD268EC + + fileRef + B10B87316572C626AE542BEF6BF90AB8 + isa + PBXBuildFile + + C19622B8FAD7A971E1979B163A4B4716 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NSURLSession+Rx.swift + path + RxCocoa/Common/Observables/NSURLSession+Rx.swift + sourceTree + <group> + + C196E727E2C41BE6B11CD24514C3C975 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + VirtualTimeScheduler.swift + path + RxSwift/Schedulers/VirtualTimeScheduler.swift + sourceTree + <group> + + C28B0125E327306B3BF97AB7B845DCF3 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxScrollViewDelegateProxy.swift + path + RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift + sourceTree + <group> + + C2DD2AE55FD5B025F8A4EA3A898D13DE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Empty.swift + path + RxSwift/Observables/Implementations/Empty.swift + sourceTree + <group> + + C3B82261175C07DBEFCD0ECDAF22AE87 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AnonymousInvocable.swift + path + RxSwift/Schedulers/Internal/AnonymousInvocable.swift + sourceTree + <group> + + C6147276EE27AC9FE3CD46E59777FAF2 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Info.plist + sourceTree + <group> + + C663D2F8A14F92218FEC6B10819C2DB6 + + fileRef + A900C20F9274E0FD115FCBE5DC0EFD08 + isa + PBXBuildFile + + C6758814735858BE99EBE271016012FD + + fileRef + 17FB140647BB76D23D59FFBF6C5DD92A + isa + PBXBuildFile + + C6EE26222139A6A47DA828E6117B6AD2 + + fileRef + EFA2484FD26FAEF1C6911F811A4CE9E6 + isa + PBXBuildFile + + C70D33646152C1E86BC0BB8550CB87CA + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Repeat.swift + path + RxSwift/Observables/Implementations/Repeat.swift + sourceTree + <group> + + C72981D14F849840AAB2C31102D3462E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + OperationQueueScheduler.swift + path + RxSwift/Schedulers/OperationQueueScheduler.swift + sourceTree + <group> + + C72A1289626AD74D4AFBA270028A4D29 + + fileRef + 2A12A995F09098AB3C520E44A7F21B39 + isa + PBXBuildFile + + C753699E995684D0B5BF366F20706CD8 + + fileRef + D3B55E2EEFA4624FFC141A44B919D657 + isa + PBXBuildFile + + C8086E03A30CE350440572D47C198417 + + fileRef + CAC858DFAB2574B6467C911758116E8A + isa + PBXBuildFile + + C9A868CC07FDB9C5D9EC50E044971237 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIBindingObserver.swift + path + RxCocoa/Common/CocoaUnits/UIBindingObserver.swift + sourceTree + <group> + + C9B09E865987D1A599387D7281F5BBCE + + fileRef + D808921287D885DF56415711F5C166C6 + isa + PBXBuildFile + + C9F0DF1810EE9332C04BD3FCE1FD0028 + + fileRef + 6461F5720A098DDB0B2274E2F248EEEE + isa + PBXBuildFile + + CA4B885B08825CA6C24810C081775439 + + fileRef + 9A96BCD9A584BD6AD6D0DA476D30B6EB + isa + PBXBuildFile + + CA75218C95FD58E4235481BC1E18FD45 + + buildActionMask + 2147483647 + files + + 084B705D32E8B7EAC9DAB878444D0068 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + CAC858DFAB2574B6467C911758116E8A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UICollectionView+Rx.swift + path + RxCocoa/iOS/UICollectionView+Rx.swift + sourceTree + <group> + + CB6EA11ADC74720822E6FA0A64E1272F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Filter.swift + path + RxSwift/Observables/Implementations/Filter.swift + sourceTree + <group> + + CB9ABB929E0277887549C309CB6BAD3A + + buildActionMask + 2147483647 + files + + 200A48E02C33A1F61F5063E95650C30F + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + CBB5901900E1195A5BCBC00C338696CD + + fileRef + 2C2541E19C7304A7845BAE7E02C80669 + isa + PBXBuildFile + + CBC0F7C552B739C909B650A0F42F7F38 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-resources.sh + sourceTree + <group> + + CC0C13390F4C968CC85A74DFC6DCA262 + + fileRef + D879A8F052BEBEB92FB683A3A898A429 + isa + PBXBuildFile + + CC0C1AB471FD0B8B224233A706874D5D + + fileRef + 441DFC5ACFC6E2A5D387326C0947B277 + isa + PBXBuildFile + + CC6A26CD98172EC53F9F75DB7ACB5CF1 + + fileRef + 3D9163E5D6158E7F4BF09A20179BE020 + isa + PBXBuildFile + + CC732C7316E22D4ACD189E1892A436CB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Sink.swift + path + RxSwift/Observables/Implementations/Sink.swift + sourceTree + <group> + + CCFA2D47D5AACEE84E6C3699ABD87C8D + + fileRef + 6299CB01EF53A3D0653565468584543E + isa + PBXBuildFile + + CD4CAC80DC030122988117CD2ED3549D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ObservableConvertibleType.swift + path + RxSwift/ObservableConvertibleType.swift + sourceTree + <group> + + CE4AEEB83610F9879D468525B7F822C7 + + baseConfigurationReference + 977577C045EDA9D9D1F46E2598D19FC7 + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + INFOPLIST_FILE + Target Support Files/Pods/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MACH_O_TYPE + staticlib + MODULEMAP_FILE + Target Support Files/Pods/Pods.modulemap + MTL_ENABLE_DEBUG_INFO + YES + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PODS_ROOT + $(SRCROOT) + PRODUCT_NAME + Pods + SDKROOT + iphoneos + SKIP_INSTALL + YES + SWIFT_OPTIMIZATION_LEVEL + -Onone + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Debug + + CE700D43FA8690A81B9257BB4C0BD0DF + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + MainScheduler.swift + path + RxSwift/Schedulers/MainScheduler.swift + sourceTree + <group> + + CE9A03E833D81D028F85BBEEF74481E2 + + fileRef + 7759B133FEF8792909C44A4CC3DC9516 + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + CF54AA66A2FE8F6F1EC0B5C4C7F484A0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Error.swift + path + RxSwift/Observables/Implementations/Error.swift + sourceTree + <group> + + CF56ABEF76ADED7648A485CEEC5D51E0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + RxSwift-dummy.m + sourceTree + <group> + + CFABE2D4B97ADCACD624D19561A2AE73 + + buildActionMask + 2147483647 + files + + BA47C8ADE4F91BD0EBC480532BBDC2D3 + 3CB36EBB5FC1EFA95019AB418E93C232 + 5D6AB6A57925FCC53C20CE5CD39C51D0 + 6E27FC52C51F16B139B65BCC7C84731F + C6758814735858BE99EBE271016012FD + 3F803D899583DE5F2D73199C6813784F + 91C9BD0CFB1BBEB07DBBE4075922B632 + 7ACF3BB9B1E88A6AB6CDDA8467440DCD + 940F33ACE585B52DF1974EFEDA737FC3 + 583D952E4A953749259F1BE7603CA675 + 851D9AD3BE46D9537144FE2AC84A4E9C + D3BCDED234A97B48412522485B2B476E + 11CC5121FFA3658EB2EB4E82F9B9B82B + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + CFD1F3CC5727C73301F80802E6551933 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Extensions.swift + path + RxSwift/Observable+Extensions.swift + sourceTree + <group> + + D0405803033A2A777B8E4DFA0C1800ED + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + path + Pods-acknowledgements.markdown + sourceTree + <group> + + D125EDAAE76FB0D1A59DD6FAC0F69544 + + fileRef + EE223FA8862F01F60FC69E89064647A8 + isa + PBXBuildFile + + D1A4C314413E516D8F58F418D1E6DD07 + + baseConfigurationReference + A03C545BCEC4A498D4B6619118987DD2 + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_PREFIX_HEADER + Target Support Files/RxSwift/RxSwift-prefix.pch + INFOPLIST_FILE + Target Support Files/RxSwift/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MODULEMAP_FILE + Target Support Files/RxSwift/RxSwift.modulemap + MTL_ENABLE_DEBUG_INFO + NO + PRODUCT_NAME + RxSwift + SDKROOT + iphoneos + SKIP_INSTALL + YES + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Release + + D1CEDCE925310C77A210F636713C1441 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + KVORepresentable+Swift.swift + path + RxCocoa/Common/KVORepresentable+Swift.swift + sourceTree + <group> + + D1DBC6A35775A443338A956A225AA02B + + children + + 3C3930F9DBF25C61A5C1D179C0E7E5F6 + 5588B4DCF94DC925DC127773ECD50B51 + B76BF8B9E71435300B76C4532EC12C49 + C3B82261175C07DBEFCD0ECDAF22AE87 + EFA2484FD26FAEF1C6911F811A4CE9E6 + 0A912C35A25B4C6602BF08291FAE3004 + 845C026917854713292B174F2B8BDB3F + 26C998BA0C9F3D400CA831881C074270 + 800FB207162559F8300CDAD6A4B600D1 + 1EB350527B1AE776CD73D2511C86D3E7 + EBBE1DF3B018B3CC653E6E897B43A82B + A5A5E97317274189276CC3DB57BFCB73 + B59DA5CA4399176873A9EE010B5EA2B0 + 0B025F960D41663563FC11F91BA9B869 + D501B740C6D22952BF68AA8D37085BEE + D3B55E2EEFA4624FFC141A44B919D657 + 676DE6CFA76E39BC763BD7722317C834 + 70DBC6AE653E78AB74CB92B3E2F77EE8 + D1EAA37957D3936571AB4D8A3776EFF7 + B55DCD3507B2EE7803D49228FAAE1CD4 + 5F6327673E3F87097792674AD378AD52 + 784BED503D8BE98732C93D0C6448153E + 441DFC5ACFC6E2A5D387326C0947B277 + 7D8AE06924BA20D160696C7942EA775F + 1BE948F15D64E20CEF56BA1D4FC1E33C + D353A47E6CD7E5E8DAF7C34F121B5A54 + BCE921727DC16636E0BAE377A3B0FFF3 + D808921287D885DF56415711F5C166C6 + 8EFD87CC8E01C471E19BAD9418044DEA + 85A8ECCDAF7995A8B3470BCBCB983335 + A206B4AD3900E7F4D1A7AE065E35CED4 + 4B8669EC184CBA3164600B930089C05B + 5457E90DF3AEE179FB36214B805FE973 + 3C210CF6BF3541A9831656764CCF885D + 1E68D5BD90F32098FF97E1AB9C744E84 + C2DD2AE55FD5B025F8A4EA3A898D13DE + CF54AA66A2FE8F6F1EC0B5C4C7F484A0 + B10B87316572C626AE542BEF6BF90AB8 + F740249AC41D3D238E39262123382497 + CB6EA11ADC74720822E6FA0A64E1272F + EC0A385E8F984992617EBA5211964CD2 + 2F6B7B01566FEDCD5FBB77E39EFA64EB + D4722CAAE200E4B0411054AB70B0C303 + 58256B9C5980899CACE4DC7159C528C5 + 4279C9D2D05C19941158717F0F559DEA + 9FED317D2BABDD67EF9EA8D9E88EE3D0 + 876F1C7DA0E2051355E5DB973CB7780D + 61846750E7CECDD77A085A538953FAAC + 74D13BBF3EC30B71F10CD6B5615D0A2C + 9110430CC674B97291BCAF26A62C88C9 + 4260C809B7FEE07923736187C9AE79B7 + CE700D43FA8690A81B9257BB4C0BD0DF + 6110DFC8EE70B8256F4B5E3A59611447 + D4499EA2E44574A5AE601F560DE9CCEC + D264068C557BF3BB2529E44B5CD0E453 + DC5EC7F4DDD9D77BCBFB2979B736DC57 + 3645C6AF7A2DF19E831BB51BE0E79FBC + 0FFEA9A4B315E9B31B73A6710745D103 + B51B6FCA8FEEC0A32E3B8A70CBB196BE + 029F09CC3AFC1AEFD9FC5917BA2838D0 + 144C55F46E9D68745B625164F4635B38 + 225D1B10ABE8FE9AD4494DB45467505B + FABB602DCFA18ECA8E2AD8FD2A65464C + EB90A2864C486A816F2284843A112286 + CFD1F3CC5727C73301F80802E6551933 + E1FBC01ECD62CF7C86996B784A5EEE67 + 85F858FDD58EB15C15E14772F5DD8ECC + 6C7D2982E1BCFBEFCD55C0D92BB51463 + 23C76CC570D86E45DF5CD5D0E317192C + CD4CAC80DC030122988117CD2ED3549D + 499C6E6FCE62FEDFBFE49220143CF552 + 2A4E7B2CB9DFD37BCC9FDB2B8E095FB6 + 4E733D1C077257B4DA3842DB2788848A + 151B1EA97C49FFAAB10DA9202217C797 + E609A02BFFF952BDD5C180D5C4DD2CB6 + C72981D14F849840AAB2C31102D3462E + 0B8BC1514BC8EADED66490D64E134B8A + EDC638D5D1F0EF4130D86FD36C718F9C + 0023C9576F10E0C4EBFB584BC22717BD + 01A0D0FF0E26E601C9B0F970A86CBC2A + 090B1C9981157AF4696758F4F39FAC15 + 172A197BA3A42B0FD4CC2CC39E9EAA2C + 56BB4DFAF273C27A852A5F37501150A1 + 057F5E8B86019FB80F6AAB6C464E402E + 57985A41D21A122421ED6B2A6726E491 + 7003E31B9341D6FA7A9620556AC85306 + 25BD0B96B9FD73AA02777C39601AB852 + C70D33646152C1E86BC0BB8550CB87CA + F82BF66280845DC03E439ED911D4C9E6 + 1D47FDC509CC6012F58CBB02FB3C1597 + 6299CB01EF53A3D0653565468584543E + 35995BC7F759B47F43AE185AFAD51652 + 615E9126937F439CD90911924BC01B0C + 999B44EE476358F96B295852D3121415 + 51EF47FAB0D3FF7DB2CD6D72F7240747 + 6B0AE53698B242EB3C6E643BA87DCEFD + 01308D3386921C873DC96C12D0C80F76 + BF80996B8779B8510190168D42CE1054 + 5FF796B62A8DCBAC70273C760FB159A0 + E2DFDF4B45C309185DEAEA3DBB05CEA0 + 232099316E5E397A762EB8B9ABC28E23 + 433A626CA7B1C7B6BC01AE38CFCECCFB + 6461F5720A098DDB0B2274E2F248EEEE + DBFC781397A0C69D96F10ACF3AB4F5D3 + FC47C1C19FB8CBC87D2D2C65F51FC0B1 + 32CB01AC3AF4BCA714C974314E4A8A4A + CC732C7316E22D4ACD189E1892A436CB + 668AFA91410C6BF6A9602A900390FECE + E445DD04AFF19161A70059117511BCB1 + 125B65A6DFCB7864AC715ACAEA8BD5DD + C0E1D0006BF8ECEB788D5D27B92B605B + 8489124E660E85539600413DF81D3BFB + B6DC713232690AAF81B17C6D66C427B9 + D5D5B715FF96EB5C3C76E3001C745146 + 3A060231C86DA5DD9FA2EBEAE84F3D86 + A900C20F9274E0FD115FCBE5DC0EFD08 + 00418CD7AC4CB116D272EECEFA030618 + 5B0293D24DD3877F68F85D299BD1AB72 + BCE6B0570138EFE5FF6B9234C86CFBD9 + A2FD7878DFE437D98CECF3B9172C4FFE + 596C25F05AB6F4BBB8C3C825C371BF33 + 088DE14E5C10FF9C821CA3B6C787D973 + 5CD68E79931886F23102744D9857D127 + 1E8D18E2366E3F8F2F40361F651A0617 + 3D9163E5D6158E7F4BF09A20179BE020 + DD73E4B85E9E94E50ED44E1ED67F40B5 + 4F5A9AE2E69A6209334BD8D719313300 + 16AE453F6FDA15E1EE365985A3B1A125 + 99FFB5D0CAC91ACE66C4BE604287632F + 1FBB7E6E956C2F293B72404553C2351C + F6BC37353F857F871443AFDA0A838241 + 0536B88F3D1500291202B201B543B3E3 + 70400A80C14CDF888E4F39A959B5A630 + C196E727E2C41BE6B11CD24514C3C975 + 0EB3C235F612FF548CA8D18F27104378 + F78B7323949B2AC903E43446BF7A0D96 + 7DF1914CCFB91A15DC70812FCF84E033 + B361317740C73D3F69F1C576A9128A09 + 8DEC3E68907858B696D3837F9F58603F + 49DCDDFC41096500551C97F6967B029E + + isa + PBXGroup + name + RxSwift + path + RxSwift + sourceTree + <group> + + D1EAA37957D3936571AB4D8A3776EFF7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + CompositeDisposable.swift + path + RxSwift/Disposables/CompositeDisposable.swift + sourceTree + <group> + + D264068C557BF3BB2529E44B5CD0E453 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Multicast.swift + path + RxSwift/Observables/Implementations/Multicast.swift + sourceTree + <group> + + D28A3B2C0ADF33FDB2FFF057778F6014 + + fileRef + 85F858FDD58EB15C15E14772F5DD8ECC + isa + PBXBuildFile + + D353A47E6CD7E5E8DAF7C34F121B5A54 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Debug.swift + path + RxSwift/Observables/Implementations/Debug.swift + sourceTree + <group> + + D3B55E2EEFA4624FFC141A44B919D657 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + CombineLatest.swift + path + RxSwift/Observables/Implementations/CombineLatest.swift + sourceTree + <group> + + D3BCDED234A97B48412522485B2B476E + + fileRef + 034EA0DF9142FCC79A3DA482659336CA + isa + PBXBuildFile + + D41D8CD98F00B204E9800998ECF8427E + + attributes + + LastSwiftUpdateCheck + 0700 + LastUpgradeCheck + 0700 + + buildConfigurationList + 2D8E8EC45A3A1A1D94AE762CB5028504 + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + 7DB346D0F39D3F0E887471402A8071AB + productRefGroup + E0601970BA36B69F4FB94D009DF3D2E2 + projectDirPath + + projectReferences + + projectRoot + + targets + + E583FF0415B7227CCA84A3B32C903A1F + 34164F5A92067F8A435D205F6A3EDD6C + 25F9F1D9857DDA8501939EF8F297A6C9 + 73218F2FA5E25FEBDC6511ADD2235F8D + + + D42819AC6D2B8C931BBD8D363CB7BD19 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxImagePickerDelegateProxy.swift + path + RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift + sourceTree + <group> + + D4499EA2E44574A5AE601F560DE9CCEC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Merge.swift + path + RxSwift/Observables/Implementations/Merge.swift + sourceTree + <group> + + D4722CAAE200E4B0411054AB70B0C303 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + HistoricalSchedulerTimeConverter.swift + path + RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift + sourceTree + <group> + + D4918FDB2355CAEDB8DAE07AB2E3C6F7 + + fileRef + F358A84E6D0DC41A3CA4819377685154 + isa + PBXBuildFile + + D501B740C6D22952BF68AA8D37085BEE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Catch.swift + path + RxSwift/Observables/Implementations/Catch.swift + sourceTree + <group> + + D5D5B715FF96EB5C3C76E3001C745146 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SubjectType.swift + path + RxSwift/Subjects/SubjectType.swift + sourceTree + <group> + + D652B7A2306FCC0DA29BEC25B07CEDA6 + + fileRef + C72981D14F849840AAB2C31102D3462E + isa + PBXBuildFile + + D7106586C1289824253F5739428FF83D + + fileRef + D501B740C6D22952BF68AA8D37085BEE + isa + PBXBuildFile + + D732C1A2A927D8908391B62A4F1E7688 + + fileRef + 2EA0E9C5462A28EB7B882E51C1C411DD + isa + PBXBuildFile + + D7BD0E4AC2980DC6DBABA7BFD154B9A3 + + fileRef + DDE22FAE3553669F602B2ECC317D74D3 + isa + PBXBuildFile + + D808921287D885DF56415711F5C166C6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + DelaySubscription.swift + path + RxSwift/Observables/Implementations/DelaySubscription.swift + sourceTree + <group> + + D84795872901D017DC0415AD7944DE46 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Constraint.swift + path + Source/Constraint.swift + sourceTree + <group> + + D879A8F052BEBEB92FB683A3A898A429 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIApplication+Rx.swift + path + RxCocoa/iOS/UIApplication+Rx.swift + sourceTree + <group> + + D8A1A9D8F7092A5C647F603957481974 + + fileRef + C196E727E2C41BE6B11CD24514C3C975 + isa + PBXBuildFile + + D8BAB36697C7A40E4B3DD3207DC59382 + + fileRef + 1D47FDC509CC6012F58CBB02FB3C1597 + isa + PBXBuildFile + + DA1B289F52BDC4A81842D047C91AC2E4 + + fileRef + B590B94974631BBB1F364E4287764689 + isa + PBXBuildFile + + DA312349A49333542E6F4B36B329960E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods.release.xcconfig + sourceTree + <group> + + DA42B0758849AF18BEC1FCEE93055B91 + + fileRef + 397ED6A120A7323FEFFD443352B8A3B8 + isa + PBXBuildFile + + DAE96B9DC7873FC574E7C64371F40283 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Bind.swift + path + RxCocoa/Common/Observable+Bind.swift + sourceTree + <group> + + DBC0E1A7127B866643D868B9823D8026 + + fileRef + 01A0D0FF0E26E601C9B0F970A86CBC2A + isa + PBXBuildFile + + DBFC781397A0C69D96F10ACF3AB4F5D3 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ShareReplay1WhileConnected.swift + path + RxSwift/Observables/Implementations/ShareReplay1WhileConnected.swift + sourceTree + <group> + + DC5EC7F4DDD9D77BCBFB2979B736DC57 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NAryDisposable.swift + path + RxSwift/Disposables/NAryDisposable.swift + sourceTree + <group> + + DD73E4B85E9E94E50ED44E1ED67F40B5 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + TakeWhile.swift + path + RxSwift/Observables/Implementations/TakeWhile.swift + sourceTree + <group> + + DDE22FAE3553669F602B2ECC317D74D3 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ControlProperty+Driver.swift + path + RxCocoa/Common/CocoaUnits/Driver/ControlProperty+Driver.swift + sourceTree + <group> + + DE00E23FD080426B3D64BF9671E9AC44 + + fileRef + 7A2190B63C68AD46C434D06BFDB30926 + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + DE447A348EE64C3999FA6FAF9A868F8C + + fileRef + F740249AC41D3D238E39262123382497 + isa + PBXBuildFile + + DF96D869AF266300F88E7443BF8D31AE + + fileRef + B361317740C73D3F69F1C576A9128A09 + isa + PBXBuildFile + + E0601970BA36B69F4FB94D009DF3D2E2 + + children + + B8AE099FDA15B3511041CF87AF79E813 + 72CB9501BD0BC598BA2108E6B4A4936E + 0D1D66E44C281FF65C1CC3E4B07911AD + 9F72194393E3FB94C46321C95CB0C0F5 + + isa + PBXGroup + name + Products + sourceTree + <group> + + E16103E2BF9840BFD685927C807EA582 + + fileRef + 528D3EA23ED9E6EF1D9C575E25A49FB6 + isa + PBXBuildFile + + E1FBC01ECD62CF7C86996B784A5EEE67 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Multiple.swift + path + RxSwift/Observables/Observable+Multiple.swift + sourceTree + <group> + + E20935A593E09F236FC35768050EA711 + + fileRef + CE700D43FA8690A81B9257BB4C0BD0DF + isa + PBXBuildFile + + E2DFDF4B45C309185DEAEA3DBB05CEA0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Sequence.swift + path + RxSwift/Observables/Implementations/Sequence.swift + sourceTree + <group> + + E3613934F16C6EECA78AC0671E73B7A1 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIStepper+Rx.swift + path + RxCocoa/iOS/UIStepper+Rx.swift + sourceTree + <group> + + E3B6B8B8AA8121DF3428F342D46A4D3B + + fileRef + C0E1D0006BF8ECEB788D5D27B92B605B + isa + PBXBuildFile + + E445DD04AFF19161A70059117511BCB1 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SkipUntil.swift + path + RxSwift/Observables/Implementations/SkipUntil.swift + sourceTree + <group> + + E46B8D9D10C48D48B948C65D020C62EA + + fileRef + F358A84E6D0DC41A3CA4819377685154 + isa + PBXBuildFile + + E583FF0415B7227CCA84A3B32C903A1F + + buildConfigurationList + 280E9DFDA1908748134CAFB9A82E1741 + buildPhases + + CB9ABB929E0277887549C309CB6BAD3A + CA75218C95FD58E4235481BC1E18FD45 + 56AAC762383C0CEE3853FE2668E70B61 + + buildRules + + dependencies + + 7F36F6B574F4DF1D5287AA32672E2DA9 + 60D027A224FDBB3AC9682CC25631D1DB + 5CAB22A43CE32A3CE5D2676AA84E0D33 + + isa + PBXNativeTarget + name + Pods + productName + Pods + productReference + B8AE099FDA15B3511041CF87AF79E813 + productType + com.apple.product-type.framework + + E5AF3CEAB96D9E182A80F7B8F4BA9B8C + + isa + PBXTargetDependency + name + RxSwift + target + 25F9F1D9857DDA8501939EF8F297A6C9 + targetProxy + F99D8B247A002E35248DD379DBACBAD2 + + E5B22FE3B83FEDAFB8CAFD8E723AC7BA + + children + + 6008EE3EABD4DB4463FD26374855C356 + 7C2660C36388E791B5934A4D4D3E2C67 + 8A2DD9DA4E4315F65C3A6E66C44DF165 + 29E5241C08609363E6F1AAC9C5F42CEC + F4F18C2A25FF75A2F3D8E20F29F7E8CD + FD3FDB08AE00A509EA108C19E5DA3556 + + isa + PBXGroup + name + Support Files + path + ../Target Support Files/RxCocoa + sourceTree + <group> + + E609A02BFFF952BDD5C180D5C4DD2CB6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ObserverType.swift + path + RxSwift/ObserverType.swift + sourceTree + <group> + + E64C9D8DEC29C225490E35958BDF9A30 + + fileRef + 23C76CC570D86E45DF5CD5D0E317192C + isa + PBXBuildFile + + E6695FFBDFD7B74A5B6792093C1534DA + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Driver+Subscription.swift + path + RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift + sourceTree + <group> + + E6A2C2F8D5B2D9682595721EFB16F878 + + buildActionMask + 2147483647 + files + + E46B8D9D10C48D48B948C65D020C62EA + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + E6A804B228A5A40DE159E0F6D5AE904A + + fileRef + FC47C1C19FB8CBC87D2D2C65F51FC0B1 + isa + PBXBuildFile + + E6B987A05470AF5BDE82773E37DE7C7A + + fileRef + F6B70D809894D72C378E8A936DF1574E + isa + PBXBuildFile + + E6DE8641466E02841AEEBD78475EC209 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConstraintRelation.swift + path + Source/ConstraintRelation.swift + sourceTree + <group> + + E6E23E7CFDD8698759AEC20FBAEB9BD9 + + fileRef + E609A02BFFF952BDD5C180D5C4DD2CB6 + isa + PBXBuildFile + + E7367FA065AC51AB9F2C507DDCDF12BF + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIGestureRecognizer+Rx.swift + path + RxCocoa/iOS/UIGestureRecognizer+Rx.swift + sourceTree + <group> + + E7F21354943D9F42A70697D5A5EF72E9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-frameworks.sh + sourceTree + <group> + + E8446514FBAD26C0E18F24A5715AEF67 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Info.plist + sourceTree + <group> + + E8CB4E60187ECDDE3B5987C6E7A6AF10 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxCollectionViewReactiveArrayDataSource.swift + path + RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift + sourceTree + <group> + + E91F950DD3D257CF82FC24ABEC76D904 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + MessageSentObserver.swift + path + RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift + sourceTree + <group> + + E97A4EF64A15485B2E669F47D9AA38A3 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIProgressView+Rx.swift + path + RxCocoa/iOS/UIProgressView+Rx.swift + sourceTree + <group> + + E9B8F833D852833496378181C48CFC1C + + fileRef + D4499EA2E44574A5AE601F560DE9CCEC + isa + PBXBuildFile + + EB20D0D091DF7A77CED3ED8FC7C03732 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxTableViewDataSourceProxy.swift + path + RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift + sourceTree + <group> + + EB90A2864C486A816F2284843A112286 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Debug.swift + path + RxSwift/Observables/Observable+Debug.swift + sourceTree + <group> + + EBBE1DF3B018B3CC653E6E897B43A82B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + BinaryDisposable.swift + path + RxSwift/Disposables/BinaryDisposable.swift + sourceTree + <group> + + EC0A385E8F984992617EBA5211964CD2 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Generate.swift + path + RxSwift/Observables/Implementations/Generate.swift + sourceTree + <group> + + EC7E3EC98725BAF4C38077B86DAB4B36 + + fileRef + B76BF8B9E71435300B76C4532EC12C49 + isa + PBXBuildFile + + ED5E3A9552871B077DB20F398E32FB98 + + fileRef + 5FF796B62A8DCBAC70273C760FB159A0 + isa + PBXBuildFile + + EDC638D5D1F0EF4130D86FD36C718F9C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Platform.Linux.swift + path + RxSwift/Platform/Platform.Linux.swift + sourceTree + <group> + + EE223FA8862F01F60FC69E89064647A8 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxSearchBarDelegateProxy.swift + path + RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift + sourceTree + <group> + + EEFA6230C6260BD3AFEC74516A483F89 + + fileRef + 1E8D18E2366E3F8F2F40361F651A0617 + isa + PBXBuildFile + + EF339BD67C3BFF8D67A8C136007EB45A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + name + _RXDelegateProxy.m + path + RxCocoa/Common/_RXDelegateProxy.m + sourceTree + <group> + + EF53C92A3153BC34FF83DF0A37B958D2 + + fileRef + 4580DA105CA940BC89AB669CD5AD4F28 + isa + PBXBuildFile + settings + + ATTRIBUTES + + Public + + + + EFA2484FD26FAEF1C6911F811A4CE9E6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AnonymousObservable.swift + path + RxSwift/Observables/Implementations/AnonymousObservable.swift + sourceTree + <group> + + EFE67D1CBFBF76AFC315D8FE0B22E360 + + baseConfigurationReference + 8A2DD9DA4E4315F65C3A6E66C44DF165 + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_PREFIX_HEADER + Target Support Files/RxCocoa/RxCocoa-prefix.pch + INFOPLIST_FILE + Target Support Files/RxCocoa/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MODULEMAP_FILE + Target Support Files/RxCocoa/RxCocoa.modulemap + MTL_ENABLE_DEBUG_INFO + NO + PRODUCT_NAME + RxCocoa + SDKROOT + iphoneos + SKIP_INSTALL + YES + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Release + + F0CC3FE5C12A74238662EBB6B5C802FA + + fileRef + 34FB3798707BF7068EF1896AAA2732FE + isa + PBXBuildFile + + F1A59B8933773EE750FDDB3BCC507820 + + fileRef + BF80996B8779B8510190168D42CE1054 + isa + PBXBuildFile + + F1DBD6FA0D53809443274DEEBEC2B4CA + + fileRef + 668AFA91410C6BF6A9602A900390FECE + isa + PBXBuildFile + + F1DE74F7C05BDBF8BA973F6ABF9EE5B4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UIActivityIndicatorView+Rx.swift + path + RxCocoa/iOS/UIActivityIndicatorView+Rx.swift + sourceTree + <group> + + F211999F66420F30DB9F89779EED62A2 + + fileRef + F6BC37353F857F871443AFDA0A838241 + isa + PBXBuildFile + + F2837B9A8EAEF829432B670CC750D605 + + buildActionMask + 2147483647 + files + + 34EC4ACE1D4AB848467C0002EAD0157E + 314DCDB0850EF3AF6348A7CD6F60E999 + EC7E3EC98725BAF4C38077B86DAB4B36 + 9C6B0D8C4BED402F7D13CA1987D63529 + C6EE26222139A6A47DA828E6117B6AD2 + 4FD55E5CBDCEE29F4EFED21A113DB62C + 6161F9D66427B47C103CB7958C327C96 + 183261C7A2F61BC0FA4D44B4CB401367 + 3DFAE9AFE40544527F02C69CECAB76BD + 58D99810C20AD99B0D0C26CE4D1ED274 + 4D4421759A9859E8F9E470F42E40C189 + BBDE9C4CC210F52F45F6DBD56AAB108D + 8ADBD98751DA7F0BA48597A9A76737E7 + B5B7BD570020FAD3B34492D16B5306E0 + D7106586C1289824253F5739428FF83D + A064FC333E23C370AD63449951FE2B80 + 5895AEC29F6C03C328531A8C4C57C566 + C753699E995684D0B5BF366F20706CD8 + 1421B62B13D51AACF3F94B4B2B50B663 + 724A545F0915A11FEEF0407FBC21FB8A + 92E06DCD86280F9354E6187B22FB8330 + C0B59CCA57CADF1338B1E8036D331A7E + CC0C1AB471FD0B8B224233A706874D5D + 028FE2DBB63201A19CC6DDB63AC61C78 + 59333D422C627D0EE22AA612F83CBAE2 + 267653F95D77385C430885AD58D0C383 + 91DAF59DD37D86F8E88C94C763862AA6 + C9B09E865987D1A599387D7281F5BBCE + 002F7871983CFEDD6FE35E0EC78DB800 + F787F8BFEF7A906479C13B8659FE9D83 + 29B33C639137C1D34787FF28DFAE3B20 + 1118A9ACF1A71293D7A77F2E47562D79 + 52BAFA642B1D92094D22C535702468CC + 97D2C9BEFF7997DB75C9AB101A4DFCB4 + AA7754534C21AC0934FD7D63FF5E4495 + 2AAD4AA94984312A2C005BD623D029E7 + 746FAD3CEA8749116EB3CE9CD031BF21 + C1949AC017DB4AC50F1D545E9DD268EC + DE447A348EE64C3999FA6FAF9A868F8C + 7515A28049150E8259C134CD10388388 + 620F377CE2D618C40CD050AF801780CC + 033BF0AF9B2A00CA4ACB4D6853F1CE91 + 1F7BB96673200695A2A0B90770469BAA + 1E3BE982D2E06E17011C1DCBE2693EB8 + 23C79AB6DC5168096DE2982B2BD64033 + AF38DD7C4458C6BB575583761DFDAC03 + 89497B3C3E51981AE2544A152C254D19 + C0E0D21C794E89280FDB29F0E10A16A7 + FAFAD729A664FAFE36BD9871A35A0A38 + F2EB389DC48B617C544ED3E13F03B694 + 22A9DAE56DE0B4FB45E9CA48BD0502EC + E20935A593E09F236FC35768050EA711 + A08FB0F0C4E7E1B4EC6A2622219C1796 + E9B8F833D852833496378181C48CFC1C + 9838570345B9495C4D2CA80BC4975979 + 6441D87D93F2BE9837122300A742794E + 0BC821B138F259BDEF47EB0EC1DA0393 + 85A40BB90176D634B0B56B08CDD1AB71 + 0FA6D7F0F7DB305EDE91525657B7459A + 46F5509E31129BA86AC096A83C540BF8 + 1C6258EFD35B3F8138DFF9B89D81A245 + 972E047591F1CB4F35B7A9C85C4D953C + 2E44A654DD376DFBD71824196F86F7F1 + BBDC4A9920191C47CFA496A6DA3C1330 + 9173B28DEB22F2AF47173D9869C0DC50 + D28A3B2C0ADF33FDB2FFF057778F6014 + F4751861DB3F99F5B4DDDEE49121A803 + E64C9D8DEC29C225490E35958BDF9A30 + 278B26B7DAB8B0C975F06B67844467EF + 9BC71B557027D185F0520BD31AB6D3D7 + 2F3061C7229DF25C7C1FD989C98101C2 + 6B4B6716ABC06F2E61A9984A6A546096 + 56E21B787EF70CB34538D221CA0F06C5 + 6A27CE966E0944B616D405F81E8DDB98 + E6E23E7CFDD8698759AEC20FBAEB9BD9 + D652B7A2306FCC0DA29BEC25B07CEDA6 + 1743ACDA42299F910916959336409434 + 36DF3A9B762C81BCCFA014E2139A9A31 + 7B006AB09A3CFFA078739702CA64BC04 + DBC0E1A7127B866643D868B9823D8026 + 316D33A0E415DD4627E335AE62BB4EBB + 75218E5E79DD02BADE06373379EB99D5 + 644DF9B9119C15D380A50455A13FCD27 + B703901D5ED3A58CB1663315023A9111 + 4F147DC0445B81434F4A9DC470107C7B + 290A3018DB69C5AB9C319DC4F5080507 + 928F478E6A46C4E67CBC7C8684E000CF + 07B3B54C63761FE4D033626CDFE607FC + 1E374FC0B87F0F3A5A22AEC27DA905F5 + D8BAB36697C7A40E4B3DD3207DC59382 + CCFA2D47D5AACEE84E6C3699ABD87C8D + BAFE55ACB04182DD671B80F722415B2B + AE1465B27A47C3FF79B2908B3B9AC6E7 + FA13A740F3BECACF3991E6718246FBB4 + 551092297F3E790EE61EADFDFA7F8EE9 + B4EFA4EDF3B5EE644188E2E42FCF2330 + 01466519C7C2BC355C938B4694D5579D + 587194D5EA3ABD10D0ABA4EE7C9F425E + F1A59B8933773EE750FDDB3BCC507820 + ED5E3A9552871B077DB20F398E32FB98 + 381FF96B891F70E71F6B3E82AE34A8EE + 2536B3EAF58421C002D79C4699185445 + 8B2D5B0B49F5F75D4EBBA6B07BDF9AB9 + C9F0DF1810EE9332C04BD3FCE1FD0028 + 6D86A21B88DD9B5B309E5F12DE9AC154 + E6A804B228A5A40DE159E0F6D5AE904A + 8763124815289BB7284CF3A868839A86 + 994646826A17BC3C12BA719D59D863D9 + F1DBD6FA0D53809443274DEEBEC2B4CA + 19FDB2D893DFACDE96465C14639A2E70 + F99EA48693FDD96244E119A1F896BBC4 + E3B6B8B8AA8121DF3428F342D46A4D3B + 52B72671CE1FBBE0B5F35769E5333E88 + 8975248C641D67DC62B446E5F9DAA341 + 26ABF4A217D670548D97D184175EE76B + 0F25B77F6C2E840E73EBDF1FA82C04FB + C663D2F8A14F92218FEC6B10819C2DB6 + 1CDEFC3678FE3B3F2D7413ACA9D11962 + 2E6D95BA9B545E171178308F97876E17 + 2C15FF1C605FDB57A8A2C72FE84ACF15 + 95219771FD32FA71AEB8C3FD90017E80 + 24D88C6930116D13ACCDE2C1FAB37979 + FE632AA3A9BBB3FFC9FAED8980458CB4 + 7C0BF13D1590FE5E628B5F78BC68EDB0 + EEFA6230C6260BD3AFEC74516A483F89 + CC6A26CD98172EC53F9F75DB7ACB5CF1 + 7D4015D30A583B6FD780A7BFF7DD7214 + 3092DCE78346B190383777BF8DEA8ED4 + 61BD6D1A4BA245EDD1621CEB0E302CA2 + A0BF71A4044B9813E59254A740137A94 + 7D05D320257100F18F660FB65425881A + F211999F66420F30DB9F89779EED62A2 + 3A945514ADB5DB2FB0AACD518873FA43 + 27145393C5A6574A4E14AE19282FD975 + D8A1A9D8F7092A5C647F603957481974 + FAF6D2741F9918621D63A3E9409A21A0 + B6FF1149D7AA0D517AA59646AEE71A79 + DF96D869AF266300F88E7443BF8D31AE + 1D8CB0E97E751F57688918CB1F2EE415 + BB485A23AEAE115E9C9A070F697AA07A + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + F2C930ADE0DE954DBD7CDD1D92D02451 + + fileRef + 1ECBF5CAC16F304DA6AE6348B18F850B + isa + PBXBuildFile + + F2EB389DC48B617C544ED3E13F03B694 + + fileRef + 9110430CC674B97291BCAF26A62C88C9 + isa + PBXBuildFile + + F30B3079A2DD1841077A3E16D6C2954A + + fileRef + E7367FA065AC51AB9F2C507DDCDF12BF + isa + PBXBuildFile + + F358A84E6D0DC41A3CA4819377685154 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/Foundation.framework + sourceTree + DEVELOPER_DIR + + F3B230EBF1F2C7A861A092F9E614C8AC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ConstraintDescription.swift + path + Source/ConstraintDescription.swift + sourceTree + <group> + + F4751861DB3F99F5B4DDDEE49121A803 + + fileRef + 6C7D2982E1BCFBEFCD55C0D92BB51463 + isa + PBXBuildFile + + F4B1B04AFAE81AC3F2E5D96BBEE9C177 + + fileRef + 13452471F0BD4D22B6C338882D3DE71A + isa + PBXBuildFile + + F4F18C2A25FF75A2F3D8E20F29F7E8CD + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + RxCocoa-prefix.pch + sourceTree + <group> + + F510BBE322B14D44AC9C1F59A43830A8 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + NSLayoutConstraint+Rx.swift + path + RxCocoa/Common/NSLayoutConstraint+Rx.swift + sourceTree + <group> + + F543860A7601469F48CC82CAAC47784D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxTableViewDataSourceType.swift + path + RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift + sourceTree + <group> + + F591200744D88BFFE606274DCA0176B0 + + baseConfigurationReference + 8A2DD9DA4E4315F65C3A6E66C44DF165 + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_PREFIX_HEADER + Target Support Files/RxCocoa/RxCocoa-prefix.pch + INFOPLIST_FILE + Target Support Files/RxCocoa/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MODULEMAP_FILE + Target Support Files/RxCocoa/RxCocoa.modulemap + MTL_ENABLE_DEBUG_INFO + YES + PRODUCT_NAME + RxCocoa + SDKROOT + iphoneos + SKIP_INSTALL + YES + SWIFT_OPTIMIZATION_LEVEL + -Onone + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Debug + + F6B70D809894D72C378E8A936DF1574E + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxTextViewDelegateProxy.swift + path + RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift + sourceTree + <group> + + F6BC37353F857F871443AFDA0A838241 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Using.swift + path + RxSwift/Observables/Implementations/Using.swift + sourceTree + <group> + + F740249AC41D3D238E39262123382497 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Event.swift + path + RxSwift/Event.swift + sourceTree + <group> + + F787F8BFEF7A906479C13B8659FE9D83 + + fileRef + 85A8ECCDAF7995A8B3470BCBCB983335 + isa + PBXBuildFile + + F78B7323949B2AC903E43446BF7A0D96 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + WithLatestFrom.swift + path + RxSwift/Observables/Implementations/WithLatestFrom.swift + sourceTree + <group> + + F82BF66280845DC03E439ED911D4C9E6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ReplaySubject.swift + path + RxSwift/Subjects/ReplaySubject.swift + sourceTree + <group> + + F923CF20AEFAD5202875DDD7C0202354 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + ViewController+SnapKit.swift + path + Source/ViewController+SnapKit.swift + sourceTree + <group> + + F99D8B247A002E35248DD379DBACBAD2 + + containerPortal + D41D8CD98F00B204E9800998ECF8427E + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 25F9F1D9857DDA8501939EF8F297A6C9 + remoteInfo + RxSwift + + F99EA48693FDD96244E119A1F896BBC4 + + fileRef + 125B65A6DFCB7864AC715ACAEA8BD5DD + isa + PBXBuildFile + + FA13A740F3BECACF3991E6718246FBB4 + + fileRef + 615E9126937F439CD90911924BC01B0C + isa + PBXBuildFile + + FABB602DCFA18ECA8E2AD8FD2A65464C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + Observable+Creation.swift + path + RxSwift/Observables/Observable+Creation.swift + sourceTree + <group> + + FAF6D2741F9918621D63A3E9409A21A0 + + fileRef + 0EB3C235F612FF548CA8D18F27104378 + isa + PBXBuildFile + + FAFAD729A664FAFE36BD9871A35A0A38 + + fileRef + 74D13BBF3EC30B71F10CD6B5615D0A2C + isa + PBXBuildFile + + FB01AF1B542DAE00930A42B4265B1C32 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + RxSwift-prefix.pch + sourceTree + <group> + + FB45FFD90572718D82AB9092B750F0CA + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + CLANG_WARN_UNREACHABLE_CODE + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + COPY_PHASE_STRIP + YES + ENABLE_NS_ASSERTIONS + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PREPROCESSOR_DEFINITIONS + + RELEASE=1 + + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + STRIP_INSTALLED_PRODUCT + NO + SYMROOT + ${SRCROOT}/../build + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + FB96FC2908D003D1B760BF869EE15F7D + + fileRef + B8E3470124B5487055D30A4C0984C209 + isa + PBXBuildFile + + FBC8B9C8AABDDD285AD350C35687ABD4 + + fileRef + 37A4DFED0A41C03849803CFACEF319EE + isa + PBXBuildFile + + FBF63D2E50154DDEBC0DAA9B167838B7 + + fileRef + FF63F315CCBF6EC394C4641D831497CE + isa + PBXBuildFile + + FC47C1C19FB8CBC87D2D2C65F51FC0B1 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + SingleAssignmentDisposable.swift + path + RxSwift/Disposables/SingleAssignmentDisposable.swift + sourceTree + <group> + + FD3FDB08AE00A509EA108C19E5DA3556 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + RxCocoa-umbrella.h + sourceTree + <group> + + FDA882FC01CB4EDCAF66D964E9D7FA20 + + baseConfigurationReference + DA312349A49333542E6F4B36B329960E + buildSettings + + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + CURRENT_PROJECT_VERSION + 1 + DEFINES_MODULE + YES + DYLIB_COMPATIBILITY_VERSION + 1 + DYLIB_CURRENT_VERSION + 1 + DYLIB_INSTALL_NAME_BASE + @rpath + ENABLE_STRICT_OBJC_MSGSEND + YES + INFOPLIST_FILE + Target Support Files/Pods/Info.plist + INSTALL_PATH + $(LOCAL_LIBRARY_DIR)/Frameworks + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + LD_RUNPATH_SEARCH_PATHS + + $(inherited) + @executable_path/Frameworks + @loader_path/Frameworks + + MACH_O_TYPE + staticlib + MODULEMAP_FILE + Target Support Files/Pods/Pods.modulemap + MTL_ENABLE_DEBUG_INFO + NO + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PODS_ROOT + $(SRCROOT) + PRODUCT_NAME + Pods + SDKROOT + iphoneos + SKIP_INSTALL + YES + TARGETED_DEVICE_FAMILY + 1,2 + VERSIONING_SYSTEM + apple-generic + VERSION_INFO_PREFIX + + + isa + XCBuildConfiguration + name + Release + + FDEB042BC99357B7D2809594005D5F8B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + UITextView+Rx.swift + path + RxCocoa/iOS/UITextView+Rx.swift + sourceTree + <group> + + FE632AA3A9BBB3FFC9FAED8980458CB4 + + fileRef + 088DE14E5C10FF9C821CA3B6C787D973 + isa + PBXBuildFile + + FEF7A1F40355BD9CF8794C28B7DD51B0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + name + _RXObjCRuntime.m + path + RxCocoa/Common/_RXObjCRuntime.m + sourceTree + <group> + + FF63F315CCBF6EC394C4641D831497CE + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + KVORepresentable.swift + path + RxCocoa/Common/KVORepresentable.swift + sourceTree + <group> + + FFA0699393CDD4772FEE63E9556F679F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + RxTableViewReactiveArrayDataSource.swift + path + RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift + sourceTree + <group> + + + rootObject + D41D8CD98F00B204E9800998ECF8427E + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/Pods.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/Pods.xcscheme new file mode 100644 index 0000000..d84dc45 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/Pods.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxCocoa.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxCocoa.xcscheme new file mode 100644 index 0000000..4ba27e3 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxCocoa.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxSwift.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxSwift.xcscheme new file mode 100644 index 0000000..53630bd --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/RxSwift.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/SnapKit.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/SnapKit.xcscheme new file mode 100644 index 0000000..232d092 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/SnapKit.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/xcschememanagement.plist b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..fe2cfaf --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/liurong.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,52 @@ + + + + + SchemeUserState + + Pods.xcscheme + + isShown + + + RxCocoa.xcscheme + + isShown + + + RxSwift.xcscheme + + isShown + + + SnapKit.xcscheme + + isShown + + + + SuppressBuildableAutocreation + + 25F9F1D9857DDA8501939EF8F297A6C9 + + primary + + + 34164F5A92067F8A435D205F6A3EDD6C + + primary + + + 73218F2FA5E25FEBDC6511ADD2235F8D + + primary + + + E583FF0415B7227CCA84A3B32C903A1F + + primary + + + + + diff --git a/Pods/RxCocoa/LICENSE.md b/Pods/RxCocoa/LICENSE.md new file mode 100644 index 0000000..d6765d9 --- /dev/null +++ b/Pods/RxCocoa/LICENSE.md @@ -0,0 +1,9 @@ +**The MIT License** +**Copyright © 2015 Krunoslav Zaher** +**All rights reserved.** + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Pods/RxCocoa/README.md b/Pods/RxCocoa/README.md new file mode 100644 index 0000000..b5d5519 --- /dev/null +++ b/Pods/RxCocoa/README.md @@ -0,0 +1,77 @@ +Miss Electric Eel 2016 RxSwift: ReactiveX for Swift +====================================== + +[![Travis CI](https://travis-ci.org/ReactiveX/RxSwift.svg?branch=master)](https://travis-ci.org/ReactiveX/RxSwift) ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20OSX%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux%28experimental%29-333333.svg) ![pod](https://img.shields.io/cocoapods/v/RxSwift.svg) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) + + +Xcode 7.3 Swift 2.2 required + +## About Rx + +Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable` interface. + +This is a Swift version of [Rx](https://github.com/Reactive-Extensions/Rx.NET). + +It tries to port as many concepts from the original version as possible, but some concepts were adapted for more pleasant and performant integration with iOS/OSX environment. + +Cross platform documentation can be found on [ReactiveX.io](http://reactivex.io/). + +Like the original Rx, its intention is to enable easy composition of asynchronous operations and event/data streams. + +KVO observing, async operations and streams are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful. + +## I came here because I want to ... + +###### ... understand + +* [why use rx?](Documentation/Why.md) +* [the basics, getting started with RxSwift](Documentation/GettingStarted.md) +* [units](Documentation/Units.md) - what is `Driver`, `ControlProperty`, and `Variable` ... and why do they exist? +* [testing](Documentation/UnitTests.md) +* [tips and common errors](Documentation/Tips.md) +* [debugging](Documentation/GettingStarted.md#debugging) +* [the math behind Rx](Documentation/MathBehindRx.md) +* [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) + +###### ... hack around + +* with example app. [Running Example App](Documentation/ExampleApp.md) +* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md) + +###### ... interact + +* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences.
[![Slack channel](http://slack.rxswift.org/badge.svg)](http://slack.rxswift.org) [Join Slack Channel](http://slack.rxswift.org/) +* Report a problem using the library. [Open an Issue With Bug Template](Documentation/IssueTemplate.md) +* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md) + + +###### ... compare + +* [with other libraries](Documentation/ComparisonWithOtherLibraries.md). + + +###### ... find compatible + +* libraries from [RxSwiftCommunity](https://github.com/RxSwiftCommunity). +* [Pods using RxSwift](https://cocoapods.org/?q=uses%3Arxswift). + +###### ... see the broader vision + +* Does this exist for Android? [RxJava](https://github.com/ReactiveX/RxJava) +* Where is all of this going, what is the future, what about reactive architectures, how do you design entire apps this way? [Cycle.js](https://github.com/cyclejs/cycle-core) - this is javascript, but [RxJS](https://github.com/Reactive-Extensions/RxJS) is javascript version of Rx. + +##### References + +* [http://reactivex.io/](http://reactivex.io/) +* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions) +* [Erik Meijer (Wikipedia)](http://en.wikipedia.org/wiki/Erik_Meijer_%28computer_scientist%29) +* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY) +* [Reactive Programming Overview (Jafar Husain from Netflix)](https://www.youtube.com/watch?v=dwP1TNXE6fc) +* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf) +* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/) +* [Haskell](https://www.haskell.org/) diff --git a/Pods/RxCocoa/RxCocoa/Common/CLLocationManager+Rx.swift b/Pods/RxCocoa/RxCocoa/Common/CLLocationManager+Rx.swift new file mode 100644 index 0000000..18318c7 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CLLocationManager+Rx.swift @@ -0,0 +1,218 @@ +// +// CLLocationManager+Rx.swift +// RxCocoa +// +// Created by Carlos García on 8/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import CoreLocation +#if !RX_NO_MODULE +import RxSwift +#endif + + +extension CLLocationManager { + + /** + Reactive wrapper for `delegate`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_delegate: DelegateProxy { + return proxyForObject(RxCLLocationManagerDelegateProxy.self, self) + } + + // MARK: Responding to Location Events + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didUpdateLocations: Observable<[CLLocation]> { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didUpdateLocations:))) + .map { a in + return try castOrThrow([CLLocation].self, a[1]) + } + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didFailWithError: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didFailWithError:))) + .map { a in + return try castOrThrow(NSError.self, a[1]) + } + } + + #if os(iOS) || os(OSX) + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didFinishDeferredUpdatesWithError: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didFinishDeferredUpdatesWithError:))) + .map { a in + return try castOptionalOrThrow(NSError.self, a[1]) + } + } + #endif + + #if os(iOS) + + // MARK: Pausing Location Updates + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didPauseLocationUpdates: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManagerDidPauseLocationUpdates(_:))) + .map { _ in + return () + } + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didResumeLocationUpdates: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManagerDidResumeLocationUpdates(_:))) + .map { _ in + return () + } + } + + // MARK: Responding to Heading Events + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didUpdateHeading: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didUpdateHeading:))) + .map { a in + return try castOrThrow(CLHeading.self, a[1]) + } + } + + // MARK: Responding to Region Events + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didEnterRegion: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didEnterRegion:))) + .map { a in + return try castOrThrow(CLRegion.self, a[1]) + } + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didExitRegion: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didExitRegion:))) + .map { a in + return try castOrThrow(CLRegion.self, a[1]) + } + } + + #endif + + #if os(iOS) || os(OSX) + + /** + 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:))) + .map { a in + let stateNumber = try castOrThrow(NSNumber.self, a[1]) + let state = CLRegionState(rawValue: stateNumber.integerValue) ?? CLRegionState.Unknown + let region = try castOrThrow(CLRegion.self, a[2]) + return (state: state, region: region) + } + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_monitoringDidFailForRegionWithError: Observable<(region: CLRegion?, error: NSError)> { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:monitoringDidFailForRegion:withError:))) + .map { a in + let region = try castOptionalOrThrow(CLRegion.self, a[1]) + let error = try castOrThrow(NSError.self, a[2]) + return (region: region, error: error) + } + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didStartMonitoringForRegion: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didStartMonitoringForRegion:))) + .map { a in + return try castOrThrow(CLRegion.self, a[1]) + } + } + + #endif + + #if os(iOS) + + // MARK: Responding to Ranging Events + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didRangeBeaconsInRegion: Observable<(beacons: [CLBeacon], region: CLBeaconRegion)> { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didRangeBeacons:inRegion:))) + .map { a in + let beacons = try castOrThrow([CLBeacon].self, a[1]) + let region = try castOrThrow(CLBeaconRegion.self, a[2]) + return (beacons: beacons, region: region) + } + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion, error: NSError)> { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:rangingBeaconsDidFailForRegion:withError:))) + .map { a in + let region = try castOrThrow(CLBeaconRegion.self, a[1]) + let error = try castOrThrow(NSError.self, a[2]) + return (region: region, error: error) + } + } + + // MARK: Responding to Visit Events + + /** + Reactive wrapper for `delegate` message. + */ + @available(iOS 8.0, *) + public var rx_didVisit: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didVisit:))) + .map { a in + return try castOrThrow(CLVisit.self, a[1]) + } + } + + #endif + + // MARK: Responding to Authorization Changes + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didChangeAuthorizationStatus: Observable { + return rx_delegate.observe(#selector(CLLocationManagerDelegate.locationManager(_:didChangeAuthorizationStatus:))) + .map { a in + let number = try castOrThrow(NSNumber.self, a[1]) + return CLAuthorizationStatus(rawValue: Int32(number.integerValue)) ?? .NotDetermined + } + } + + + +} diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlEvent.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlEvent.swift new file mode 100644 index 0000000..8157389 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlEvent.swift @@ -0,0 +1,86 @@ +// +// ControlEvent.swift +// Rx +// +// Created by Krunoslav Zaher on 8/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +/** +Protocol that enables extension of `ControlEvent`. +*/ +public protocol ControlEventType : ObservableType { + + /** + - returns: `ControlEvent` interface + */ + func asControlEvent() -> ControlEvent +} + +/** + Unit for `Observable`/`ObservableType` that represents event on UI element. + + It's properties are: + + - it never fails + - it won't send any initial value on subscription + - it will `Complete` sequence on control being deallocated + - it never errors out + - it delivers events on `MainScheduler.instance` + + **The implementation of `ControlEvent` will ensure that sequence of events is being subscribed on main scheduler + (`subscribeOn(ConcurrentMainScheduler.instance)` behavior).** + + **It is implementor's responsibility to make sure that that all other properties enumerated above are satisfied.** + + **If they aren't, then using this unit communicates wrong properties and could potentially break someone's code.** + + **In case `events` observable sequence that is being passed into initializer doesn't satisfy all enumerated + properties, please don't use this unit.** +*/ +public struct ControlEvent : ControlEventType { + public typealias E = PropertyType + + let _events: Observable + + /** + Initializes control event with a observable sequence that represents events. + + - parameter events: Observable sequence that represents events. + - returns: Control event created with a observable sequence of events. + */ + public init(events: Ev) { + _events = events.subscribeOn(ConcurrentMainScheduler.instance) + } + + /** + Subscribes an observer to control events. + + - 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(observer: O) -> Disposable { + return _events.subscribe(observer) + } + + /** + - returns: `Observable` interface. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asObservable() -> Observable { + return _events + } + + /** + - returns: `ControlEvent` interface. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asControlEvent() -> ControlEvent { + return self + } +} diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlProperty.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlProperty.swift new file mode 100644 index 0000000..a432f0e --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/ControlProperty.swift @@ -0,0 +1,110 @@ +// +// ControlProperty.swift +// Rx +// +// Created by Krunoslav Zaher on 8/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +/** +Protocol that enables extension of `ControlProperty`. +*/ +public protocol ControlPropertyType : ObservableType, ObserverType { + + /** + - returns: `ControlProperty` interface + */ + func asControlProperty() -> ControlProperty +} + +/** + Unit for `Observable`/`ObservableType` that represents property of UI element. + + It's properties are: + + - it never fails + - `shareReplay(1)` behavior + - it's stateful, upon subscription (calling subscribe) last element is immediately replayed if it was produced + - it will `Complete` sequence on control being deallocated + - it never errors out + - it delivers events on `MainScheduler.instance` + + **The implementation of `ControlProperty` will ensure that sequence of values is being subscribed on main scheduler + (`subscribeOn(ConcurrentMainScheduler.instance)` behavior).** + + **It is implementor's responsibility to make sure that that all other properties enumerated above are satisfied.** + + **If they aren't, then using this unit communicates wrong properties and could potentially break someone's code.** + + **In case `values` observable sequence that is being passed into initializer doesn't satisfy all enumerated + properties, please don't use this unit.** +*/ +public struct ControlProperty : ControlPropertyType { + public typealias E = PropertyType + + let _values: Observable + let _valueSink: AnyObserver + + /** + Initializes control property with a observable sequence that represents property values and observer that enables + binding values to property. + + - parameter values: Observable sequence that represents property values. + - parameter valueSink: Observer that enables binding values to control property. + - returns: Control property created with a observable sequence of values and an observer that enables binding values + to property. + */ + public init(values: V, valueSink: S) { + _values = values.subscribeOn(ConcurrentMainScheduler.instance) + _valueSink = valueSink.asObserver() + } + + /** + Subscribes an observer to control property values. + + - 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(observer: O) -> Disposable { + return _values.subscribe(observer) + } + + /** + - returns: `Observable` interface. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asObservable() -> Observable { + return _values + } + + /** + - returns: `ControlProperty` interface. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asControlProperty() -> ControlProperty { + return self + } + + /** + Binds event to user interface. + + - In case next element is received, it is being set to control value. + - 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) { + switch event { + case .Error(let error): + bindingErrorToInterface(error) + case .Next: + _valueSink.on(event) + case .Completed: + _valueSink.on(event) + } + } +} diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlEvent+Driver.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlEvent+Driver.swift new file mode 100644 index 0000000..6e2559b --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlEvent+Driver.swift @@ -0,0 +1,30 @@ +// +// ControlEvent+Driver.swift +// Rx +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +extension ControlEvent { + /** + Converts `ControlEvent` to `Driver` unit. + + `ControlEvent` already can't fail, so no special case needs to be handled. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asDriver() -> Driver { + return self.asDriver { (error) -> Driver in + #if DEBUG + rxFatalError("Somehow driver received error from a source that shouldn't fail.") + #else + return Driver.empty() + #endif + } + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlProperty+Driver.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlProperty+Driver.swift new file mode 100644 index 0000000..9e7048d --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlProperty+Driver.swift @@ -0,0 +1,30 @@ +// +// ControlProperty+Driver.swift +// Rx +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +extension ControlProperty { + /** + Converts `ControlProperty` to `Driver` unit. + + `ControlProperty` already can't fail, so no special case needs to be handled. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asDriver() -> Driver { + return self.asDriver { (error) -> Driver in + #if DEBUG + rxFatalError("Somehow driver received error from a source that shouldn't fail.") + #else + return Driver.empty() + #endif + } + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift new file mode 100644 index 0000000..dde0f05 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators+arity.swift @@ -0,0 +1,322 @@ +// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project +// +// Driver+Operators+arity.swift +// Rx +// +// Created by Krunoslav Zaher on 10/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + + + +// 2 + +extension Driver { + /** + 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. + + - 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 + (source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E) + -> Driver { + let source = Observable.zip( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + +extension Driver { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - 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 + (source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E) + -> Driver { + let source = Observable.combineLatest( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + + + +// 3 + +extension Driver { + /** + 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. + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E) + -> Driver { + let source = Observable.zip( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + +extension Driver { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E) + -> Driver { + let source = Observable.combineLatest( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + + + +// 4 + +extension Driver { + /** + 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. + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> Driver { + let source = Observable.zip( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + +extension Driver { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> Driver { + let source = Observable.combineLatest( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + + + +// 5 + +extension Driver { + /** + 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. + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> Driver { + let source = Observable.zip( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + +extension Driver { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> Driver { + let source = Observable.combineLatest( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + + + +// 6 + +extension Driver { + /** + 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. + + - 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 + (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) + -> Driver { + let source = Observable.zip( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + +extension Driver { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - 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 + (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) + -> Driver { + let source = Observable.combineLatest( + source1.asDriver().asObservable(), source2.asDriver().asObservable(), source3.asDriver().asObservable(), source4.asDriver().asObservable(), source5.asDriver().asObservable(), source6.asDriver().asObservable(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + + + +// 7 + +extension Driver { + /** + 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. + + - 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 + (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) + -> Driver { + 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(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + +extension Driver { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - 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 + (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) + -> Driver { + 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(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + + + +// 8 + +extension Driver { + /** + 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. + + - 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 + (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) + -> Driver { + 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(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + +extension Driver { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - 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 + (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) + -> Driver { + 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(), + resultSelector: resultSelector + ) + + return Driver(source) + } +} + diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators.swift new file mode 100644 index 0000000..c3fb732 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Operators.swift @@ -0,0 +1,493 @@ +// +// Driver+Operators.swift +// Rx +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +// MARK: map +extension DriverConvertibleType { + + /** + Projects each element of an observable sequence into a new form. + + - 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(selector: E -> R) -> Driver { + let source = self + .asObservable() + .map(selector) + return Driver(source) + } +} + +// MARK: filter +extension DriverConvertibleType { + /** + Filters the elements of an observable sequence based on a predicate. + + - 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 { + let source = self + .asObservable() + .filter(predicate) + return Driver(source) + } +} + +// MARK: switchLatest +extension DriverConvertibleType where E : DriverConvertibleType { + + /** + Transforms an observable sequence of observable sequences into an observable sequence + producing values only from the most recent observable sequence. + + Each time a new inner observable sequence is received, unsubscribe from the + previous inner observable sequence. + + - 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") + public func switchLatest() -> Driver { + let source: Observable = self + .asObservable() + .map { $0.asDriver() } + .switchLatest() + return Driver(source) + } +} + +// MARK: flatMapLatest +extension DriverConvertibleType { + /** + Projects each element of an observable sequence into a new sequence of observable sequences and then + transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. + + It is a combination of `map` + `switchLatest` operator + + - parameter selector: A transform function to apply to each element. + - 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(selector: (E) -> Driver) + -> Driver { + let source: Observable = self + .asObservable() + .flatMapLatest(selector) + return Driver(source) + } +} + +// MARK: flatMapFirst +extension DriverConvertibleType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + If element is received while there is some projected observable sequence being merged it will simply be ignored. + + - 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(selector: (E) -> Driver) + -> Driver { + let source: Observable = self + .asObservable() + .flatMapFirst(selector) + return Driver(source) + } +} + +// MARK: doOn +extension DriverConvertibleType { + + /** + Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence. + + - 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) -> Void) + -> Driver { + let source = self.asObservable() + .doOn(eventHandler) + + return Driver(source) + } + + /** + 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. + - 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) + -> Driver { + let source = self.asObservable() + .doOn(onNext: onNext, onError: onError, onCompleted: onCompleted) + + return Driver(source) + } + + /** + Invokes an action for each Next 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. + - 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)) + -> Driver { + return self.doOn(onNext: onNext) + } + + /** + Invokes an action for the Completed event in the observable sequence, and propagates all observer messages through the result sequence. + + - 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)) + -> Driver { + return self.doOn(onCompleted: onCompleted) + } +} + +// MARK: debug +extension DriverConvertibleType { + + /** + Prints received events for all observers on standard output. + + - 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 { + let source = self.asObservable() + .debug(identifier, file: file, line: line, function: function) + return Driver(source) + } +} + +// MARK: distinctUntilChanged +extension DriverConvertibleType where E: Equatable { + + /** + Returns an observable sequence that contains only distinct contiguous elements according to equality operator. + + - 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") + public func distinctUntilChanged() + -> Driver { + let source = self.asObservable() + .distinctUntilChanged({ $0 }, comparer: { ($0 == $1) }) + + return Driver(source) + } +} + +extension DriverConvertibleType { + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `keySelector`. + + - 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(keySelector: (E) -> K) -> Driver { + let source = self.asObservable() + .distinctUntilChanged(keySelector, comparer: { $0 == $1 }) + return Driver(source) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `comparer`. + + - 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 { + let source = self.asObservable() + .distinctUntilChanged({ $0 }, comparer: comparer) + return Driver(source) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. + + - parameter keySelector: A function to compute the comparison key for each element. + - 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(keySelector: (E) -> K, comparer: (lhs: K, rhs: K) -> Bool) -> Driver { + let source = self.asObservable() + .distinctUntilChanged(keySelector, comparer: comparer) + return Driver(source) + } +} + + +// MARK: flatMap +extension DriverConvertibleType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + + - 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(selector: (E) -> Driver) -> Driver { + let source = self.asObservable() + .flatMap(selector) + + return Driver(source) + } +} + +// MARK: merge +extension DriverConvertibleType where E : DriverConvertibleType { + + /** + Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence. + + - 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") + public func merge() -> Driver { + let source = self.asObservable() + .map { $0.asDriver() } + .merge() + return Driver(source) + } + + /** + Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences. + + - 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) + -> Driver { + let source = self.asObservable() + .map { $0.asDriver() } + .merge(maxConcurrent: maxConcurrent) + return Driver(source) + } +} + +// MARK: throttle +extension DriverConvertibleType { + + /** + Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers. + + `throttle` and `debounce` are synonyms. + + - 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) + -> Driver { + let source = self.asObservable() + .throttle(dueTime, scheduler: driverObserveOnScheduler) + + return Driver(source) + } + + /** + Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers. + + `throttle` and `debounce` are synonyms. + + - 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) + -> Driver { + let source = self.asObservable() + .debounce(dueTime, scheduler: driverObserveOnScheduler) + + return Driver(source) + } +} + +// MARK: scan +extension DriverConvertibleType { + /** + Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. + + For aggregation behavior with no intermediate results, see `reduce`. + + - parameter seed: The initial accumulator value. + - 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(seed: A, accumulator: (A, E) -> A) + -> Driver { + let source = self.asObservable() + .scan(seed, accumulator: accumulator) + return Driver(source) + } +} + +// MARK: concat +extension SequenceType where Generator.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") + public func concat() + -> Driver { + let source = self.lazy.map { $0.asDriver().asObservable() }.concat() + return Driver(source) + } +} + +extension CollectionType where Generator.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") + public func concat() + -> Driver { + let source = self.map { $0.asDriver().asObservable() }.concat() + return Driver(source) + } +} + +// MARK: zip +extension CollectionType where Generator.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. + + - 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(resultSelector: [Generator.Element.E] throws -> R) -> Driver { + let source = self.map { $0.asDriver().asObservable() }.zip(resultSelector) + return Driver(source) + } +} + +// MARK: combineLatest +extension CollectionType where Generator.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. + + - 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(resultSelector: [Generator.Element.E] throws -> R) -> Driver { + let source = self.map { $0.asDriver().asObservable() }.combineLatest(resultSelector) + return Driver(source) + } +} + +// MARK: withLatestFrom +extension DriverConvertibleType { + + /** + Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any. + + - parameter second: Second observable source. + - 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(second: SecondO, resultSelector: (E, SecondO.E) -> ResultType) -> Driver { + let source = self.asObservable() + .withLatestFrom(second.asDriver(), resultSelector: resultSelector) + + return Driver(source) + } + + /** + Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emitts an element. + + - 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(second: SecondO) -> Driver { + let source = self.asObservable() + .withLatestFrom(second.asDriver()) + + return Driver(source) + } +} + +// MARK: skip +extension DriverConvertibleType { + + /** + Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. + + - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html) + + - 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) + -> Driver { + let source = self.asObservable() + .skip(count) + return Driver(source) + } +} + +// MARK: startWith +extension DriverConvertibleType { + + /** + Prepends a value to an observable sequence. + + - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html) + + - 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) + -> Driver { + let source = self.asObservable() + .startWith(element) + + return Driver(source) + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift new file mode 100644 index 0000000..17bbb33 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver+Subscription.swift @@ -0,0 +1,90 @@ +// +// Driver+Subscription.swift +// Rx +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +extension DriverConvertibleType { + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better. + + - 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(observer: O) -> Disposable { + MainScheduler.ensureExecutingOnScheduler() + return self.asObservable().subscribe(observer) + } + + /** + Subscribes to observable sequence using custom binder function. + + - 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(transformation: Observable -> R) -> R { + MainScheduler.ensureExecutingOnScheduler() + return transformation(self.asObservable()) + } + + /** + Subscribes to observable sequence using custom binder function and final parameter passed to binder function + after `self` is passed. + + public func drive(with: Self -> R1 -> R2, curriedArgument: R1) -> R2 { + return with(self)(curriedArgument) + } + + - parameter with: Function used to bind elements from `self`. + - 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(with: Observable -> R1 -> R2, curriedArgument: R1) -> R2 { + MainScheduler.ensureExecutingOnScheduler() + return with(self.asObservable())(curriedArgument) + } + + /** + Subscribes an element handler, a completion handler and disposed handler to an observable sequence. + + Error callback is not exposed because `Driver` can't error out. + + - parameter onNext: Action to invoke for each element in the observable sequence. + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + gracefully completed, errored, or if the generation is cancelled by disposing subscription) + - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has + 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() + return self.asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed) + } + + /** + Subscribes an element handler to an observable sequence. + + - 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() + return self.asObservable().subscribeNext(onNext) + } +} + + diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver.swift new file mode 100644 index 0000000..d12f939 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Driver.swift @@ -0,0 +1,221 @@ +// +// Driver.swift +// Rx +// +// Created by Krunoslav Zaher on 8/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +/** +A type that can be converted to `Driver`. +*/ +public protocol DriverConvertibleType : ObservableConvertibleType { + + /** + Converts self to `Driver`. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + func asDriver() -> Driver +} + +extension DriverConvertibleType { + @warn_unused_result(message="http://git.io/rxs.uo") + public func asObservable() -> Observable { + return asDriver().asObservable() + } +} + +/** + Unit that represents observable sequence with following properties: + + - it never fails + - it delivers events on `MainScheduler.instance` + - `shareReplayLatestWhileConnected()` behavior + - all observers share sequence computation resources + - it's stateful, upon subscription (calling subscribe) last element is immediatelly replayed if it was produced + - computation of elements is reference counted with respect to the number of observers + - if there are no subscribers, it will release sequence computation resources + + `Driver` can be considered a builder pattern for observable sequences that drive the application. + + If observable sequence has produced at least one element, after new subscription is made last produced element will be + immediately replayed on the same thread on which the subscription was made. + + When using `drive*`, `subscribe*` and `bind*` family of methods, they should always be called from main thread. + + If `drive*`, `subscribe*` and `bind*` are called from background thread, it is possible that initial replay + will happen on background thread, and subsequent events will arrive on main thread. + + To find out more about units and how to use them, please visit `Documentation/Units.md`. +*/ +public struct Driver : DriverConvertibleType { + public typealias E = Element + + let _source: Observable + + init(_ source: Observable) { + self._source = source.shareReplayLatestWhileConnected() + } + + init(raw: Observable) { + self._source = raw + } + + #if EXPANDABLE_DRIVER + public static func createUnsafe(source: O) -> Driver { + return Driver(raw: source.asObservable()) + } + #endif + + /** + - returns: Built observable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asObservable() -> Observable { + return _source + } + + /** + - returns: `self` + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asDriver() -> Driver { + return self + } +} + + +extension Driver { + + /** + Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message. + + - returns: An observable sequence with no elements. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func empty() -> Driver { + return Driver(raw: Observable.empty().subscribeOn(driverSubscribeOnScheduler)) + } + + /** + Returns a non-terminating observable sequence, which can be used to denote an infinite duration. + + - returns: An observable sequence whose observers will never get called. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func never() -> Driver { + return Driver(raw: Observable.never().subscribeOn(driverSubscribeOnScheduler)) + } + + /** + Returns an observable sequence that contains a single element. + + - 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 { + return Driver(raw: Observable.just(element).subscribeOn(driverSubscribeOnScheduler)) + } + + /** + Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. + + - 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) + -> Driver { + return Driver(Observable.deferred { observableFactory().asObservable() }) + } + + /** + This method creates a new Observable instance with a variable number of elements. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - 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 { + let source = elements.toObservable(driverSubscribeOnScheduler) + return Driver(raw: source) + } +} + +extension Driver where Element : SignedIntegerType { + /** + Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages. + + - seealso: [interval operator on reactivex.io](http://reactivex.io/documentation/operators/interval.html) + + - 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) + -> Driver { + return Driver(Observable.interval(period, scheduler: driverObserveOnScheduler)) + } +} + +// MARK: timer + +extension Driver where Element: SignedIntegerType { + /** + 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. + + - seealso: [timer operator on reactivex.io](http://reactivex.io/documentation/operators/timer.html) + + - parameter dueTime: Relative time at which to produce the first value. + - 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) + -> Driver { + return Driver(Observable.timer(dueTime, period: period, scheduler: driverObserveOnScheduler)) + } +} + +/** + This method can be used in unit tests to ensure that driver is using mock schedulers instead of + maind schedulers. + + **This shouldn't be used in normal release builds.** +*/ +public func driveOnScheduler(scheduler: SchedulerType, action: () -> ()) { + let originalObserveOnScheduler = driverObserveOnScheduler + let originalSubscribeOnScheduler = driverSubscribeOnScheduler + + driverObserveOnScheduler = scheduler + driverSubscribeOnScheduler = scheduler + + action() + + // If you remove this line , compiler buggy optimizations will change behavior of this code + _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(driverObserveOnScheduler) + _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(driverSubscribeOnScheduler) + // Scary, I know + + driverObserveOnScheduler = originalObserveOnScheduler + driverSubscribeOnScheduler = originalSubscribeOnScheduler +} + +func _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(scheduler: SchedulerType) { + let a: Int32 = 1 + let b = 314 + Int32(rand() & 1) + if a == b { + print(scheduler) + } +} + +var driverObserveOnScheduler: SchedulerType = MainScheduler.instance +var driverSubscribeOnScheduler: SchedulerType = ConcurrentMainScheduler.instance diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift new file mode 100644 index 0000000..5bc3f43 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift @@ -0,0 +1,63 @@ +// +// ObservableConvertibleType+Driver.swift +// Rx +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +extension ObservableConvertibleType { + /** + Converts anything convertible to `Observable` to `Driver` unit. + + - 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 { + let source = self + .asObservable() + .observeOn(driverObserveOnScheduler) + .catchErrorJustReturn(onErrorJustReturn) + return Driver(source) + } + + /** + Converts anything convertible to `Observable` to `Driver` unit. + + - 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) -> Driver { + let source = self + .asObservable() + .observeOn(driverObserveOnScheduler) + .catchError { _ in + onErrorDriveWith.asObservable() + } + return Driver(source) + } + + /** + Converts anything convertible to `Observable` to `Driver` unit. + + - 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) -> Driver { + let source = self + .asObservable() + .observeOn(driverObserveOnScheduler) + .catchError { error in + onErrorRecover(error: error).asObservable() + } + return Driver(source) + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Variable+Driver.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Variable+Driver.swift new file mode 100644 index 0000000..f2c038f --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Variable+Driver.swift @@ -0,0 +1,26 @@ +// +// Variable+Driver.swift +// Rx +// +// Created by Krunoslav Zaher on 12/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + +extension Variable { + /** + Converts `Variable` to `Driver` unit. + + - returns: Driving observable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asDriver() -> Driver { + let source = self.asObservable() + .observeOn(driverObserveOnScheduler) + return Driver(source) + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift new file mode 100644 index 0000000..04b4603 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift @@ -0,0 +1,63 @@ +// +// UIBindingObserver.swift +// Rx +// +// Created by Krunoslav Zaher on 2/7/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + +/** +Observer that enforces interface binding rules: + * can't bind errors (in debug builds binding of errors causes `fatalError` in release builds errors are being logged) + * ensures binding is performed on main thread + +`InterfaceBindingObserver` doesn't retain target interface and in case owned interface element is released, element isn't bound. +*/ +public class UIBindingObserver : ObserverType { + public typealias E = Value + + weak var UIElement: UIElementType? + + let binding: (UIElementType, Value) -> Void + + /** + Initializes `ViewBindingObserver` using + */ + public init(UIElement: UIElementType, binding: (UIElementType, Value) -> Void) { + self.UIElement = UIElement + self.binding = binding + } + + /** + Binds next element to owner view as described in `binding`. + */ + public func on(event: Event) { + MainScheduler.ensureExecutingOnScheduler() + + switch event { + case .Next(let element): + if let view = self.UIElement { + binding(view, element) + } + case .Error(let error): + bindingErrorToInterface(error) + break + case .Completed: + break + } + } + + /** + Erases type of observer. + + - returns: type erased observer. + */ + public func asObserver() -> AnyObserver { + return AnyObserver(eventHandler: on) + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift b/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift new file mode 100644 index 0000000..89213e7 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift @@ -0,0 +1,155 @@ +// +// DelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +var delegateAssociatedTag: UInt8 = 0 +var dataSourceAssociatedTag: UInt8 = 0 + +/** +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 { + + private var subjectsForSelector = [Selector: PublishSubject<[AnyObject]>]() + + /** + Parent object associated with delegate proxy. + */ + weak private(set) var parentObject: AnyObject? + + /** + Initializes new instance. + + - parameter parentObject: Optional parent object that owns `DelegateProxy` as associated object. + */ + public required init(parentObject: AnyObject) { + self.parentObject = parentObject + + MainScheduler.ensureExecutingOnScheduler() +#if TRACE_RESOURCES + OSAtomicIncrement32(&resourceCount) +#endif + super.init() + } + + /** + Returns observable sequence of invocations of delegate methods. + + - 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) { + print("Delegate proxy is already implementing `\(selector)`, a more performant way of registering might exist.") + } + + if !self.respondsToSelector(selector) { + rxFatalError("This class doesn't respond to selector \(selector)") + } + + let subject = subjectsForSelector[selector] + + if let subject = subject { + return subject + } + else { + let subject = PublishSubject<[AnyObject]>() + subjectsForSelector[selector] = subject + return subject + } + } + + // proxy + + public override func interceptedSelector(selector: Selector, withArguments arguments: [AnyObject]!) { + subjectsForSelector[selector]?.on(.Next(arguments)) + } + + /** + Returns tag used to identify associated object. + + - returns: Associated object tag. + */ + public class func delegateAssociatedObjectTag() -> UnsafePointer { + return _pointer(&delegateAssociatedTag) + } + + /** + Initializes new instance of delegate proxy. + + - returns: Initialized instance of `self`. + */ + public class func createProxyForObject(object: AnyObject) -> AnyObject { + return self.init(parentObject: object) + } + + /** + Returns assigned proxy for object. + + - 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) + } + + /** + Assigns proxy to object. + + - 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())) + + objc_setAssociatedObject(object, self.delegateAssociatedObjectTag(), proxy, .OBJC_ASSOCIATION_RETAIN) + } + + /** + Sets reference of normal delegate that receives all forwarded messages + through `self`. + + - 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) + } + + /** + Returns reference of normal delegate that receives all forwarded messages + through `self`. + + - returns: Value of reference if set or nil. + */ + public func forwardToDelegate() -> AnyObject? { + return self._forwardToDelegate + } + + deinit { + for v in subjectsForSelector.values { + v.on(.Completed) + } +#if TRACE_RESOURCES + OSAtomicDecrement32(&resourceCount) +#endif + } + + // MARK: Pointer + + class func _pointer(p: UnsafePointer) -> UnsafePointer { + return p + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift b/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift new file mode 100644 index 0000000..8b0992e --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift @@ -0,0 +1,252 @@ +// +// DelegateProxyType.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +/** +`DelegateProxyType` protocol enables using both normal delegates and Rx observable sequences with +views that can have only one delegate/datasource registered. + +`Proxies` store information about observers, subscriptions and delegates +for specific views. + +Type implementing `DelegateProxyType` should never be initialized directly. + +To fetch initialized instance of type implementing `DelegateProxyType`, `proxyForObject` method +should be used. + +This is more or less how it works. + + + + +-------------------------------------------+ + | | + | UIView subclass (UIScrollView) | + | | + +-----------+-------------------------------+ + | + | Delegate + | + | + +-----------v-------------------------------+ + | | + | Delegate proxy : DelegateProxyType +-----+----> Observable + | , UIScrollViewDelegate | | + +-----------+-------------------------------+ +----> Observable + | | + | +----> Observable + | | + | forwards events | + | to custom delegate | + | v + +-----------v-------------------------------+ + | | + | Custom delegate (UIScrollViewDelegate) | + | | + +-------------------------------------------+ + + +Since RxCocoa needs to automagically create those Proxys +..and because views that have delegates can be hierarchical + +UITableView : UIScrollView : UIView + +.. and corresponding delegates are also hierarchical + +UITableViewDelegate : UIScrollViewDelegate : NSObject + +.. and sometimes there can be only one proxy/delegate registered, +every view has a corresponding delegate virtual factory method. + +In case of UITableView / UIScrollView, there is + + extensions UIScrollView { + public func rx_createDelegateProxy() -> RxScrollViewDelegateProxy { + return RxScrollViewDelegateProxy(view: self) + } + .... + + +and override in UITableView + + extension UITableView { + public override func rx_createDelegateProxy() -> RxScrollViewDelegateProxy { + .... + + +*/ +public protocol DelegateProxyType : AnyObject { + /** + Creates new proxy for target object. + */ + static func createProxyForObject(object: AnyObject) -> AnyObject + + /** + Returns assigned proxy for object. + + - 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? + + /** + Assigns proxy to object. + + - 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) + + /** + Returns designated delegate property for object. + + Objects can have multiple delegate properties. + + Each delegate property needs to have it's own type implementing `DelegateProxyType`. + + - parameter object: Object that has delegate property. + - returns: Value of delegate property. + */ + static func currentDelegateFor(object: AnyObject) -> AnyObject? + + /** + Sets designated delegate property for object. + + Objects can have multiple delegate properties. + + Each delegate property needs to have it's own type implementing `DelegateProxyType`. + + - parameter toObject: Object that has delegate property. + - parameter delegate: Delegate value. + */ + static func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) + + /** + Returns reference of normal delegate that receives all forwarded messages + through `self`. + + - returns: Value of reference if set or nil. + */ + func forwardToDelegate() -> AnyObject? + + /** + Sets reference of normal delegate that receives all forwarded messages + through `self`. + + - parameter forwardToDelegate: Reference of delegate that receives all messages through `self`. + - parameter retainDelegate: Should `self` retain `forwardToDelegate`. + */ + func setForwardToDelegate(forwardToDelegate: AnyObject?, retainDelegate: Bool) +} + +/** +Returns existing proxy for object or installs new instance of delegate proxy. + +- parameter object: Target object on which to install delegate proxy. +- returns: Installed instance of delegate proxy. + + + extension UISearchBar { + + public var rx_delegate: DelegateProxy { + return proxyForObject(RxSearchBarDelegateProxy.self, self) + } + + public var rx_text: ControlProperty { + let source: Observable = self.rx_delegate.observe("searchBar:textDidChange:") + ... + } + } +*/ +public func proxyForObject(type: P.Type, _ object: AnyObject) -> P { + MainScheduler.ensureExecutingOnScheduler() + + let maybeProxy = P.assignedProxyFor(object) as? P + + let proxy: P + if maybeProxy == nil { + proxy = P.createProxyForObject(object) as! P + P.assignProxy(proxy, toObject: object) + assert(P.assignedProxyFor(object) === proxy) + } + else { + proxy = maybeProxy! + } + + let currentDelegate: AnyObject? = P.currentDelegateFor(object) + + if currentDelegate !== proxy { + proxy.setForwardToDelegate(currentDelegate, retainDelegate: false) + P.setCurrentDelegate(proxy, toObject: object) + assert(P.currentDelegateFor(object) === proxy) + assert(proxy.forwardToDelegate() === currentDelegate) + } + + return proxy +} + +func installDelegate(proxy: P, delegate: AnyObject, retainDelegate: Bool, onProxyForObject object: AnyObject) -> Disposable { + weak var weakDelegate: AnyObject? = delegate + + assert(proxy.forwardToDelegate() === nil, "There is already a delegate set -> `\(proxy.forwardToDelegate())` for object -> `\(object)`.\nMaybe delegate was already set in `xib` or `storyboard` and now it's being overwritten in code.") + + proxy.setForwardToDelegate(delegate, retainDelegate: retainDelegate) + + // refresh properties after delegate is set + // some views like UITableView cache `respondsToSelector` + P.setCurrentDelegate(nil, toObject: object) + P.setCurrentDelegate(proxy, toObject: object) + + assert(proxy.forwardToDelegate() === delegate, "Setting of delegate failed") + + return AnonymousDisposable { + MainScheduler.ensureExecutingOnScheduler() + + let delegate: AnyObject? = weakDelegate + + assert(delegate == nil || proxy.forwardToDelegate() === delegate, "Delegate was changed from time it was first set. Current \(proxy.forwardToDelegate()), and it should have been \(proxy)") + + proxy.setForwardToDelegate(nil, retainDelegate: retainDelegate) + } +} + +extension ObservableType { + func subscribeProxyDataSourceForObject(object: AnyObject, dataSource: AnyObject, retainDataSource: Bool, binding: (P, Event) -> Void) + -> Disposable { + let proxy = proxyForObject(P.self, object) + let disposable = installDelegate(proxy, delegate: dataSource, retainDelegate: retainDataSource, onProxyForObject: object) + + let subscription = self.asObservable() + // source can't ever end, otherwise it will release the subscriber + .concat(Observable.never()) + .subscribe { [weak object] (event: Event) in + MainScheduler.ensureExecutingOnScheduler() + + if let object = object { + assert(proxy === P.currentDelegateFor(object), "Proxy changed from the time it was first set.\nOriginal: \(proxy)\nExisting: \(P.currentDelegateFor(object))") + } + + binding(proxy, event) + + switch event { + case .Error(let error): + bindingErrorToInterface(error) + disposable.dispose() + case .Completed: + disposable.dispose() + default: + break + } + } + + return StableCompositeDisposable.create(subscription, disposable) + } +} diff --git a/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+CoreGraphics.swift b/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+CoreGraphics.swift new file mode 100644 index 0000000..19abf65 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+CoreGraphics.swift @@ -0,0 +1,71 @@ +// +// KVORepresentable+CoreGraphics.swift +// Rx +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif +import CoreGraphics + +#if arch(x86_64) || arch(arm64) +let CGRectType = "{CGRect={CGPoint=dd}{CGSize=dd}}" +let CGSizeType = "{CGSize=dd}" +let CGPointType = "{CGPoint=dd}" +#elseif arch(i386) || arch(arm) +let CGRectType = "{CGRect={CGPoint=ff}{CGSize=ff}}" +let CGSizeType = "{CGSize=ff}" +let CGPointType = "{CGPoint=ff}" +#endif + +extension CGRect : KVORepresentable { + public typealias KVOType = NSValue + + /** + Constructs self from `NSValue`. + */ + public init?(KVOValue: KVOType) { + if strcmp(KVOValue.objCType, CGRectType) != 0 { + return nil + } + var typedValue = CGRect(x: 0, y: 0, width: 0, height: 0) + KVOValue.getValue(&typedValue) + self = typedValue + } +} + +extension CGPoint : KVORepresentable { + public typealias KVOType = NSValue + + /** + Constructs self from `NSValue`. + */ + public init?(KVOValue: KVOType) { + if strcmp(KVOValue.objCType, CGPointType) != 0 { + return nil + } + var typedValue = CGPoint(x: 0, y: 0) + KVOValue.getValue(&typedValue) + self = typedValue + } +} + +extension CGSize : KVORepresentable { + public typealias KVOType = NSValue + + /** + Constructs self from `NSValue`. + */ + public init?(KVOValue: KVOType) { + if strcmp(KVOValue.objCType, CGSizeType) != 0 { + return nil + } + var typedValue = CGSize(width: 0, height: 0) + KVOValue.getValue(&typedValue) + self = typedValue + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+Swift.swift b/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+Swift.swift new file mode 100644 index 0000000..a118bc4 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+Swift.swift @@ -0,0 +1,93 @@ +// +// KVORepresentable+Swift.swift +// Rx +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +extension Int : KVORepresentable { + public typealias KVOType = NSNumber + + /** + Constructs `Self` using KVO value. + */ + public init?(KVOValue: KVOType) { + self.init(KVOValue.integerValue) + } +} + +extension Int32 : KVORepresentable { + public typealias KVOType = NSNumber + + /** + Constructs `Self` using KVO value. + */ + public init?(KVOValue: KVOType) { + self.init(KVOValue.intValue) + } +} + +extension Int64 : KVORepresentable { + public typealias KVOType = NSNumber + + /** + Constructs `Self` using KVO value. + */ + public init?(KVOValue: KVOType) { + self.init(KVOValue.longLongValue) + } +} + +extension UInt : KVORepresentable { + public typealias KVOType = NSNumber + + /** + Constructs `Self` using KVO value. + */ + public init?(KVOValue: KVOType) { + self.init(KVOValue.unsignedLongValue) + } +} + +extension UInt32 : KVORepresentable { + public typealias KVOType = NSNumber + + /** + Constructs `Self` using KVO value. + */ + public init?(KVOValue: KVOType) { + self.init(KVOValue.unsignedIntValue) + } +} + +extension UInt64 : KVORepresentable { + public typealias KVOType = NSNumber + + /** + Constructs `Self` using KVO value. + */ + public init?(KVOValue: KVOType) { + self.init(KVOValue.unsignedLongLongValue) + } +} + + +extension RawRepresentable where RawValue: KVORepresentable { + /** + Constructs `Self` using optional KVO value. + */ + init?(KVOValue: RawValue.KVOType?) { + guard let KVOValue = KVOValue else { + return nil + } + + guard let rawValue = RawValue(KVOValue: KVOValue) else { + return nil + } + + self.init(rawValue: rawValue) + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/KVORepresentable.swift b/Pods/RxCocoa/RxCocoa/Common/KVORepresentable.swift new file mode 100644 index 0000000..c51774b --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/KVORepresentable.swift @@ -0,0 +1,38 @@ +// +// KVORepresentable.swift +// Rx +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Type that is KVO representable (KVO mechanism can be used to observe it). +*/ +public protocol KVORepresentable { + /** + Associated KVO type. + */ + associatedtype KVOType + + /** + Constructs `Self` using KVO value. + */ + init?(KVOValue: KVOType) +} + +extension KVORepresentable { + /** + Initializes `KVORepresentable` with optional value. + */ + init?(KVOValue: KVOType?) { + guard let KVOValue = KVOValue else { + return nil + } + + self.init(KVOValue: KVOValue) + } +} + diff --git a/Pods/RxCocoa/RxCocoa/Common/Logging.swift b/Pods/RxCocoa/RxCocoa/Common/Logging.swift new file mode 100644 index 0000000..0db671a --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Logging.swift @@ -0,0 +1,27 @@ +// +// Logging.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/3/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Simple logging settings for RxCocoa library. +*/ +public struct Logging { + public typealias LogURLRequest = (NSURLRequest) -> Bool + + /** + Log URL requests to standard output in curl format. + */ + public static var URLRequests: LogURLRequest = { _ in + #if DEBUG + return true + #else + return false + #endif + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift b/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift new file mode 100644 index 0000000..36e9759 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift @@ -0,0 +1,43 @@ +// +// NSLayoutConstraint+Rx.swift +// Rx +// +// Created by Krunoslav Zaher on 12/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if os(OSX) +import Cocoa +#else +import UIKit +#endif + +#if !RX_NO_MODULE +import RxSwift +#endif + +#if os(iOS) || os(OSX) || os(tvOS) +extension NSLayoutConstraint { + /** + Bindable sink for `constant` property. + */ + public var rx_constant: AnyObserver { + return UIBindingObserver(UIElement: self) { constraint, constant in + constraint.constant = constant + }.asObserver() + } + + /** + Bindable sink for `active` property. + */ + @available(iOS 8, OSX 10.10, *) + public var rx_active: AnyObserver { + return UIBindingObserver(UIElement: self) { constraint, value in + constraint.active = value + }.asObserver() + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift b/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift new file mode 100644 index 0000000..cff3762 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift @@ -0,0 +1,107 @@ +// +// Observable+Bind.swift +// Rx +// +// Created by Krunoslav Zaher on 8/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +extension ObservableType { + + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better, and enables + writing more consistent binding code. + + - 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(observer: O) -> Disposable { + return self.subscribe(observer) + } + + /** + Creates new subscription and sends elements to variable. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - 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) -> Disposable { + return subscribe { e in + switch e { + case let .Next(element): + variable.value = element + case let .Error(error): + let error = "Binding error to variable: \(error)" + #if DEBUG + rxFatalError(error) + #else + print(error) + #endif + case .Completed: + break + } + } + } + + /** + Subscribes to observable sequence using custom binder function. + + - 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(binder: Self -> R) -> R { + return binder(self) + } + + /** + Subscribes to observable sequence using custom binder function and final parameter passed to binder function + after `self` is passed. + + public func bindTo(binder: Self -> R1 -> R2, curriedArgument: R1) -> R2 { + return binder(self)(curriedArgument) + } + + - parameter binder: Function used to bind elements from `self`. + - 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(binder: Self -> R1 -> R2, curriedArgument: R1) -> R2 { + return binder(self)(curriedArgument) + } + + + /** + Subscribes an element handler to an observable sequence. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - 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 { + return subscribe(onNext: onNext, onError: { error in + let error = "Binding error: \(error)" + #if DEBUG + rxFatalError(error) + #else + print(error) + #endif + }) + } +} diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/ControlTarget.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/ControlTarget.swift new file mode 100644 index 0000000..ade22a2 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/ControlTarget.swift @@ -0,0 +1,92 @@ +// +// ControlTarget.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) || os(OSX) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +#if os(iOS) || os(tvOS) + import UIKit + + typealias Control = UIKit.UIControl + typealias ControlEvents = UIKit.UIControlEvents +#elseif os(OSX) + import Cocoa + + typealias Control = Cocoa.NSControl +#endif + +// This should be only used from `MainScheduler` +class ControlTarget: RxTarget { + typealias Callback = (Control) -> Void + + let selector: Selector = #selector(ControlTarget.eventHandler(_:)) + + weak var control: Control? +#if os(iOS) || os(tvOS) + let controlEvents: UIControlEvents +#endif + var callback: Callback? + #if os(iOS) || os(tvOS) + init(control: Control, controlEvents: UIControlEvents, callback: Callback) { + MainScheduler.ensureExecutingOnScheduler() + + self.control = control + self.controlEvents = controlEvents + self.callback = callback + + super.init() + + control.addTarget(self, action: selector, forControlEvents: controlEvents) + + let method = self.methodForSelector(selector) + if method == nil { + rxFatalError("Can't find method") + } + } +#elseif os(OSX) + init(control: Control, callback: Callback) { + MainScheduler.ensureExecutingOnScheduler() + + self.control = control + self.callback = callback + + super.init() + + control.target = self + control.action = selector + + let method = self.methodForSelector(selector) + if method == nil { + rxFatalError("Can't find method") + } + } +#endif + + func eventHandler(sender: Control!) { + if let callback = self.callback, control = self.control { + callback(control) + } + } + + override func dispose() { + super.dispose() +#if os(iOS) || os(tvOS) + self.control?.removeTarget(self, action: self.selector, forControlEvents: self.controlEvents) +#elseif os(OSX) + self.control?.target = nil + self.control?.action = nil +#endif + self.callback = nil + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/DeallocObservable.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/DeallocObservable.swift new file mode 100644 index 0000000..8d66996 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/DeallocObservable.swift @@ -0,0 +1,24 @@ +// +// DeallocObservable.swift +// Rx +// +// Created by Krunoslav Zaher on 12/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +class DeallocObservable { + let _subject = ReplaySubject.create(bufferSize: 1) + + init() { + } + + deinit { + _subject.on(.Next(())) + _subject.on(.Completed) + } +} diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObservable.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObservable.swift new file mode 100644 index 0000000..08cfeea --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObservable.swift @@ -0,0 +1,147 @@ +// +// KVOObservable.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 7/5/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +class KVOObservable + : ObservableType + , KVOObservableProtocol { + typealias E = Element? + + unowned var target: AnyObject + var strongTarget: AnyObject? + + var keyPath: String + var options: NSKeyValueObservingOptions + var retainTarget: Bool + + init(object: AnyObject, keyPath: String, options: NSKeyValueObservingOptions, retainTarget: Bool) { + self.target = object + self.keyPath = keyPath + self.options = options + self.retainTarget = retainTarget + if retainTarget { + self.strongTarget = object + } + } + + func subscribe(observer: O) -> Disposable { + let observer = KVOObserver(parent: self) { (value) in + if value as? NSNull != nil { + observer.on(.Next(nil)) + return + } + observer.on(.Next(value as? Element)) + } + + return AnonymousDisposable { + observer.dispose() + } + } + +} + +#if !DISABLE_SWIZZLING + +func observeWeaklyKeyPathFor(target: NSObject, keyPath: String, options: NSKeyValueObservingOptions) -> Observable { + let components = keyPath.componentsSeparatedByString(".").filter { $0 != "self" } + + let observable = observeWeaklyKeyPathFor(target, keyPathSections: components, options: options) + .distinctUntilChanged { $0 === $1 } + .finishWithNilWhenDealloc(target) + + if !options.intersect(.Initial).isEmpty { + return observable + } + else { + return observable + .skip(1) + } +} + +// This should work correctly +// 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 +} + +extension ObservableType where E == AnyObject? { + func finishWithNilWhenDealloc(target: NSObject) + -> Observable { + let deallocating = target.rx_deallocating + + return deallocating + .map { _ in + return Observable.just(nil) + } + .startWith(self.asObservable()) + .switchLatest() + } +} + +func observeWeaklyKeyPathFor( + target: NSObject, + keyPathSections: [String], + options: NSKeyValueObservingOptions + ) -> Observable { + + weak var weakTarget: AnyObject? = target + + let propertyName = keyPathSections[0] + let remainingPaths = Array(keyPathSections[1.. + + // KVO recursion for value changes + return propertyObservable + .flatMapLatest { (nextTarget: AnyObject?) -> Observable in + if nextTarget == nil { + return Observable.just(nil) + } + let nextObject = nextTarget! as? NSObject + + let strongTarget: AnyObject? = weakTarget + + if nextObject == nil { + return Observable.error(RxCocoaError.InvalidObjectOnKeyPath(object: nextTarget!, sourceObject: strongTarget ?? NSNull(), propertyName: propertyName)) + } + + // if target is alive, then send change + // if it's deallocated, don't send anything + if strongTarget == nil { + return Observable.empty() + } + + let nextElementsObservable = keyPathSections.count == 1 + ? Observable.just(nextTarget) + : observeWeaklyKeyPathFor(nextObject!, keyPathSections: remainingPaths, options: options) + + if isWeak { + return nextElementsObservable + .finishWithNilWhenDealloc(nextObject!) + } + else { + return nextElementsObservable + } + } +} +#endif + diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObserver.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObserver.swift new file mode 100644 index 0000000..eea490e --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObserver.swift @@ -0,0 +1,46 @@ +// +// KVOObserver.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +protocol KVOObservableProtocol { + var target: AnyObject { get } + var keyPath: String { get } + var retainTarget: Bool { get } + var options: NSKeyValueObservingOptions { get } +} + +class KVOObserver : _RXKVOObserver + , Disposable { + typealias Callback = (AnyObject?) -> Void + + var retainSelf: KVOObserver? = nil + + init(parent: KVOObservableProtocol, callback: Callback) { + #if TRACE_RESOURCES + OSAtomicIncrement32(&resourceCount) + #endif + + super.init(target: parent.target, retainTarget: parent.retainTarget, keyPath: parent.keyPath, options: parent.options, callback: callback) + self.retainSelf = self + } + + override func dispose() { + super.dispose() + self.retainSelf = nil + } + + deinit { + #if TRACE_RESOURCES + OSAtomicDecrement32(&resourceCount) + #endif + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift new file mode 100644 index 0000000..a73fb01 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift @@ -0,0 +1,74 @@ +// +// MessageSentObserver.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + +#if !DISABLE_SWIZZLING + + class DeallocatingObservable + : ObservableConvertibleType + , RXMessageSentObserver { + typealias E = () + + private let _subject = ReplaySubject<()>.create(bufferSize: 1) + + @objc var targetImplementation: IMP = RX_default_target_implementation() + + var isActive: Bool { + return targetImplementation != RX_default_target_implementation() + } + + init() { + } + + @objc func messageSentWithParameters(parameters: [AnyObject]) -> Void { + _subject.on(.Next()) + } + + func asObservable() -> Observable<()> { + return _subject + } + + deinit { + _subject.on(.Completed) + } + } + + class MessageSentObservable + : ObservableConvertibleType + , RXMessageSentObserver { + typealias E = [AnyObject] + + private let _subject = PublishSubject<[AnyObject]>() + + @objc var targetImplementation: IMP = RX_default_target_implementation() + + var isActive: Bool { + return targetImplementation != RX_default_target_implementation() + } + + init() { + } + + @objc func messageSentWithParameters(parameters: [AnyObject]) -> Void { + _subject.on(.Next(parameters)) + } + + func asObservable() -> Observable<[AnyObject]> { + return _subject + } + + deinit { + _subject.on(.Completed) + } + } + +#endif diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift new file mode 100644 index 0000000..a9ad451 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift @@ -0,0 +1,34 @@ +// +// NSNotificationCenter+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 5/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +extension NSNotificationCenter { + /** + Transforms notifications posted to notification center to observable sequence of notifications. + + - parameter name: Filter notifications by name. + - 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 { + return Observable.create { [weak object] observer in + let nsObserver = self.addObserverForName(name, object: object, queue: nil) { notification in + observer.on(.Next(notification)) + } + + return AnonymousDisposable { + self.removeObserver(nsObserver) + } + } + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+KVORepresentable.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+KVORepresentable.swift new file mode 100644 index 0000000..91ac289 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+KVORepresentable.swift @@ -0,0 +1,45 @@ +// +// NSObject+Rx+KVORepresentable.swift +// Rx +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + +extension NSObject { + + /** + Specialization of generic `rx_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. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func rx_observe(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable { + return rx_observe(E.KVOType.self, keyPath, options: options, retainSelf: retainSelf) + .map(E.init) + } +} + +#if !DISABLE_SWIZZLING + // KVO + extension NSObject { + /** + Specialization of generic `rx_observeWeakly` method. + + For more information take a look at `rx_observeWeakly` method. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func rx_observeWeakly(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable { + return rx_observeWeakly(E.KVOType.self, keyPath, options: options) + .map(E.init) + } + } +#endif diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+RawRepresentable.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+RawRepresentable.swift new file mode 100644 index 0000000..7ff37f4 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+RawRepresentable.swift @@ -0,0 +1,51 @@ +// +// NSObject+Rx+RawRepresentable.swift +// Rx +// +// Created by Krunoslav Zaher on 11/9/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + +extension NSObject { + /** + Specialization of generic `rx_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. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func rx_observe(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable { + return rx_observe(E.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf) + .map(E.init) + } +} + +#if !DISABLE_SWIZZLING + + // rx_observeWeakly + RawRepresentable + extension NSObject { + + /** + Specialization of generic `rx_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. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func rx_observeWeakly(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable { + return rx_observeWeakly(E.RawValue.KVOType.self, keyPath, options: options) + .map(E.init) + } + } +#endif diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx.swift new file mode 100644 index 0000000..263647d --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx.swift @@ -0,0 +1,240 @@ +// +// NSObject+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +#if !DISABLE_SWIZZLING +var deallocatingSubjectTriggerContext: UInt8 = 0 +var deallocatingSubjectContext: UInt8 = 0 +#endif +var deallocatedSubjectTriggerContext: UInt8 = 0 +var deallocatedSubjectContext: UInt8 = 0 + +/** +KVO is a tricky mechanism. + +When observing child in a ownership hierarchy, usually retaining observing target is wanted behavior. +When observing parent in a ownership hierarchy, usually retaining target isn't wanter behavior. + +KVO with weak references is especially tricky. For it to work, some kind of swizzling is required. +That can be done by + * replacing object class dynamically (like KVO does) + * by swizzling `dealloc` method on all instances for a class. + * some third method ... + +Both approaches can fail in certain scenarios: + * problems arise when swizzlers return original object class (like KVO does when nobody is observing) + * Problems can arise because replacing dealloc method isn't atomic operation (get implementation, + set implementation). + +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 { + + + /** + 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. + + * 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. + + - 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(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable { + return KVOObservable(object: self, keyPath: keyPath, options: options, retainTarget: retainSelf).asObservable() + } +} + +#if !DISABLE_SWIZZLING +// KVO +extension 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 + + * 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 + + **Since it needs to intercept object deallocation process it needs to perform swizzling of `dealloc` method on observed object.** + + - parameter keyPath: Key path of property names to observe. + - 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(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable { + return observeWeaklyKeyPathFor(self, keyPath: keyPath, options: options) + .map { n in + return n as? E + } + } +} +#endif + +// Dealloc +extension NSObject { + + /** + Observable sequence of object deallocated events. + + After object is deallocated one `()` element will be produced and sequence will immediately complete. + + - returns: Observable sequence of object deallocated events. + */ + public var rx_deallocated: Observable { + return rx_synchronized { + if let deallocObservable = objc_getAssociatedObject(self, &deallocatedSubjectContext) as? DeallocObservable { + return deallocObservable._subject + } + + let deallocObservable = DeallocObservable() + + objc_setAssociatedObject(self, &deallocatedSubjectContext, deallocObservable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + return deallocObservable._subject + } + } + +#if !DISABLE_SWIZZLING + + /** + Observable sequence of message arguments that completes when object is deallocated. + + In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`. + + In case some argument is `nil`, instance of `NSNull()` will be sent. + + - returns: Observable sequence of object deallocating events. + */ + public func rx_sentMessage(selector: Selector) -> Observable<[AnyObject]> { + return rx_synchronized { + // in case of dealloc selector replay subject behavior needs to be used + if selector == deallocSelector { + return rx_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 { + subject = existingSubject + } + else { + subject = MessageSentObservable() + objc_setAssociatedObject( + self, + selectorReference, + subject, + .OBJC_ASSOCIATION_RETAIN_NONATOMIC + ) + } + + if subject.isActive { + return subject.asObservable() + } + + var error: NSError? + let targetImplementation = RX_ensure_observing(self, selector, &error) + if targetImplementation == nil { + return Observable.error(error?.rxCocoaErrorForTarget(self) ?? RxCocoaError.Unknown) + } + + subject.targetImplementation = targetImplementation + return subject.asObservable() + } + } + + /** + Observable sequence of object deallocating events. + + When `dealloc` message is sent to `self` one `()` element will be produced and after object is deallocated sequence + will immediately complete. + + In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`. + + - returns: Observable sequence of object deallocating events. + */ + public var rx_deallocating: Observable<()> { + return rx_synchronized { + + let subject: DeallocatingObservable + if let existingSubject = objc_getAssociatedObject(self, rxDeallocatingSelectorReference) as? DeallocatingObservable { + subject = existingSubject + } + else { + subject = DeallocatingObservable() + objc_setAssociatedObject( + self, + rxDeallocatingSelectorReference, + subject, + .OBJC_ASSOCIATION_RETAIN_NONATOMIC + ) + } + + if subject.isActive { + return subject.asObservable() + } + + var error: NSError? + let targetImplementation = RX_ensure_observing(self, deallocSelector, &error) + if targetImplementation == nil { + return Observable.error(error?.rxCocoaErrorForTarget(self) ?? RxCocoaError.Unknown) + } + + subject.targetImplementation = targetImplementation + return subject.asObservable() + } + } +#endif +} + +let deallocSelector = NSSelectorFromString("dealloc") +let rxDeallocatingSelector = RX_selector(deallocSelector) +let rxDeallocatingSelectorReference = RX_reference_from_selector(rxDeallocatingSelector) + +extension NSObject { + func rx_synchronized(@noescape action: () -> T) -> T { + objc_sync_enter(self) + let result = action() + objc_sync_exit(self) + return result + } +} + +extension NSObject { + /** + 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(key: UnsafePointer, createCachedObservable: () -> T) -> T { + if let value = objc_getAssociatedObject(self, key) { + return value as! T + } + + let observable = createCachedObservable() + + objc_setAssociatedObject(self, key, observable, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC) + + return observable + } +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/Observables/NSURLSession+Rx.swift b/Pods/RxCocoa/RxCocoa/Common/Observables/NSURLSession+Rx.swift new file mode 100644 index 0000000..99bceaa --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Observables/NSURLSession+Rx.swift @@ -0,0 +1,240 @@ +// +// NSURLSession+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +/** +RxCocoa URL errors. +*/ +public enum RxCocoaURLError + : ErrorType + , CustomDebugStringConvertible { + /** + Unknown error occurred. + */ + case Unknown + /** + Response is not NSHTTPURLResponse + */ + case NonHTTPResponse(response: NSURLResponse) + /** + Response is not successful. (not in `200 ..< 300` range) + */ + case HTTPRequestFailed(response: NSHTTPURLResponse, data: NSData?) + /** + Deserialization error. + */ + case DeserializationError(error: ErrorType) +} + +public extension RxCocoaURLError { + /** + A textual representation of `self`, suitable for debugging. + */ + public var debugDescription: String { + switch self { + case .Unknown: + return "Unknown error has occurred." + case let .NonHTTPResponse(response): + return "Response is not NSHTTPURLResponse `\(response)`." + case let .HTTPRequestFailed(response, _): + return "HTTP request failed with `\(response.statusCode)`." + 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 convertURLRequestToCurlCommand(request: NSURLRequest) -> 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 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) ?? "") + returnValue += "\n -H \"\(escapedKey): \(escapedValue)\" " + } + + let URLString = request.URL?.absoluteString ?? "" + + returnValue += "\n\"\(escapeTerminalString(URLString))\"" + + returnValue += " -i -v" + + return returnValue +} + +func convertResponseToString(data: NSData!, _ response: NSURLResponse!, _ error: NSError!, _ interval: NSTimeInterval) -> String { + let ms = Int(interval * 1000) + + if let response = response as? NSHTTPURLResponse { + if 200 ..< 300 ~= response.statusCode { + return "Success (\(ms)ms): Status \(response.statusCode)" + } + else { + return "Failure (\(ms)ms): Status \(response.statusCode)" + } + } + + if let error = error { + if error.domain == NSURLErrorDomain && error.code == NSURLErrorCancelled { + return "Cancelled (\(ms)ms)" + } + return "Failure (\(ms)ms): NSError > \(error)" + } + + return "" +} + +extension NSURLSession { + /** + Observable sequence of responses for URL request. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + - 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)> { + return Observable.create { observer in + + // smart compiler should be able to optimize this out + var d: NSDate? + + if Logging.URLRequests(request) { + d = NSDate() + } + + let task = self.dataTaskWithRequest(request) { (data, response, error) in + + if Logging.URLRequests(request) { + let interval = NSDate().timeIntervalSinceDate(d ?? NSDate()) + print(convertURLRequestToCurlCommand(request)) + print(convertResponseToString(data, response, error, interval)) + } + + guard let response = response, data = data else { + observer.on(.Error(error ?? RxCocoaURLError.Unknown)) + return + } + + guard let httpResponse = response as? NSHTTPURLResponse else { + observer.on(.Error(RxCocoaURLError.NonHTTPResponse(response: response))) + return + } + + observer.on(.Next(data, httpResponse)) + observer.on(.Completed) + } + + + let t = task + t.resume() + + return AnonymousDisposable { + task.cancel() + } + } + } + + /** + Observable sequence of response data for URL request. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + If response is not HTTP response with status code in the range of `200 ..< 300`, sequence + will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`. + + - 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 { + return rx_response(request).map { (data, response) -> NSData in + if 200 ..< 300 ~= response.statusCode { + return data + } + else { + throw RxCocoaURLError.HTTPRequestFailed(response: response, data: data) + } + } + } + + /** + Observable sequence of response JSON for URL request. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + If response is not HTTP response with status code in the range of `200 ..< 300`, sequence + will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`. + + If there is an error during JSON deserialization observable sequence will fail with that error. + + - 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 { + return rx_data(request).map { (data) -> AnyObject in + do { + return try NSJSONSerialization.JSONObjectWithData(data, options: []) + } catch let error { + throw RxCocoaURLError.DeserializationError(error: error) + } + } + } + + /** + Observable sequence of response JSON for GET request with `URL`. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + If response is not HTTP response with status code in the range of `200 ..< 300`, sequence + will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`. + + If there is an error during JSON deserialization observable sequence will fail with that error. + + - 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 { + return rx_JSON(NSURLRequest(URL: URL)) + } +} diff --git a/Pods/RxCocoa/RxCocoa/Common/Proxies/RxCLLocationManagerDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/Common/Proxies/RxCLLocationManagerDelegateProxy.swift new file mode 100644 index 0000000..5ab7dd6 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/Proxies/RxCLLocationManagerDelegateProxy.swift @@ -0,0 +1,27 @@ +// +// RxCLLocationManagerDelegateProxy.swift +// RxCocoa +// +// Created by Carlos García on 8/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import CoreLocation +#if !RX_NO_MODULE +import RxSwift +#endif + +class RxCLLocationManagerDelegateProxy : DelegateProxy + , CLLocationManagerDelegate + , DelegateProxyType { + + class func currentDelegateFor(object: AnyObject) -> AnyObject? { + let locationManager: CLLocationManager = castOrFatalError(object) + return locationManager.delegate + } + + class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { + let locationManager: CLLocationManager = castOrFatalError(object) + locationManager.delegate = castOptionalOrFatalError(delegate) + } +} diff --git a/Pods/RxCocoa/RxCocoa/Common/RxCocoa.swift b/Pods/RxCocoa/RxCocoa/Common/RxCocoa.swift new file mode 100644 index 0000000..9c58d6c --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/RxCocoa.swift @@ -0,0 +1,343 @@ +// +// RxCocoa.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +#if os(iOS) + import UIKit +#endif + +/** +RxCocoa errors. +*/ +public enum RxCocoaError + : ErrorType + , CustomDebugStringConvertible { + /** + Unknown error has occurred. + */ + case Unknown + /** + Invalid operation was attempted. + */ + case InvalidOperation(object: AnyObject) + /** + Items are not yet bound to user interface but have been requested. + */ + case ItemsNotYetBound(object: AnyObject) + /** + Invalid KVO Path. + */ + case InvalidPropertyName(object: AnyObject, propertyName: String) + /** + Invalid object on key path. + */ + case InvalidObjectOnKeyPath(object: AnyObject, sourceObject: AnyObject, propertyName: String) + /** + Error during swizzling. + */ + case ErrorDuringSwizzling + /* + Casting error. + */ + case CastingError(object: AnyObject, targetType: Any.Type) +} + +#if !DISABLE_SWIZZLING +/** +RxCocoa ObjC runtime interception mechanism. + */ +public enum RxCocoaInterceptionMechanism { + /** + Unknown message interception mechanism. + */ + case Unknown + /** + Key value observing interception mechanism. + */ + case KVO +} + +/** +RxCocoa ObjC runtime modification errors. + */ +public enum RxCocoaObjCRuntimeError + : ErrorType + , CustomDebugStringConvertible { + /** + Unknown error has occurred. + */ + 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`. + + This error is easily resolved by just using `rx_sentMessage` observing before `rx_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 + subclass registered in hierarchy or not. + + 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`) + * 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 + should return object's original real class (if that doesn't happen then it's really easy to argue that's a bug + in that interception mechanism). + + This library won't remove registered interceptor even if there aren't any observers left because + 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) + + /** + Trying to observe messages for selector that isn't implemented. + */ + case SelectorNotImplemented(target: AnyObject) + + /** + Core Foundation classes are usually toll free bridged. Those classes crash the program in case + `object_setClass` is performed on them. + + 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) + + /** + Two libraries have simultaneously tried to modify ObjC runtime and that was detected. This can only + happen in scenarios where multiple interception libraries are used. + + To synchronize other libraries intercepting messages for an object, use `synchronized` on target object and + it's meta-class. + */ + case ThreadingCollisionWithOtherInterceptionMechanism(target: AnyObject) + + /** + For some reason saving original method implementation under RX namespace failed. + */ + case SavingOriginalForwardingMethodFailed(target: AnyObject) + + /** + Intercepting a sent message by replacing a method implementation with `_objc_msgForward` failed for some reason. + */ + case ReplacingMethodWithForwardingImplementation(target: AnyObject) + + /** + Attempt to intercept one of the performance sensitive methods: + * class + * respondsToSelector: + * methodSignatureForSelector: + * forwardingTargetForSelector: + */ + case ObservingPerformanceSensitiveMessages(target: AnyObject) + + /** + Message implementation has unsupported return type (for example large struct). The reason why this is a error + is because in some cases intercepting sent messages requires replacing implementation with `_objc_msgForward_stret` + instead of `_objc_msgForward`. + + The unsupported cases should be fairly uncommon. + */ + case ObservingMessagesWithUnsupportedReturnType(target: AnyObject) +} + +#endif + +// MARK: Debug descriptions + +public extension RxCocoaError { + /** + A textual representation of `self`, suitable for debugging. + */ + public var debugDescription: String { + switch self { + case .Unknown: + return "Unknown error occurred." + case let .InvalidOperation(object): + return "Invalid operation was attempted on `\(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): + return "Object `\(object)` dosn't have a property named `\(propertyName)`." + case let .InvalidObjectOnKeyPath(object, sourceObject, propertyName): + return "Unobservable object `\(object)` was observed as `\(propertyName)` of `\(sourceObject)`." + case .ErrorDuringSwizzling: + return "Error during swizzling." + case .CastingError(let object, let targetType): + return "Error casting `\(object)` to `\(targetType)`" + } + } +} + +#if !DISABLE_SWIZZLING + +public extension RxCocoaObjCRuntimeError { + /** + A textual representation of `self`, suitable for debugging. + */ + public var debugDescription: String { + switch self { + case let .Unknown(target): + return "Unknown error occurred.\nTarget: `\(target)`" + 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): + return "Trying to observe messages for selector that isn't implemented.\nTarget: \(target)" + case let CantInterceptCoreFoundationTollFreeBridgedObjects(target): + return "Interception of messages sent to Core Foundation isn't supported.\nTarget: \(target)" + case let ThreadingCollisionWithOtherInterceptionMechanism(target): + return "Detected a conflict while modifying ObjC runtime.\nTarget: \(target)" + case let SavingOriginalForwardingMethodFailed(target): + return "Saving original method implementation failed.\nTarget: \(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): + return "Attempt to intercept one of the performance sensitive methods. \nTarget: \(target)" + case let ObservingMessagesWithUnsupportedReturnType(target): + return "Attempt to intercept a method with unsupported return type. \nTarget: \(target)" + } + } +} + +#endif + +// MARK: Error binding policies + +func bindingErrorToInterface(error: ErrorType) { + let error = "Binding error to UI: \(error)" +#if DEBUG + rxFatalError(error) +#else + print(error) +#endif +} + +// MARK: Abstract methods + +@noreturn func rxAbstractMethodWithMessage(message: String) { + rxFatalError(message) +} + +@noreturn func rxAbstractMethod() { + rxFatalError("Abstract method") +} + +// MARK: casts or fatal error + +// workaround for Swift compiler bug, cheers compiler team :) +func castOptionalOrFatalError(value: AnyObject?) -> T? { + if value == nil { + return nil + } + let v: T = castOrFatalError(value) + return v +} + +func castOrThrow(resultType: T.Type, _ object: AnyObject) throws -> T { + guard let returnValue = object as? T else { + throw RxCocoaError.CastingError(object: object, targetType: resultType) + } + + return returnValue +} + +func castOptionalOrThrow(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) + } + + return returnValue +} + +func castOrFatalError(value: AnyObject!, message: String) -> T { + let maybeResult: T? = value as? T + guard let result = maybeResult else { + rxFatalError(message) + } + + return result +} + +func castOrFatalError(value: Any!) -> T { + let maybeResult: T? = value as? T + guard let result = maybeResult else { + rxFatalError("Failure converting from \(value) to \(T.self)") + } + + return result +} + +// MARK: Error messages + +let dataSourceNotSet = "DataSource not set" +let delegateNotSet = "Delegate not set" + +#if !DISABLE_SWIZZLING + +// MARK: Conversions `NSError` > `RxCocoaObjCRuntimeError` + +extension NSError { + func rxCocoaErrorForTarget(target: AnyObject) -> RxCocoaObjCRuntimeError { + if domain == RXObjCRuntimeErrorDomain { + let errorCode = RXObjCRuntimeError(rawValue: self.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) + } + } + + return RxCocoaObjCRuntimeError.Unknown(target: target) + } +} + +#endif + + +// MARK: Shared with RxSwift + +#if !RX_NO_MODULE + +@noreturn func rxFatalError(lastMessage: String) { + // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours. + fatalError(lastMessage) +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift b/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift new file mode 100644 index 0000000..f9fe14c --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift @@ -0,0 +1,44 @@ +// +// RxTarget.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif + +class RxTarget : NSObject + , Disposable { + + private var retainSelf: RxTarget? + + override init() { + super.init() + self.retainSelf = self + +#if TRACE_RESOURCES + OSAtomicIncrement32(&resourceCount) +#endif + +#if DEBUG + MainScheduler.ensureExecutingOnScheduler() +#endif + } + + func dispose() { +#if DEBUG + MainScheduler.ensureExecutingOnScheduler() +#endif + self.retainSelf = nil + } + +#if TRACE_RESOURCES + deinit { + OSAtomicDecrement32(&resourceCount) + } +#endif +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift b/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift new file mode 100644 index 0000000..e4d52d3 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift @@ -0,0 +1,24 @@ +// +// SectionedViewDataSourceType.swift +// Rx +// +// Created by Krunoslav Zaher on 1/10/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Data source with access to underlying sectioned model. +*/ +public protocol 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. + */ + func modelAtIndexPath(indexPath: NSIndexPath) throws -> Any +} \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/_RX.h b/Pods/RxCocoa/RxCocoa/Common/_RX.h new file mode 100644 index 0000000..28d2de6 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RX.h @@ -0,0 +1,133 @@ +// +// _RX.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import +#import + +/** + ################################################################################ + This file is part of RX private API + ################################################################################ + */ + +#if TRACE_RESOURCES >= 2 +# define DLOG(...) NSLog(__VA_ARGS__) +#else +# define DLOG(...) +#endif + +#if DEBUG +# define ABORT_IN_DEBUG abort(); +#else +# define ABORT_IN_DEBUG +#endif + + +#define SEL_VALUE(x) [NSValue valueWithPointer:(x)] +#define CLASS_VALUE(x) [NSValue valueWithNonretainedObject:(x)] +#define IMP_VALUE(x) [NSValue valueWithPointer:(x)] + +// Inspired by http://p99.gforge.inria.fr + +// https://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_1.html#SEC26 +#define RX_CAT2(_1, _2) _RX_CAT2(_1, _2) + +#define RX_ELEMENT_AT(n, ...) RX_CAT2(_RX_ELEMENT_AT_, n)(__VA_ARGS__) + +#define RX_COUNT(...) RX_ELEMENT_AT(6, ## __VA_ARGS__, 6, 5, 4, 3, 2, 1, 0) + +/** + #define JOIN(context, index, head, tail) head; tail + #define APPLY(context, index, item) item = (context)[index] + + RX_FOR(A, JOIN, APPLY, toto, tutu); + + toto = (A)[0]; tutu = (A)[1]; + */ +#define RX_FOR(context, join, generate, ...) RX_CAT2( _RX_FOR_, RX_COUNT(__VA_ARGS__))(context, 0, join, generate, ## __VA_ARGS__) + +/** + #define JOIN(context, index, head, tail) head tail + #define APPLY(context, index, item) item = (context)[index] + + RX_FOR(A, JOIN, APPLY, toto, tutu); + + , toto = (A)[0], tutu = (A)[1] + */ +#define RX_FOR_COMMA(context, generate, ...) RX_CAT2( _RX_FOR_COMMA_, RX_COUNT(__VA_ARGS__))(context, 0, generate, ## __VA_ARGS__) + +#define RX_INC(x) RX_CAT2(_RX_INC_, x) + +// element at + +#define _RX_ELEMENT_AT_0(x, ...) x +#define _RX_ELEMENT_AT_1(_0, x, ...) x +#define _RX_ELEMENT_AT_2(_0, _1, x, ...) x +#define _RX_ELEMENT_AT_3(_0, _1, _2, x, ...) x +#define _RX_ELEMENT_AT_4(_0, _1, _2, _3, x, ...) x +#define _RX_ELEMENT_AT_5(_0, _1, _2, _3, _4, x, ...) x +#define _RX_ELEMENT_AT_6(_0, _1, _2, _3, _4, _5, x, ...) x + +// rx for + +#define _RX_FOR_0(context, index, join, generate) + +#define _RX_FOR_1(context, index, join, generate, head) \ + generate(context, index, head) + +#define _RX_FOR_2(context, index, join, generate, head, ...) \ + join(context, index, generate(context, index, head), _RX_FOR_1(context, RX_INC(index), join, generate, __VA_ARGS__)) + +#define _RX_FOR_3(context, index, join, generate, head, ...) \ + join(context, index, generate(context, index, head), _RX_FOR_2(context, RX_INC(index), join, generate, __VA_ARGS__)) + +#define _RX_FOR_4(context, index, join, generate, head, ...) \ + join(context, index, generate(context, index, head), _RX_FOR_3(context, RX_INC(index), join, generate, __VA_ARGS__)) + +#define _RX_FOR_5(context, index, join, generate, head, ...) \ + join(context, index, generate(context, index, head), _RX_FOR_4(context, RX_INC(index), join, generate, __VA_ARGS__)) + +#define _RX_FOR_6(context, index, join, generate, head, ...) \ + join(context, index, generate(context, index, head), _RX_FOR_5(context, RX_INC(index), join, generate, __VA_ARGS__)) + +// rx for + +#define _RX_FOR_COMMA_0(context, index, generate) + +#define _RX_FOR_COMMA_1(context, index, generate, head) \ + , generate(context, index, head) + +#define _RX_FOR_COMMA_2(context, index, generate, head, ...) \ + , generate(context, index, head) _RX_FOR_COMMA_1(context, RX_INC(index), generate, __VA_ARGS__) + +#define _RX_FOR_COMMA_3(context, index, generate, head, ...) \ + , generate(context, index, head) _RX_FOR_COMMA_2(context, RX_INC(index), generate, __VA_ARGS__) + +#define _RX_FOR_COMMA_4(context, index, generate, head, ...) \ + , generate(context, index, head) _RX_FOR_COMMA_3(context, RX_INC(index), generate, __VA_ARGS__) + +#define _RX_FOR_COMMA_5(context, index, generate, head, ...) \ + , generate(context, index, head) _RX_FOR_COMMA_4(context, RX_INC(index), generate, __VA_ARGS__) + +#define _RX_FOR_COMMA_6(context, index, generate, head, ...) \ + , generate(context, index, head) _RX_FOR_COMMA_5(context, RX_INC(index), generate, __VA_ARGS__) + + +// rx inc + +#define _RX_INC_0 1 +#define _RX_INC_1 2 +#define _RX_INC_2 3 +#define _RX_INC_3 4 +#define _RX_INC_4 5 +#define _RX_INC_5 6 +#define _RX_INC_6 7 + +// rx cat + +#define _RX_CAT2(_1, _2) _1 ## _2 \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/_RX.m b/Pods/RxCocoa/RxCocoa/Common/_RX.m new file mode 100644 index 0000000..4c5ffe7 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RX.m @@ -0,0 +1,10 @@ +// +// _RX.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import "_RX.h" + diff --git a/Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.h b/Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.h new file mode 100644 index 0000000..718636b --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.h @@ -0,0 +1,21 @@ +// +// _RXDelegateProxy.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import + +@interface _RXDelegateProxy : NSObject + +@property (nonatomic, assign, readonly) id _forwardToDelegate; + +-(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate; + +-(BOOL)hasWiredImplementationForSelector:(SEL)selector; + +-(void)interceptedSelector:(SEL)selector withArguments:(NSArray*)arguments; + +@end diff --git a/Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.m b/Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.m new file mode 100644 index 0000000..581fbab --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RXDelegateProxy.m @@ -0,0 +1,135 @@ +// +// _RXDelegateProxy.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import "_RXDelegateProxy.h" +#import "_RX.h" +#import "_RXObjCRuntime.h" + +@interface _RXDelegateProxy () + +@property (nonatomic, strong) id strongForwardDelegate; + +@end + +static NSMutableDictionary *forwardableSelectorsPerClass = nil; + +@implementation _RXDelegateProxy + ++(NSSet*)collectSelectorsForProtocol:(Protocol *)protocol { + NSMutableSet *selectors = [NSMutableSet set]; + + unsigned int protocolMethodCount = 0; + struct objc_method_description *pMethods = protocol_copyMethodDescriptionList(protocol, NO, YES, &protocolMethodCount); + + for (unsigned int i = 0; i < protocolMethodCount; ++i) { + struct objc_method_description method = pMethods[i]; + if (RX_is_method_with_description_void(method)) { + [selectors addObject:SEL_VALUE(method.name)]; + } + } + + free(pMethods); + + unsigned int numberOfBaseProtocols = 0; + Protocol * __unsafe_unretained * pSubprotocols = protocol_copyProtocolList(protocol, &numberOfBaseProtocols); + + for (unsigned int i = 0; i < numberOfBaseProtocols; ++i) { + [selectors unionSet:[self collectSelectorsForProtocol:pSubprotocols[i]]]; + } + + free(pSubprotocols); + + return selectors; +} + ++(void)initialize { + @synchronized (_RXDelegateProxy.class) { + if (forwardableSelectorsPerClass == nil) { + forwardableSelectorsPerClass = [[NSMutableDictionary alloc] init]; + } + + NSMutableSet *allowedSelectors = [NSMutableSet set]; + +#define CLASS_HIERARCHY_MAX_DEPTH 100 + + NSInteger classHierarchyDepth = 0; + Class targetClass = self; + + for (classHierarchyDepth = 0, targetClass = self; + classHierarchyDepth < CLASS_HIERARCHY_MAX_DEPTH && targetClass != nil; + ++classHierarchyDepth, targetClass = class_getSuperclass(targetClass) + ) { + unsigned int count; + Protocol *__unsafe_unretained *pProtocols = class_copyProtocolList(targetClass, &count); + + for (unsigned int i = 0; i < count; i++) { + NSSet *selectorsForProtocol = [self collectSelectorsForProtocol:pProtocols[i]]; + [allowedSelectors unionSet:selectorsForProtocol]; + } + + free(pProtocols); + } + + if (classHierarchyDepth == CLASS_HIERARCHY_MAX_DEPTH) { + NSLog(@"Detected weird class hierarchy with depth over %d. Starting with this class -> %@", CLASS_HIERARCHY_MAX_DEPTH, self); +#if DEBUG + abort(); +#endif + } + + forwardableSelectorsPerClass[CLASS_VALUE(self)] = allowedSelectors; + } +} + +-(void)interceptedSelector:(SEL)selector withArguments:(NSArray *)arguments { + +} + +-(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate { + __forwardToDelegate = forwardToDelegate; + if (retainDelegate) { + self.strongForwardDelegate = forwardToDelegate; + } + else { + self.strongForwardDelegate = nil; + } +} + +-(BOOL)hasWiredImplementationForSelector:(SEL)selector { + return [super respondsToSelector:selector]; +} + +-(BOOL)canRespondToSelector:(SEL)selector { + @synchronized(_RXDelegateProxy.class) { + NSSet *allowedMethods = forwardableSelectorsPerClass[CLASS_VALUE(self.class)]; + NSAssert(allowedMethods != nil, @"Set of allowed methods not initialized"); + return [allowedMethods containsObject:SEL_VALUE(selector)]; + } +} + +-(BOOL)respondsToSelector:(SEL)aSelector { + return [super respondsToSelector:aSelector] + || [self._forwardToDelegate respondsToSelector:aSelector] + || [self canRespondToSelector:aSelector]; +} + +-(void)forwardInvocation:(NSInvocation *)anInvocation { + if (RX_is_method_signature_void(anInvocation.methodSignature)) { + NSArray *arguments = RX_extract_arguments(anInvocation); + [self interceptedSelector:anInvocation.selector withArguments:arguments]; + } + + if (self._forwardToDelegate && [self._forwardToDelegate respondsToSelector:anInvocation.selector]) { + [anInvocation invokeWithTarget:self._forwardToDelegate]; + } +} + +-(void)dealloc { +} + +@end diff --git a/Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.h b/Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.h new file mode 100644 index 0000000..ec9afd5 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.h @@ -0,0 +1,30 @@ +// +// _RXKVOObserver.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import + +/** + ################################################################################ + This file is part of RX private API + ################################################################################ + */ + +typedef void (^KVOCallback)(id); + +// Exists because if written in Swift, reading unowned is disabled during dealloc process +@interface _RXKVOObserver : NSObject + +-(instancetype)initWithTarget:(id)target + retainTarget:(BOOL)retainTarget + keyPath:(NSString*)keyPath + options:(NSKeyValueObservingOptions)options + callback:(KVOCallback)callback; + +-(void)dispose; + +@end diff --git a/Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.m b/Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.m new file mode 100644 index 0000000..965d189 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RXKVOObserver.m @@ -0,0 +1,54 @@ +// +// _RXKVOObserver.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import "_RXKVOObserver.h" + +@interface _RXKVOObserver () + +@property (nonatomic, unsafe_unretained) id target; +@property (nonatomic, strong ) id retainedTarget; +@property (nonatomic, copy ) NSString *keyPath; +@property (nonatomic, copy ) KVOCallback callback; + +@end + +@implementation _RXKVOObserver + +-(instancetype)initWithTarget:(id)target + retainTarget:(BOOL)retainTarget + keyPath:(NSString*)keyPath + options:(NSKeyValueObservingOptions)options + callback:(void (^)(id))callback { + self = [super init]; + if (!self) return nil; + + self.target = target; + if (retainTarget) { + self.retainedTarget = target; + } + self.keyPath = keyPath; + self.callback = callback; + + [self.target addObserver:self forKeyPath:self.keyPath options:options context:nil]; + + return self; +} + +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + @synchronized(self) { + self.callback(change[NSKeyValueChangeNewKey]); + } +} + +-(void)dispose { + [self.target removeObserver:self forKeyPath:self.keyPath context:nil]; + self.target = nil; + self.retainedTarget = nil; +} + +@end diff --git a/Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.h b/Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.h new file mode 100644 index 0000000..17d8bf0 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.h @@ -0,0 +1,112 @@ +// +// _RXObjCRuntime.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import + +#if !DISABLE_SWIZZLING + +/** + ################################################################################ + This file is part of RX private API + ################################################################################ + */ + +/** + This flag controls `RELEASE` configuration behavior in case race was detecting while modifying + ObjC runtime. + + In case this value is set to `YES`, after runtime race is detected, `abort()` will be called. + Otherwise, only error will be reported using normal error reporting mechanism. + + In `DEBUG` mode `abort` will be always called in case race is detected. + + Races can't happen in case this is the only library modifying ObjC runtime, but in case there are multiple libraries + changing ObjC runtime, race conditions can occur because there is no way to synchronize multiple libraries unaware of + each other. + + To help remedy this situation this library will use `synchronized` on target object and it's meta-class, but + there aren't any guarantees of how other libraries will behave. + + Default value is `NO`. + + */ +extern BOOL RXAbortOnThreadingHazard; + +/** + Error domain for RXObjCRuntime. + */ +extern NSString * __nonnull const RXObjCRuntimeErrorDomain; + +/** + `userInfo` key with additional information is interceptor probably KVO. + */ +extern NSString * __nonnull const RXObjCRuntimeErrorIsKVOKey; + +typedef NS_ENUM(NSInteger, RXObjCRuntimeError) { + RXObjCRuntimeErrorUnknown = 1, + RXObjCRuntimeErrorObjectMessagesAlreadyBeingIntercepted = 2, + RXObjCRuntimeErrorSelectorNotImplemented = 3, + RXObjCRuntimeErrorCantInterceptCoreFoundationTollFreeBridgedObjects = 4, + RXObjCRuntimeErrorThreadingCollisionWithOtherInterceptionMechanism = 5, + RXObjCRuntimeErrorSavingOriginalForwardingMethodFailed = 6, + RXObjCRuntimeErrorReplacingMethodWithForwardingImplementation = 7, + RXObjCRuntimeErrorObservingPerformanceSensitiveMessages = 8, + RXObjCRuntimeErrorObservingMessagesWithUnsupportedReturnType = 9, +}; + +/** + Transforms normal selector into a selector with RX prefix. + */ +SEL _Nonnull RX_selector(SEL _Nonnull selector); + +/** + Transforms selector into a unique pointer (because of Swift conversion rules) + */ +void * __nonnull RX_reference_from_selector(SEL __nonnull selector); + +/** + Protocol that interception observers must implement. + */ +@protocol RXMessageSentObserver + +/** + In case the same selector is being intercepted for a pair of base/sub classes, + this property will differentiate between interceptors that need to fire. + */ +@property (nonatomic, assign, readonly) IMP __nonnull targetImplementation; + +-(void)messageSentWithParameters:(NSArray* __nonnull)parameters; + +@end + +/** + Ensures interceptor is installed on target object. + */ +IMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSError *__nullable * __nonnull error); + +/** + Extracts arguments for `invocation`. + */ +NSArray * __nonnull RX_extract_arguments(NSInvocation * __nonnull invocation); + +/** + Returns `YES` in case method has `void` return type. + */ +BOOL RX_is_method_with_description_void(struct objc_method_description method); + +/** + Returns `YES` in case methodSignature has `void` return type. + */ +BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature); + +/** + Default value for `RXInterceptionObserver.targetImplementation`. + */ +IMP __nonnull RX_default_target_implementation(); + +#endif \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.m b/Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.m new file mode 100644 index 0000000..72e2123 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/Common/_RXObjCRuntime.m @@ -0,0 +1,1022 @@ +// +// _RXObjCRuntime.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import +#import +#import +#import +#import + +#import "_RX.h" +#import "_RXObjcRuntime.h" + +#if !DISABLE_SWIZZLING + +// self + cmd +#define HIDDEN_ARGUMENT_COUNT 2 + +@class RXObjCRuntime; + +BOOL RXAbortOnThreadingHazard = NO; + +typedef NSInvocation *NSInvocationRef; +typedef NSMethodSignature *NSMethodSignatureRef; +typedef unsigned char rx_uchar; +typedef unsigned short rx_ushort; +typedef unsigned int rx_uint; +typedef unsigned long rx_ulong; +typedef id (^rx_block)(id); +typedef BOOL (^RXInterceptWithOptimizedObserver)(RXObjCRuntime * __nonnull self, Class __nonnull class, SEL __nonnull selector, NSError ** __nonnull error); + +static CFTypeID defaultTypeID; +static SEL deallocSelector; + +static int RxSwizzlingTargetClassKey = 0; + +#if TRACE_RESOURCES +static int32_t numberOInterceptedMethods = 0; +static int32_t numberOfForwardedMethods = 0; +#endif + +#define THREADING_HAZARD(class) \ + NSLog(@"There was a problem swizzling on `%@`.\nYou have probably two libraries performing swizzling in runtime.\nWe didn't want to crash your program, but this is not good ...\nYou an solve this problem by either not using swizzling in this library, removing one of those other libraries, or making sure that swizzling parts are synchronized (only perform them on main thread).\nAnd yes, this message will self destruct when you clear the console, and since it's non deterministric, the problem could still exist and it will be hard for you to reproduce it.", NSStringFromClass(class)); ABORT_IN_DEBUG if (RXAbortOnThreadingHazard) { abort(); } + +#define ALWAYS(condition, message) if (!(condition)) { [NSException raise:@"RX Invalid Operator" format:@"%@", message]; } +#define ALWAYS_WITH_INFO(condition, message) NSAssert((condition), @"%@ [%@] > %@", NSStringFromClass(class), NSStringFromSelector(selector), (message)) +#define C_ALWAYS(condition, message) NSCAssert((condition), @"%@ [%@] > %@", NSStringFromClass(class), NSStringFromSelector(selector), (message)) + +#define RX_PREFIX @"_RX_namespace_" + +#define RX_ARG_id(value) ((value) ?: [NSNull null]) +#define RX_ARG_char(value) [NSNumber numberWithChar:value] +#define RX_ARG_short(value) [NSNumber numberWithShort:value] +#define RX_ARG_int(value) [NSNumber numberWithInt:value] +#define RX_ARG_long(value) [NSNumber numberWithLong:value] +#define RX_ARG_BOOL(value) [NSNumber numberWithBool:value] +#define RX_ARG_SEL(value) [NSNumber valueWithPointer:value] +#define RX_ARG_rx_uchar(value) [NSNumber numberWithUnsignedInt:value] +#define RX_ARG_rx_ushort(value) [NSNumber numberWithUnsignedInt:value] +#define RX_ARG_rx_uint(value) [NSNumber numberWithUnsignedInt:value] +#define RX_ARG_rx_ulong(value) [NSNumber numberWithUnsignedLong:value] +#define RX_ARG_rx_block(value) ((id)(value) ?: [NSNull null]) +#define RX_ARG_float(value) [NSNumber numberWithFloat:value] +#define RX_ARG_double(value) [NSNumber numberWithDouble:value] + +typedef struct supported_type { + const char *encoding; +} supported_type_t; + +static supported_type_t supported_types[] = { + { .encoding = @encode(void)}, + { .encoding = @encode(id)}, + { .encoding = @encode(Class)}, + { .encoding = @encode(void (^)())}, + { .encoding = @encode(char)}, + { .encoding = @encode(short)}, + { .encoding = @encode(int)}, + { .encoding = @encode(long)}, + { .encoding = @encode(long long)}, + { .encoding = @encode(unsigned char)}, + { .encoding = @encode(unsigned short)}, + { .encoding = @encode(unsigned int)}, + { .encoding = @encode(unsigned long)}, + { .encoding = @encode(unsigned long long)}, + { .encoding = @encode(float)}, + { .encoding = @encode(double)}, + { .encoding = @encode(BOOL)}, + { .encoding = @encode(const char*)}, +}; + +NSString * __nonnull const RXObjCRuntimeErrorDomain = @"RXObjCRuntimeErrorDomain"; +NSString * __nonnull const RXObjCRuntimeErrorIsKVOKey = @"RXObjCRuntimeErrorIsKVOKey"; + +BOOL RX_return_type_is_supported(const char *type) { + if (type == nil) { + return NO; + } + + for (int i = 0; i < sizeof(supported_types) / sizeof(supported_type_t); ++i) { + if (supported_types[i].encoding[0] != type[0]) { + continue; + } + if (strcmp(supported_types[i].encoding, type) == 0) { + return YES; + } + } + + return NO; +} + +static BOOL RX_method_has_supported_return_type(Method method) { + const char *rawEncoding = method_getTypeEncoding(method); + ALWAYS(rawEncoding != nil, @"Example encoding method is nil."); + + NSMethodSignature *methodSignature = [NSMethodSignature signatureWithObjCTypes:rawEncoding]; + ALWAYS(methodSignature != nil, @"Method signature method is nil."); + + return RX_return_type_is_supported(methodSignature.methodReturnType); +} + +SEL __nonnull RX_selector(SEL __nonnull selector) { + NSString *selectorString = NSStringFromSelector(selector); + return NSSelectorFromString([RX_PREFIX stringByAppendingString:selectorString]); +} + +BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature) { + const char *methodReturnType = methodSignature.methodReturnType; + return strcmp(methodReturnType, @encode(void)) == 0; +} + +BOOL RX_is_method_with_description_void(struct objc_method_description method) { + return strncmp(method.types, @encode(void), 1) == 0; +} + +// inspired by https://github.com/ReactiveCocoa/ReactiveCocoa/blob/swift-development/ReactiveCocoa/Objective-C/NSInvocation%2BRACTypeParsing.m +// awesome work +id __nonnull RX_extract_argument_at_index(NSInvocation * __nonnull invocation, NSUInteger index) { + const char *argumentType = [invocation.methodSignature getArgumentTypeAtIndex:index]; + +#define RETURN_VALUE(type) \ + else if (strcmp(argumentType, @encode(type)) == 0) {\ + type val = 0; \ + [invocation getArgument:&val atIndex:index]; \ + return @(val); \ + } + + // Skip const type qualifier. + if (argumentType[0] == 'r') { + argumentType++; + } + + if (strcmp(argumentType, @encode(id)) == 0 + || strcmp(argumentType, @encode(Class)) == 0 + || strcmp(argumentType, @encode(void (^)())) == 0 + ) { + __unsafe_unretained id argument = nil; + [invocation getArgument:&argument atIndex:index]; + return argument; + } + RETURN_VALUE(char) + RETURN_VALUE(short) + RETURN_VALUE(int) + RETURN_VALUE(long) + RETURN_VALUE(long long) + RETURN_VALUE(unsigned char) + RETURN_VALUE(unsigned short) + RETURN_VALUE(unsigned int) + RETURN_VALUE(unsigned long) + RETURN_VALUE(unsigned long long) + RETURN_VALUE(float) + RETURN_VALUE(double) + RETURN_VALUE(BOOL) + RETURN_VALUE(const char *) + else { + NSUInteger size = 0; + NSGetSizeAndAlignment(argumentType, &size, NULL); + NSCParameterAssert(size > 0); + uint8_t data[size]; + [invocation getArgument:&data atIndex:index]; + + return [NSValue valueWithBytes:&data objCType:argumentType]; + } +} + +NSArray *RX_extract_arguments(NSInvocation *invocation) { + NSUInteger numberOfArguments = invocation.methodSignature.numberOfArguments; + NSUInteger numberOfVisibleArguments = numberOfArguments - HIDDEN_ARGUMENT_COUNT; + + NSCParameterAssert(numberOfVisibleArguments >= 0); + + NSMutableArray *arguments = [NSMutableArray arrayWithCapacity:numberOfVisibleArguments]; + + for (NSUInteger index = HIDDEN_ARGUMENT_COUNT; index < numberOfArguments; ++index) { + [arguments addObject:RX_extract_argument_at_index(invocation, index) ?: [NSNull null]]; + } + + return arguments; +} + +void * __nonnull RX_reference_from_selector(SEL __nonnull selector) { + return selector; +} + +static BOOL RX_forward_invocation(id __nonnull __unsafe_unretained self, NSInvocation *invocation) { + SEL originalSelector = RX_selector(invocation.selector); + + id messageSentObserver = objc_getAssociatedObject(self, originalSelector); + + if (messageSentObserver != nil) { + NSArray *arguments = RX_extract_arguments(invocation); + [messageSentObserver messageSentWithParameters:arguments]; + } + + if ([self respondsToSelector:originalSelector]) { + invocation.selector = originalSelector; + [invocation invokeWithTarget:self]; + return YES; + } + + return NO; +} + +static BOOL RX_responds_to_selector(id __nonnull __unsafe_unretained self, SEL selector) { + Class class = object_getClass(self); + if (class == nil) { return NO; } + + Method m = class_getInstanceMethod(class, selector); + if (m != nil) { return YES; } + + return NO; +} + +static NSMethodSignatureRef RX_method_signature(id __nonnull __unsafe_unretained self, SEL selector) { + Class class = object_getClass(self); + if (class == nil) { return nil; } + + Method method = class_getInstanceMethod(class, selector); + if (method == nil) { return nil; } + + const char *encoding = method_getTypeEncoding(method); + if (encoding == nil) { return nil; } + + return [NSMethodSignature signatureWithObjCTypes:encoding]; +} + +static NSString * __nonnull RX_method_encoding(Method __nonnull method) { + const char *typeEncoding = method_getTypeEncoding(method); + ALWAYS(typeEncoding != nil, @"Method encoding is nil."); + + NSString *encoding = [NSString stringWithCString:typeEncoding encoding:NSASCIIStringEncoding]; + ALWAYS(encoding != nil, @"Can't convert encoding to NSString."); + return encoding; +} + +// inspired by +// https://github.com/mikeash/MAZeroingWeakRef/blob/master/Source/MAZeroingWeakRef.m +// https://github.com/ReactiveCocoa/ReactiveCocoa/blob/swift-development/ReactiveCocoa/Objective-C/NSObject%2BRACDeallocating.m +// https://github.com/steipete/Aspects +@interface RXObjCRuntime: NSObject + +@property (nonatomic, assign) pthread_mutex_t lock; + +@property (nonatomic, strong) NSMutableSet *classesThatSupportObservingByForwarding; +@property (nonatomic, strong) NSMutableDictionary *> *forwardedSelectorsByClass; + +@property (nonatomic, strong) NSMutableDictionary *dynamicSublassByRealClass; +@property (nonatomic, strong) NSMutableDictionary*> *interceptorIMPbySelectorsByClass; + ++(RXObjCRuntime*)instance; + +-(void)performLocked:(void (^)(RXObjCRuntime* __nonnull))action; +-(IMP __nullable)ensurePrepared:(id __nonnull)target forObserving:(SEL __nonnull)selector error:(NSError** __nonnull)error; +-(BOOL)ensureSwizzledSelector:(SEL __nonnull)selector + ofClass:(Class __nonnull)class + newImplementationGenerator:(IMP(^)())newImplementationGenerator +replacementImplementationGenerator:(IMP (^)(IMP originalImplemenation))replacementImplementationGenerator + error:(NSError ** __nonnull)error; + + ++(void)registerOptimizedObserver:(RXInterceptWithOptimizedObserver)registration encodedAs:(SEL)selector; + +@end + +/** + All API methods perform work on locked instance of `RXObjCRuntime`. In that way it's easy to prove + that every action is properly locked. + */ +IMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSError ** __nonnull error) { + __block IMP __nonnull targetImplementation = nil; + // Target is the second object that needs to be synchronized to TRY to make sure other swizzling framework + // won't do something in parallel. + // Even though this is too fine grained locking and more coarse grained locks should exist, this is just in case + // someone calls this method directly without any external lock. + @synchronized(target) { + // The only other resource that all other swizzling libraries have in common without introducing external + // dependencies is class object. + // + // It is polite to try to synchronize it in hope other unknown entities will also attempt to do so. + // It's like trying to figure out how to communicate with aliens without actually communicating, + // save for the fact that aliens are people, programmers, authors of swizzling libraries. + @synchronized([target class]) { + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + targetImplementation = [self ensurePrepared:target + forObserving:selector + error:error]; + }]; + } + } + + return targetImplementation; +} + +IMP __nonnull RX_default_target_implementation() { + return _objc_msgForward; +} + +// bodies + +#define FORWARD_BODY(invocation) if (RX_forward_invocation(self, NAME_CAT(_, 0, invocation))) { return; } + +#define RESPONDS_TO_SELECTOR_BODY(selector) if (RX_responds_to_selector(self, NAME_CAT(_, 0, selector))) return YES; + +#define CLASS_BODY(...) return actAsClass; + +#define METHOD_SIGNATURE_FOR_SELECTOR_BODY(selector) \ + NSMethodSignatureRef methodSignature = RX_method_signature(self, NAME_CAT(_, 0, selector)); \ + if (methodSignature != nil) { \ + return methodSignature; \ + } + +#define DEALLOCATING_BODY(...) \ + id observer = objc_getAssociatedObject(self, rxSelector); \ + if (observer != nil && observer.targetImplementation == thisIMP) { \ + [observer messageSentWithParameters:@[]]; \ + } + +#define OBSERVE_BODY(...) \ + id observer = objc_getAssociatedObject(self, rxSelector); \ + \ + if (observer != nil && observer.targetImplementation == thisIMP) { \ + [observer messageSentWithParameters:@[COMMA_DELIMITED_ARGUMENTS(__VA_ARGS__)]]; \ + } \ + + +#define BUILD_ARG_WRAPPER(type) RX_ARG_ ## type //RX_ARG_ ## type + +#define CAT(_1, _2, head, tail) RX_CAT2(head, tail) +#define SEPARATE_BY_COMMA(_1, _2, head, tail) head, tail +#define SEPARATE_BY_SPACE(_1, _2, head, tail) head tail +#define SEPARATE_BY_UNDERSCORE(head, tail) RX_CAT2(RX_CAT2(head, _), tail) + +#define UNDERSCORE_TYPE_CAT(_1, index, type) RX_CAT2(_, type) // generates -> _type +#define NAME_CAT(_1, index, type) SEPARATE_BY_UNDERSCORE(type, index) // generates -> type_0 +#define TYPE_AND_NAME_CAT(_1, index, type) type SEPARATE_BY_UNDERSCORE(type, index) // generates -> type type_0 +#define NOT_NULL_ARGUMENT_CAT(_1, index, type) BUILD_ARG_WRAPPER(type)(NAME_CAT(_1, index, type)) // generates -> ((id)(type_0) ?: [NSNull null]) +#define EXAMPLE_PARAMETER(_1, index, type) RX_CAT2(_, type):(type)SEPARATE_BY_UNDERSCORE(type, index) // generates -> _type:(type)type_0 +#define SELECTOR_PART(_1, index, type) RX_CAT2(_, type:) // generates -> _type: + +#define COMMA_DELIMITED_ARGUMENTS(...) RX_FOR(_, SEPARATE_BY_COMMA, NOT_NULL_ARGUMENT_CAT, ## __VA_ARGS__) +#define ARGUMENTS(...) RX_FOR_COMMA(_, NAME_CAT, ## __VA_ARGS__) +#define DECLARE_ARGUMENTS(...) RX_FOR_COMMA(_, TYPE_AND_NAME_CAT, ## __VA_ARGS__) + +// optimized observe methods + +#define GENERATE_METHOD_IDENTIFIER(...) RX_CAT2(swizzle, RX_FOR(_, CAT, UNDERSCORE_TYPE_CAT, ## __VA_ARGS__)) + +#define GENERATE_OBSERVE_METHOD_DECLARATION(...) \ + -(BOOL)GENERATE_METHOD_IDENTIFIER(__VA_ARGS__):(Class __nonnull)class \ + selector:(SEL)selector \ + error:(NSError ** __nonnull)error { \ + + +#define BUILD_EXAMPLE_METHOD(return_value, ...) \ + +(return_value)RX_CAT2(RX_CAT2(example_, return_value), RX_FOR(_, SEPARATE_BY_SPACE, EXAMPLE_PARAMETER, ## __VA_ARGS__)) {} + +#define BUILD_EXAMPLE_METHOD_SELECTOR(return_value, ...) \ + RX_CAT2(RX_CAT2(example_, return_value), RX_FOR(_, SEPARATE_BY_SPACE, SELECTOR_PART, ## __VA_ARGS__)) + +#define SWIZZLE_OBSERVE_METHOD(return_value, ...) \ + @interface RXObjCRuntime (GENERATE_METHOD_IDENTIFIER(return_value, ## __VA_ARGS__)) \ + @end \ + \ + @implementation RXObjCRuntime(GENERATE_METHOD_IDENTIFIER(return_value, ## __VA_ARGS__)) \ + BUILD_EXAMPLE_METHOD(return_value, ## __VA_ARGS__) \ + SWIZZLE_METHOD(return_value, GENERATE_OBSERVE_METHOD_DECLARATION(return_value, ## __VA_ARGS__), OBSERVE_BODY, ## __VA_ARGS__) \ + \ + +(void)load { \ + __unused SEL exampleSelector = @selector(BUILD_EXAMPLE_METHOD_SELECTOR(return_value, ## __VA_ARGS__)); \ + [self registerOptimizedObserver:^BOOL(RXObjCRuntime * __nonnull self, Class __nonnull class, \ + SEL __nonnull selector, NSError **__nonnull error) { \ + return [self GENERATE_METHOD_IDENTIFIER(return_value, ## __VA_ARGS__):class selector:selector error:error]; \ + } encodedAs:exampleSelector]; \ + } \ + \ + @end \ + +// infrastructure method + +#define SWIZZLE_INFRASTRUCTURE_METHOD(return_value, method_name, parameters, method_selector, body, ...) \ + SWIZZLE_METHOD(return_value, -(BOOL)method_name:(Class __nonnull)class parameters error:(NSError **__nonnull)error \ + { \ + SEL selector = method_selector; , body, __VA_ARGS__) \ + + +// common base + +#define SWIZZLE_METHOD(return_value, method_prototype, body, ...) \ +method_prototype \ + __unused SEL rxSelector = RX_selector(selector); \ + IMP (^newImplementationGenerator)() = ^() { \ + __block IMP thisIMP = nil; \ + id newImplementation = ^return_value(__unsafe_unretained id self DECLARE_ARGUMENTS(__VA_ARGS__)) { \ + body(__VA_ARGS__) \ + \ + struct objc_super superInfo = { \ + .receiver = self, \ + .super_class = class_getSuperclass(class) \ + }; \ + \ + return_value (*msgSend)(struct objc_super *, SEL DECLARE_ARGUMENTS(__VA_ARGS__)) \ + = (__typeof__(msgSend))objc_msgSendSuper; \ + return msgSend(&superInfo, selector ARGUMENTS(__VA_ARGS__)); \ + }; \ + \ + thisIMP = imp_implementationWithBlock(newImplementation); \ + return thisIMP; \ + }; \ + \ + IMP (^replacementImplementationGenerator)(IMP) = ^(IMP originalImplementation) { \ + __block return_value (*originalImplementationTyped)(__unsafe_unretained id, SEL DECLARE_ARGUMENTS(__VA_ARGS__) ) \ + = (__typeof__(originalImplementationTyped))(originalImplementation); \ + \ + __block IMP thisIMP = nil; \ + id implementationReplacement = ^return_value(__unsafe_unretained id self DECLARE_ARGUMENTS(__VA_ARGS__) ) { \ + body(__VA_ARGS__) \ + \ + return originalImplementationTyped(self, selector ARGUMENTS(__VA_ARGS__)); \ + }; \ + \ + thisIMP = imp_implementationWithBlock(implementationReplacement); \ + return thisIMP; \ + }; \ + \ + return [self ensureSwizzledSelector:selector \ + ofClass:class \ + newImplementationGenerator:newImplementationGenerator \ + replacementImplementationGenerator:replacementImplementationGenerator \ + error:error]; \ + } \ + + +@interface RXObjCRuntime (InfrastructureMethods) +@end + +// MARK: Infrastucture Methods + +@implementation RXObjCRuntime (InfrastructureMethods) + +SWIZZLE_INFRASTRUCTURE_METHOD( + void, + swizzleForwardInvocation, + , + @selector(forwardInvocation:), + FORWARD_BODY, + NSInvocationRef +) +SWIZZLE_INFRASTRUCTURE_METHOD( + BOOL, + swizzleRespondsToSelector, + , + @selector(respondsToSelector:), + RESPONDS_TO_SELECTOR_BODY, + SEL +) +SWIZZLE_INFRASTRUCTURE_METHOD( + Class __nonnull, + swizzleClass, + toActAs:(Class)actAsClass, + @selector(class), + CLASS_BODY +) +SWIZZLE_INFRASTRUCTURE_METHOD( + NSMethodSignatureRef, + swizzleMethodSignatureForSelector, + , + @selector(methodSignatureForSelector:), + METHOD_SIGNATURE_FOR_SELECTOR_BODY, + SEL +) +SWIZZLE_INFRASTRUCTURE_METHOD( + void, + swizzleDeallocating, + , + deallocSelector, + DEALLOCATING_BODY +) + +@end + +// MARK: Optimized intercepting methods for specific combination of parameter types + +SWIZZLE_OBSERVE_METHOD(void) + +SWIZZLE_OBSERVE_METHOD(void, id) +SWIZZLE_OBSERVE_METHOD(void, char) +SWIZZLE_OBSERVE_METHOD(void, short) +SWIZZLE_OBSERVE_METHOD(void, int) +SWIZZLE_OBSERVE_METHOD(void, long) +SWIZZLE_OBSERVE_METHOD(void, rx_uchar) +SWIZZLE_OBSERVE_METHOD(void, rx_ushort) +SWIZZLE_OBSERVE_METHOD(void, rx_uint) +SWIZZLE_OBSERVE_METHOD(void, rx_ulong) +SWIZZLE_OBSERVE_METHOD(void, rx_block) +SWIZZLE_OBSERVE_METHOD(void, float) +SWIZZLE_OBSERVE_METHOD(void, double) +SWIZZLE_OBSERVE_METHOD(void, SEL) + +SWIZZLE_OBSERVE_METHOD(void, id, id) +SWIZZLE_OBSERVE_METHOD(void, id, char) +SWIZZLE_OBSERVE_METHOD(void, id, short) +SWIZZLE_OBSERVE_METHOD(void, id, int) +SWIZZLE_OBSERVE_METHOD(void, id, long) +SWIZZLE_OBSERVE_METHOD(void, id, rx_uchar) +SWIZZLE_OBSERVE_METHOD(void, id, rx_ushort) +SWIZZLE_OBSERVE_METHOD(void, id, rx_uint) +SWIZZLE_OBSERVE_METHOD(void, id, rx_ulong) +SWIZZLE_OBSERVE_METHOD(void, id, rx_block) +SWIZZLE_OBSERVE_METHOD(void, id, float) +SWIZZLE_OBSERVE_METHOD(void, id, double) +SWIZZLE_OBSERVE_METHOD(void, id, SEL) + +// MARK: RXObjCRuntime + +@implementation RXObjCRuntime + +static RXObjCRuntime *_instance = nil; +static NSMutableDictionary *optimizedObserversByMethodEncoding = nil; + ++(RXObjCRuntime*)instance { + return _instance; +} + ++(void)initialize { + _instance = [[RXObjCRuntime alloc] init]; + defaultTypeID = CFGetTypeID((CFTypeRef)RXObjCRuntime.class); // just need a reference of some object not from CF + deallocSelector = NSSelectorFromString(@"dealloc"); + NSAssert(_instance != nil, @"Failed to initialize swizzling"); +} + +-(instancetype)init { + self = [super init]; + if (!self) return nil; + + self.classesThatSupportObservingByForwarding = [NSMutableSet set]; + self.forwardedSelectorsByClass = [NSMutableDictionary dictionary]; + + self.dynamicSublassByRealClass = [NSMutableDictionary dictionary]; + self.interceptorIMPbySelectorsByClass = [NSMutableDictionary dictionary]; + + pthread_mutexattr_t lock_attr; + pthread_mutexattr_init(&lock_attr); + pthread_mutexattr_settype(&lock_attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&_lock, &lock_attr); + pthread_mutexattr_destroy(&lock_attr); + + return self; +} + +-(void)performLocked:(void (^)(RXObjCRuntime* __nonnull))action { + pthread_mutex_lock(&_lock); + action(self); + pthread_mutex_unlock(&_lock); +} + ++(void)registerOptimizedObserver:(RXInterceptWithOptimizedObserver)registration encodedAs:(SEL)selector { + Method exampleEncodingMethod = class_getClassMethod(self, selector); + ALWAYS(exampleEncodingMethod != nil, @"Example encoding method is nil."); + + NSString *methodEncoding = RX_method_encoding(exampleEncodingMethod); + + if (optimizedObserversByMethodEncoding == nil) { + optimizedObserversByMethodEncoding = [NSMutableDictionary dictionary]; + } + + DLOG(@"Added optimized method: %@ (%@)", methodEncoding, NSStringFromSelector(selector)); + ALWAYS(optimizedObserversByMethodEncoding[methodEncoding] == nil, @"Optimized observer already registered") + optimizedObserversByMethodEncoding[methodEncoding] = registration; +} + +/** + This is the main entry point for observing messages sent to arbitrary objects. + */ +-(IMP __nullable)ensurePrepared:(id __nonnull)target forObserving:(SEL __nonnull)selector error:(NSError** __nonnull)error { + Method instanceMethod = class_getInstanceMethod([target class], selector); + if (instanceMethod == nil) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorSelectorNotImplemented + userInfo:nil]; + return nil; + } + + if (selector == @selector(class) + || selector == @selector(forwardingTargetForSelector:) + || selector == @selector(methodSignatureForSelector:) + || selector == @selector(respondsToSelector:)) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorObservingPerformanceSensitiveMessages + userInfo:nil]; + return nil; + } + + // For `dealloc` message, original implementation will be swizzled. + // This is a special case because observing `dealloc` message is performed when `rx_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. + if (selector == deallocSelector) { + Class __nonnull deallocSwizzingTarget = [target class]; + IMP interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:deallocSwizzingTarget]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + + if (![self swizzleDeallocating:deallocSwizzingTarget error:error]) { + return nil; + } + + interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:deallocSwizzingTarget]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + } + else { + Class __nullable swizzlingImplementorClass = [self prepareTargetClassForObserving:target error:error]; + if (swizzlingImplementorClass == nil) { + return nil; + } + + NSString *methodEncoding = RX_method_encoding(instanceMethod); + RXInterceptWithOptimizedObserver optimizedIntercept = [optimizedObserversByMethodEncoding objectForKey:methodEncoding]; + + if (!RX_method_has_supported_return_type(instanceMethod)) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorObservingMessagesWithUnsupportedReturnType + userInfo:nil]; + + return nil; + } + + // optimized interception method + if (optimizedIntercept != nil) { + IMP interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:swizzlingImplementorClass]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + + if (!optimizedIntercept(self, swizzlingImplementorClass, selector, error)) { + return nil; + } + + interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:swizzlingImplementorClass]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + } + // default fallback to observing by forwarding messages + else { + if ([self forwardingSelector:selector forClass:swizzlingImplementorClass]) { + return RX_default_target_implementation(); + } + + if (![self observeByForwardingMessages:swizzlingImplementorClass + selector:selector + target:target + error:error]) { + return nil; + } + + if ([self forwardingSelector:selector forClass:swizzlingImplementorClass]) { + return RX_default_target_implementation(); + } + } + } + + + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorUnknown + userInfo:nil]; + + return nil; +} + +-(Class __nullable)prepareTargetClassForObserving:(id __nonnull)target error:(NSError **__nonnull)error { + Class swizzlingClass = objc_getAssociatedObject(target, &RxSwizzlingTargetClassKey); + if (swizzlingClass != nil) { + return swizzlingClass; + } + + Class __nonnull wannaBeClass = [target class]; + /** + Core Foundation classes are usually toll free bridged. Those classes crash the program in case + `object_setClass` is performed on them. + + 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. + */ + BOOL isThisTollFreeFoundationClass = CFGetTypeID((CFTypeRef)target) != defaultTypeID; + + if (isThisTollFreeFoundationClass) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorCantInterceptCoreFoundationTollFreeBridgedObjects + userInfo:nil]; + return nil; + } + + /** + 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`. + + This error is easily resolved by just using `rx_sentMessage` observing before `rx_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 + subclass registered in hierarchy or not. + + 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`) + * 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 + object's original real class (if that doesn't happen then it's really easy to argue that's a bug + in that other library). + + This library won't remove registered interceptor even if there aren't any observers left because + it's highly unlikely it would have any benefit in real world use cases, and it's even more + dangerous. + */ + if ([target class] != object_getClass(target)) { + BOOL isKVO = [target respondsToSelector:NSSelectorFromString(@"_isKVOA")]; + + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorObjectMessagesAlreadyBeingIntercepted + userInfo:@{ + RXObjCRuntimeErrorIsKVOKey: @(isKVO) + }]; + return nil; + } + + Class __nullable dynamicFakeSubclass = [self ensureHasDynamicFakeSubclass:wannaBeClass error:error]; + + if (dynamicFakeSubclass == nil) { + return nil; + } + + Class previousClass = object_setClass(target, dynamicFakeSubclass); + if (previousClass != wannaBeClass) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorThreadingCollisionWithOtherInterceptionMechanism + userInfo:nil]; + THREADING_HAZARD(wannaBeClass); + return nil; + } + + objc_setAssociatedObject(target, &RxSwizzlingTargetClassKey, dynamicFakeSubclass, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + return dynamicFakeSubclass; +} + + +-(BOOL)forwardingSelector:(SEL)selector forClass:(Class __nonnull)class { + return [self.forwardedSelectorsByClass[CLASS_VALUE(class)] containsObject:SEL_VALUE(selector)]; +} + +-(void)registerForwardedSelector:(SEL)selector forClass:(Class __nonnull)class { + NSValue *classValue = CLASS_VALUE(class); + + NSMutableSet *forwardedSelectors = self.forwardedSelectorsByClass[classValue]; + + if (forwardedSelectors == nil) { + forwardedSelectors = [NSMutableSet set]; + self.forwardedSelectorsByClass[classValue] = forwardedSelectors; + } + + [forwardedSelectors addObject:SEL_VALUE(selector)]; +} + +-(BOOL)observeByForwardingMessages:(Class __nonnull)swizzlingImplementorClass + selector:(SEL)selector + target:(id __nonnull)target + error:(NSError **__nonnull)error { + if (![self ensureForwardingMethodsAreSwizzled:swizzlingImplementorClass error:error]) { + return NO; + } + + ALWAYS(![self forwardingSelector:selector forClass:swizzlingImplementorClass], @"Already observing selector for class"); + +#if TRACE_RESOURCES + OSAtomicIncrement32(&numberOfForwardedMethods); +#endif + SEL rxSelector = RX_selector(selector); + + Method instanceMethod = class_getInstanceMethod(swizzlingImplementorClass, selector); + ALWAYS(instanceMethod != nil, @"Instance method is nil"); + + const char* methodEncoding = method_getTypeEncoding(instanceMethod); + ALWAYS(methodEncoding != nil, @"Method encoding is nil."); + NSMethodSignature *methodSignature = [NSMethodSignature signatureWithObjCTypes:methodEncoding]; + ALWAYS(methodSignature != nil, @"Method signature is invalid."); + + IMP implementation = method_getImplementation(instanceMethod); + + if (implementation == nil) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorSelectorNotImplemented + userInfo:nil]; + + return NO; + } + + if (!class_addMethod(swizzlingImplementorClass, rxSelector, implementation, methodEncoding)) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorSavingOriginalForwardingMethodFailed + userInfo:nil]; + return NO; + } + + if (!class_addMethod(swizzlingImplementorClass, selector, _objc_msgForward, methodEncoding)) { + if (implementation != method_setImplementation(instanceMethod, _objc_msgForward)) { + *error = [NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorReplacingMethodWithForwardingImplementation + userInfo:nil]; + THREADING_HAZARD(swizzlingImplementorClass); + return NO; + } + } + + DLOG(@"Rx uses forwarding to observe `%@` for `%@`.", NSStringFromSelector(selector), swizzlingImplementorClass); + [self registerForwardedSelector:selector forClass:swizzlingImplementorClass]; + + return YES; +} + +/** + If object don't have some weird behavior, claims it's the same class that runtime shows, + then dynamic subclass is created (only this instance will have performance hit). + + In case something weird is detected, then original base class is being swizzled and all instances + will have somewhat reduced performance. + + This is especially handy optimization for weak KVO. Nobody will swizzle for example `NSString`, + but to know when instance of a `NSString` was deallocated, performance hit will be only felt on a + single instance of `NSString`, not all instances of `NSString`s. + */ +-(Class __nullable)ensureHasDynamicFakeSubclass:(Class __nonnull)class error:(NSError **)error { + Class dynamicFakeSubclass = [self.dynamicSublassByRealClass objectForKey:CLASS_VALUE(class)]; + if (dynamicFakeSubclass != nil) { + return dynamicFakeSubclass; + } + + NSString *dynamicFakeSublassName = [RX_PREFIX stringByAppendingString:NSStringFromClass(class)]; + const char *dynamicFakeSublassNameRaw = dynamicFakeSublassName.UTF8String; + dynamicFakeSubclass = objc_allocateClassPair(class, dynamicFakeSublassNameRaw, 0); + ALWAYS(dynamicFakeSubclass != nil, @"Class not generated"); + + if (![self swizzleClass:dynamicFakeSubclass toActAs:class error:error]) { + return nil; + } + + objc_registerClassPair(dynamicFakeSubclass); + + [self.dynamicSublassByRealClass setObject:dynamicFakeSubclass forKey:CLASS_VALUE(class)]; + ALWAYS([self.dynamicSublassByRealClass objectForKey:CLASS_VALUE(class)] != nil, @"Class not registered"); + + return dynamicFakeSubclass; +} + +-(BOOL)ensureForwardingMethodsAreSwizzled:(Class __nonnull)class error:(NSError ** __nonnull)error { + NSValue *classValue = CLASS_VALUE(class); + if ([self.classesThatSupportObservingByForwarding containsObject:classValue]) { + return YES; + } + + if (![self swizzleForwardInvocation:class error:error]) { return NO; } + if (![self swizzleMethodSignatureForSelector:class error:error]) { return NO; } + if (![self swizzleRespondsToSelector:class error:error]) { return NO; } + + [self.classesThatSupportObservingByForwarding addObject:classValue]; + + return YES; +} + +-(void)registerInterceptedSelector:(SEL)selector implementation:(IMP)implementation forClass:(Class)class { + NSValue * __nonnull classValue = CLASS_VALUE(class); + NSValue * __nonnull selectorValue = SEL_VALUE(selector); + + NSMutableDictionary *swizzledIMPBySelectorsForClass = self.interceptorIMPbySelectorsByClass[classValue]; + + if (swizzledIMPBySelectorsForClass == nil) { + swizzledIMPBySelectorsForClass = [NSMutableDictionary dictionary]; + [self.interceptorIMPbySelectorsByClass setObject:swizzledIMPBySelectorsForClass forKey:classValue]; + } + + [swizzledIMPBySelectorsForClass setObject:IMP_VALUE(implementation) forKey:selectorValue]; + + ALWAYS([self interceptorImplementationForSelector:selector forClass:class] != nil, @"Class should have been swizzled"); +} + +-(IMP)interceptorImplementationForSelector:(SEL)selector forClass:(Class)class { + NSValue * __nonnull classValue = CLASS_VALUE(class); + NSValue * __nonnull selectorValue = SEL_VALUE(selector); + + NSMutableDictionary *swizzledIMPBySelectorForClass = self.interceptorIMPbySelectorsByClass[classValue]; + + NSValue *impValue = [swizzledIMPBySelectorForClass objectForKey:selectorValue]; + return impValue.pointerValue; +} + +-(BOOL)ensureSwizzledSelector:(SEL __nonnull)selector + ofClass:(Class __nonnull)class + newImplementationGenerator:(IMP(^)())newImplementationGenerator +replacementImplementationGenerator:(IMP (^)(IMP originalImplemenation))replacementImplementationGenerator + error:(NSError ** __nonnull)error { + if ([self interceptorImplementationForSelector:selector forClass:class] != nil) { + DLOG(@"Trying to register same intercept at least once, this sounds like a possible bug"); + return YES; + } + +#if TRACE_RESOURCES + OSAtomicIncrement32(&numberOInterceptedMethods); +#endif + + DLOG(@"Rx is swizzling `%@` for `%@`", NSStringFromSelector(selector), class); + + Method existingMethod = class_getInstanceMethod(class, selector); + ALWAYS(existingMethod != nil, @"Method doesn't exist"); + + const char *encoding = method_getTypeEncoding(existingMethod); + ALWAYS(encoding != nil, @"Encoding is nil"); + + IMP newImplementation = newImplementationGenerator(); + + if (class_addMethod(class, selector, newImplementation, encoding)) { + // new method added, job done + [self registerInterceptedSelector:selector implementation:newImplementation forClass:class]; + + return YES; + } + + imp_removeBlock(newImplementation); + + // if add fails, that means that method already exists on targetClass + Method existingMethodOnTargetClass = existingMethod; + + IMP originalImplementation = method_getImplementation(existingMethodOnTargetClass); + ALWAYS(originalImplementation != nil, @"Method must exist."); + IMP implementationReplacementIMP = replacementImplementationGenerator(originalImplementation); + ALWAYS(implementationReplacementIMP != nil, @"Method must exist."); + IMP originalImplementationAfterChange = method_setImplementation(existingMethodOnTargetClass, implementationReplacementIMP); + ALWAYS(originalImplementation != nil, @"Method must exist."); + + // If method replacing failed, who knows what happened, better not trying again, otherwise program can get + // corrupted. + [self registerInterceptedSelector:selector implementation:implementationReplacementIMP forClass:class]; + + // ¯\_(ツ)_/¯ + if (originalImplementationAfterChange != originalImplementation) { + THREADING_HAZARD(class); + return NO; + } + + return YES; +} + +@end + +#if TRACE_RESOURCES + +NSInteger RX_number_of_dynamic_subclasses() { + __block NSInteger count = 0; + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + count = self.dynamicSublassByRealClass.count; + }]; + + return count; +} + +NSInteger RX_number_of_forwarding_enabled_classes() { + __block NSInteger count = 0; + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + count = self.classesThatSupportObservingByForwarding.count; + }]; + + return count; +} + +NSInteger RX_number_of_intercepting_classes() { + __block NSInteger count = 0; + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + count = self.interceptorIMPbySelectorsByClass.count; + }]; + + return count; +} + +NSInteger RX_number_of_forwarded_methods() { + return numberOfForwardedMethods; +} + +NSInteger RX_number_of_swizzled_methods() { + return numberOInterceptedMethods; +} + +#endif + +#endif \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/RxCocoa.h b/Pods/RxCocoa/RxCocoa/RxCocoa.h new file mode 100644 index 0000000..7436904 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/RxCocoa.h @@ -0,0 +1,19 @@ +// +// RxCocoa.h +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import +#import "_RX.h" +#import "_RXDelegateProxy.h" +#import "_RXKVOObserver.h" +#import "_RXObjCRuntime.h" + +//! Project version number for RxCocoa. +FOUNDATION_EXPORT double RxCocoaVersionNumber; + +//! Project version string for RxCocoa. +FOUNDATION_EXPORT const unsigned char RxCocoaVersionString[]; \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift b/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift new file mode 100644 index 0000000..2ff9e09 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift @@ -0,0 +1,107 @@ +// +// RxCollectionViewReactiveArrayDataSource.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +// objc monkey business +class _RxCollectionViewReactiveArrayDataSource + : NSObject + , UICollectionViewDataSource { + + func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { + return 1 + } + + func _collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 0 + } + + func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return _collectionView(collectionView, numberOfItemsInSection: section) + } + + func _collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + rxAbstractMethod() + } + + func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + return _collectionView(collectionView, cellForItemAtIndexPath: indexPath) + } +} + +class RxCollectionViewReactiveArrayDataSourceSequenceWrapper + : RxCollectionViewReactiveArrayDataSource + , RxCollectionViewDataSourceType { + typealias Element = S + + override init(cellFactory: CellFactory) { + super.init(cellFactory: cellFactory) + } + + func collectionView(collectionView: UICollectionView, observedEvent: Event) { + UIBindingObserver(UIElement: self) { collectionViewDataSource, sectionModels in + let sections = Array(sectionModels) + collectionViewDataSource.collectionView(collectionView, observedElements: sections) + }.on(observedEvent) + } +} + + +// Please take a look at `DelegateProxyType.swift` +class RxCollectionViewReactiveArrayDataSource + : _RxCollectionViewReactiveArrayDataSource + , SectionedViewDataSourceType { + + typealias CellFactory = (UICollectionView, Int, Element) -> UICollectionViewCell + + var itemModels: [Element]? = nil + + func modelAtIndex(index: Int) -> Element? { + return itemModels?[index] + } + + func modelAtIndexPath(indexPath: NSIndexPath) throws -> Any { + precondition(indexPath.section == 0) + guard let item = itemModels?[indexPath.item] else { + throw RxCocoaError.ItemsNotYetBound(object: self) + } + return item + } + + var cellFactory: CellFactory + + init(cellFactory: CellFactory) { + self.cellFactory = cellFactory + } + + // data source + + override func _collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return itemModels?.count ?? 0 + } + + override func _collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + return cellFactory(collectionView, indexPath.item, itemModels![indexPath.item]) + } + + // reactive + + func collectionView(collectionView: UICollectionView, observedElements: [Element]) { + self.itemModels = observedElements + + collectionView.reloadData() + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift b/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift new file mode 100644 index 0000000..e3e80de --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift @@ -0,0 +1,104 @@ +// +// RxTableViewReactiveArrayDataSource.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/26/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +// objc monkey business +class _RxTableViewReactiveArrayDataSource + : NSObject + , UITableViewDataSource { + + func numberOfSectionsInTableView(tableView: UITableView) -> Int { + return 1 + } + + func _tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 0 + } + + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return _tableView(tableView, numberOfRowsInSection: section) + } + + func _tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + rxAbstractMethod() + } + + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + return _tableView(tableView, cellForRowAtIndexPath: indexPath) + } +} + + +class RxTableViewReactiveArrayDataSourceSequenceWrapper + : RxTableViewReactiveArrayDataSource + , RxTableViewDataSourceType { + typealias Element = S + + override init(cellFactory: CellFactory) { + super.init(cellFactory: cellFactory) + } + + func tableView(tableView: UITableView, observedEvent: Event) { + UIBindingObserver(UIElement: self) { tableViewDataSource, sectionModels in + let sections = Array(sectionModels) + tableViewDataSource.tableView(tableView, observedElements: sections) + }.on(observedEvent) + } +} + +// Please take a look at `DelegateProxyType.swift` +class RxTableViewReactiveArrayDataSource + : _RxTableViewReactiveArrayDataSource + , SectionedViewDataSourceType { + typealias CellFactory = (UITableView, Int, Element) -> UITableViewCell + + var itemModels: [Element]? = nil + + func modelAtIndex(index: Int) -> Element? { + return itemModels?[index] + } + + func modelAtIndexPath(indexPath: NSIndexPath) throws -> Any { + precondition(indexPath.section == 0) + guard let item = itemModels?[indexPath.item] else { + throw RxCocoaError.ItemsNotYetBound(object: self) + } + return item + } + + let cellFactory: CellFactory + + init(cellFactory: CellFactory) { + self.cellFactory = cellFactory + } + + override func _tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return itemModels?.count ?? 0 + } + + override func _tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + return cellFactory(tableView, indexPath.item, itemModels![indexPath.row]) + } + + // reactive + + func tableView(tableView: UITableView, observedElements: [Element]) { + self.itemModels = observedElements + + tableView.reloadData() + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift b/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift new file mode 100644 index 0000000..ecbe6e9 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift @@ -0,0 +1,12 @@ +// +// ItemEvents.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/20/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +import UIKit + +public typealias ItemMovedEvent = (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath) \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift new file mode 100644 index 0000000..b2c933b --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift @@ -0,0 +1,43 @@ +// +// NSTextStorage+Rx.swift +// Rx +// +// Created by Segii Shulga on 12/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) +import Foundation + +#if !RX_NO_MODULE + import RxSwift +#endif + import UIKit + +extension NSTextStorage { + + /** + Reactive wrapper for `delegate`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_delegate:DelegateProxy { + return proxyForObject(RxTextStorageDelegateProxy.self, self) + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didProcessEditingRangeChangeInLength: Observable<(editedMask:NSTextStorageEditActions, editedRange:NSRange, delta:Int)> { + return rx_delegate + .observe(#selector(NSTextStorageDelegate.textStorage(_:didProcessEditing:range:changeInLength:))) + .map { a in + let editedMask = NSTextStorageEditActions(rawValue: try castOrThrow(UInt.self, a[1]) ) + let editedRange = try castOrThrow(NSValue.self, a[2]).rangeValue + let delta = try castOrThrow(Int.self, a[3]) + + return (editedMask, editedRange, delta) + } + } +} +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift b/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift new file mode 100644 index 0000000..8ff42f6 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift @@ -0,0 +1,36 @@ +// +// RxCollectionViewDataSourceType.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +/** +Marks data source as `UICollectionView` reactive data source enabling it to be used with one of the `bindTo` methods. +*/ +public protocol RxCollectionViewDataSourceType /*: UICollectionViewDataSource*/ { + + /** + Type of elements that can be bound to collection view. + */ + associatedtype Element + + /** + New observable sequence event observed. + + - parameter collectionView: Bound collection view. + - parameter observedEvent: Event + */ + func collectionView(collectionView: UICollectionView, observedEvent: Event) -> Void +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift b/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift new file mode 100644 index 0000000..e68d896 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift @@ -0,0 +1,36 @@ +// +// RxTableViewDataSourceType.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/26/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +/** +Marks data source as `UITableView` reactive data source enabling it to be used with one of the `bindTo` methods. +*/ +public protocol RxTableViewDataSourceType /*: UITableViewDataSource*/ { + + /** + Type of elements that can be bound to table view. + */ + associatedtype Element + + /** + New observable sequence event observed. + + - parameter tableView: Bound table view. + - parameter observedEvent: Event + */ + func tableView(tableView: UITableView, observedEvent: Event) -> Void +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift new file mode 100644 index 0000000..eaa3f2b --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift @@ -0,0 +1,118 @@ +// +// RxCollectionViewDataSourceProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet() + +class CollectionViewDataSourceNotSet + : NSObject + , UICollectionViewDataSource { + func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + rxAbstractMethodWithMessage(dataSourceNotSet) + } + + // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: + func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + rxAbstractMethodWithMessage(dataSourceNotSet) + } + +} + +/** + For more information take a look at `DelegateProxyType`. + */ +public class RxCollectionViewDataSourceProxy + : DelegateProxy + , UICollectionViewDataSource + , DelegateProxyType { + + /** + Typed parent object. + */ + public weak private(set) var collectionView: UICollectionView? + + private weak var _requiredMethodsDataSource: UICollectionViewDataSource? = collectionViewDataSourceNotSet + + /** + Initializes `RxCollectionViewDataSourceProxy` + + - parameter parentObject: Parent object for delegate proxy. + */ + public required init(parentObject: AnyObject) { + self.collectionView = (parentObject as! UICollectionView) + super.init(parentObject: parentObject) + } + + // MARK: delegate + + /** + Required delegate method implementation. + */ + public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, numberOfItemsInSection: section) ?? 0 + } + + /** + Required delegate method implementation. + */ + public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, cellForItemAtIndexPath: indexPath) + } + + // MARK: proxy + + /** + For more information take a look at `DelegateProxyType`. + */ + public override class func createProxyForObject(object: AnyObject) -> AnyObject { + let collectionView = (object as! UICollectionView) + + return castOrFatalError(collectionView.rx_createDataSourceProxy()) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public override class func delegateAssociatedObjectTag() -> UnsafePointer { + return _pointer(&dataSourceAssociatedTag) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { + let collectionView: UICollectionView = castOrFatalError(object) + collectionView.dataSource = castOptionalOrFatalError(delegate) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func currentDelegateFor(object: AnyObject) -> AnyObject? { + let collectionView: UICollectionView = castOrFatalError(object) + return collectionView.dataSource + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public override func setForwardToDelegate(forwardToDelegate: AnyObject?, retainDelegate: Bool) { + let requiredMethodsDataSource: UICollectionViewDataSource? = castOptionalOrFatalError(forwardToDelegate) + _requiredMethodsDataSource = requiredMethodsDataSource ?? collectionViewDataSourceNotSet + super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift new file mode 100644 index 0000000..b2c5933 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift @@ -0,0 +1,41 @@ +// +// RxCollectionViewDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +/** + For more information take a look at `DelegateProxyType`. + */ +public class RxCollectionViewDelegateProxy + : RxScrollViewDelegateProxy + , UICollectionViewDelegate + , UICollectionViewDelegateFlowLayout { + + /** + Typed parent object. + */ + public weak private(set) var collectionView: UICollectionView? + + /** + Initializes `RxCollectionViewDelegateProxy` + + - parameter parentObject: Parent object for delegate proxy. + */ + public required init(parentObject: AnyObject) { + self.collectionView = (parentObject as! UICollectionView) + super.init(parentObject: parentObject) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift new file mode 100644 index 0000000..21397b9 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift @@ -0,0 +1,41 @@ +// +// RxImagePickerDelegateProxy.swift +// Rx +// +// Created by Segii Shulga on 1/4/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + + import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + import UIKit + +public class RxImagePickerDelegateProxy + : DelegateProxy + , DelegateProxyType + , UIImagePickerControllerDelegate + , UINavigationControllerDelegate { + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { + let imagePickerController: UIImagePickerController = castOrFatalError(object) + imagePickerController.delegate = castOptionalOrFatalError(delegate) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func currentDelegateFor(object: AnyObject) -> AnyObject? { + let imagePickerController: UIImagePickerController = castOrFatalError(object) + return imagePickerController.delegate + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift new file mode 100644 index 0000000..0bfc88c --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift @@ -0,0 +1,101 @@ +// +// RxScrollViewDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +/** + For more information take a look at `DelegateProxyType`. +*/ +public class RxScrollViewDelegateProxy + : DelegateProxy + , UIScrollViewDelegate + , DelegateProxyType { + + private var _contentOffsetSubject: ReplaySubject? + + /** + Typed parent object. + */ + public weak private(set) var scrollView: UIScrollView? + + /** + Optimized version used for observing content offset changes. + */ + internal var contentOffsetSubject: Observable { + if _contentOffsetSubject == nil { + let replaySubject = ReplaySubject.create(bufferSize: 1) + _contentOffsetSubject = replaySubject + replaySubject.on(.Next(self.scrollView?.contentOffset ?? CGPointZero)) + } + + return _contentOffsetSubject! + } + + /** + Initializes `RxScrollViewDelegateProxy` + + - parameter parentObject: Parent object for delegate proxy. + */ + public required init(parentObject: AnyObject) { + self.scrollView = (parentObject as! UIScrollView) + super.init(parentObject: parentObject) + } + + // MARK: delegate methods + + /** + For more information take a look at `DelegateProxyType`. + */ + public func scrollViewDidScroll(scrollView: UIScrollView) { + if let contentOffset = _contentOffsetSubject { + contentOffset.on(.Next(scrollView.contentOffset)) + } + self._forwardToDelegate?.scrollViewDidScroll?(scrollView) + } + + // MARK: delegate proxy + + /** + For more information take a look at `DelegateProxyType`. + */ + public override class func createProxyForObject(object: AnyObject) -> AnyObject { + let scrollView = (object as! UIScrollView) + + return castOrFatalError(scrollView.rx_createDelegateProxy()) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { + let collectionView: UIScrollView = castOrFatalError(object) + collectionView.delegate = castOptionalOrFatalError(delegate) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func currentDelegateFor(object: AnyObject) -> AnyObject? { + let collectionView: UIScrollView = castOrFatalError(object) + return collectionView.delegate + } + + deinit { + if let contentOffset = _contentOffsetSubject { + contentOffset.on(.Completed) + } + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift new file mode 100644 index 0000000..7f41b5d --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift @@ -0,0 +1,32 @@ +// +// RxSearchBarDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 7/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +class RxSearchBarDelegateProxy : DelegateProxy + , UISearchBarDelegate + , DelegateProxyType { + + class func currentDelegateFor(object: AnyObject) -> AnyObject? { + let searchBar: UISearchBar = castOrFatalError(object) + return searchBar.delegate + } + + class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { + let searchBar: UISearchBar = castOrFatalError(object) + searchBar.delegate = castOptionalOrFatalError(delegate) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift new file mode 100644 index 0000000..6786e6d --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift @@ -0,0 +1,127 @@ +// +// RxTableViewDataSourceProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +let tableViewDataSourceNotSet = TableViewDataSourceNotSet() + +class TableViewDataSourceNotSet + : NSObject + , UITableViewDataSource { + func numberOfSectionsInTableView(tableView: UITableView) -> Int { + rxAbstractMethodWithMessage(dataSourceNotSet) + } + + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + rxAbstractMethodWithMessage(dataSourceNotSet) + } + + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { + rxAbstractMethodWithMessage(dataSourceNotSet) + } +} + +/** + For more information take a look at `DelegateProxyType`. + */ +public class RxTableViewDataSourceProxy + : DelegateProxy + , UITableViewDataSource + , DelegateProxyType { + + /** + Typed parent object. + */ + public weak private(set) var tableView: UITableView? + + private weak var _requiredMethodsDataSource: UITableViewDataSource? = tableViewDataSourceNotSet + + /** + Initializes `RxTableViewDataSourceProxy` + + - parameter parentObject: Parent object for delegate proxy. + */ + public required init(parentObject: AnyObject) { + self.tableView = (parentObject as! UITableView) + super.init(parentObject: parentObject) + } + + // MARK: delegate + + /** + 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 { + 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) + } + + // MARK: proxy + + /** + For more information take a look at `DelegateProxyType`. + */ + public override class func createProxyForObject(object: AnyObject) -> AnyObject { + let tableView = (object as! UITableView) + + return castOrFatalError(tableView.rx_createDataSourceProxy()) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public override class func delegateAssociatedObjectTag() -> UnsafePointer { + return _pointer(&dataSourceAssociatedTag) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { + let collectionView: UITableView = castOrFatalError(object) + collectionView.dataSource = castOptionalOrFatalError(delegate) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func currentDelegateFor(object: AnyObject) -> AnyObject? { + let collectionView: UITableView = castOrFatalError(object) + return collectionView.dataSource + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public override func setForwardToDelegate(forwardToDelegate: AnyObject?, retainDelegate: Bool) { + let requiredMethodsDataSource: UITableViewDataSource? = castOptionalOrFatalError(forwardToDelegate) + _requiredMethodsDataSource = requiredMethodsDataSource ?? tableViewDataSourceNotSet + super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift new file mode 100644 index 0000000..243f585 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift @@ -0,0 +1,41 @@ +// +// RxTableViewDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +/** + For more information take a look at `DelegateProxyType`. +*/ +public class RxTableViewDelegateProxy + : RxScrollViewDelegateProxy + , UITableViewDelegate { + + + /** + Typed parent object. + */ + public weak private(set) var tableView: UITableView? + + /** + Initializes `RxTableViewDelegateProxy` + + - parameter parentObject: Parent object for delegate proxy. + */ + public required init(parentObject: AnyObject) { + self.tableView = (parentObject as! UITableView) + super.init(parentObject: parentObject) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift new file mode 100644 index 0000000..074b2d9 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift @@ -0,0 +1,41 @@ +// +// RxTextStorageDelegateProxy.swift +// Rx +// +// Created by Segii Shulga on 12/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + + import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif + import UIKit + +public class RxTextStorageDelegateProxy + : DelegateProxy + , DelegateProxyType + , NSTextStorageDelegate { + + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) { + let textStorage: NSTextStorage = castOrFatalError(object) + textStorage.delegate = castOptionalOrFatalError(delegate) + } + + /** + For more information take a look at `DelegateProxyType`. + */ + public class func currentDelegateFor(object: AnyObject) -> AnyObject? { + let textStorage: NSTextStorage = castOrFatalError(object) + return textStorage.delegate + } + + +} +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift new file mode 100644 index 0000000..6b0a5bc --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift @@ -0,0 +1,56 @@ +// +// RxTextViewDelegateProxy.swift +// RxCocoa +// +// Created by Yuta ToKoRo on 7/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +/** + For more information take a look at `DelegateProxyType`. +*/ +public class RxTextViewDelegateProxy + : RxScrollViewDelegateProxy + , UITextViewDelegate { + + /** + Typed parent object. + */ + public weak private(set) var textView: UITextView? + + /** + Initializes `RxTextViewDelegateProxy` + + - parameter parentObject: Parent object for delegate proxy. + */ + public required init(parentObject: AnyObject) { + self.textView = (parentObject as! UITextView) + super.init(parentObject: parentObject) + } + + // MARK: delegate methods + + /** + For more information take a look at `DelegateProxyType`. + */ + @objc public func textView(textView: UITextView, shouldChangeTextInRange 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, + replacementText: text) ?? true + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift new file mode 100644 index 0000000..f1a7696 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift @@ -0,0 +1,33 @@ +// +// UIActivityIndicatorView+Rx.swift +// Rx +// +// Created by Ivan Persidskiy on 02/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) +import UIKit + +#if !RX_NO_MODULE +import RxSwift +#endif + +extension UIActivityIndicatorView { + + /** + Bindable sink for `startAnimating()`, `stopAnimating()` methods. + */ + public var rx_animating: AnyObserver { + return UIBindingObserver(UIElement: self) { activityIndicator, active in + if active { + self.startAnimating() + } else { + self.stopAnimating() + } + }.asObserver() + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift new file mode 100644 index 0000000..1bf270d --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift @@ -0,0 +1,30 @@ +// +// UIApplication+Rx.swift +// RxExample +// +// Created by Mads Bøgeskov on 18/01/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if os(iOS) + import UIKit + +#if !RX_NO_MODULE + import RxSwift +#endif + + extension UIApplication { + + /** + Bindable sink for `networkActivityIndicatorVisible`. + */ + public var rx_networkActivityIndicatorVisible: AnyObserver { + return UIBindingObserver(UIElement: self) { application, active in + application.networkActivityIndicatorVisible = active + }.asObserver() + } + } +#endif + diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift new file mode 100644 index 0000000..a77462f --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift @@ -0,0 +1,86 @@ +// +// UIBarButtonItem+Rx.swift +// RxCocoa +// +// Created by Daniel Tartaglia on 5/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +var rx_tap_key: UInt8 = 0 + +extension UIBarButtonItem { + + /** + Bindable sink for `enabled` property. + */ + public var rx_enabled: AnyObserver { + return UIBindingObserver(UIElement: self) { UIElement, value in + UIElement.enabled = value + }.asObserver() + } + + /** + Reactive wrapper for target action pattern on `self`. + */ + public var rx_tap: ControlEvent { + let source = rx_lazyInstanceObservable(&rx_tap_key) { () -> Observable in + Observable.create { [weak self] observer in + guard let control = self else { + observer.on(.Completed) + return NopDisposable.instance + } + let target = BarButtonItemTarget(barButtonItem: control) { + observer.on(.Next()) + } + return target + } + .takeUntil(self.rx_deallocated) + .share() + } + + return ControlEvent(events: source) + } +} + + +@objc +class BarButtonItemTarget: RxTarget { + typealias Callback = () -> Void + + weak var barButtonItem: UIBarButtonItem? + var callback: Callback! + + init(barButtonItem: UIBarButtonItem, callback: () -> Void) { + self.barButtonItem = barButtonItem + self.callback = callback + super.init() + barButtonItem.target = self + barButtonItem.action = #selector(BarButtonItemTarget.action(_:)) + } + + override func dispose() { + super.dispose() +#if DEBUG + MainScheduler.ensureExecutingOnScheduler() +#endif + + barButtonItem?.target = nil + barButtonItem?.action = nil + + callback = nil + } + + func action(sender: AnyObject) { + callback() + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift new file mode 100644 index 0000000..e40ac0a --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift @@ -0,0 +1,48 @@ +// +// UIButton+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UIButton { + + /** + Reactive wrapper for `TouchUpInside` control event. + */ + public var rx_tap: ControlEvent { + return rx_controlEvent(.TouchUpInside) + } + +} + +#endif + +#if os(tvOS) + +import Foundation +#if !RX_NO_MODULE + import RxSwift +#endif +import UIKit + +extension UIButton { + + /** + Reactive wrapper for `PrimaryActionTriggered` control event. + */ + public var rx_primaryAction: ControlEvent { + return rx_controlEvent(.PrimaryActionTriggered) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift new file mode 100644 index 0000000..1f52db3 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift @@ -0,0 +1,234 @@ +// +// UICollectionView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +// Items + +extension UICollectionView { + + /** + Binds sequences of elements to collection view items. + + - parameter source: Observable sequence of items. + - parameter cellFactory: Transform between sequence elements and view cells. + - returns: Disposable object that can be used to unbind. + */ + public func rx_itemsWithCellFactory + (source: O) + -> (cellFactory: (UICollectionView, Int, S.Generator.Element) -> UICollectionViewCell) + -> Disposable { + return { cellFactory in + let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper(cellFactory: cellFactory) + return self.rx_itemsWithDataSource(dataSource)(source: source) + } + + } + + /** + Binds sequences of elements to collection view items. + + - parameter cellIdentifier: Identifier used to dequeue cells. + - parameter source: Observable sequence of items. + - parameter configureCell: Transform between sequence elements and view cells. + - parameter cellType: Type of table view cell. + - returns: Disposable object that can be used to unbind. + */ + public func rx_itemsWithCellIdentifier + (cellIdentifier: String, cellType: Cell.Type = Cell.self) + -> (source: O) + -> (configureCell: (Int, S.Generator.Element, Cell) -> Void) + -> Disposable { + return { source in + return { configureCell in + let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper { (cv, i, item) in + let indexPath = NSIndexPath(forItem: i, inSection: 0) + let cell = cv.dequeueReusableCellWithReuseIdentifier(cellIdentifier, forIndexPath: indexPath) as! Cell + configureCell(i, item, cell) + return cell + } + + return self.rx_itemsWithDataSource(dataSource)(source: source) + } + } + } + + /** + Binds sequences of elements to collection view items using a custom reactive data used to perform the transformation. + + - parameter dataSource: Data source used to transform elements to view cells. + - parameter source: Observable sequence of items. + - returns: Disposable object that can be used to unbind. + */ + public func rx_itemsWithDataSource, S: SequenceType, O: ObservableType where DataSource.Element == S, O.E == S> + (dataSource: DataSource) + -> (source: O) + -> Disposable { + return { source in + return source.subscribeProxyDataSourceForObject(self, dataSource: dataSource, retainDataSource: false) { [weak self] (_: RxCollectionViewDataSourceProxy, event) -> Void in + guard let collectionView = self else { + return + } + dataSource.collectionView(collectionView, observedEvent: event) + } + } + } +} + +extension UICollectionView { + + /** + Factory method that enables subclasses to implement their own `rx_delegate`. + + - returns: Instance of delegate proxy that wraps `delegate`. + */ + public override func rx_createDelegateProxy() -> RxScrollViewDelegateProxy { + return RxCollectionViewDelegateProxy(parentObject: self) + } + + /** + Factory method that enables subclasses to implement their own `rx_dataSource`. + + - returns: Instance of delegate proxy that wraps `dataSource`. + */ + public func rx_createDataSourceProxy() -> RxCollectionViewDataSourceProxy { + return RxCollectionViewDataSourceProxy(parentObject: self) + } + + /** + Reactive wrapper for `dataSource`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_dataSource: DelegateProxy { + return proxyForObject(RxCollectionViewDataSourceProxy.self, self) + } + + /** + Installs data source as forwarding delegate on `rx_dataSource`. + + It enables using normal delegate mechanism with reactive delegate mechanism. + + - parameter dataSource: Data source object. + - returns: Disposable object that can be used to unbind the data source. + */ + public func rx_setDataSource(dataSource: UICollectionViewDataSource) + -> Disposable { + let proxy = proxyForObject(RxCollectionViewDataSourceProxy.self, self) + return installDelegate(proxy, delegate: dataSource, retainDelegate: false, onProxyForObject: self) + } + + /** + Reactive wrapper for `delegate` message `collectionView:didSelectItemAtIndexPath:`. + */ + public var rx_itemSelected: ControlEvent { + let source = rx_delegate.observe(#selector(UICollectionViewDelegate.collectionView(_:didSelectItemAtIndexPath:))) + .map { a in + return a[1] as! NSIndexPath + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `collectionView:didSelectItemAtIndexPath:`. + */ + public var rx_itemDeselected: ControlEvent { + let source = rx_delegate.observe(#selector(UICollectionViewDelegate.collectionView(_:didDeselectItemAtIndexPath:))) + .map { a in + return a[1] as! NSIndexPath + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `collectionView:didSelectItemAtIndexPath:`. + + It can be only used when one of the `rx_itemsWith*` methods is used to bind observable sequence, + or any other data source conforming to `SectionedViewDataSourceType` protocol. + + ``` + collectionView.rx_modelSelected(MyModel.self) + .map { ... + ``` + */ + public func rx_modelSelected(modelType: T.Type) -> ControlEvent { + let source: Observable = rx_itemSelected.flatMap { [weak self] indexPath -> Observable in + guard let view = self else { + return Observable.empty() + } + + return Observable.just(try view.rx_modelAtIndexPath(indexPath)) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `collectionView:didSelectItemAtIndexPath:`. + + It can be only used when one of the `rx_itemsWith*` methods is used to bind observable sequence, + or any other data source conforming to `SectionedViewDataSourceType` protocol. + + ``` + collectionView.rx_modelDeselected(MyModel.self) + .map { ... + ``` + */ + public func rx_modelDeselected(modelType: T.Type) -> ControlEvent { + let source: Observable = rx_itemDeselected.flatMap { [weak self] indexPath -> Observable in + guard let view = self else { + return Observable.empty() + } + + return Observable.just(try view.rx_modelAtIndexPath(indexPath)) + } + + return ControlEvent(events: source) + } + + /** + Syncronous helper method for retrieving a model at indexPath through a reactive data source + */ + public func rx_modelAtIndexPath(indexPath: NSIndexPath) throws -> T { + let dataSource: SectionedViewDataSourceType = castOrFatalError(self.rx_dataSource.forwardToDelegate(), message: "This method only works in case one of the `rx_itemsWith*` methods was used.") + + let element = try dataSource.modelAtIndexPath(indexPath) + + return element as! T + } +} +#endif + +#if os(tvOS) + +extension UICollectionView { + + /** + Reactive wrapper for `delegate` message `collectionView:didUpdateFocusInContext:withAnimationCoordinator:`. + */ + public var rx_didUpdateFocusInContextWithAnimationCoordinator: ControlEvent<(context: UIFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator)> { + + let source = rx_delegate.observe(#selector(UICollectionViewDelegate.collectionView(_:didUpdateFocusInContext:withAnimationCoordinator:))) + .map { a -> (context: UIFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator) in + let context = a[1] as! UIFocusUpdateContext + let animationCoordinator = a[2] as! UIFocusAnimationCoordinator + return (context: context, animationCoordinator: animationCoordinator) + } + + return ControlEvent(events: source) + } +} +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift new file mode 100644 index 0000000..92299e3 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift @@ -0,0 +1,100 @@ +// +// UIControl+Rx.swift +// RxCocoa +// +// Created by Daniel Tartaglia on 5/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UIControl { + + /** + Bindable sink for `enabled` property. + */ + public var rx_enabled: AnyObserver { + return UIBindingObserver(UIElement: self) { control, value in + control.enabled = value + }.asObserver() + } + + /** + Bindable sink for `selected` property. + */ + public var rx_selected: AnyObserver { + return UIBindingObserver(UIElement: self) { control, selected in + control.selected = selected + }.asObserver() + } + + /** + Reactive wrapper for target action pattern. + + - parameter controlEvents: Filter for observed event types. + */ + public func rx_controlEvent(controlEvents: UIControlEvents) -> ControlEvent { + let source: Observable = Observable.create { [weak self] observer in + MainScheduler.ensureExecutingOnScheduler() + + guard let control = self else { + observer.on(.Completed) + return NopDisposable.instance + } + + let controlTarget = ControlTarget(control: control, controlEvents: controlEvents) { + control in + observer.on(.Next()) + } + + return AnonymousDisposable { + controlTarget.dispose() + } + }.takeUntil(rx_deallocated) + + return ControlEvent(events: source) + } + + /** + 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. + + Can somebody offer poor Swift compiler writers some other better job maybe, this is becoming + ridiculous. So much time wasted ... + */ + static func rx_value(control: C, getter: (C) -> T, setter: (C, T) -> Void) -> ControlProperty { + let source: Observable = Observable.create { [weak weakControl = control] observer in + guard let control = weakControl else { + observer.on(.Completed) + return NopDisposable.instance + } + + observer.on(.Next(getter(control))) + + let controlTarget = ControlTarget(control: control as! UIControl, controlEvents: [.AllEditingEvents, .ValueChanged]) { _ in + if let control = weakControl { + observer.on(.Next(getter(control))) + } + } + + return AnonymousDisposable { + controlTarget.dispose() + } + } + .distinctUntilChanged() + .takeUntil((control as! NSObject).rx_deallocated) + + let bindingObserver = UIBindingObserver(UIElement: control, binding: setter) + + return ControlProperty(values: source, valueSink: bindingObserver) + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift new file mode 100644 index 0000000..a09c9c6 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift @@ -0,0 +1,35 @@ +// +// UIDatePicker+Rx.swift +// RxCocoa +// +// Created by Daniel Tartaglia on 5/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UIDatePicker { + + /** + Reactive wrapper for `date` property. + */ + public var rx_date: ControlProperty { + return UIControl.rx_value( + self, + getter: { datePicker in + datePicker.date + }, setter: { datePicker, value in + datePicker.date = value + } + ) + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift new file mode 100644 index 0000000..65e6e24 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift @@ -0,0 +1,81 @@ +// +// UIGestureRecognizer+Rx.swift +// Touches +// +// Created by Carlos García on 10/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + + +// This should be only used from `MainScheduler` +class GestureTarget: RxTarget { + typealias Callback = (UIGestureRecognizer) -> Void + + let selector = #selector(ControlTarget.eventHandler(_:)) + + weak var gestureRecognizer: UIGestureRecognizer? + var callback: Callback? + + init(_ gestureRecognizer: UIGestureRecognizer, callback: Callback) { + self.gestureRecognizer = gestureRecognizer + self.callback = callback + + super.init() + + gestureRecognizer.addTarget(self, action: selector) + + let method = self.methodForSelector(selector) + if method == nil { + fatalError("Can't find method") + } + } + + func eventHandler(sender: UIGestureRecognizer!) { + if let callback = self.callback, gestureRecognizer = self.gestureRecognizer { + callback(gestureRecognizer) + } + } + + override func dispose() { + super.dispose() + + self.gestureRecognizer?.removeTarget(self, action: self.selector) + self.callback = nil + } +} + +extension UIGestureRecognizer { + + /** + Reactive wrapper for gesture recognizer events. + */ + public var rx_event: ControlEvent { + let source: Observable = Observable.create { [weak self] observer in + MainScheduler.ensureExecutingOnScheduler() + + guard let control = self else { + observer.on(.Completed) + return NopDisposable.instance + } + + let observer = GestureTarget(control) { + control in + observer.on(.Next(control)) + } + + return observer + }.takeUntil(rx_deallocated) + + return ControlEvent(events: source) + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIImagePickerController+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIImagePickerController+Rx.swift new file mode 100644 index 0000000..8e23935 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIImagePickerController+Rx.swift @@ -0,0 +1,52 @@ +// +// UIImagePickerController+Rx.swift +// Rx +// +// Created by Segii Shulga on 1/4/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if os(iOS) + import Foundation + +#if !RX_NO_MODULE + import RxSwift +#endif + import UIKit + + extension UIImagePickerController { + + /** + Reactive wrapper for `delegate`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_delegate: DelegateProxy { + return proxyForObject(RxImagePickerDelegateProxy.self, self) + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didFinishPickingMediaWithInfo: Observable<[String : AnyObject]> { + return rx_delegate + .observe(#selector(UIImagePickerControllerDelegate.imagePickerController(_:didFinishPickingMediaWithInfo:))) + .map({ (a) in + return try castOrThrow(Dictionary.self, a[1]) + }) + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didCancel: Observable<()> { + return rx_delegate + .observe(#selector(UIImagePickerControllerDelegate.imagePickerControllerDidCancel(_:))) + .map {_ in () } + } + + } + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift new file mode 100644 index 0000000..6d0caf0 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift @@ -0,0 +1,51 @@ +// +// UIImageView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UIImageView { + + /** + Bindable sink for `image` property. + */ + public var rx_image: AnyObserver { + return self.rx_imageAnimated(nil) + } + + /** + Bindable sink for `image` property. + + - parameter transitionType: Optional transition type while setting the image (kCATransitionFade, kCATransitionMoveIn, ...) + */ + public func rx_imageAnimated(transitionType: String?) -> AnyObserver { + return UIBindingObserver(UIElement: self) { imageView, image in + if let transitionType = transitionType { + if image != nil { + let transition = CATransition() + transition.duration = 0.25 + transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + transition.type = transitionType + imageView.layer.addAnimation(transition, forKey: kCATransition) + } + } + else { + imageView.layer.removeAllAnimations() + } + imageView.image = image + }.asObserver() + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift new file mode 100644 index 0000000..7e5822f --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift @@ -0,0 +1,39 @@ +// +// UILabel+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UILabel { + + /** + Bindable sink for `text` property. + */ + public var rx_text: AnyObserver { + return UIBindingObserver(UIElement: self) { label, text in + label.text = text + }.asObserver() + } + + /** + Bindable sink for `attributedText` property. + */ + public var rx_attributedText: AnyObserver { + return UIBindingObserver(UIElement: self) { label, text in + label.attributedText = text + }.asObserver() + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift new file mode 100644 index 0000000..3b59dd7 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift @@ -0,0 +1,30 @@ +// +// UIProgressView+Rx.swift +// Rx +// +// Created by Samuel Bae on 2/27/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UIProgressView { + + /** + Bindable sink for `progress` property + */ + public var rx_progress: AnyObserver { + return UIBindingObserver(UIElement: self) { progressView, progress in + progressView.progress = progress + }.asObserver() + } + +} + +#endif \ No newline at end of file diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift new file mode 100644 index 0000000..4c106d2 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift @@ -0,0 +1,33 @@ +// +// UIRefreshControl+Rx.swift +// RxCocoa +// +// Created by Yosuke Ishikawa on 1/31/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) +import UIKit + +#if !RX_NO_MODULE +import RxSwift +#endif + +extension UIRefreshControl { + + /** + Bindable sink for `beginRefreshing()`, `endRefreshing()` methods. + */ + public var rx_refreshing: AnyObserver { + return UIBindingObserver(UIElement: self) { refreshControl, refresh in + if refresh { + refreshControl.beginRefreshing() + } else { + refreshControl.endRefreshing() + } + }.asObserver() + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift new file mode 100644 index 0000000..2aaf8e4 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift @@ -0,0 +1,65 @@ +// +// UIScrollView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/3/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UIScrollView { + + /** + Factory method that enables subclasses to implement their own `rx_delegate`. + + - returns: Instance of delegate proxy that wraps `delegate`. + */ + public func rx_createDelegateProxy() -> RxScrollViewDelegateProxy { + return RxScrollViewDelegateProxy(parentObject: self) + } + + /** + Reactive wrapper for `delegate`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_delegate: DelegateProxy { + return proxyForObject(RxScrollViewDelegateProxy.self, self) + } + + /** + Reactive wrapper for `contentOffset`. + */ + public var rx_contentOffset: ControlProperty { + let proxy = proxyForObject(RxScrollViewDelegateProxy.self, self) + + let bindingObserver = UIBindingObserver(UIElement: self) { scrollView, contentOffset in + scrollView.contentOffset = contentOffset + } + + return ControlProperty(values: proxy.contentOffsetSubject, valueSink: bindingObserver) + } + + /** + Installs delegate as forwarding delegate on `rx_delegate`. + + It enables using normal delegate mechanism with reactive delegate mechanism. + + - parameter delegate: Delegate object. + - returns: Disposable object that can be used to unbind the delegate. + */ + public func rx_setDelegate(delegate: UIScrollViewDelegate) + -> Disposable { + let proxy = proxyForObject(RxScrollViewDelegateProxy.self, self) + return installDelegate(proxy, delegate: delegate, retainDelegate: false, onProxyForObject: self) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift new file mode 100644 index 0000000..038aca3 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift @@ -0,0 +1,73 @@ +// +// UISearchBar+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + + + +extension UISearchBar { + + /** + Reactive wrapper for `delegate`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_delegate: DelegateProxy { + return proxyForObject(RxSearchBarDelegateProxy.self, self) + } + + /** + Reactive wrapper for `text` property. + */ + public var rx_text: ControlProperty { + let source: Observable = Observable.deferred { [weak self] () -> Observable in + let text = self?.text ?? "" + + return (self?.rx_delegate.observe(#selector(UISearchBarDelegate.searchBar(_:textDidChange:))) ?? Observable.empty()) + .map { a in + return a[1] as? String ?? "" + } + .startWith(text) + } + + let bindingObserver = UIBindingObserver(UIElement: self) { (searchBar, text: String) in + searchBar.text = text + } + + return ControlProperty(values: source, valueSink: bindingObserver) + } + + /** + Reactive wrapper for `selectedScopeButtonIndex` property. + */ + public var rx_selectedScopeButtonIndex: ControlProperty { + let source: Observable = Observable.deferred { [weak self] () -> Observable in + let index = self?.selectedScopeButtonIndex ?? 0 + + return (self?.rx_delegate.observe(#selector(UISearchBarDelegate.searchBar(_:selectedScopeButtonIndexDidChange:))) ?? Observable.empty()) + .map { a in + return try castOrThrow(Int.self, a[1]) + } + .startWith(index) + } + + let bindingObserver = UIBindingObserver(UIElement: self) { (searchBar, index: Int) in + searchBar.selectedScopeButtonIndex = index + } + + return ControlProperty(values: source, valueSink: bindingObserver) + } +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift new file mode 100644 index 0000000..be46f4a --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift @@ -0,0 +1,35 @@ +// +// UISegmentedControl+Rx.swift +// RxCocoa +// +// Created by Carlos García on 8/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + + +extension UISegmentedControl { + + /** + Reactive wrapper for `selectedSegmentIndex` property. + */ + public var rx_value: ControlProperty { + return UIControl.rx_value( + self, + getter: { segmentedControl in + segmentedControl.selectedSegmentIndex + }, setter: { segmentedControl, value in + segmentedControl.selectedSegmentIndex = value + } + ) + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift new file mode 100644 index 0000000..2c02bd0 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift @@ -0,0 +1,35 @@ +// +// UISlider+Rx.swift +// RxCocoa +// +// Created by Alexander van der Werff on 28/05/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UISlider { + + /** + Reactive wrapper for `value` property. + */ + public var rx_value: ControlProperty { + return UIControl.rx_value( + self, + getter: { slider in + slider.value + }, setter: { slider, value in + slider.value = value + } + ) + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift new file mode 100644 index 0000000..9dc40c5 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift @@ -0,0 +1,36 @@ +// +// UIStepper+Rx.swift +// RxCocoa +// +// Created by Yuta ToKoRo on 9/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +extension UIStepper { + + /** + Reactive wrapper for `value` property. + */ + public var rx_value: ControlProperty { + return UIControl.rx_value( + self, + getter: { stepper in + stepper.value + }, setter: { stepper, value in + stepper.value = value + } + ) + } + +} + +#endif + diff --git a/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift new file mode 100644 index 0000000..bfc5b11 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift @@ -0,0 +1,36 @@ +// +// UISwitch+Rx.swift +// RxCocoa +// +// Created by Carlos García on 8/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + + +extension UISwitch { + + /** + Reactive wrapper for `on` property. + */ + public var rx_value: ControlProperty { + return UIControl.rx_value( + self, + getter: { uiSwitch in + uiSwitch.on + }, setter: { uiSwitch, value in + uiSwitch.on = value + } + ) + } + +} + +#endif + diff --git a/Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift new file mode 100644 index 0000000..2d07cde --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift @@ -0,0 +1,30 @@ +// +// UITabBarItem+Rx.swift +// Rx +// +// Created by Mateusz Derks on 04/03/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + + import Foundation + import UIKit +#if !RX_NO_MODULE + import RxSwift +#endif + +extension UITabBarItem { + + /** + Bindable sink for `badgeValue` property. + */ + public var rx_badgeValue: AnyObserver { + return UIBindingObserver(UIElement: self) { tabBarItem, badgeValue in + tabBarItem.badgeValue = badgeValue + }.asObserver() + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift new file mode 100644 index 0000000..5066140 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift @@ -0,0 +1,291 @@ +// +// UITableView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +// Items + +extension UITableView { + + /** + Binds sequences of elements to table view rows. + + - parameter source: Observable sequence of items. + - parameter cellFactory: Transform between sequence elements and view cells. + - returns: Disposable object that can be used to unbind. + */ + public func rx_itemsWithCellFactory + (source: O) + -> (cellFactory: (UITableView, Int, S.Generator.Element) -> UITableViewCell) + -> Disposable { + return { cellFactory in + let dataSource = RxTableViewReactiveArrayDataSourceSequenceWrapper(cellFactory: cellFactory) + + return self.rx_itemsWithDataSource(dataSource)(source: source) + } + } + + /** + Binds sequences of elements to table view rows. + + - parameter cellIdentifier: Identifier used to dequeue cells. + - parameter source: Observable sequence of items. + - parameter configureCell: Transform between sequence elements and view cells. + - parameter cellType: Type of table view cell. + - returns: Disposable object that can be used to unbind. + */ + public func rx_itemsWithCellIdentifier + (cellIdentifier: String, cellType: Cell.Type = Cell.self) + -> (source: O) + -> (configureCell: (Int, S.Generator.Element, Cell) -> Void) + -> Disposable { + return { source in + return { configureCell in + let dataSource = RxTableViewReactiveArrayDataSourceSequenceWrapper { (tv, i, item) in + let indexPath = NSIndexPath(forItem: i, inSection: 0) + let cell = tv.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! Cell + configureCell(i, item, cell) + return cell + } + return self.rx_itemsWithDataSource(dataSource)(source: source) + } + } + } + + /** + Binds sequences of elements to table view rows using a custom reactive data used to perform the transformation. + + - parameter dataSource: Data source used to transform elements to view cells. + - parameter source: Observable sequence of items. + - returns: Disposable object that can be used to unbind. + */ + public func rx_itemsWithDataSource, S: SequenceType, O: ObservableType where DataSource.Element == S, O.E == S> + (dataSource: DataSource) + -> (source: O) + -> Disposable { + return { source in + return source.subscribeProxyDataSourceForObject(self, dataSource: dataSource, retainDataSource: false) { [weak self] (_: RxTableViewDataSourceProxy, event) -> Void in + guard let tableView = self else { + return + } + dataSource.tableView(tableView, observedEvent: event) + } + } + } +} + +extension UITableView { + + /** + Factory method that enables subclasses to implement their own `rx_delegate`. + + - returns: Instance of delegate proxy that wraps `delegate`. + */ + public override func rx_createDelegateProxy() -> RxScrollViewDelegateProxy { + return RxTableViewDelegateProxy(parentObject: self) + } + + /** + Factory method that enables subclasses to implement their own `rx_dataSource`. + + - returns: Instance of delegate proxy that wraps `dataSource`. + */ + public func rx_createDataSourceProxy() -> RxTableViewDataSourceProxy { + return RxTableViewDataSourceProxy(parentObject: self) + } + + /** + Reactive wrapper for `dataSource`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_dataSource: DelegateProxy { + return proxyForObject(RxTableViewDataSourceProxy.self, self) + } + + /** + Installs data source as forwarding delegate on `rx_dataSource`. + + It enables using normal delegate mechanism with reactive delegate mechanism. + + - parameter dataSource: Data source object. + - returns: Disposable object that can be used to unbind the data source. + */ + public func rx_setDataSource(dataSource: UITableViewDataSource) + -> Disposable { + let proxy = proxyForObject(RxTableViewDataSourceProxy.self, self) + + return installDelegate(proxy, delegate: dataSource, retainDelegate: false, onProxyForObject: self) + } + + // events + + /** + Reactive wrapper for `delegate` message `tableView:didSelectRowAtIndexPath:`. + */ + public var rx_itemSelected: ControlEvent { + let source = rx_delegate.observe(#selector(UITableViewDelegate.tableView(_:didSelectRowAtIndexPath:))) + .map { a in + return a[1] as! NSIndexPath + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:didDeselectRowAtIndexPath:`. + */ + public var rx_itemDeselected: ControlEvent { + let source = rx_delegate.observe(#selector(UITableViewDelegate.tableView(_:didDeselectRowAtIndexPath:))) + .map { a in + return a[1] as! NSIndexPath + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:accessoryButtonTappedForRowWithIndexPath:`. + */ + public var rx_itemAccessoryButtonTapped: ControlEvent { + let source: Observable = rx_delegate.observe(#selector(UITableViewDelegate.tableView(_:accessoryButtonTappedForRowWithIndexPath:))) + .map { a in + return a[1] as! NSIndexPath + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`. + */ + public var rx_itemInserted: ControlEvent { + let source = rx_dataSource.observe(#selector(UITableViewDataSource.tableView(_:commitEditingStyle:forRowAtIndexPath:))) + .filter { a in + return UITableViewCellEditingStyle(rawValue: (a[1] as! NSNumber).integerValue) == .Insert + } + .map { a in + return (a[2] as! NSIndexPath) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`. + */ + public var rx_itemDeleted: ControlEvent { + let source = rx_dataSource.observe(#selector(UITableViewDataSource.tableView(_:commitEditingStyle:forRowAtIndexPath:))) + .filter { a in + return UITableViewCellEditingStyle(rawValue: (a[1] as! NSNumber).integerValue) == .Delete + } + .map { a in + return (a[2] as! NSIndexPath) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:moveRowAtIndexPath:toIndexPath:`. + */ + public var rx_itemMoved: ControlEvent { + let source: Observable = rx_dataSource.observe(#selector(UITableViewDataSource.tableView(_:moveRowAtIndexPath:toIndexPath:))) + .map { a in + return ((a[1] as! NSIndexPath), (a[2] as! NSIndexPath)) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:didSelectRowAtIndexPath:`. + + It can be only used when one of the `rx_itemsWith*` methods is used to bind observable sequence, + or any other data source conforming to `SectionedViewDataSourceType` protocol. + + ``` + tableView.rx_modelSelected(MyModel.self) + .map { ... + ``` + */ + public func rx_modelSelected(modelType: T.Type) -> ControlEvent { + let source: Observable = rx_itemSelected.flatMap { [weak self] indexPath -> Observable in + guard let view = self else { + return Observable.empty() + } + + return Observable.just(try view.rx_modelAtIndexPath(indexPath)) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:didDeselectRowAtIndexPath:`. + + It can be only used when one of the `rx_itemsWith*` methods is used to bind observable sequence, + or any other data source conforming to `SectionedViewDataSourceType` protocol. + + ``` + tableView.rx_modelDeselected(MyModel.self) + .map { ... + ``` + */ + public func rx_modelDeselected(modelType: T.Type) -> ControlEvent { + let source: Observable = rx_itemDeselected.flatMap { [weak self] indexPath -> Observable in + guard let view = self else { + return Observable.empty() + } + + return Observable.just(try view.rx_modelAtIndexPath(indexPath)) + } + + return ControlEvent(events: source) + } + + /** + Synchronous helper method for retrieving a model at indexPath through a reactive data source. + */ + public func rx_modelAtIndexPath(indexPath: NSIndexPath) throws -> T { + let dataSource: SectionedViewDataSourceType = castOrFatalError(self.rx_dataSource.forwardToDelegate(), message: "This method only works in case one of the `rx_items*` methods was used.") + + let element = try dataSource.modelAtIndexPath(indexPath) + + return castOrFatalError(element) + } +} + +#endif + +#if os(tvOS) + + extension UITableView { + + /** + Reactive wrapper for `delegate` message `tableView:didUpdateFocusInContext:withAnimationCoordinator:`. + */ + public var rx_didUpdateFocusInContextWithAnimationCoordinator: ControlEvent<(context: UIFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator)> { + + let source = rx_delegate.observe(#selector(UITableViewDelegate.tableView(_:didUpdateFocusInContext:withAnimationCoordinator:))) + .map { a -> (context: UIFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator) in + let context = a[1] as! UIFocusUpdateContext + let animationCoordinator = a[2] as! UIFocusAnimationCoordinator + return (context: context, animationCoordinator: animationCoordinator) + } + + return ControlEvent(events: source) + } + } +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift new file mode 100644 index 0000000..35f888f --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift @@ -0,0 +1,35 @@ +// +// UITextField+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +#if !RX_NO_MODULE +import RxSwift +#endif +import UIKit + +extension UITextField { + + /** + Reactive wrapper for `text` property. + */ + public var rx_text: ControlProperty { + return UIControl.rx_value( + self, + getter: { textField in + textField.text ?? "" + }, setter: { textField, value in + textField.text = value + } + ) + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift new file mode 100644 index 0000000..06389f3 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift @@ -0,0 +1,65 @@ +// +// UITextView+Rx.swift +// RxCocoa +// +// Created by Yuta ToKoRo on 7/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + + + +extension UITextView { + + /** + Factory method that enables subclasses to implement their own `rx_delegate`. + + - returns: Instance of delegate proxy that wraps `delegate`. + */ + public override func rx_createDelegateProxy() -> RxScrollViewDelegateProxy { + return RxTextViewDelegateProxy(parentObject: self) + } + + /** + Reactive wrapper for `text` property. + */ + public var rx_text: ControlProperty { + let source: Observable = Observable.deferred { [weak self] in + let text = self?.text ?? "" + + let textChanged = self?.textStorage + // This project uses text storage notifications because + // that's the only way to catch autocorrect changes + // in all cases. Other suggestions are welcome. + .rx_didProcessEditingRangeChangeInLength + // This observe on is here because text storage + // will emit event while process is not completely done, + // so rebinding a value will cause an exception to be thrown. + .observeOn(MainScheduler.asyncInstance) + .map { _ in + return self?.textStorage.string ?? "" + } + ?? Observable.empty() + + return textChanged + .startWith(text) + .distinctUntilChanged() + } + + let bindingObserver = UIBindingObserver(UIElement: self) { (textView, text: String) in + textView.text = text + } + + return ControlProperty(values: source, valueSink: bindingObserver) + } + +} + +#endif diff --git a/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift b/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift new file mode 100644 index 0000000..ea0ee82 --- /dev/null +++ b/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift @@ -0,0 +1,37 @@ +// +// UIView+Rx.swift +// Rx +// +// Created by Krunoslav Zaher on 12/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import Foundation +import UIKit +#if !RX_NO_MODULE +import RxSwift +#endif + +extension UIView { + /** + Bindable sink for `hidden` property. + */ + public var rx_hidden: AnyObserver { + return UIBindingObserver(UIElement: self) { view, hidden in + view.hidden = hidden + }.asObserver() + } + + /** + Bindable sink for `alpha` property. + */ + public var rx_alpha: AnyObserver { + return UIBindingObserver(UIElement: self) { view, alpha in + view.alpha = alpha + }.asObserver() + } +} + +#endif diff --git a/Pods/RxSwift/LICENSE.md b/Pods/RxSwift/LICENSE.md new file mode 100644 index 0000000..d6765d9 --- /dev/null +++ b/Pods/RxSwift/LICENSE.md @@ -0,0 +1,9 @@ +**The MIT License** +**Copyright © 2015 Krunoslav Zaher** +**All rights reserved.** + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Pods/RxSwift/README.md b/Pods/RxSwift/README.md new file mode 100644 index 0000000..b5d5519 --- /dev/null +++ b/Pods/RxSwift/README.md @@ -0,0 +1,77 @@ +Miss Electric Eel 2016 RxSwift: ReactiveX for Swift +====================================== + +[![Travis CI](https://travis-ci.org/ReactiveX/RxSwift.svg?branch=master)](https://travis-ci.org/ReactiveX/RxSwift) ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20OSX%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux%28experimental%29-333333.svg) ![pod](https://img.shields.io/cocoapods/v/RxSwift.svg) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) + + +Xcode 7.3 Swift 2.2 required + +## About Rx + +Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable` interface. + +This is a Swift version of [Rx](https://github.com/Reactive-Extensions/Rx.NET). + +It tries to port as many concepts from the original version as possible, but some concepts were adapted for more pleasant and performant integration with iOS/OSX environment. + +Cross platform documentation can be found on [ReactiveX.io](http://reactivex.io/). + +Like the original Rx, its intention is to enable easy composition of asynchronous operations and event/data streams. + +KVO observing, async operations and streams are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful. + +## I came here because I want to ... + +###### ... understand + +* [why use rx?](Documentation/Why.md) +* [the basics, getting started with RxSwift](Documentation/GettingStarted.md) +* [units](Documentation/Units.md) - what is `Driver`, `ControlProperty`, and `Variable` ... and why do they exist? +* [testing](Documentation/UnitTests.md) +* [tips and common errors](Documentation/Tips.md) +* [debugging](Documentation/GettingStarted.md#debugging) +* [the math behind Rx](Documentation/MathBehindRx.md) +* [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) + +###### ... hack around + +* with example app. [Running Example App](Documentation/ExampleApp.md) +* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md) + +###### ... interact + +* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences.
[![Slack channel](http://slack.rxswift.org/badge.svg)](http://slack.rxswift.org) [Join Slack Channel](http://slack.rxswift.org/) +* Report a problem using the library. [Open an Issue With Bug Template](Documentation/IssueTemplate.md) +* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md) + + +###### ... compare + +* [with other libraries](Documentation/ComparisonWithOtherLibraries.md). + + +###### ... find compatible + +* libraries from [RxSwiftCommunity](https://github.com/RxSwiftCommunity). +* [Pods using RxSwift](https://cocoapods.org/?q=uses%3Arxswift). + +###### ... see the broader vision + +* Does this exist for Android? [RxJava](https://github.com/ReactiveX/RxJava) +* Where is all of this going, what is the future, what about reactive architectures, how do you design entire apps this way? [Cycle.js](https://github.com/cyclejs/cycle-core) - this is javascript, but [RxJS](https://github.com/Reactive-Extensions/RxJS) is javascript version of Rx. + +##### References + +* [http://reactivex.io/](http://reactivex.io/) +* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions) +* [Erik Meijer (Wikipedia)](http://en.wikipedia.org/wiki/Erik_Meijer_%28computer_scientist%29) +* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY) +* [Reactive Programming Overview (Jafar Husain from Netflix)](https://www.youtube.com/watch?v=dwP1TNXE6fc) +* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf) +* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/) +* [Haskell](https://www.haskell.org/) diff --git a/Pods/RxSwift/RxSwift/AnyObserver.swift b/Pods/RxSwift/RxSwift/AnyObserver.swift new file mode 100644 index 0000000..88a8440 --- /dev/null +++ b/Pods/RxSwift/RxSwift/AnyObserver.swift @@ -0,0 +1,75 @@ +// +// AnyObserver.swift +// Rx +// +// Created by Krunoslav Zaher on 2/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +A type-erased `ObserverType`. + +Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type. +*/ +public struct AnyObserver : ObserverType { + /** + The type of elements in sequence that observer can observe. + */ + public typealias E = Element + + /** + Anonymous event handler type. + */ + public typealias EventHandler = (Event) -> Void + + public let observer: EventHandler + + /** + Construct an instance whose `on(event)` calls `eventHandler(event)` + + - parameter eventHandler: Event handler that observes sequences events. + */ + public init(eventHandler: EventHandler) { + self.observer = eventHandler + } + + /** + Construct an instance whose `on(event)` calls `observer.on(event)` + + - parameter observer: Observer that receives sequence events. + */ + public init(_ observer: O) { + self.observer = observer.on + } + + /** + Send `event` to this observer. + + - parameter event: Event instance. + */ + public func on(event: Event) { + return self.observer(event) + } + + /** + Erases type of observer and returns canonical observer. + + - returns: type erased observer. + */ + public func asObserver() -> AnyObserver { + return self + } +} + +extension ObserverType { + /** + Erases type of observer and returns canonical observer. + + - returns: type erased observer. + */ + public func asObserver() -> AnyObserver { + return AnyObserver(self) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Cancelable.swift b/Pods/RxSwift/RxSwift/Cancelable.swift new file mode 100644 index 0000000..1a6c591 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Cancelable.swift @@ -0,0 +1,19 @@ +// +// Cancelable.swift +// Rx +// +// Created by Krunoslav Zaher on 3/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents disposable resource with state tracking. +*/ +public protocol Cancelable : Disposable { + /** + - returns: Was resource disposed. + */ + var disposed: Bool { get } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift b/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift new file mode 100644 index 0000000..e39fa6c --- /dev/null +++ b/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift @@ -0,0 +1,104 @@ +// +// AsyncLock.swift +// Rx +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +In case nobody holds this lock, the work will be queued and executed immediately +on thread that is requesting lock. + +In case there is somebody currently holding that lock, action will be enqueued. +When owned of the lock finishes with it's processing, it will also execute +and pending work. + +That means that enqueued work could possibly be executed later on a different thread. +*/ +class AsyncLock + : Disposable + , Lock + , SynchronizedDisposeType { + typealias Action = () -> Void + + var _lock = SpinLock() + + private var _queue: Queue = Queue(capacity: 0) + + private var _isExecuting: Bool = false + private var _hasFaulted: Bool = false + + // lock { + func lock() { + _lock.lock() + } + + func unlock() { + _lock.unlock() + } + // } + + private func enqueue(action: I) -> I? { + _lock.lock(); defer { _lock.unlock() } // { + if _hasFaulted { + return nil + } + + if _isExecuting { + _queue.enqueue(action) + return nil + } + + _isExecuting = true + + return action + // } + } + + private func dequeue() -> I? { + _lock.lock(); defer { _lock.unlock() } // { + if _queue.count > 0 { + return _queue.dequeue() + } + else { + _isExecuting = false + return nil + } + // } + } + + func invoke(action: I) { + let firstEnqueuedAction = enqueue(action) + + if let firstEnqueuedAction = firstEnqueuedAction { + firstEnqueuedAction.invoke() + } + else { + // action is enqueued, it's somebody else's concern now + return + } + + while true { + let nextAction = dequeue() + + if let nextAction = nextAction { + nextAction.invoke() + } + else { + return + } + } + } + + func dispose() { + synchronizedDispose() + } + + func _synchronized_dispose() { + _queue = Queue(capacity: 0) + _hasFaulted = true + } +} diff --git a/Pods/RxSwift/RxSwift/Concurrency/Lock.swift b/Pods/RxSwift/RxSwift/Concurrency/Lock.swift new file mode 100644 index 0000000..048ac50 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Concurrency/Lock.swift @@ -0,0 +1,119 @@ +// +// Lock.swift +// Rx +// +// Created by Krunoslav Zaher on 3/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol Lock { + func lock() + func unlock() +} + +#if os(Linux) + import Glibc + + /** + Simple wrapper for spin lock. + */ + class SpinLock { + private var _lock: pthread_spinlock_t = 0 + + init() { + if (pthread_spin_init(&_lock, 0) != 0) { + fatalError("Spin lock initialization failed") + } + } + + func lock() { + pthread_spin_lock(&_lock) + } + + func unlock() { + pthread_spin_unlock(&_lock) + } + + func performLocked(@noescape action: () -> Void) { + pthread_spin_lock(&_lock) + action() + pthread_spin_unlock(&_lock) + } + + func calculateLocked(@noescape action: () -> T) -> T { + pthread_spin_lock(&_lock) + let result = action() + pthread_spin_unlock(&_lock) + return result + } + + func calculateLockedOrFail(@noescape action: () throws -> T) throws -> T { + pthread_spin_lock(&_lock) + defer { + pthread_spin_unlock(&_lock) + } + let result = try action() + return result + } + + deinit { + pthread_spin_destroy(&_lock) + } + } +#else + + // https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000321.html + typealias SpinLock = NSRecursiveLock +#endif + +extension NSRecursiveLock : Lock { + func performLocked(@noescape action: () -> Void) { + self.lock() + action() + self.unlock() + } + + func calculateLocked(@noescape action: () -> T) -> T { + self.lock() + let result = action() + self.unlock() + return result + } + + func calculateLockedOrFail(@noescape action: () throws -> T) throws -> T { + self.lock() + defer { + self.unlock() + } + let result = try action() + return result + } +} + +/* +let RECURSIVE_MUTEX = _initializeRecursiveMutex() + +func _initializeRecursiveMutex() -> pthread_mutex_t { + var mutex: pthread_mutex_t = pthread_mutex_t() + var mta: pthread_mutexattr_t = pthread_mutexattr_t() + + pthread_mutex_init(&mutex, nil) + pthread_mutexattr_init(&mta) + pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE) + pthread_mutex_init(&mutex, &mta) + + return mutex +} + +extension pthread_mutex_t { + mutating func lock() { + pthread_mutex_lock(&self) + } + + mutating func unlock() { + pthread_mutex_unlock(&self) + } +} +*/ diff --git a/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift b/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift new file mode 100644 index 0000000..b11fcaa --- /dev/null +++ b/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift @@ -0,0 +1,23 @@ +// +// LockOwnerType.swift +// Rx +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol LockOwnerType : class, Lock { + var _lock: NSRecursiveLock { get } +} + +extension LockOwnerType { + func lock() { + _lock.lock() + } + + func unlock() { + _lock.unlock() + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift new file mode 100644 index 0000000..5764575 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift @@ -0,0 +1,20 @@ +// +// SynchronizedDisposeType.swift +// Rx +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol SynchronizedDisposeType : class, Disposable, Lock { + func _synchronized_dispose() +} + +extension SynchronizedDisposeType { + func synchronizedDispose() { + lock(); defer { unlock() } + _synchronized_dispose() + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift new file mode 100644 index 0000000..84a3df5 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift @@ -0,0 +1,20 @@ +// +// SynchronizedOnType.swift +// Rx +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol SynchronizedOnType : class, ObserverType, Lock { + func _synchronized_on(event: Event) +} + +extension SynchronizedOnType { + func synchronizedOn(event: Event) { + lock(); defer { unlock() } + _synchronized_on(event) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift new file mode 100644 index 0000000..a490315 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift @@ -0,0 +1,20 @@ +// +// SynchronizedSubscribeType.swift +// Rx +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol SynchronizedSubscribeType : class, ObservableType, Lock { + func _synchronized_subscribe(observer: O) -> Disposable +} + +extension SynchronizedSubscribeType { + func synchronizedSubscribe(observer: O) -> Disposable { + lock(); defer { unlock() } + return _synchronized_subscribe(observer) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift new file mode 100644 index 0000000..4f41cb8 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift @@ -0,0 +1,15 @@ +// +// SynchronizedUnsubscribeType.swift +// Rx +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol SynchronizedUnsubscribeType : class { + associatedtype DisposeKey + + func synchronizedUnsubscribe(disposeKey: DisposeKey) +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/ConnectableObservableType.swift b/Pods/RxSwift/RxSwift/ConnectableObservableType.swift new file mode 100644 index 0000000..6722a4c --- /dev/null +++ b/Pods/RxSwift/RxSwift/ConnectableObservableType.swift @@ -0,0 +1,21 @@ +// +// ConnectableObservableType.swift +// Rx +// +// Created by Krunoslav Zaher on 3/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence. +*/ +public protocol ConnectableObservableType : ObservableType { + /** + Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established. + + - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. + */ + func connect() -> Disposable +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/DataStructures/Bag.swift b/Pods/RxSwift/RxSwift/DataStructures/Bag.swift new file mode 100644 index 0000000..fe074de --- /dev/null +++ b/Pods/RxSwift/RxSwift/DataStructures/Bag.swift @@ -0,0 +1,327 @@ +// +// Bag.swift +// Rx +// +// Created by Krunoslav Zaher on 2/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation +import Swift + +let arrayDictionaryMaxSize = 30 + +/** +Class that enables using memory allocations as a means to uniquely identify objects. +*/ +class Identity { + // weird things have known to happen with Swift + var _forceAllocation: Int32 = 0 +} + +func hash(_x: Int) -> Int { + var x = _x + x = ((x >> 16) ^ x) &* 0x45d9f3b + x = ((x >> 16) ^ x) &* 0x45d9f3b + x = ((x >> 16) ^ x) + return x; +} + +/** +Unique identifier for object added to `Bag`. +*/ +public struct BagKey : Hashable { + let uniqueIdentity: Identity? + let key: Int + + public var hashValue: Int { + if let uniqueIdentity = uniqueIdentity { + return hash(key) ^ (unsafeAddressOf(uniqueIdentity).hashValue) + } + else { + return hash(key) + } + } +} + +/** +Compares two `BagKey`s. +*/ +public func == (lhs: BagKey, rhs: BagKey) -> Bool { + return lhs.key == rhs.key && lhs.uniqueIdentity === rhs.uniqueIdentity +} + +/** +Data structure that represents a bag of elements typed `T`. + +Single element can be stored multiple times. + +Time and space complexity of insertion an deletion is O(n). + +It is suitable for storing small number of elements. +*/ +public struct Bag : CustomDebugStringConvertible { + /** + Type of identifier for inserted elements. + */ + public typealias KeyType = BagKey + + private typealias ScopeUniqueTokenType = Int + + typealias Entry = (key: BagKey, value: T) + + private var _uniqueIdentity: Identity? + private var _nextKey: ScopeUniqueTokenType = 0 + + // data + + // first fill inline variables + private var _key0: BagKey? = nil + private var _value0: T? = nil + + private var _key1: BagKey? = nil + private var _value1: T? = nil + + // then fill "array dictionary" + private var _pairs = ContiguousArray() + + // last is sparse dictionary + private var _dictionary: [BagKey : T]? = nil + + private var _onlyFastPath = true + + /** + Creates new empty `Bag`. + */ + public init() { + } + + /** + Inserts `value` into bag. + + - parameter element: Element to insert. + - returns: Key that can be used to remove element from bag. + */ + public mutating func insert(element: T) -> BagKey { + _nextKey = _nextKey &+ 1 + +#if DEBUG + _nextKey = _nextKey % 20 +#endif + + if _nextKey == 0 { + _uniqueIdentity = Identity() + } + + let key = BagKey(uniqueIdentity: _uniqueIdentity, key: _nextKey) + + if _key0 == nil { + _key0 = key + _value0 = element + return key + } + + _onlyFastPath = false + + if _key1 == nil { + _key1 = key + _value1 = element + return key + } + + if _dictionary != nil { + _dictionary![key] = element + return key + } + + if _pairs.count < arrayDictionaryMaxSize { + _pairs.append(key: key, value: element) + return key + } + + if _dictionary == nil { + _dictionary = [:] + } + + _dictionary![key] = element + + return key + } + + /** + - returns: Number of elements in bag. + */ + public var count: Int { + return _pairs.count + (_value0 != nil ? 1 : 0) + (_value1 != nil ? 1 : 0) + (_dictionary?.count ?? 0) + } + + /** + Removes all elements from bag and clears capacity. + */ + public mutating func removeAll() { + _key0 = nil + _value0 = nil + _key1 = nil + _value1 = nil + + _pairs.removeAll(keepCapacity: false) + _dictionary?.removeAll(keepCapacity: false) + } + + /** + Removes element with a specific `key` from bag. + + - parameter key: Key that identifies element to remove from bag. + - returns: Element that bag contained, or nil in case element was already removed. + */ + public mutating func removeKey(key: BagKey) -> T? { + if _key0 == key { + _key0 = nil + let value = _value0! + _value0 = nil + return value + } + + if _key1 == key { + _key1 = nil + let value = _value1! + _value1 = nil + return value + } + + if let existingObject = _dictionary?.removeValueForKey(key) { + return existingObject + } + + for i in 0 ..< _pairs.count { + if _pairs[i].key == key { + let value = _pairs[i].value + _pairs.removeAtIndex(i) + return value + } + } + + return nil + } +} + +extension Bag { + /** + A textual representation of `self`, suitable for debugging. + */ + public var debugDescription : String { + return "\(self.count) elements in Bag" + } +} + + +// MARK: forEach + +extension Bag { + /** + Enumerates elements inside the bag. + + - parameter action: Enumeration closure. + */ + public func forEach(@noescape action: (T) -> Void) { + if _onlyFastPath { + if let value0 = _value0 { + action(value0) + } + return + } + + let pairs = _pairs + let value0 = _value0 + let value1 = _value1 + let dictionary = _dictionary + + if let value0 = value0 { + action(value0) + } + + if let value1 = value1 { + action(value1) + } + + for i in 0 ..< pairs.count { + action(pairs[i].value) + } + + if dictionary?.count ?? 0 > 0 { + for element in dictionary!.values { + action(element) + } + } + } +} + +extension Bag where T: ObserverType { + /** + Dispatches `event` to app observers contained inside bag. + + - parameter action: Enumeration closure. + */ + public func on(event: Event) { + if _onlyFastPath { + _value0?.on(event) + return + } + + let pairs = _pairs + let value0 = _value0 + let value1 = _value1 + let dictionary = _dictionary + + if let value0 = value0 { + value0.on(event) + } + + if let value1 = value1 { + value1.on(event) + } + + for i in 0 ..< pairs.count { + pairs[i].value.on(event) + } + + if dictionary?.count ?? 0 > 0 { + for element in dictionary!.values { + element.on(event) + } + } + } +} + +/** +Dispatches `dispose` to all disposables contained inside bag. +*/ +public func disposeAllIn(bag: Bag) { + if bag._onlyFastPath { + bag._value0?.dispose() + return + } + + let pairs = bag._pairs + let value0 = bag._value0 + let value1 = bag._value1 + let dictionary = bag._dictionary + + if let value0 = value0 { + value0.dispose() + } + + if let value1 = value1 { + value1.dispose() + } + + for i in 0 ..< pairs.count { + pairs[i].value.dispose() + } + + if dictionary?.count ?? 0 > 0 { + for element in dictionary!.values { + element.dispose() + } + } +} diff --git a/Pods/RxSwift/RxSwift/DataStructures/InfiniteSequence.swift b/Pods/RxSwift/RxSwift/DataStructures/InfiniteSequence.swift new file mode 100644 index 0000000..a594bb5 --- /dev/null +++ b/Pods/RxSwift/RxSwift/DataStructures/InfiniteSequence.swift @@ -0,0 +1,30 @@ +// +// InfiniteSequence.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Sequence that repeats `repeatedValue` infinite number of times. +*/ +struct InfiniteSequence : SequenceType { + typealias Element = E + typealias Generator = AnyGenerator + + private let _repeatedValue: E + + init(repeatedValue: E) { + _repeatedValue = repeatedValue + } + + func generate() -> Generator { + let repeatedValue = _repeatedValue + return AnyGenerator { + return repeatedValue + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/DataStructures/PriorityQueue.swift b/Pods/RxSwift/RxSwift/DataStructures/PriorityQueue.swift new file mode 100644 index 0000000..efbd546 --- /dev/null +++ b/Pods/RxSwift/RxSwift/DataStructures/PriorityQueue.swift @@ -0,0 +1,120 @@ +// +// PriorityQueue.swift +// Rx +// +// Created by Krunoslav Zaher on 12/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +struct PriorityQueue { + private let _hasHigherPriority: (Element, Element) -> Bool + private var _elements = [Element]() + + init(hasHigherPriority: (Element, Element) -> Bool) { + _hasHigherPriority = hasHigherPriority + } + + mutating func enqueue(element: Element) { + _elements.append(element) + bubbleToHigherPriority(_elements.count - 1) + } + + func peek() -> Element? { + return _elements.first + } + + var isEmpty: Bool { + return _elements.count == 0 + } + + mutating func dequeue() -> Element? { + guard let front = peek() else { + return nil + } + + removeAt(0) + + return front + } + + mutating func remove(element: Element) { + for i in 0 ..< _elements.count { + if _elements[i] === element { + removeAt(i) + return + } + } + } + + private mutating func removeAt(index: Int) { + let removingLast = index == _elements.count - 1 + if !removingLast { + swap(&_elements[index], &_elements[_elements.count - 1]) + } + + _elements.popLast() + + if !removingLast { + bubbleToHigherPriority(index) + bubbleToLowerPriority(index) + } + } + + private mutating func bubbleToHigherPriority(initialUnbalancedIndex: Int) { + precondition(initialUnbalancedIndex >= 0) + precondition(initialUnbalancedIndex < _elements.count) + + var unbalancedIndex = initialUnbalancedIndex + + while unbalancedIndex > 0 { + let parentIndex = (unbalancedIndex - 1) / 2 + + if _hasHigherPriority(_elements[unbalancedIndex], _elements[parentIndex]) { + swap(&_elements[unbalancedIndex], &_elements[parentIndex]) + + unbalancedIndex = parentIndex + } + else { + break + } + } + } + + private mutating func bubbleToLowerPriority(initialUnbalancedIndex: Int) { + precondition(initialUnbalancedIndex >= 0) + precondition(initialUnbalancedIndex < _elements.count) + + var unbalancedIndex = initialUnbalancedIndex + repeat { + let leftChildIndex = unbalancedIndex * 2 + 1 + let rightChildIndex = unbalancedIndex * 2 + 2 + + var highestPriorityIndex = unbalancedIndex + + if leftChildIndex < _elements.count && _hasHigherPriority(_elements[leftChildIndex], _elements[highestPriorityIndex]) { + highestPriorityIndex = leftChildIndex + } + + if rightChildIndex < _elements.count && _hasHigherPriority(_elements[rightChildIndex], _elements[highestPriorityIndex]) { + highestPriorityIndex = rightChildIndex + } + + if highestPriorityIndex != unbalancedIndex { + swap(&_elements[highestPriorityIndex], &_elements[unbalancedIndex]) + + unbalancedIndex = highestPriorityIndex + } + else { + break + } + } while true + } +} + +extension PriorityQueue : CustomDebugStringConvertible { + var debugDescription: String { + return _elements.debugDescription + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/DataStructures/Queue.swift b/Pods/RxSwift/RxSwift/DataStructures/Queue.swift new file mode 100644 index 0000000..f38d4ae --- /dev/null +++ b/Pods/RxSwift/RxSwift/DataStructures/Queue.swift @@ -0,0 +1,174 @@ +// +// Queue.swift +// Rx +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Data structure that represents queue. + +Complexity of `enqueue`, `dequeue` is O(1) when number of operations is +averaged over N operations. + +Complexity of `peek` is O(1). +*/ +public struct Queue: SequenceType { + /** + Type of generator. + */ + public typealias Generator = AnyGenerator + + private let _resizeFactor = 2 + + private var _storage: ContiguousArray + private var _count: Int + private var _pushNextIndex: Int + private var _initialCapacity: Int + + /** + Creates new queue. + + - parameter capacity: Capacity of newly created queue. + */ + public init(capacity: Int) { + _initialCapacity = capacity + + _count = 0 + _pushNextIndex = 0 + + if capacity > 0 { + _storage = ContiguousArray(count: capacity, repeatedValue: nil) + } + else { + _storage = ContiguousArray() + } + } + + private var dequeueIndex: Int { + let index = _pushNextIndex - count + return index < 0 ? index + _storage.count : index + } + + /** + - returns: Is queue empty. + */ + public var isEmpty: Bool { + return count == 0 + } + + /** + - returns: Number of elements inside queue. + */ + public var count: Int { + return _count + } + + /** + - returns: Element in front of a list of elements to `dequeue`. + */ + public func peek() -> T { + precondition(count > 0) + + return _storage[dequeueIndex]! + } + + mutating private func resizeTo(size: Int) { + var newStorage = ContiguousArray(count: size, repeatedValue: nil) + + let count = _count + + let dequeueIndex = self.dequeueIndex + let spaceToEndOfQueue = _storage.count - dequeueIndex + + // first batch is from dequeue index to end of array + let countElementsInFirstBatch = min(count, spaceToEndOfQueue) + // second batch is wrapped from start of array to end of queue + let numberOfElementsInSecondBatch = count - countElementsInFirstBatch + + newStorage[0 ..< countElementsInFirstBatch] = _storage[dequeueIndex ..< (dequeueIndex + countElementsInFirstBatch)] + newStorage[countElementsInFirstBatch ..< (countElementsInFirstBatch + numberOfElementsInSecondBatch)] = _storage[0 ..< numberOfElementsInSecondBatch] + + _count = count + _pushNextIndex = count + _storage = newStorage + } + + /** + Enqueues `element`. + + - parameter element: Element to enqueue. + */ + public mutating func enqueue(element: T) { + if count == _storage.count { + resizeTo(max(_storage.count, 1) * _resizeFactor) + } + + _storage[_pushNextIndex] = element + _pushNextIndex += 1 + _count = _count + 1 + + if _pushNextIndex >= _storage.count { + _pushNextIndex -= _storage.count + } + } + + private mutating func dequeueElementOnly() -> T { + precondition(count > 0) + + let index = dequeueIndex + let value = _storage[index]! + + _storage[index] = nil + + _count = _count - 1 + + return value + } + + /** + Dequeues element or throws an exception in case queue is empty. + + - returns: Dequeued element. + */ + public mutating func dequeue() -> T? { + if self.count == 0 { + return nil + } + + let value = dequeueElementOnly() + + let downsizeLimit = _storage.count / (_resizeFactor * _resizeFactor) + if _count < downsizeLimit && downsizeLimit >= _initialCapacity { + resizeTo(_storage.count / _resizeFactor) + } + + return value + } + + /** + - returns: Generator of contained elements. + */ + public func generate() -> Generator { + var i = dequeueIndex + var count = _count + + return AnyGenerator { + if count == 0 { + return nil + } + + count -= 1 + if i >= self._storage.count { + i -= self._storage.count + } + + let element = self._storage[i] + i += 1 + return element + } + } +} diff --git a/Pods/RxSwift/RxSwift/Disposable.swift b/Pods/RxSwift/RxSwift/Disposable.swift new file mode 100644 index 0000000..a785d36 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposable.swift @@ -0,0 +1,19 @@ +// +// Disposable.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Respresents disposable resource. +*/ +public protocol Disposable { + /** + Dispose resource. + */ + func dispose() +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift new file mode 100644 index 0000000..17a4091 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift @@ -0,0 +1,54 @@ +// +// AnonymousDisposable.swift +// Rx +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents an Action-based disposable. + +When dispose method is called, disposal action will be dereferenced. +*/ +public final class AnonymousDisposable : DisposeBase, Cancelable { + public typealias DisposeAction = () -> Void + + private var _disposed: AtomicInt = 0 + private var _disposeAction: DisposeAction? + + /** + - returns: Was resource disposed. + */ + public var disposed: Bool { + return _disposed == 1 + } + + /** + Constructs a new disposable with the given action used for disposal. + + - parameter disposeAction: Disposal action which will be run upon calling `dispose`. + */ + public init(_ disposeAction: DisposeAction) { + _disposeAction = disposeAction + super.init() + } + + /** + Calls the disposal action if and only if the current instance hasn't been disposed yet. + + After invoking disposal action, disposal action will be dereferenced. + */ + public func dispose() { + if AtomicCompareAndSwap(0, 1, &_disposed) { + assert(_disposed == 1) + + if let action = _disposeAction { + _disposeAction = nil + action() + } + } + } +} diff --git a/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift new file mode 100644 index 0000000..b617659 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift @@ -0,0 +1,54 @@ +// +// BinaryDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents two disposable resources that are disposed together. +*/ +public final class BinaryDisposable : DisposeBase, Cancelable { + + private var _disposed: AtomicInt = 0 + + // state + private var _disposable1: Disposable? + private var _disposable2: Disposable? + + /** + - returns: Was resource disposed. + */ + public var disposed: Bool { + return _disposed > 0 + } + + /** + Constructs new binary disposable from two disposables. + + - parameter disposable1: First disposable + - parameter disposable2: Second disposable + */ + init(_ disposable1: Disposable, _ disposable2: Disposable) { + _disposable1 = disposable1 + _disposable2 = disposable2 + super.init() + } + + /** + Calls the disposal action if and only if the current instance hasn't been disposed yet. + + After invoking disposal action, disposal action will be dereferenced. + */ + public func dispose() { + if AtomicCompareAndSwap(0, 1, &_disposed) { + _disposable1?.dispose() + _disposable2?.dispose() + _disposable1 = nil + _disposable2 = nil + } + } +} diff --git a/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift new file mode 100644 index 0000000..05b8a43 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift @@ -0,0 +1,45 @@ +// +// BooleanDisposable.swift +// Rx +// +// Created by Junior B. on 10/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents a disposable resource that can be checked for disposal status. +*/ +public class BooleanDisposable : Disposable, Cancelable { + + internal static let BooleanDisposableTrue = BooleanDisposable(disposed: true) + private var _disposed = false + + /** + Initializes a new instance of the `BooleanDisposable` class + */ + public init() { + } + + /** + Initializes a new instance of the `BooleanDisposable` class with given value + */ + public init(disposed: Bool) { + self._disposed = disposed + } + + /** + - returns: Was resource disposed. + */ + public var disposed: Bool { + return _disposed + } + + /** + Sets the status to disposed, which can be observer through the `disposed` property. + */ + public func dispose() { + _disposed = true + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift new file mode 100644 index 0000000..dbf5068 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift @@ -0,0 +1,118 @@ +// +// CompositeDisposable.swift +// Rx +// +// Created by Krunoslav Zaher on 2/20/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents a group of disposable resources that are disposed together. +*/ +public class CompositeDisposable : DisposeBase, Disposable, Cancelable { + public typealias DisposeKey = Bag.KeyType + + private var _lock = SpinLock() + + // state + private var _disposables: Bag? = Bag() + + public var disposed: Bool { + _lock.lock(); defer { _lock.unlock() } + return _disposables == nil + } + + public override init() { + } + + /** + Initializes a new instance of composite disposable with the specified number of disposables. + */ + public init(_ disposable1: Disposable, _ disposable2: Disposable) { + _disposables!.insert(disposable1) + _disposables!.insert(disposable2) + } + + /** + Initializes a new instance of composite disposable with the specified number of disposables. + */ + public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable) { + _disposables!.insert(disposable1) + _disposables!.insert(disposable2) + _disposables!.insert(disposable3) + } + + /** + Initializes a new instance of composite disposable with the specified number of disposables. + */ + public init(disposables: [Disposable]) { + for disposable in disposables { + _disposables!.insert(disposable) + } + } + + /** + Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. + + - parameter disposable: Disposable to add. + - returns: Key that can be used to remove disposable from composite disposable. In case dispose bag was already + disposed `nil` will be returned. + */ + public func addDisposable(disposable: Disposable) -> DisposeKey? { + let key = _addDisposable(disposable) + + if key == nil { + disposable.dispose() + } + + return key + } + + private func _addDisposable(disposable: Disposable) -> DisposeKey? { + _lock.lock(); defer { _lock.unlock() } + + return _disposables?.insert(disposable) + } + + /** + - returns: Gets the number of disposables contained in the `CompositeDisposable`. + */ + public var count: Int { + _lock.lock(); defer { _lock.unlock() } + return _disposables?.count ?? 0 + } + + /** + Removes and disposes the disposable identified by `disposeKey` from the CompositeDisposable. + + - parameter disposeKey: Key used to identify disposable to be removed. + */ + public func removeDisposable(disposeKey: DisposeKey) { + _removeDisposable(disposeKey)?.dispose() + } + + private func _removeDisposable(disposeKey: DisposeKey) -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + return _disposables?.removeKey(disposeKey) + } + + /** + Disposes all disposables in the group and removes them from the group. + */ + public func dispose() { + if let disposables = _dispose() { + disposeAllIn(disposables) + } + } + + private func _dispose() -> Bag? { + _lock.lock(); defer { _lock.unlock() } + + let disposeBag = _disposables + _disposables = nil + + return disposeBag + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift b/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift new file mode 100644 index 0000000..1b24d7f --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift @@ -0,0 +1,94 @@ +// +// DisposeBag.swift +// Rx +// +// Created by Krunoslav Zaher on 3/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +extension Disposable { + /** + Adds `self` to `bag`. + + - parameter bag: `DisposeBag` to add `self` to. + */ + public func addDisposableTo(bag: DisposeBag) { + bag.addDisposable(self) + } +} + +/** +Thread safe bag that disposes added disposables on `deinit`. + +This returns ARC (RAII) like resource management to `RxSwift`. + +In case contained disposables need to be disposed, just deference dispose bag +or create new one in it's place. + + self.existingDisposeBag = DisposeBag() + +In case explicit disposal is necessary, there is also `CompositeDisposable`. +*/ +public class DisposeBag: DisposeBase { + + private var _lock = SpinLock() + + // state + private var _disposables = [Disposable]() + private var _disposed = false + + /** + Constructs new empty dispose bag. + */ + public override init() { + super.init() + } + + /** + Adds `disposable` to be disposed when dispose bag is being deinited. + + - parameter disposable: Disposable to add. + */ + public func addDisposable(disposable: Disposable) { + _addDisposable(disposable)?.dispose() + } + + private func _addDisposable(disposable: Disposable) -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + if _disposed { + return disposable + } + + _disposables.append(disposable) + + return nil + } + + /** + This is internal on purpose, take a look at `CompositeDisposable` instead. + */ + private func dispose() { + let oldDisposables = _dispose() + + for disposable in oldDisposables { + disposable.dispose() + } + } + + private func _dispose() -> [Disposable] { + _lock.lock(); defer { _lock.unlock() } + + let disposables = _disposables + + _disposables.removeAll(keepCapacity: false) + _disposed = true + + return disposables + } + + deinit { + dispose() + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift b/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift new file mode 100644 index 0000000..53c4328 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift @@ -0,0 +1,26 @@ +// +// DisposeBase.swift +// Rx +// +// Created by Krunoslav Zaher on 4/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Base class for all disposables. +*/ +public class DisposeBase { + init() { +#if TRACE_RESOURCES + AtomicIncrement(&resourceCount) +#endif + } + + deinit { +#if TRACE_RESOURCES + AtomicDecrement(&resourceCount) +#endif + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/NAryDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/NAryDisposable.swift new file mode 100644 index 0000000..b39cd98 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/NAryDisposable.swift @@ -0,0 +1,10 @@ +// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project +// +// NAryDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/20/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation diff --git a/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift new file mode 100644 index 0000000..fe8a0c7 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift @@ -0,0 +1,32 @@ +// +// NopDisposable.swift +// Rx +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents a disposable that does nothing on disposal. + +Nop = No Operation +*/ +public struct NopDisposable : Disposable { + + /** + Singleton instance of `NopDisposable`. + */ + public static let instance: Disposable = NopDisposable() + + init() { + + } + + /** + Does nothing. + */ + public func dispose() { + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift new file mode 100644 index 0000000..2d29d74 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift @@ -0,0 +1,127 @@ +// +// RefCountDisposable.swift +// Rx +// +// Created by Junior B. on 10/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** + Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. + */ +public class RefCountDisposable : DisposeBase, Cancelable { + private var _lock = SpinLock() + private var _disposable = nil as Disposable? + private var _primaryDisposed = false + private var _count = 0 + + /** + - returns: Was resource disposed. + */ + public var disposed: Bool { + _lock.lock(); defer { _lock.unlock() } + return _disposable == nil + } + + /** + Initializes a new instance of the `RefCountDisposable`. + */ + public init(disposable: Disposable) { + _disposable = disposable + super.init() + } + + /** + Holds a dependent disposable that when disposed decreases the refcount on the underlying disposable. + + When getter is called, a dependent disposable contributing to the reference count that manages the underlying disposable's lifetime is returned. + */ + public func retain() -> Disposable { + return _lock.calculateLocked { + if let _ = _disposable { + + do { + try incrementChecked(&_count) + } catch (_) { + rxFatalError("RefCountDisposable increment failed") + } + + return RefCountInnerDisposable(self) + } else { + return NopDisposable.instance + } + } + } + + /** + Disposes the underlying disposable only when all dependent disposables have been disposed. + */ + public func dispose() { + let oldDisposable: Disposable? = _lock.calculateLocked { + if let oldDisposable = _disposable where !_primaryDisposed + { + _primaryDisposed = true + + if (_count == 0) + { + _disposable = nil + return oldDisposable + } + } + + return nil + } + + if let disposable = oldDisposable { + disposable.dispose() + } + } + + private func release() { + let oldDisposable: Disposable? = _lock.calculateLocked { + if let oldDisposable = _disposable { + do { + try decrementChecked(&_count) + } catch (_) { + rxFatalError("RefCountDisposable decrement on release failed") + } + + guard _count >= 0 else { + rxFatalError("RefCountDisposable counter is lower than 0") + } + + if _primaryDisposed && _count == 0 { + _disposable = nil + return oldDisposable + } + } + + return nil + } + + if let disposable = oldDisposable { + disposable.dispose() + } + } +} + +internal final class RefCountInnerDisposable: DisposeBase, Disposable +{ + private let _parent: RefCountDisposable + private var _disposed: AtomicInt = 0 + + init(_ parent: RefCountDisposable) + { + _parent = parent + super.init() + } + + internal func dispose() + { + if AtomicCompareAndSwap(0, 1, &_disposed) { + _parent.release() + } + } +} diff --git a/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift new file mode 100644 index 0000000..ac73499 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift @@ -0,0 +1,58 @@ +// +// ScheduledDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +private let disposeScheduledDisposable: ScheduledDisposable -> Disposable = { sd in + sd.disposeInner() + return NopDisposable.instance +} + +/** +Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler. +*/ +public class ScheduledDisposable : Cancelable { + public let scheduler: ImmediateSchedulerType + + private var _disposed: AtomicInt = 0 + + // state + private var _disposable: Disposable? + + /** + - returns: Was resource disposed. + */ + public var disposed: Bool { + return _disposed == 1 + } + + /** + Initializes a new instance of the `ScheduledDisposable` that uses a `scheduler` on which to dispose the `disposable`. + + - parameter scheduler: Scheduler where the disposable resource will be disposed on. + - parameter disposable: Disposable resource to dispose on the given scheduler. + */ + public init(scheduler: ImmediateSchedulerType, disposable: Disposable) { + self.scheduler = scheduler + _disposable = disposable + } + + /** + Disposes the wrapped disposable on the provided scheduler. + */ + public func dispose() { + scheduler.schedule(self, action: disposeScheduledDisposable) + } + + func disposeInner() { + if AtomicCompareAndSwap(0, 1, &_disposed) { + _disposable!.dispose() + _disposable = nil + } + } +} diff --git a/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift new file mode 100644 index 0000000..cb5c4e3 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift @@ -0,0 +1,85 @@ +// +// SerialDisposable.swift +// Rx +// +// Created by Krunoslav Zaher on 3/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource. +*/ +public class SerialDisposable : DisposeBase, Cancelable { + private var _lock = SpinLock() + + // state + private var _current = nil as Disposable? + private var _disposed = false + + /** + - returns: Was resource disposed. + */ + public var disposed: Bool { + return _disposed + } + + /** + Initializes a new instance of the `SerialDisposable`. + */ + override public init() { + super.init() + } + + /** + Gets or sets the underlying disposable. + + Assigning this property disposes the previous disposable object. + + If the `SerialDisposable` has already been disposed, assignment to this property causes immediate disposal of the given disposable object. + */ + public var disposable: Disposable { + get { + return _lock.calculateLocked { + return self.disposable + } + } + set (newDisposable) { + let disposable: Disposable? = _lock.calculateLocked { + if _disposed { + return newDisposable + } + else { + let toDispose = _current + _current = newDisposable + return toDispose + } + } + + if let disposable = disposable { + disposable.dispose() + } + } + } + + /** + Disposes the underlying disposable as well as all future replacements. + */ + public func dispose() { + _dispose()?.dispose() + } + + private func _dispose() -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + if _disposed { + return nil + } + else { + _disposed = true + let current = _current + _current = nil + return current + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift new file mode 100644 index 0000000..9fedf5f --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift @@ -0,0 +1,89 @@ +// +// SingleAssignmentDisposable.swift +// Rx +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents a disposable resource which only allows a single assignment of its underlying disposable resource. + +If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an exception. +*/ +public class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable { + private var _lock = SpinLock() + + // state + private var _disposed = false + private var _disposableSet = false + private var _disposable = nil as Disposable? + + /** + - returns: A value that indicates whether the object is disposed. + */ + public var disposed: Bool { + return _disposed + } + + /** + Initializes a new instance of the `SingleAssignmentDisposable`. + */ + public override init() { + super.init() + } + + /** + Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined. + + **Throws exception if the `SingleAssignmentDisposable` has already been assigned to.** + */ + public var disposable: Disposable { + get { + _lock.lock(); defer { _lock.unlock() } + return _disposable ?? NopDisposable.instance + } + set { + _setDisposable(newValue)?.dispose() + } + } + + private func _setDisposable(newValue: Disposable) -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + if _disposableSet { + rxFatalError("oldState.disposable != nil") + } + + _disposableSet = true + + if _disposed { + return newValue + } + + _disposable = newValue + + return nil + } + + /** + Disposes the underlying disposable. + */ + public func dispose() { + if _disposed { + return + } + _dispose()?.dispose() + } + + private func _dispose() -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + + _disposed = true + let disposable = _disposable + _disposable = nil + + return disposable + } +} diff --git a/Pods/RxSwift/RxSwift/Disposables/StableCompositeDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/StableCompositeDisposable.swift new file mode 100644 index 0000000..54162d2 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/StableCompositeDisposable.swift @@ -0,0 +1,15 @@ +// +// StableCompositeDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +public final class StableCompositeDisposable { + public static func create(disposable1: Disposable, _ disposable2: Disposable) -> Disposable { + return BinaryDisposable(disposable1, disposable2) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift b/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift new file mode 100644 index 0000000..7a3e1e9 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift @@ -0,0 +1,23 @@ +// +// SubscriptionDisposable.swift +// Rx +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +struct SubscriptionDisposable : Disposable { + private let _key: T.DisposeKey + private weak var _owner: T? + + init(owner: T, key: T.DisposeKey) { + _owner = owner + _key = key + } + + func dispose() { + _owner?.synchronizedUnsubscribe(_key) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Errors.swift b/Pods/RxSwift/RxSwift/Errors.swift new file mode 100644 index 0000000..ccb71c1 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Errors.swift @@ -0,0 +1,72 @@ +// +// Errors.swift +// Rx +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +let RxErrorDomain = "RxErrorDomain" +let RxCompositeFailures = "RxCompositeFailures" + +/** +Generic Rx error codes. +*/ +public enum RxError + : ErrorType + , CustomDebugStringConvertible { + /** + Unknown error occured. + */ + case Unknown + /** + Performing an action on disposed object. + */ + case Disposed(object: AnyObject) + /** + Aritmetic overflow error. + */ + case Overflow + /** + Argument out of range error. + */ + case ArgumentOutOfRange + /** + Sequence doesn't contain any elements. + */ + case NoElements + /** + Sequence contains more than one element. + */ + case MoreThanOneElement + /** + Timeout error. + */ + case Timeout +} + +public extension RxError { + /** + A textual representation of `self`, suitable for debugging. + */ + public var debugDescription: String { + switch self { + case .Unknown: + return "Unknown error occured." + case .Disposed(let object): + return "Object `\(object)` was already disposed." + case .Overflow: + return "Arithmetic overflow occured." + case .ArgumentOutOfRange: + return "Argument out of range." + case .NoElements: + return "Sequence doesn't contain any elements." + case .MoreThanOneElement: + return "Sequence contains more than one element." + case .Timeout: + return "Sequence timeout." + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Event.swift b/Pods/RxSwift/RxSwift/Event.swift new file mode 100644 index 0000000..32b2780 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Event.swift @@ -0,0 +1,81 @@ +// +// Event.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + + +/** +Represents sequence event + +Sequence grammar: +Next\* (Error | Completed) +*/ +public enum Event : CustomDebugStringConvertible { + /** + Next element is produced + */ + case Next(Element) + + /** + Sequence terminates with error + */ + case Error(ErrorType) + + /** + Sequence completes sucessfully + */ + case Completed +} + +extension Event { + /** + - returns: Description of event + */ + public var debugDescription: String { + switch self { + case .Next(let value): + return "Next(\(value))" + case .Error(let error): + return "Error(\(error))" + case .Completed: + return "Completed" + } + } +} + +extension Event { + /** + - returns: Is `Completed` or `Error` event + */ + public var isStopEvent: Bool { + switch self { + case .Next: return false + case .Error, .Completed: return true + } + } + + /** + - returns: If `Next` event, returns element value. + */ + public var element: Element? { + if case .Next(let value) = self { + return value + } + return nil + } + + /** + - returns: If `Error` event, returns error. + */ + public var error: ErrorType? { + if case .Error(let error) = self { + return error + } + return nil + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift b/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift new file mode 100644 index 0000000..5d336f7 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift @@ -0,0 +1,25 @@ +// +// String+Rx.swift +// Rx +// +// Created by Krunoslav Zaher on 12/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +extension String { + /** + This is needed because on Linux Swift doesn't have `rangeOfString(..., options: .BackwardsSearch)` + */ + func lastIndexOf(character: Character) -> Index? { + var last: Index? + for i in startIndex ..< endIndex { + if self[i] == character { + last = i + } + } + + return last + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift b/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift new file mode 100644 index 0000000..b5e0309 --- /dev/null +++ b/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift @@ -0,0 +1,42 @@ +// +// ImmediateSchedulerType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents an object that immediately schedules units of work. +*/ +public protocol ImmediateSchedulerType { + /** + Schedules an action to be executed immediatelly. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + func schedule(state: StateType, action: (StateType) -> Disposable) -> Disposable +} + +extension ImmediateSchedulerType { + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleRecursive(state: State, action: (state: State, recurse: (State) -> ()) -> ()) -> Disposable { + let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self) + + recursiveScheduler.schedule(state) + + return AnonymousDisposable { + recursiveScheduler.dispose() + } + } +} diff --git a/Pods/RxSwift/RxSwift/Observable+Extensions.swift b/Pods/RxSwift/RxSwift/Observable+Extensions.swift new file mode 100644 index 0000000..c44b9b0 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observable+Extensions.swift @@ -0,0 +1,128 @@ +// +// Observable+Extensions.swift +// Rx +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +extension ObservableType { + /** + Subscribes an event handler to an observable sequence. + + - parameter on: Action to invoke for each event 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 subscribe(on: (event: Event) -> Void) + -> Disposable { + let observer = AnonymousObserver { e in + on(event: e) + } + return self.subscribeSafe(observer) + } + + /** + Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable 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. + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has + 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 subscribe(onNext onNext: (E -> Void)? = nil, onError: (ErrorType -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) + -> Disposable { + + let disposable: Disposable + + if let disposed = onDisposed { + disposable = AnonymousDisposable(disposed) + } + else { + disposable = NopDisposable.instance + } + + let observer = AnonymousObserver { e in + switch e { + case .Next(let value): + onNext?(value) + case .Error(let e): + onError?(e) + disposable.dispose() + case .Completed: + onCompleted?() + disposable.dispose() + } + } + return BinaryDisposable( + self.subscribeSafe(observer), + disposable + ) + } + + /** + Subscribes an element handler to an observable sequence. + + - 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 subscribeNext(onNext: (E) -> Void) + -> Disposable { + let observer = AnonymousObserver { e in + if case .Next(let value) = e { + onNext(value) + } + } + return self.subscribeSafe(observer) + } + + /** + Subscribes an error handler to an observable sequence. + + - parameter onError: Action to invoke upon errored termination of the observable sequence. + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.ud") + public func subscribeError(onError: (ErrorType) -> Void) + -> Disposable { + let observer = AnonymousObserver { e in + if case .Error(let error) = e { + onError(error) + } + } + return self.subscribeSafe(observer) + } + + /** + Subscribes a completion handler to an observable sequence. + + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.ud") + public func subscribeCompleted(onCompleted: () -> Void) + -> Disposable { + let observer = AnonymousObserver { e in + if case .Completed = e { + onCompleted() + } + } + return self.subscribeSafe(observer) + } +} + +public extension ObservableType { + /** + All internal subscribe calls go through this method. + */ + @warn_unused_result(message="http://git.io/rxs.ud") + func subscribeSafe(observer: O) -> Disposable { + return self.asObservable().subscribe(observer) + } +} diff --git a/Pods/RxSwift/RxSwift/Observable.swift b/Pods/RxSwift/RxSwift/Observable.swift new file mode 100644 index 0000000..31e2e65 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observable.swift @@ -0,0 +1,51 @@ +// +// Observable.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +A type-erased `ObservableType`. + +It represents a push style sequence. +*/ +public class Observable : ObservableType { + /** + Type of elements in sequence. + */ + public typealias E = Element + + init() { +#if TRACE_RESOURCES + OSAtomicIncrement32(&resourceCount) +#endif + } + + public func subscribe(observer: O) -> Disposable { + abstractMethod() + } + + public func asObservable() -> Observable { + return self + } + + deinit { +#if TRACE_RESOURCES + AtomicDecrement(&resourceCount) +#endif + } + + // this is kind of ugly I know :( + // Swift compiler reports "Not supported yet" when trying to override protocol extensions, so ¯\_(ツ)_/¯ + + /** + Optimizations for map operator + */ + internal func composeMap(selector: Element throws -> R) -> Observable { + return Map(source: self, selector: selector) + } +} diff --git a/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift b/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift new file mode 100644 index 0000000..a749a06 --- /dev/null +++ b/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift @@ -0,0 +1,26 @@ +// +// ObservableConvertibleType.swift +// Rx +// +// Created by Krunoslav Zaher on 9/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Type that can be converted to observable sequence (`Observer`). +*/ +public protocol ObservableConvertibleType { + /** + Type of elements in sequence. + */ + associatedtype E + + /** + Converts `self` to `Observable` sequence. + + - returns: Observable sequence that represents `self`. + */ + func asObservable() -> Observable +} diff --git a/Pods/RxSwift/RxSwift/ObservableType.swift b/Pods/RxSwift/RxSwift/ObservableType.swift new file mode 100644 index 0000000..93723e3 --- /dev/null +++ b/Pods/RxSwift/RxSwift/ObservableType.swift @@ -0,0 +1,57 @@ +// +// ObservableType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents a push style sequence. +*/ +public protocol ObservableType : ObservableConvertibleType { + /** + Type of elements in sequence. + */ + associatedtype E + + /** + Subscribes `observer` to receive events for this sequence. + + ### Grammar + + **Next\* (Error | Completed)?** + + * sequences can produce zero or more elements so zero or more `Next` events can be sent to `observer` + * once an `Error` or `Completed` event is sent, the sequence terminates and can't produce any other elements + + It is possible that events are sent from different threads, but no two events can be sent concurrently to + `observer`. + + ### Resource Management + + When sequence sends `Complete` or `Error` event all internal resources that compute sequence elements + will be freed. + + To cancel production of sequence elements and free resources immediatelly, call `dispose` on returned + subscription. + + - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources. + */ + @warn_unused_result(message="http://git.io/rxs.ud") + func subscribe(observer: O) -> Disposable + +} + +extension ObservableType { + + /** + Default implementation of converting `ObservableType` to `Observable`. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func asObservable() -> Observable { + return Observable.create(self.subscribe) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/AddRef.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/AddRef.swift new file mode 100644 index 0000000..50358ec --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/AddRef.swift @@ -0,0 +1,47 @@ +// +// AddRef.swift +// Rx +// +// Created by Junior B. on 30/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class AddRefSink : Sink, ObserverType { + typealias Element = O.E + + override init(observer: O) { + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(_): + forwardOn(event) + case .Completed, .Error(_): + forwardOn(event) + dispose() + } + } +} + +class AddRef : Producer { + typealias EventHandler = Event throws -> Void + + private let _source: Observable + private let _refCount: RefCountDisposable + + init(source: Observable, refCount: RefCountDisposable) { + _source = source + _refCount = refCount + } + + override func run(observer: O) -> Disposable { + let releaseDisposable = _refCount.retain() + let sink = AddRefSink(observer: observer) + sink.disposable = StableCompositeDisposable.create(releaseDisposable, _source.subscribeSafe(sink)) + + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Amb.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Amb.swift new file mode 100644 index 0000000..874d5a1 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Amb.swift @@ -0,0 +1,122 @@ +// +// Amb.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +enum AmbState { + case Neither + case Left + case Right +} + +class AmbObserver : ObserverType { + typealias Element = ElementType + typealias Parent = AmbSink + typealias This = AmbObserver + typealias Sink = (This, Event) -> Void + + private let _parent: Parent + private var _sink: Sink + private var _cancel: Disposable + + init(parent: Parent, cancel: Disposable, sink: Sink) { +#if TRACE_RESOURCES + AtomicIncrement(&resourceCount) +#endif + + _parent = parent + _sink = sink + _cancel = cancel + } + + func on(event: Event) { + _sink(self, event) + if event.isStopEvent { + _cancel.dispose() + } + } + + deinit { +#if TRACE_RESOURCES + AtomicDecrement(&resourceCount) +#endif + } +} + +class AmbSink : Sink { + typealias Parent = Amb + typealias AmbObserverType = AmbObserver + + private let _parent: Parent + + private let _lock = NSRecursiveLock() + // state + private var _choice = AmbState.Neither + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let disposeAll = StableCompositeDisposable.create(subscription1, subscription2) + + let forwardEvent = { (o: AmbObserverType, event: Event) -> Void in + self.forwardOn(event) + } + + let decide = { (o: AmbObserverType, event: Event, me: AmbState, otherSubscription: Disposable) in + self._lock.performLocked { + if self._choice == .Neither { + self._choice = me + o._sink = forwardEvent + o._cancel = disposeAll + otherSubscription.dispose() + } + + if self._choice == me { + self.forwardOn(event) + if event.isStopEvent { + self.dispose() + } + } + } + } + + let sink1 = AmbObserver(parent: self, cancel: subscription1) { o, e in + decide(o, e, .Left, subscription2) + } + + let sink2 = AmbObserver(parent: self, cancel: subscription1) { o, e in + decide(o, e, .Right, subscription1) + } + + subscription1.disposable = _parent._left.subscribe(sink1) + subscription2.disposable = _parent._right.subscribe(sink2) + + return disposeAll + } +} + +class Amb: Producer { + private let _left: Observable + private let _right: Observable + + init(left: Observable, right: Observable) { + _left = left + _right = right + } + + override func run(observer: O) -> Disposable { + let sink = AmbSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift new file mode 100644 index 0000000..11346a9 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift @@ -0,0 +1,56 @@ +// +// AnonymousObservable.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class AnonymousObservableSink : Sink, ObserverType { + typealias E = O.E + typealias Parent = AnonymousObservable + + // state + private var _isStopped: AtomicInt = 0 + + override init(observer: O) { + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next: + if _isStopped == 1 { + return + } + forwardOn(event) + case .Error, .Completed: + if AtomicCompareAndSwap(0, 1, &_isStopped) { + forwardOn(event) + dispose() + } + } + } + + func run(parent: Parent) -> Disposable { + return parent._subscribeHandler(AnyObserver(self)) + } +} + +class AnonymousObservable : Producer { + typealias SubscribeHandler = (AnyObserver) -> Disposable + + let _subscribeHandler: SubscribeHandler + + init(_ subscribeHandler: SubscribeHandler) { + _subscribeHandler = subscribeHandler + } + + override func run(observer: O) -> Disposable { + let sink = AnonymousObservableSink(observer: observer) + sink.disposable = sink.run(self) + return sink + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Buffer.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Buffer.swift new file mode 100644 index 0000000..2da636d --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Buffer.swift @@ -0,0 +1,119 @@ +// +// Buffer.swift +// Rx +// +// Created by Krunoslav Zaher on 9/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class BufferTimeCount : Producer<[Element]> { + + private let _timeSpan: RxTimeInterval + private let _count: Int + private let _scheduler: SchedulerType + private let _source: Observable + + init(source: Observable, timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) { + _source = source + _timeSpan = timeSpan + _count = count + _scheduler = scheduler + } + + override func run(observer: O) -> Disposable { + let sink = BufferTimeCountSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + +class BufferTimeCountSink + : Sink + , LockOwnerType + , ObserverType + , SynchronizedOnType { + typealias Parent = BufferTimeCount + typealias E = Element + + private let _parent: Parent + + let _lock = NSRecursiveLock() + + // state + private let _timerD = SerialDisposable() + private var _buffer = [Element]() + private var _windowID = 0 + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + createTimer(_windowID) + return StableCompositeDisposable.create(_timerD, _parent._source.subscribe(self)) + } + + func startNewWindowAndSendCurrentOne() { + _windowID = _windowID &+ 1 + let windowID = _windowID + + let buffer = _buffer + _buffer = [] + forwardOn(.Next(buffer)) + + createTimer(windowID) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let element): + _buffer.append(element) + + if _buffer.count == _parent._count { + startNewWindowAndSendCurrentOne() + } + + case .Error(let error): + _buffer = [] + forwardOn(.Error(error)) + dispose() + case .Completed: + forwardOn(.Next(_buffer)) + forwardOn(.Completed) + dispose() + } + } + + func createTimer(windowID: Int) { + if _timerD.disposed { + return + } + + if _windowID != windowID { + return + } + + let nextTimer = SingleAssignmentDisposable() + + _timerD.disposable = nextTimer + + nextTimer.disposable = _parent._scheduler.scheduleRelative(windowID, dueTime: _parent._timeSpan) { previousWindowID in + self._lock.performLocked { + if previousWindowID != self._windowID { + return + } + + self.startNewWindowAndSendCurrentOne() + } + + return NopDisposable.instance + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Catch.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Catch.swift new file mode 100644 index 0000000..72cb33b --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Catch.swift @@ -0,0 +1,162 @@ +// +// Catch.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// catch with callback + +class CatchSinkProxy : ObserverType { + typealias E = O.E + typealias Parent = CatchSink + + private let _parent: Parent + + init(parent: Parent) { + _parent = parent + } + + func on(event: Event) { + _parent.forwardOn(event) + + switch event { + case .Next: + break + case .Error, .Completed: + _parent.dispose() + } + } +} + +class CatchSink : Sink, ObserverType { + typealias E = O.E + typealias Parent = Catch + + private let _parent: Parent + private let _subscription = SerialDisposable() + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + let d1 = SingleAssignmentDisposable() + _subscription.disposable = d1 + d1.disposable = _parent._source.subscribe(self) + + return _subscription + } + + func on(event: Event) { + switch event { + case .Next: + forwardOn(event) + case .Completed: + forwardOn(event) + dispose() + case .Error(let error): + do { + let catchSequence = try _parent._handler(error) + + let observer = CatchSinkProxy(parent: self) + + _subscription.disposable = catchSequence.subscribe(observer) + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + } + } +} + +class Catch : Producer { + typealias Handler = (ErrorType) throws -> Observable + + private let _source: Observable + private let _handler: Handler + + init(source: Observable, handler: Handler) { + _source = source + _handler = handler + } + + override func run(observer: O) -> Disposable { + let sink = CatchSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + +// catch enumerable + +class CatchSequenceSink + : TailRecursiveSink + , ObserverType { + typealias Element = O.E + typealias Parent = CatchSequence + + private var _lastError: ErrorType? + + override init(observer: O) { + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next: + forwardOn(event) + case .Error(let error): + _lastError = error + schedule(.MoveNext) + case .Completed: + forwardOn(event) + dispose() + } + } + + override func subscribeToNext(source: Observable) -> Disposable { + return source.subscribe(self) + } + + override func done() { + if let lastError = _lastError { + forwardOn(.Error(lastError)) + } + else { + forwardOn(.Completed) + } + + self.dispose() + } + + override func extract(observable: Observable) -> SequenceGenerator? { + if let onError = observable as? CatchSequence { + return (onError.sources.generate(), nil) + } + else { + return nil + } + } +} + +class CatchSequence : Producer { + typealias Element = S.Generator.Element.E + + let sources: S + + init(sources: S) { + self.sources = sources + } + + override func run(observer: O) -> Disposable { + let sink = CatchSequenceSink(observer: observer) + sink.disposable = sink.run((self.sources.generate(), nil)) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+CollectionType.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+CollectionType.swift new file mode 100644 index 0000000..c1dba6b --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+CollectionType.swift @@ -0,0 +1,125 @@ +// +// CombineLatest+CollectionType.swift +// Rx +// +// Created by Krunoslav Zaher on 8/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class CombineLatestCollectionTypeSink + : Sink { + typealias Parent = CombineLatestCollectionType + typealias SourceElement = C.Generator.Element.E + + let _parent: Parent + + let _lock = NSRecursiveLock() + + // state + var _numberOfValues = 0 + var _values: [SourceElement?] + var _isDone: [Bool] + var _numberOfDone = 0 + var _subscriptions: [SingleAssignmentDisposable] + + init(parent: Parent, observer: O) { + _parent = parent + _values = [SourceElement?](count: parent._count, repeatedValue: nil) + _isDone = [Bool](count: parent._count, repeatedValue: false) + _subscriptions = Array() + _subscriptions.reserveCapacity(parent._count) + + for _ in 0 ..< parent._count { + _subscriptions.append(SingleAssignmentDisposable()) + } + + super.init(observer: observer) + } + + func on(event: Event, atIndex: Int) { + _lock.lock(); defer { _lock.unlock() } // { + switch event { + case .Next(let element): + if _values[atIndex] == nil { + _numberOfValues += 1 + } + + _values[atIndex] = element + + if _numberOfValues < _parent._count { + let numberOfOthersThatAreDone = self._numberOfDone - (_isDone[atIndex] ? 1 : 0) + if numberOfOthersThatAreDone == self._parent._count - 1 { + forwardOn(.Completed) + dispose() + } + return + } + + do { + let result = try _parent._resultSelector(_values.map { $0! }) + forwardOn(.Next(result)) + } + catch let error { + forwardOn(.Error(error)) + dispose() + } + + case .Error(let error): + forwardOn(.Error(error)) + dispose() + case .Completed: + if _isDone[atIndex] { + return + } + + _isDone[atIndex] = true + _numberOfDone += 1 + + if _numberOfDone == self._parent._count { + forwardOn(.Completed) + dispose() + } + else { + _subscriptions[atIndex].dispose() + } + } + // } + } + + func run() -> Disposable { + var j = 0 + for i in _parent._sources.startIndex ..< _parent._sources.endIndex { + let index = j + let source = _parent._sources[i].asObservable() + _subscriptions[j].disposable = source.subscribe(AnyObserver { event in + self.on(event, atIndex: index) + }) + + j += 1 + } + + return CompositeDisposable(disposables: _subscriptions.map { $0 }) + } +} + +class CombineLatestCollectionType : Producer { + typealias ResultSelector = [C.Generator.Element.E] throws -> R + + let _sources: C + let _resultSelector: ResultSelector + let _count: Int + + init(sources: C, resultSelector: ResultSelector) { + _sources = sources + _resultSelector = resultSelector + _count = Int(self._sources.count.toIntMax()) + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestCollectionTypeSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+arity.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+arity.swift new file mode 100644 index 0000000..8f7b608 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest+arity.swift @@ -0,0 +1,726 @@ +// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project +// +// CombineLatest+arity.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + + + +// 2 + +extension Observable { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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 + (source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E) + -> Observable { + return CombineLatest2( + source1: source1.asObservable(), source2: source2.asObservable(), + resultSelector: resultSelector + ) + } +} + +class CombineLatestSink2_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest2 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 2, observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + + subscription1.disposable = _parent._source1.subscribe(observer1) + subscription2.disposable = _parent._source2.subscribe(observer2) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2) + } +} + +class CombineLatest2 : Producer { + typealias ResultSelector = (E1, E2) throws -> R + + let _source1: Observable + let _source2: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, resultSelector: ResultSelector) { + _source1 = source1 + _source2 = source2 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestSink2_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 3 + +extension Observable { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E) + -> Observable { + return CombineLatest3( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), + resultSelector: resultSelector + ) + } +} + +class CombineLatestSink3_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest3 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 3, observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + + subscription1.disposable = _parent._source1.subscribe(observer1) + subscription2.disposable = _parent._source2.subscribe(observer2) + subscription3.disposable = _parent._source3.subscribe(observer3) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3) + } +} + +class CombineLatest3 : Producer { + typealias ResultSelector = (E1, E2, E3) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, resultSelector: ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestSink3_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 4 + +extension Observable { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> Observable { + return CombineLatest4( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), + resultSelector: resultSelector + ) + } +} + +class CombineLatestSink4_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest4 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 4, observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + + subscription1.disposable = _parent._source1.subscribe(observer1) + subscription2.disposable = _parent._source2.subscribe(observer2) + subscription3.disposable = _parent._source3.subscribe(observer3) + subscription4.disposable = _parent._source4.subscribe(observer4) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4) + } +} + +class CombineLatest4 : Producer { + typealias ResultSelector = (E1, E2, E3, E4) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, resultSelector: ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestSink4_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 5 + +extension Observable { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> Observable { + return CombineLatest5( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), + resultSelector: resultSelector + ) + } +} + +class CombineLatestSink5_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest5 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 5, observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + + subscription1.disposable = _parent._source1.subscribe(observer1) + subscription2.disposable = _parent._source2.subscribe(observer2) + subscription3.disposable = _parent._source3.subscribe(observer3) + subscription4.disposable = _parent._source4.subscribe(observer4) + subscription5.disposable = _parent._source5.subscribe(observer5) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5) + } +} + +class CombineLatest5 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, resultSelector: ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestSink5_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 6 + +extension Observable { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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 + (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) + -> Observable { + return CombineLatest6( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), + resultSelector: resultSelector + ) + } +} + +class CombineLatestSink6_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest6 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + var _latestElement6: E6! = nil + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 6, observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + let observer6 = CombineLatestObserver(lock: _lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self._latestElement6 = e }, this: subscription6) + + subscription1.disposable = _parent._source1.subscribe(observer1) + subscription2.disposable = _parent._source2.subscribe(observer2) + subscription3.disposable = _parent._source3.subscribe(observer3) + subscription4.disposable = _parent._source4.subscribe(observer4) + subscription5.disposable = _parent._source5.subscribe(observer5) + subscription6.disposable = _parent._source6.subscribe(observer6) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5, _latestElement6) + } +} + +class CombineLatest6 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + let _source6: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, resultSelector: ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + _source6 = source6 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestSink6_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 7 + +extension Observable { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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 + (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) + -> Observable { + return CombineLatest7( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), + resultSelector: resultSelector + ) + } +} + +class CombineLatestSink7_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest7 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + var _latestElement6: E6! = nil + var _latestElement7: E7! = nil + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 7, observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + let observer6 = CombineLatestObserver(lock: _lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self._latestElement6 = e }, this: subscription6) + let observer7 = CombineLatestObserver(lock: _lock, parent: self, index: 6, setLatestValue: { (e: E7) -> Void in self._latestElement7 = e }, this: subscription7) + + subscription1.disposable = _parent._source1.subscribe(observer1) + subscription2.disposable = _parent._source2.subscribe(observer2) + subscription3.disposable = _parent._source3.subscribe(observer3) + subscription4.disposable = _parent._source4.subscribe(observer4) + subscription5.disposable = _parent._source5.subscribe(observer5) + subscription6.disposable = _parent._source6.subscribe(observer6) + subscription7.disposable = _parent._source7.subscribe(observer7) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5, _latestElement6, _latestElement7) + } +} + +class CombineLatest7 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + let _source6: Observable + let _source7: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, resultSelector: ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + _source6 = source6 + _source7 = source7 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestSink7_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 8 + +extension Observable { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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 + (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) + -> Observable { + return CombineLatest8( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(), + resultSelector: resultSelector + ) + } +} + +class CombineLatestSink8_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest8 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + var _latestElement6: E6! = nil + var _latestElement7: E7! = nil + var _latestElement8: E8! = nil + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 8, observer: observer) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + let subscription8 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + let observer6 = CombineLatestObserver(lock: _lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self._latestElement6 = e }, this: subscription6) + let observer7 = CombineLatestObserver(lock: _lock, parent: self, index: 6, setLatestValue: { (e: E7) -> Void in self._latestElement7 = e }, this: subscription7) + let observer8 = CombineLatestObserver(lock: _lock, parent: self, index: 7, setLatestValue: { (e: E8) -> Void in self._latestElement8 = e }, this: subscription8) + + subscription1.disposable = _parent._source1.subscribe(observer1) + subscription2.disposable = _parent._source2.subscribe(observer2) + subscription3.disposable = _parent._source3.subscribe(observer3) + subscription4.disposable = _parent._source4.subscribe(observer4) + subscription5.disposable = _parent._source5.subscribe(observer5) + subscription6.disposable = _parent._source6.subscribe(observer6) + subscription7.disposable = _parent._source7.subscribe(observer7) + subscription8.disposable = _parent._source8.subscribe(observer8) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7, + subscription8 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5, _latestElement6, _latestElement7, _latestElement8) + } +} + +class CombineLatest8 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7, E8) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + let _source6: Observable + let _source7: Observable + let _source8: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, source8: Observable, resultSelector: ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + _source6 = source6 + _source7 = source7 + _source8 = source8 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = CombineLatestSink8_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest.swift new file mode 100644 index 0000000..f493fde --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/CombineLatest.swift @@ -0,0 +1,134 @@ +// +// CombineLatest.swift +// Rx +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol CombineLatestProtocol : class { + func next(index: Int) + func fail(error: ErrorType) + func done(index: Int) +} + +class CombineLatestSink + : Sink + , CombineLatestProtocol { + typealias Element = O.E + + let _lock = NSRecursiveLock() + + private let _arity: Int + private var _numberOfValues = 0 + private var _numberOfDone = 0 + private var _hasValue: [Bool] + private var _isDone: [Bool] + + init(arity: Int, observer: O) { + _arity = arity + _hasValue = [Bool](count: arity, repeatedValue: false) + _isDone = [Bool](count: arity, repeatedValue: false) + + super.init(observer: observer) + } + + func getResult() throws -> Element { + abstractMethod() + } + + func next(index: Int) { + if !_hasValue[index] { + _hasValue[index] = true + _numberOfValues += 1 + } + + if _numberOfValues == _arity { + do { + let result = try getResult() + forwardOn(.Next(result)) + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + } + else { + var allOthersDone = true + + for i in 0 ..< _arity { + if i != index && !_isDone[i] { + allOthersDone = false + break + } + } + + if allOthersDone { + forwardOn(.Completed) + dispose() + } + } + } + + func fail(error: ErrorType) { + forwardOn(.Error(error)) + dispose() + } + + func done(index: Int) { + if _isDone[index] { + return + } + + _isDone[index] = true + _numberOfDone += 1 + + if _numberOfDone == _arity { + forwardOn(.Completed) + dispose() + } + } +} + +class CombineLatestObserver + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Element = ElementType + typealias ValueSetter = (Element) -> Void + + private let _parent: CombineLatestProtocol + + let _lock: NSRecursiveLock + private let _index: Int + private let _this: Disposable + private let _setLatestValue: ValueSetter + + init(lock: NSRecursiveLock, parent: CombineLatestProtocol, index: Int, setLatestValue: ValueSetter, this: Disposable) { + _lock = lock + _parent = parent + _index = index + _this = this + _setLatestValue = setLatestValue + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let value): + _setLatestValue(value) + _parent.next(_index) + case .Error(let error): + _this.dispose() + _parent.fail(error) + case .Completed: + _this.dispose() + _parent.done(_index) + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Concat.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Concat.swift new file mode 100644 index 0000000..05352b9 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Concat.swift @@ -0,0 +1,63 @@ +// +// Concat.swift +// Rx +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + + +class ConcatSink + : TailRecursiveSink + , ObserverType { + typealias Element = O.E + + override init(observer: O) { + super.init(observer: observer) + } + + func on(event: Event){ + switch event { + case .Next: + forwardOn(event) + case .Error: + forwardOn(event) + dispose() + case .Completed: + schedule(.MoveNext) + } + } + + override func subscribeToNext(source: Observable) -> Disposable { + return source.subscribe(self) + } + + override func extract(observable: Observable) -> SequenceGenerator? { + if let source = observable as? Concat { + return (source._sources.generate(), source._count) + } + else { + return nil + } + } +} + +class Concat : Producer { + typealias Element = S.Generator.Element.E + + private let _sources: S + private let _count: IntMax? + + init(sources: S, count: IntMax?) { + _sources = sources + _count = count + } + + override func run(observer: O) -> Disposable { + let sink = ConcatSink(observer: observer) + sink.disposable = sink.run((_sources.generate(), _count)) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/ConnectableObservable.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/ConnectableObservable.swift new file mode 100644 index 0000000..9be64f0 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/ConnectableObservable.swift @@ -0,0 +1,92 @@ +// +// ConnectableObservable.swift +// Rx +// +// Created by Krunoslav Zaher on 3/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** + Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence. +*/ +public class ConnectableObservable + : Observable + , ConnectableObservableType { + + /** + Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established. + + - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. + */ + public func connect() -> Disposable { + abstractMethod() + } +} + +class Connection : Disposable { + + // state + private weak var _parent: ConnectableObservableAdapter? + private var _subscription : Disposable? + + init(parent: ConnectableObservableAdapter, subscription: Disposable) { + _parent = parent + _subscription = subscription + } + + func dispose() { + guard let parent = _parent else { return } + + parent._lock.performLocked { + guard let oldSubscription = _subscription else { + return + } + + _subscription = nil + if _parent?._connection === self { + parent._connection = nil + } + _parent = nil + + oldSubscription.dispose() + } + } +} + +class ConnectableObservableAdapter + : ConnectableObservable { + typealias ConnectionType = Connection + + private let _subject: S + private let _source: Observable + + private let _lock = NSRecursiveLock() + + // state + private var _connection: ConnectionType? + + init(source: Observable, subject: S) { + _source = source + _subject = subject + _connection = nil + } + + override func connect() -> Disposable { + return _lock.calculateLocked { + if let connection = _connection { + return connection + } + + let disposable = _source.subscribe(_subject.asObserver()) + let connection = Connection(parent: self, subscription: disposable) + _connection = connection + return connection + } + } + + override func subscribe(observer: O) -> Disposable { + return _subject.subscribe(observer) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Debug.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Debug.swift new file mode 100644 index 0000000..b74b9a1 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Debug.swift @@ -0,0 +1,77 @@ +// +// Debug.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +let dateFormat = "yyyy-MM-dd HH:mm:ss.SSS" + +func logEvent(identifier: String, dateFormat: NSDateFormatter, content: String) { + print("\(dateFormat.stringFromDate(NSDate())): \(identifier) -> \(content)") +} + +class Debug_ : Sink, ObserverType { + typealias Element = O.E + typealias Parent = Debug + + private let _parent: Parent + private let _timestampFormatter = NSDateFormatter() + + init(parent: Parent, observer: O) { + _parent = parent + _timestampFormatter.dateFormat = dateFormat + + logEvent(_parent._identifier, dateFormat: _timestampFormatter, content: "subscribed") + + super.init(observer: observer) + } + + func on(event: Event) { + let maxEventTextLength = 40 + let eventText = "\(event)" + let eventNormalized = eventText.characters.count > maxEventTextLength + ? String(eventText.characters.prefix(maxEventTextLength / 2)) + "..." + String(eventText.characters.suffix(maxEventTextLength / 2)) + : eventText + + logEvent(_parent._identifier, dateFormat: _timestampFormatter, content: "Event \(eventNormalized)") + forwardOn(event) + } + + override func dispose() { + logEvent(_parent._identifier, dateFormat: _timestampFormatter, content: "disposed") + super.dispose() + } +} + +class Debug : Producer { + private let _identifier: String + + private let _source: Observable + + init(source: Observable, identifier: String?, file: String, line: UInt, function: String) { + if let identifier = identifier { + _identifier = identifier + } + else { + let trimmedFile: String + if let lastIndex = file.lastIndexOf("/") { + trimmedFile = file[lastIndex.successor() ..< file.endIndex] + } + else { + trimmedFile = file + } + _identifier = "\(trimmedFile):\(line) (\(function))" + } + _source = source + } + + override func run(observer: O) -> Disposable { + let sink = Debug_(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Deferred.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Deferred.swift new file mode 100644 index 0000000..31c6f2b --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Deferred.swift @@ -0,0 +1,61 @@ +// +// Deferred.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class DeferredSink : Sink, ObserverType { + typealias E = O.E + + private let _observableFactory: () throws -> S + + init(observableFactory: () throws -> S, observer: O) { + _observableFactory = observableFactory + super.init(observer: observer) + } + + func run() -> Disposable { + do { + let result = try _observableFactory() + return result.subscribe(self) + } + catch let e { + forwardOn(.Error(e)) + dispose() + return NopDisposable.instance + } + } + + func on(event: Event) { + forwardOn(event) + + switch event { + case .Next: + break + case .Error: + dispose() + case .Completed: + dispose() + } + } +} + +class Deferred : Producer { + typealias Factory = () throws -> S + + private let _observableFactory : Factory + + init(observableFactory: Factory) { + _observableFactory = observableFactory + } + + override func run(observer: O) -> Disposable { + let sink = DeferredSink(observableFactory: _observableFactory, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/DelaySubscription.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/DelaySubscription.swift new file mode 100644 index 0000000..3dc62ac --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/DelaySubscription.swift @@ -0,0 +1,52 @@ +// +// DelaySubscription.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class DelaySubscriptionSink + : Sink + , ObserverType { + typealias Parent = DelaySubscription + typealias E = O.E + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + forwardOn(event) + if event.isStopEvent { + dispose() + } + } + +} + +class DelaySubscription: Producer { + private let _source: Observable + private let _dueTime: RxTimeInterval + private let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _scheduler = scheduler + } + + override func run(observer: O) -> Disposable { + let sink = DelaySubscriptionSink(parent: self, observer: observer) + sink.disposable = _scheduler.scheduleRelative((), dueTime: _dueTime) { _ in + return self._source.subscribe(sink) + } + + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/DistinctUntilChanged.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/DistinctUntilChanged.swift new file mode 100644 index 0000000..9f03da4 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/DistinctUntilChanged.swift @@ -0,0 +1,70 @@ +// +// DistinctUntilChanged.swift +// Rx +// +// Created by Krunoslav Zaher on 3/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class DistinctUntilChangedSink: Sink, ObserverType { + typealias E = O.E + + private let _parent: DistinctUntilChanged + private var _currentKey: Key? = nil + + init(parent: DistinctUntilChanged, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + do { + let key = try _parent._selector(value) + var areEqual = false + if let currentKey = _currentKey { + areEqual = try _parent._comparer(currentKey, key) + } + + if areEqual { + return + } + + _currentKey = key + + forwardOn(event) + } + catch let error { + forwardOn(.Error(error)) + dispose() + } + case .Error, .Completed: + forwardOn(event) + dispose() + } + } +} + +class DistinctUntilChanged: Producer { + typealias KeySelector = (Element) throws -> Key + typealias EqualityComparer = (Key, Key) throws -> Bool + + private let _source: Observable + private let _selector: KeySelector + private let _comparer: EqualityComparer + + init(source: Observable, selector: KeySelector, comparer: EqualityComparer) { + _source = source + _selector = selector + _comparer = comparer + } + + override func run(observer: O) -> Disposable { + let sink = DistinctUntilChangedSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Do.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Do.swift new file mode 100644 index 0000000..719f2bb --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Do.swift @@ -0,0 +1,53 @@ +// +// Do.swift +// Rx +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class DoSink : Sink, ObserverType { + typealias Element = O.E + typealias Parent = Do + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + do { + try _parent._eventHandler(event) + forwardOn(event) + if event.isStopEvent { + dispose() + } + } + catch let error { + forwardOn(.Error(error)) + dispose() + } + } +} + +class Do : Producer { + typealias EventHandler = Event throws -> Void + + private let _source: Observable + private let _eventHandler: EventHandler + + init(source: Observable, eventHandler: EventHandler) { + _source = source + _eventHandler = eventHandler + } + + override func run(observer: O) -> Disposable { + let sink = DoSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/ElementAt.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/ElementAt.swift new file mode 100644 index 0000000..4360afb --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/ElementAt.swift @@ -0,0 +1,79 @@ +// +// ElementAt.swift +// Rx +// +// Created by Junior B. on 21/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + + +class ElementAtSink : Sink, ObserverType { + typealias Parent = ElementAt + + let _parent: Parent + var _i: Int + + init(parent: Parent, observer: O) { + _parent = parent + _i = parent._index + + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(_): + + if (_i == 0) { + forwardOn(event) + forwardOn(.Completed) + self.dispose() + } + + do { + try decrementChecked(&_i) + } catch(let e) { + forwardOn(.Error(e)) + dispose() + return + } + + case .Error(let e): + forwardOn(.Error(e)) + self.dispose() + case .Completed: + if (_parent._throwOnEmpty) { + forwardOn(.Error(RxError.ArgumentOutOfRange)) + } else { + forwardOn(.Completed) + } + + self.dispose() + } + } +} + +class ElementAt : Producer { + + let _source: Observable + let _throwOnEmpty: Bool + let _index: Int + + init(source: Observable, index: Int, throwOnEmpty: Bool) { + if index < 0 { + rxFatalError("index can't be negative") + } + + self._source = source + self._index = index + self._throwOnEmpty = throwOnEmpty + } + + override func run(observer: O) -> Disposable { + let sink = ElementAtSink(parent: self, observer: observer) + sink.disposable = _source.subscribeSafe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Empty.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Empty.swift new file mode 100644 index 0000000..d2ebb18 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Empty.swift @@ -0,0 +1,16 @@ +// +// Empty.swift +// Rx +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class Empty : Producer { + override func subscribe(observer: O) -> Disposable { + observer.on(.Completed) + return NopDisposable.instance + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Error.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Error.swift new file mode 100644 index 0000000..79f19c9 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Error.swift @@ -0,0 +1,22 @@ +// +// Error.swift +// Rx +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class Error : Producer { + private let _error: ErrorType + + init(error: ErrorType) { + _error = error + } + + override func subscribe(observer: O) -> Disposable { + observer.on(.Error(_error)) + return NopDisposable.instance + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Filter.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Filter.swift new file mode 100644 index 0000000..b78fafb --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Filter.swift @@ -0,0 +1,60 @@ +// +// Filter.swift +// Rx +// +// Created by Krunoslav Zaher on 2/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class FilterSink: Sink, ObserverType { + typealias Predicate = (Element) throws -> Bool + typealias Element = O.E + + typealias Parent = Filter + + private let _predicate: Predicate + + init(predicate: Predicate, observer: O) { + _predicate = predicate + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + do { + let satisfies = try _predicate(value) + if satisfies { + forwardOn(.Next(value)) + } + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + case .Completed, .Error: + forwardOn(event) + dispose() + } + } +} + +class Filter : Producer { + typealias Predicate = (Element) throws -> Bool + + private let _source: Observable + private let _predicate: Predicate + + init(source: Observable, predicate: Predicate) { + _source = source + _predicate = predicate + } + + override func run(observer: O) -> Disposable { + let sink = FilterSink(predicate: _predicate, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Generate.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Generate.swift new file mode 100644 index 0000000..8321f94 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Generate.swift @@ -0,0 +1,71 @@ +// +// Generate.swift +// Rx +// +// Created by Krunoslav Zaher on 9/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class GenerateSink : Sink { + typealias Parent = Generate + + private let _parent: Parent + + private var _state: S + + init(parent: Parent, observer: O) { + _parent = parent + _state = parent._initialState + super.init(observer: observer) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRecursive(true) { (isFirst, recurse) -> Void in + do { + if !isFirst { + self._state = try self._parent._iterate(self._state) + } + + if try self._parent._condition(self._state) { + let result = try self._parent._resultSelector(self._state) + self.forwardOn(.Next(result)) + + recurse(false) + } + else { + self.forwardOn(.Completed) + self.dispose() + } + } + catch let error { + self.forwardOn(.Error(error)) + self.dispose() + } + } + } +} + +class Generate : Producer { + private let _initialState: S + private let _condition: S throws -> Bool + private let _iterate: S throws -> S + private let _resultSelector: S throws -> E + private let _scheduler: ImmediateSchedulerType + + init(initialState: S, condition: S throws -> Bool, iterate: S throws -> S, resultSelector: S throws -> E, scheduler: ImmediateSchedulerType) { + _initialState = initialState + _condition = condition + _iterate = iterate + _resultSelector = resultSelector + _scheduler = scheduler + super.init() + } + + override func run(observer: O) -> Disposable { + let sink = GenerateSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Just.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Just.swift new file mode 100644 index 0000000..280827a --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Just.swift @@ -0,0 +1,61 @@ +// +// Just.swift +// Rx +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class JustScheduledSink : Sink { + typealias Parent = JustScheduled + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + let scheduler = _parent._scheduler + return scheduler.schedule(_parent._element) { element in + self.forwardOn(.Next(element)) + return scheduler.schedule(()) { _ in + self.forwardOn(.Completed) + return NopDisposable.instance + } + } + } +} + +class JustScheduled : Producer { + private let _scheduler: ImmediateSchedulerType + private let _element: Element + + init(element: Element, scheduler: ImmediateSchedulerType) { + _scheduler = scheduler + _element = element + } + + override func subscribe(observer: O) -> Disposable { + let sink = JustScheduledSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + +class Just : Producer { + private let _element: Element + + init(element: Element) { + _element = element + } + + override func subscribe(observer: O) -> Disposable { + observer.on(.Next(_element)) + observer.on(.Completed) + return NopDisposable.instance + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Map.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Map.swift new file mode 100644 index 0000000..a4dc379 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Map.swift @@ -0,0 +1,140 @@ +// +// Map.swift +// Rx +// +// Created by Krunoslav Zaher on 3/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class MapSink : Sink, ObserverType { + typealias Selector = (SourceType) throws -> ResultType + + typealias ResultType = O.E + typealias Element = SourceType + + private let _selector: Selector + + init(selector: Selector, observer: O) { + _selector = selector + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let element): + do { + let mappedElement = try _selector(element) + forwardOn(.Next(mappedElement)) + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + case .Error(let error): + forwardOn(.Error(error)) + dispose() + case .Completed: + forwardOn(.Completed) + dispose() + } + } +} + +class MapWithIndexSink : Sink, ObserverType { + typealias Selector = (SourceType, Int) throws -> ResultType + + typealias ResultType = O.E + typealias Element = SourceType + typealias Parent = MapWithIndex + + private let _selector: Selector + + private var _index = 0 + + init(selector: Selector, observer: O) { + _selector = selector + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let element): + do { + let mappedElement = try _selector(element, try incrementChecked(&_index)) + forwardOn(.Next(mappedElement)) + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + case .Error(let error): + forwardOn(.Error(error)) + dispose() + case .Completed: + forwardOn(.Completed) + dispose() + } + } +} + +class MapWithIndex : Producer { + typealias Selector = (SourceType, Int) throws -> ResultType + + private let _source: Observable + + private let _selector: Selector + + init(source: Observable, selector: Selector) { + _source = source + _selector = selector + } + + override func run(observer: O) -> Disposable { + let sink = MapWithIndexSink(selector: _selector, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} + +#if TRACE_RESOURCES +public var numberOfMapOperators: Int32 = 0 +#endif + +class Map: Producer { + typealias Selector = (SourceType) throws -> ResultType + + private let _source: Observable + + private let _selector: Selector + + init(source: Observable, selector: Selector) { + _source = source + _selector = selector + +#if TRACE_RESOURCES + AtomicIncrement(&numberOfMapOperators) +#endif + } + + override func composeMap(selector: ResultType throws -> R) -> Observable { + let originalSelector = _selector + return Map(source: _source, selector: { (s: SourceType) throws -> R in + let r: ResultType = try originalSelector(s) + return try selector(r) + }) + } + + override func run(observer: O) -> Disposable { + let sink = MapSink(selector: _selector, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } + + #if TRACE_RESOURCES + deinit { + AtomicDecrement(&numberOfMapOperators) + } + #endif +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Merge.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Merge.swift new file mode 100644 index 0000000..a7b90bb --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Merge.swift @@ -0,0 +1,424 @@ +// +// Merge.swift +// Rx +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: Limited concurrency version + +class MergeLimitedSinkIter + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = O.E + typealias DisposeKey = Bag.KeyType + typealias Parent = MergeLimitedSink + + private let _parent: Parent + private let _disposeKey: DisposeKey + + var _lock: NSRecursiveLock { + return _parent._lock + } + + init(parent: Parent, disposeKey: DisposeKey) { + _parent = parent + _disposeKey = disposeKey + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next: + _parent.forwardOn(event) + case .Error: + _parent.forwardOn(event) + _parent.dispose() + case .Completed: + _parent._group.removeDisposable(_disposeKey) + if let next = _parent._queue.dequeue() { + _parent.subscribe(next, group: _parent._group) + } + else { + _parent._activeCount = _parent._activeCount - 1 + + if _parent._stopped && _parent._activeCount == 0 { + _parent.forwardOn(.Completed) + _parent.dispose() + } + } + } + } +} + +class MergeLimitedSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = S + typealias QueueType = Queue + + private let _maxConcurrent: Int + + let _lock = NSRecursiveLock() + + // state + private var _stopped = false + private var _activeCount = 0 + private var _queue = QueueType(capacity: 2) + + private let _sourceSubscription = SingleAssignmentDisposable() + private let _group = CompositeDisposable() + + init(maxConcurrent: Int, observer: O) { + _maxConcurrent = maxConcurrent + + _group.addDisposable(_sourceSubscription) + super.init(observer: observer) + } + + func run(source: Observable) -> Disposable { + _group.addDisposable(_sourceSubscription) + + let disposable = source.subscribe(self) + _sourceSubscription.disposable = disposable + return _group + } + + func subscribe(innerSource: E, group: CompositeDisposable) { + let subscription = SingleAssignmentDisposable() + + let key = group.addDisposable(subscription) + + if let key = key { + let observer = MergeLimitedSinkIter(parent: self, disposeKey: key) + + let disposable = innerSource.asObservable().subscribe(observer) + subscription.disposable = disposable + } + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let value): + let subscribe: Bool + if _activeCount < _maxConcurrent { + _activeCount += 1 + subscribe = true + } + else { + _queue.enqueue(value) + subscribe = false + } + + if subscribe { + self.subscribe(value, group: _group) + } + case .Error(let error): + forwardOn(.Error(error)) + dispose() + case .Completed: + if _activeCount == 0 { + forwardOn(.Completed) + dispose() + } + else { + _sourceSubscription.dispose() + } + + _stopped = true + } + } +} + +class MergeLimited : Producer { + private let _source: Observable + private let _maxConcurrent: Int + + init(source: Observable, maxConcurrent: Int) { + _source = source + _maxConcurrent = maxConcurrent + } + + override func run(observer: O) -> Disposable { + let sink = MergeLimitedSink(maxConcurrent: _maxConcurrent, observer: observer) + sink.disposable = sink.run(_source) + return sink + } +} + +// MARK: Merge + +final class MergeBasicSink : MergeSink { + override init(observer: O) { + super.init(observer: observer) + } + + override func performMap(element: S) throws -> S { + return element + } +} + +// MARK: flatMap + +final class FlatMapSink : MergeSink { + typealias Selector = (SourceType) throws -> S + + private let _selector: Selector + + init(selector: Selector, observer: O) { + _selector = selector + super.init(observer: observer) + } + + override func performMap(element: SourceType) throws -> S { + return try _selector(element) + } +} + +final class FlatMapWithIndexSink : MergeSink { + typealias Selector = (SourceType, Int) throws -> S + + private var _index = 0 + private let _selector: Selector + + init(selector: Selector, observer: O) { + _selector = selector + super.init(observer: observer) + } + + override func performMap(element: SourceType) throws -> S { + return try _selector(element, try incrementChecked(&_index)) + } +} + +// MARK: FlatMapFirst + +final class FlatMapFirstSink : MergeSink { + typealias Selector = (SourceType) throws -> S + + private let _selector: Selector + + override var subscribeNext: Bool { + return _group.count == MergeNoIterators + } + + init(selector: Selector, observer: O) { + _selector = selector + super.init(observer: observer) + } + + override func performMap(element: SourceType) throws -> S { + return try _selector(element) + } +} + +// It's value is one because initial source subscription is always in CompositeDisposable +private let MergeNoIterators = 1 + +class MergeSinkIter : ObserverType { + typealias Parent = MergeSink + typealias DisposeKey = CompositeDisposable.DisposeKey + typealias E = O.E + + private let _parent: Parent + private let _disposeKey: DisposeKey + + init(parent: Parent, disposeKey: DisposeKey) { + _parent = parent + _disposeKey = disposeKey + } + + func on(event: Event) { + switch event { + case .Next(let value): + _parent._lock.lock(); defer { _parent._lock.unlock() } // lock { + _parent.forwardOn(.Next(value)) + // } + case .Error(let error): + _parent._lock.lock(); defer { _parent._lock.unlock() } // lock { + _parent.forwardOn(.Error(error)) + _parent.dispose() + // } + case .Completed: + _parent._group.removeDisposable(_disposeKey) + // If this has returned true that means that `Completed` should be sent. + // In case there is a race who will sent first completed, + // lock will sort it out. When first Completed message is sent + // it will set observer to nil, and thus prevent further complete messages + // to be sent, and thus preserving the sequence grammar. + if _parent._stopped && _parent._group.count == MergeNoIterators { + _parent._lock.lock(); defer { _parent._lock.unlock() } // lock { + _parent.forwardOn(.Completed) + _parent.dispose() + // } + } + } + } +} + + +class MergeSink + : Sink + , ObserverType { + typealias ResultType = O.E + typealias Element = SourceType + + private let _lock = NSRecursiveLock() + + private var subscribeNext: Bool { + return true + } + + // state + private let _group = CompositeDisposable() + private let _sourceSubscription = SingleAssignmentDisposable() + + private var _stopped = false + + override init(observer: O) { + super.init(observer: observer) + } + + func performMap(element: SourceType) throws -> S { + abstractMethod() + } + + func on(event: Event) { + switch event { + case .Next(let element): + if !subscribeNext { + return + } + do { + let value = try performMap(element) + subscribeInner(value.asObservable()) + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + case .Error(let error): + _lock.lock(); defer { _lock.unlock() } // lock { + forwardOn(.Error(error)) + dispose() + // } + case .Completed: + _lock.lock(); defer { _lock.unlock() } // lock { + _stopped = true + if _group.count == MergeNoIterators { + forwardOn(.Completed) + dispose() + } + else { + _sourceSubscription.dispose() + } + //} + } + } + + func subscribeInner(source: Observable) { + let iterDisposable = SingleAssignmentDisposable() + if let disposeKey = _group.addDisposable(iterDisposable) { + let iter = MergeSinkIter(parent: self, disposeKey: disposeKey) + let subscription = source.subscribe(iter) + iterDisposable.disposable = subscription + } + } + + func run(source: Observable) -> Disposable { + _group.addDisposable(_sourceSubscription) + + let subscription = source.subscribe(self) + _sourceSubscription.disposable = subscription + + return _group + } +} + +// MARK: Producers + +final class FlatMap: Producer { + typealias Selector = (SourceType) throws -> S + + private let _source: Observable + + private let _selector: Selector + + init(source: Observable, selector: Selector) { + _source = source + _selector = selector + } + + override func run(observer: O) -> Disposable { + let sink = FlatMapSink(selector: _selector, observer: observer) + sink.disposable = sink.run(_source) + return sink + } +} + +final class FlatMapWithIndex: Producer { + typealias Selector = (SourceType, Int) throws -> S + + private let _source: Observable + + private let _selector: Selector + + init(source: Observable, selector: Selector) { + _source = source + _selector = selector + } + + override func run(observer: O) -> Disposable { + let sink = FlatMapWithIndexSink(selector: _selector, observer: observer) + sink.disposable = sink.run(_source) + return sink + } + +} + +final class FlatMapFirst: Producer { + typealias Selector = (SourceType) throws -> S + + private let _source: Observable + + private let _selector: Selector + + init(source: Observable, selector: Selector) { + _source = source + _selector = selector + } + + override func run(observer: O) -> Disposable { + let sink = FlatMapFirstSink(selector: _selector, observer: observer) + sink.disposable = sink.run(_source) + return sink + } +} + +final class Merge : Producer { + private let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(observer: O) -> Disposable { + let sink = MergeBasicSink(observer: observer) + sink.disposable = sink.run(_source) + return sink + } +} + diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Multicast.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Multicast.swift new file mode 100644 index 0000000..fd8bfd6 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Multicast.swift @@ -0,0 +1,71 @@ +// +// Multicast.swift +// Rx +// +// Created by Krunoslav Zaher on 2/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class MulticastSink: Sink, ObserverType { + typealias Element = O.E + typealias ResultType = Element + typealias MutlicastType = Multicast + + private let _parent: MutlicastType + + init(parent: MutlicastType, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + do { + let subject = try _parent._subjectSelector() + let connectable = ConnectableObservableAdapter(source: _parent._source, subject: subject) + + let observable = try _parent._selector(connectable) + + let subscription = observable.subscribe(self) + let connection = connectable.connect() + + return BinaryDisposable(subscription, connection) + } + catch let e { + forwardOn(.Error(e)) + dispose() + return NopDisposable.instance + } + } + + func on(event: Event) { + forwardOn(event) + switch event { + case .Next: break + case .Error, .Completed: + dispose() + } + } +} + +class Multicast: Producer { + typealias SubjectSelectorType = () throws -> S + typealias SelectorType = (Observable) throws -> Observable + + private let _source: Observable + private let _subjectSelector: SubjectSelectorType + private let _selector: SelectorType + + init(source: Observable, subjectSelector: SubjectSelectorType, selector: SelectorType) { + _source = source + _subjectSelector = subjectSelector + _selector = selector + } + + override func run(observer: O) -> Disposable { + let sink = MulticastSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Never.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Never.swift new file mode 100644 index 0000000..1b20b27 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Never.swift @@ -0,0 +1,15 @@ +// +// Never.swift +// Rx +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class Never : Producer { + override func subscribe(observer: O) -> Disposable { + return NopDisposable.instance + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOn.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOn.swift new file mode 100644 index 0000000..c0fb46d --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOn.swift @@ -0,0 +1,133 @@ +// +// ObserveOn.swift +// RxSwift +// +// Created by Krunoslav Zaher on 7/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class ObserveOn : Producer { + let scheduler: ImmediateSchedulerType + let source: Observable + + init(source: Observable, scheduler: ImmediateSchedulerType) { + self.scheduler = scheduler + self.source = source + +#if TRACE_RESOURCES + AtomicIncrement(&resourceCount) +#endif + } + + override func run(observer: O) -> Disposable { + let sink = ObserveOnSink(scheduler: scheduler, observer: observer) + sink._subscription.disposable = source.subscribe(sink) + return sink + } + +#if TRACE_RESOURCES + deinit { + AtomicDecrement(&resourceCount) + } +#endif +} + +enum ObserveOnState : Int32 { + // pump is not running + case Stopped = 0 + // pump is running + case Running = 1 +} + +class ObserveOnSink : ObserverBase { + typealias E = O.E + + let _scheduler: ImmediateSchedulerType + + var _lock = SpinLock() + + // state + var _state = ObserveOnState.Stopped + var _observer: O? + var _queue = Queue>(capacity: 10) + + let _scheduleDisposable = SerialDisposable() + let _subscription = SingleAssignmentDisposable() + + init(scheduler: ImmediateSchedulerType, observer: O) { + _scheduler = scheduler + _observer = observer + } + + override func onCore(event: Event) { + let shouldStart = _lock.calculateLocked { () -> Bool in + self._queue.enqueue(event) + + switch self._state { + case .Stopped: + self._state = .Running + return true + case .Running: + return false + } + } + + if shouldStart { + _scheduleDisposable.disposable = self._scheduler.scheduleRecursive((), action: self.run) + } + } + + func run(state: Void, recurse: Void -> Void) { + let (nextEvent, observer) = self._lock.calculateLocked { () -> (Event?, O?) in + if self._queue.count > 0 { + return (self._queue.dequeue(), self._observer) + } + else { + self._state = .Stopped + return (nil, self._observer) + } + } + + if let nextEvent = nextEvent { + observer?.on(nextEvent) + if nextEvent.isStopEvent { + dispose() + } + } + else { + return + } + + let shouldContinue = _shouldContinue_synchronized() + + if shouldContinue { + recurse() + } + } + + func _shouldContinue_synchronized() -> Bool { + _lock.lock(); defer { _lock.unlock() } // { + if self._queue.count > 0 { + return true + } + else { + self._state = .Stopped + return false + } + // } + } + + override func dispose() { + super.dispose() + + _subscription.dispose() + _scheduleDisposable.dispose() + + _lock.lock(); defer { _lock.unlock() } // { + _observer = nil + + // } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOnSerialDispatchQueue.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOnSerialDispatchQueue.swift new file mode 100644 index 0000000..f051f82 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/ObserveOnSerialDispatchQueue.swift @@ -0,0 +1,81 @@ +// +// ObserveOnSerialDispatchQueue.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if TRACE_RESOURCES +/** +Counts number of `SerialDispatchQueueObservables`. + +Purposed for unit tests. +*/ +public var numberOfSerialDispatchQueueObservables: AtomicInt = 0 +#endif + +class ObserveOnSerialDispatchQueueSink : ObserverBase { + let scheduler: SerialDispatchQueueScheduler + let observer: O + + let subscription = SingleAssignmentDisposable() + + var cachedScheduleLambda: ((ObserveOnSerialDispatchQueueSink, Event) -> Disposable)! + + init(scheduler: SerialDispatchQueueScheduler, observer: O) { + self.scheduler = scheduler + self.observer = observer + super.init() + + cachedScheduleLambda = { sink, event in + sink.observer.on(event) + + if event.isStopEvent { + sink.dispose() + } + + return NopDisposable.instance + } + } + + override func onCore(event: Event) { + self.scheduler.schedule((self, event), action: cachedScheduleLambda) + } + + override func dispose() { + super.dispose() + + subscription.dispose() + } +} + +class ObserveOnSerialDispatchQueue : Producer { + let scheduler: SerialDispatchQueueScheduler + let source: Observable + + init(source: Observable, scheduler: SerialDispatchQueueScheduler) { + self.scheduler = scheduler + self.source = source + +#if TRACE_RESOURCES + AtomicIncrement(&resourceCount) + AtomicIncrement(&numberOfSerialDispatchQueueObservables) +#endif + } + + override func run(observer: O) -> Disposable { + let sink = ObserveOnSerialDispatchQueueSink(scheduler: scheduler, observer: observer) + sink.subscription.disposable = source.subscribe(sink) + return sink + } + +#if TRACE_RESOURCES + deinit { + AtomicDecrement(&resourceCount) + AtomicDecrement(&numberOfSerialDispatchQueueObservables) + } +#endif +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Producer.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Producer.swift new file mode 100644 index 0000000..0a3048a --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Producer.swift @@ -0,0 +1,30 @@ +// +// Producer.swift +// Rx +// +// Created by Krunoslav Zaher on 2/20/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class Producer : Observable { + override init() { + super.init() + } + + override func subscribe(observer: O) -> Disposable { + if !CurrentThreadScheduler.isScheduleRequired { + return run(observer) + } + else { + return CurrentThreadScheduler.instance.schedule(()) { _ in + return self.run(observer) + } + } + } + + func run(observer: O) -> Disposable { + abstractMethod() + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Range.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Range.swift new file mode 100644 index 0000000..8295c59 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Range.swift @@ -0,0 +1,59 @@ +// +// Range.swift +// Rx +// +// Created by Krunoslav Zaher on 9/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class RangeProducer : Producer { + private let _start: E + private let _count: E + private let _scheduler: ImmediateSchedulerType + + init(start: E, count: E, scheduler: ImmediateSchedulerType) { + if count < 0 { + rxFatalError("count can't be negative") + } + + if start &+ (count - 1) < start { + rxFatalError("overflow of count") + } + + _start = start + _count = count + _scheduler = scheduler + } + + override func run(observer: O) -> Disposable { + let sink = RangeSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + +class RangeSink : Sink { + typealias Parent = RangeProducer + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRecursive(0 as O.E) { i, recurse in + if i < self._parent._count { + self.forwardOn(.Next(self._parent._start + i)) + recurse(i + 1) + } + else { + self.forwardOn(.Completed) + self.dispose() + } + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Reduce.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Reduce.swift new file mode 100644 index 0000000..10e03b8 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Reduce.swift @@ -0,0 +1,74 @@ +// +// Reduce.swift +// Rx +// +// Created by Krunoslav Zaher on 4/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class ReduceSink : Sink, ObserverType { + typealias ResultType = O.E + typealias Parent = Reduce + + private let _parent: Parent + private var _accumulation: AccumulateType + + init(parent: Parent, observer: O) { + _parent = parent + _accumulation = parent._seed + + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + do { + _accumulation = try _parent._accumulator(_accumulation, value) + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + case .Error(let e): + forwardOn(.Error(e)) + dispose() + case .Completed: + do { + let result = try _parent._mapResult(_accumulation) + forwardOn(.Next(result)) + forwardOn(.Completed) + dispose() + } + catch let e { + forwardOn(.Error(e)) + dispose() + } + } + } +} + +class Reduce : Producer { + typealias AccumulatorType = (AccumulateType, SourceType) throws -> AccumulateType + typealias ResultSelectorType = (AccumulateType) throws -> ResultType + + private let _source: Observable + private let _seed: AccumulateType + private let _accumulator: AccumulatorType + private let _mapResult: ResultSelectorType + + init(source: Observable, seed: AccumulateType, accumulator: AccumulatorType, mapResult: ResultSelectorType) { + _source = source + _seed = seed + _accumulator = accumulator + _mapResult = mapResult + } + + override func run(observer: O) -> Disposable { + let sink = ReduceSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/RefCount.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/RefCount.swift new file mode 100644 index 0000000..1649dda --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/RefCount.swift @@ -0,0 +1,84 @@ +// +// RefCount.swift +// Rx +// +// Created by Krunoslav Zaher on 3/5/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class RefCountSink + : Sink + , ObserverType { + typealias Element = O.E + typealias Parent = RefCount + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + let subscription = _parent._source.subscribeSafe(self) + + _parent._lock.lock(); defer { _parent._lock.unlock() } // { + if _parent._count == 0 { + _parent._count = 1 + _parent._connectableSubscription = _parent._source.connect() + } + else { + _parent._count = _parent._count + 1 + } + // } + + return AnonymousDisposable { + subscription.dispose() + self._parent._lock.lock(); defer { self._parent._lock.unlock() } // { + if self._parent._count == 1 { + self._parent._connectableSubscription!.dispose() + self._parent._count = 0 + self._parent._connectableSubscription = nil + } + else if self._parent._count > 1 { + self._parent._count = self._parent._count - 1 + } + else { + rxFatalError("Something went wrong with RefCount disposing mechanism") + } + // } + } + } + + func on(event: Event) { + switch event { + case .Next: + forwardOn(event) + case .Error, .Completed: + forwardOn(event) + dispose() + } + } +} + +class RefCount: Producer { + private let _lock = NSRecursiveLock() + + // state + private var _count = 0 + private var _connectableSubscription = nil as Disposable? + + private let _source: CO + + init(source: CO) { + _source = source + } + + override func run(observer: O) -> Disposable { + let sink = RefCountSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Repeat.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Repeat.swift new file mode 100644 index 0000000..13b9cc7 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Repeat.swift @@ -0,0 +1,44 @@ +// +// Repeat.swift +// RxExample +// +// Created by Krunoslav Zaher on 9/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class RepeatElement : Producer { + private let _element: Element + private let _scheduler: ImmediateSchedulerType + + init(element: Element, scheduler: ImmediateSchedulerType) { + _element = element + _scheduler = scheduler + } + + override func run(observer: O) -> Disposable { + let sink = RepeatElementSink(parent: self, observer: observer) + sink.disposable = sink.run() + + return sink + } +} + +class RepeatElementSink : Sink { + typealias Parent = RepeatElement + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRecursive(_parent._element) { e, recurse in + self.forwardOn(.Next(e)) + recurse(e) + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/RetryWhen.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/RetryWhen.swift new file mode 100644 index 0000000..724218e --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/RetryWhen.swift @@ -0,0 +1,150 @@ +// +// RetryWhen.swift +// Rx +// +// Created by Junior B. on 06/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class RetryTriggerSink + : ObserverType { + typealias E = TriggerObservable.E + + typealias Parent = RetryWhenSequenceSinkIter + + private let _parent: Parent + + init(parent: Parent) { + _parent = parent + } + + func on(event: Event) { + switch event { + case .Next: + _parent._parent._lastError = nil + _parent._parent.schedule(.MoveNext) + case .Error(let e): + _parent._parent.forwardOn(.Error(e)) + _parent._parent.dispose() + case .Completed: + _parent._parent.forwardOn(.Completed) + _parent._parent.dispose() + } + } +} + +class RetryWhenSequenceSinkIter + : SingleAssignmentDisposable + , ObserverType { + typealias E = O.E + typealias Parent = RetryWhenSequenceSink + + private let _parent: Parent + private let _errorHandlerSubscription = SingleAssignmentDisposable() + + init(parent: Parent) { + _parent = parent + } + + func on(event: Event) { + switch event { + case .Next: + _parent.forwardOn(event) + case .Error(let error): + _parent._lastError = error + + if let failedWith = error as? Error { + // dispose current subscription + super.dispose() + + let errorHandlerSubscription = _parent._notifier.subscribe(RetryTriggerSink(parent: self)) + _errorHandlerSubscription.disposable = errorHandlerSubscription + _parent._errorSubject.on(.Next(failedWith)) + } + else { + _parent.forwardOn(.Error(error)) + _parent.dispose() + } + case .Completed: + _parent.forwardOn(event) + _parent.dispose() + } + } + + override func dispose() { + super.dispose() + _errorHandlerSubscription.dispose() + } +} + +class RetryWhenSequenceSink + : TailRecursiveSink { + typealias Element = O.E + typealias Parent = RetryWhenSequence + + let _lock = NSRecursiveLock() + + private let _parent: Parent + + private var _lastError: ErrorType? + private let _errorSubject = PublishSubject() + private let _handler: Observable + private let _notifier = PublishSubject() + + init(parent: Parent, observer: O) { + _parent = parent + _handler = parent._notificationHandler(_errorSubject).asObservable() + super.init(observer: observer) + } + + override func done() { + if let lastError = _lastError { + forwardOn(.Error(lastError)) + _lastError = nil + } + else { + forwardOn(.Completed) + } + + dispose() + } + + override func extract(observable: Observable) -> SequenceGenerator? { + // It is important to always return `nil` here because there are sideffects in the `run` method + // that are dependant on particular `retryWhen` operator so single operator stack can't be reused in this + // case. + return nil + } + + override func subscribeToNext(source: Observable) -> Disposable { + let iter = RetryWhenSequenceSinkIter(parent: self) + iter.disposable = source.subscribe(iter) + return iter + } + + override func run(sources: SequenceGenerator) -> Disposable { + let triggerSubscription = _handler.subscribe(_notifier.asObserver()) + let superSubscription = super.run(sources) + return StableCompositeDisposable.create(superSubscription, triggerSubscription) + } +} + +class RetryWhenSequence : Producer { + typealias Element = S.Generator.Element.E + + private let _sources: S + private let _notificationHandler: Observable -> TriggerObservable + + init(sources: S, notificationHandler: Observable -> TriggerObservable) { + _sources = sources + _notificationHandler = notificationHandler + } + + override func run(observer: O) -> Disposable { + let sink = RetryWhenSequenceSink(parent: self, observer: observer) + sink.disposable = sink.run((self._sources.generate(), nil)) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Sample.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Sample.swift new file mode 100644 index 0000000..a8f0ad4 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Sample.swift @@ -0,0 +1,129 @@ +// +// Sample.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class SamplerSink + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = SampleType + + typealias Parent = SampleSequenceSink + + private let _parent: Parent + + var _lock: NSRecursiveLock { + return _parent._lock + } + + init(parent: Parent) { + _parent = parent + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next: + if let element = _parent._element { + if _parent._parent._onlyNew { + _parent._element = nil + } + + _parent.forwardOn(.Next(element)) + } + + if _parent._atEnd { + _parent.forwardOn(.Completed) + _parent.dispose() + } + case .Error(let e): + _parent.forwardOn(.Error(e)) + _parent.dispose() + case .Completed: + if let element = _parent._element { + _parent._element = nil + _parent.forwardOn(.Next(element)) + } + if _parent._atEnd { + _parent.forwardOn(.Completed) + _parent.dispose() + } + } + } +} + +class SampleSequenceSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Element = O.E + typealias Parent = Sample + + private let _parent: Parent + + let _lock = NSRecursiveLock() + + // state + private var _element = nil as Element? + private var _atEnd = false + + private let _sourceSubscription = SingleAssignmentDisposable() + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + _sourceSubscription.disposable = _parent._source.subscribe(self) + let samplerSubscription = _parent._sampler.subscribe(SamplerSink(parent: self)) + + return StableCompositeDisposable.create(_sourceSubscription, samplerSubscription) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let element): + _element = element + case .Error: + forwardOn(event) + dispose() + case .Completed: + _atEnd = true + _sourceSubscription.dispose() + } + } + +} + +class Sample : Producer { + private let _source: Observable + private let _sampler: Observable + private let _onlyNew: Bool + + init(source: Observable, sampler: Observable, onlyNew: Bool) { + _source = source + _sampler = sampler + _onlyNew = onlyNew + } + + override func run(observer: O) -> Disposable { + let sink = SampleSequenceSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Scan.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Scan.swift new file mode 100644 index 0000000..958dd69 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Scan.swift @@ -0,0 +1,64 @@ +// +// Scan.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class ScanSink : Sink, ObserverType { + typealias Parent = Scan + typealias E = ElementType + + private let _parent: Parent + private var _accumulate: Accumulate + + init(parent: Parent, observer: O) { + _parent = parent + _accumulate = parent._seed + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let element): + do { + _accumulate = try _parent._accumulator(_accumulate, element) + forwardOn(.Next(_accumulate)) + } + catch let error { + forwardOn(.Error(error)) + dispose() + } + case .Error(let error): + forwardOn(.Error(error)) + dispose() + case .Completed: + forwardOn(.Completed) + dispose() + } + } + +} + +class Scan: Producer { + typealias Accumulator = (Accumulate, Element) throws -> Accumulate + + private let _source: Observable + private let _seed: Accumulate + private let _accumulator: Accumulator + + init(source: Observable, seed: Accumulate, accumulator: Accumulator) { + _source = source + _seed = seed + _accumulator = accumulator + } + + override func run(observer: O) -> Disposable { + let sink = ScanSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Sequence.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Sequence.swift new file mode 100644 index 0000000..63ee713 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Sequence.swift @@ -0,0 +1,58 @@ +// +// Sequence.swift +// Rx +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class SequenceSink : Sink { + typealias Parent = Sequence + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + return _parent._scheduler!.scheduleRecursive((0, _parent._elements)) { (state, recurse) in + if state.0 < state.1.count { + self.forwardOn(.Next(state.1[state.0])) + recurse((state.0 + 1, state.1)) + } + else { + self.forwardOn(.Completed) + } + } + } +} + +class Sequence : Producer { + private let _elements: [E] + private let _scheduler: ImmediateSchedulerType? + + init(elements: [E], scheduler: ImmediateSchedulerType?) { + _elements = elements + _scheduler = scheduler + } + + override func subscribe(observer: O) -> Disposable { + // optimized version without scheduler + guard _scheduler != nil else { + for element in _elements { + observer.on(.Next(element)) + } + + observer.on(.Completed) + return NopDisposable.instance + } + + let sink = SequenceSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1.swift new file mode 100644 index 0000000..52cb5eb --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1.swift @@ -0,0 +1,101 @@ +// +// ShareReplay1.swift +// Rx +// +// Created by Krunoslav Zaher on 10/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// optimized version of share replay for most common case +final class ShareReplay1 + : Observable + , ObserverType + , SynchronizedUnsubscribeType { + + typealias DisposeKey = Bag>.KeyType + + private let _source: Observable + + private var _lock = NSRecursiveLock() + + private var _connection: SingleAssignmentDisposable? + private var _element: Element? + private var _stopped = false + private var _stopEvent = nil as Event? + private var _observers = Bag>() + + init(source: Observable) { + self._source = source + } + + override func subscribe(observer: O) -> Disposable { + _lock.lock(); defer { _lock.unlock() } + return _synchronized_subscribe(observer) + } + + func _synchronized_subscribe(observer: O) -> Disposable { + if let element = self._element { + observer.on(.Next(element)) + } + + if let stopEvent = self._stopEvent { + observer.on(stopEvent) + return NopDisposable.instance + } + + let initialCount = self._observers.count + + let disposeKey = self._observers.insert(AnyObserver(observer)) + + if initialCount == 0 { + let connection = SingleAssignmentDisposable() + _connection = connection + + connection.disposable = self._source.subscribe(self) + } + + return SubscriptionDisposable(owner: self, key: disposeKey) + } + + func synchronizedUnsubscribe(disposeKey: DisposeKey) { + _lock.lock(); defer { _lock.unlock() } + _synchronized_unsubscribe(disposeKey) + } + + func _synchronized_unsubscribe(disposeKey: DisposeKey) { + // if already unsubscribed, just return + if self._observers.removeKey(disposeKey) == nil { + return + } + + if _observers.count == 0 { + _connection?.dispose() + _connection = nil + } + } + + func on(event: Event) { + _lock.lock(); defer { _lock.unlock() } + _synchronized_on(event) + } + + func _synchronized_on(event: Event) { + if _stopped { + return + } + + switch event { + case .Next(let element): + _element = element + case .Error, .Completed: + _stopEvent = event + _stopped = true + _connection?.dispose() + _connection = nil + } + + _observers.on(event) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1WhileConnected.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1WhileConnected.swift new file mode 100644 index 0000000..af776b1 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/ShareReplay1WhileConnected.swift @@ -0,0 +1,92 @@ +// +// ShareReplay1WhileConnected.swift +// Rx +// +// Created by Krunoslav Zaher on 12/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// optimized version of share replay for most common case +final class ShareReplay1WhileConnected + : Observable + , ObserverType + , SynchronizedUnsubscribeType { + + typealias DisposeKey = Bag>.KeyType + + private let _source: Observable + + private var _lock = NSRecursiveLock() + + private var _connection: SingleAssignmentDisposable? + private var _element: Element? + private var _observers = Bag>() + + init(source: Observable) { + self._source = source + } + + override func subscribe(observer: O) -> Disposable { + _lock.lock(); defer { _lock.unlock() } + return _synchronized_subscribe(observer) + } + + func _synchronized_subscribe(observer: O) -> Disposable { + if let element = self._element { + observer.on(.Next(element)) + } + + let initialCount = self._observers.count + + let disposeKey = self._observers.insert(AnyObserver(observer)) + + if initialCount == 0 { + let connection = SingleAssignmentDisposable() + _connection = connection + + connection.disposable = self._source.subscribe(self) + } + + return SubscriptionDisposable(owner: self, key: disposeKey) + } + + func synchronizedUnsubscribe(disposeKey: DisposeKey) { + _lock.lock(); defer { _lock.unlock() } + _synchronized_unsubscribe(disposeKey) + } + + func _synchronized_unsubscribe(disposeKey: DisposeKey) { + // if already unsubscribed, just return + if self._observers.removeKey(disposeKey) == nil { + return + } + + if _observers.count == 0 { + _connection?.dispose() + _connection = nil + _element = nil + } + } + + func on(event: Event) { + _lock.lock(); defer { _lock.unlock() } + _synchronized_on(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let element): + _element = element + _observers.on(event) + case .Error, .Completed: + _element = nil + _connection?.dispose() + _connection = nil + let observers = _observers + _observers = Bag() + observers.on(event) + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/SingleAsync.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/SingleAsync.swift new file mode 100644 index 0000000..af7a09a --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/SingleAsync.swift @@ -0,0 +1,76 @@ +// +// SingleAsync.swift +// Rx +// +// Created by Junior B. on 09/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class SingleAsyncSink : Sink, ObserverType { + typealias Parent = SingleAsync + typealias E = ElementType + + private let _parent: Parent + private var _seenValue: Bool = false + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + do { + let forward = try _parent._predicate?(value) ?? true + if !forward { + return + } + } + catch let error { + forwardOn(.Error(error as ErrorType)) + dispose() + return + } + + if _seenValue == false { + _seenValue = true + forwardOn(.Next(value)) + } else { + forwardOn(.Error(RxError.MoreThanOneElement)) + dispose() + } + + case .Error: + forwardOn(event) + dispose() + case .Completed: + if (!_seenValue) { + forwardOn(.Error(RxError.NoElements)) + } else { + forwardOn(.Completed) + } + dispose() + } + } +} + +class SingleAsync: Producer { + typealias Predicate = (Element) throws -> Bool + + private let _source: Observable + private let _predicate: Predicate? + + init(source: Observable, predicate: Predicate? = nil) { + _source = source + _predicate = predicate + } + + override func run(observer: O) -> Disposable { + let sink = SingleAsyncSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift new file mode 100644 index 0000000..dff961f --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift @@ -0,0 +1,57 @@ +// +// Sink.swift +// Rx +// +// Created by Krunoslav Zaher on 2/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class Sink : SingleAssignmentDisposable { + private let _observer: O + + init(observer: O) { +#if TRACE_RESOURCES + AtomicIncrement(&resourceCount) +#endif + _observer = observer + } + + final func forwardOn(event: Event) { + if disposed { + return + } + _observer.on(event) + } + + final func forwarder() -> SinkForward { + return SinkForward(forward: self) + } + + deinit { +#if TRACE_RESOURCES + AtomicDecrement(&resourceCount) +#endif + } +} + +class SinkForward: ObserverType { + typealias E = O.E + + private let _forward: Sink + + init(forward: Sink) { + _forward = forward + } + + func on(event: Event) { + switch event { + case .Next: + _forward._observer.on(event) + case .Error, .Completed: + _forward._observer.on(event) + _forward.dispose() + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Skip.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Skip.swift new file mode 100644 index 0000000..2c1bf40 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Skip.swift @@ -0,0 +1,128 @@ +// +// Skip.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// count version + +class SkipCountSink : Sink, ObserverType { + typealias Parent = SkipCount + typealias Element = ElementType + + let parent: Parent + + var remaining: Int + + init(parent: Parent, observer: O) { + self.parent = parent + self.remaining = parent.count + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + + if remaining <= 0 { + forwardOn(.Next(value)) + } + else { + remaining -= 1 + } + case .Error: + forwardOn(event) + self.dispose() + case .Completed: + forwardOn(event) + self.dispose() + } + } + +} + +class SkipCount: Producer { + let source: Observable + let count: Int + + init(source: Observable, count: Int) { + self.source = source + self.count = count + } + + override func run(observer: O) -> Disposable { + let sink = SkipCountSink(parent: self, observer: observer) + sink.disposable = source.subscribe(sink) + + return sink + } +} + +// time version + +class SkipTimeSink : Sink, ObserverType { + typealias Parent = SkipTime + typealias Element = ElementType + + let parent: Parent + + // state + var open = false + + init(parent: Parent, observer: O) { + self.parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + if open { + forwardOn(.Next(value)) + } + case .Error: + forwardOn(event) + self.dispose() + case .Completed: + forwardOn(event) + self.dispose() + } + } + + func tick() { + open = true + } + + func run() -> Disposable { + let disposeTimer = parent.scheduler.scheduleRelative((), dueTime: self.parent.duration) { + self.tick() + return NopDisposable.instance + } + + let disposeSubscription = parent.source.subscribe(self) + + return BinaryDisposable(disposeTimer, disposeSubscription) + } +} + +class SkipTime: Producer { + let source: Observable + let duration: RxTimeInterval + let scheduler: SchedulerType + + init(source: Observable, duration: RxTimeInterval, scheduler: SchedulerType) { + self.source = source + self.scheduler = scheduler + self.duration = duration + } + + override func run(observer: O) -> Disposable { + let sink = SkipTimeSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/SkipUntil.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/SkipUntil.swift new file mode 100644 index 0000000..97c7680 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/SkipUntil.swift @@ -0,0 +1,125 @@ +// +// SkipUntil.swift +// Rx +// +// Created by Yury Korolev on 10/3/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class SkipUntilSinkOther + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Parent = SkipUntilSink + typealias E = Other + + private let _parent: Parent + + var _lock: NSRecursiveLock { + return _parent._lock + } + + let _subscription = SingleAssignmentDisposable() + + init(parent: Parent) { + _parent = parent + #if TRACE_RESOURCES + AtomicIncrement(&resourceCount) + #endif + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next: + _parent._forwardElements = true + _subscription.dispose() + case .Error(let e): + _parent.forwardOn(.Error(e)) + _parent.dispose() + case .Completed: + _subscription.dispose() + } + } + + #if TRACE_RESOURCES + deinit { + AtomicDecrement(&resourceCount) + } + #endif + +} + + +class SkipUntilSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = ElementType + typealias Parent = SkipUntil + + let _lock = NSRecursiveLock() + private let _parent: Parent + private var _forwardElements = false + + private let _sourceSubscription = SingleAssignmentDisposable() + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next: + if _forwardElements { + forwardOn(event) + } + case .Error: + forwardOn(event) + dispose() + case .Completed: + if _forwardElements { + forwardOn(event) + } + _sourceSubscription.dispose() + } + } + + func run() -> Disposable { + let sourceSubscription = _parent._source.subscribe(self) + let otherObserver = SkipUntilSinkOther(parent: self) + let otherSubscription = _parent._other.subscribe(otherObserver) + _sourceSubscription.disposable = sourceSubscription + otherObserver._subscription.disposable = otherSubscription + + return StableCompositeDisposable.create(_sourceSubscription, otherObserver._subscription) + } +} + +class SkipUntil: Producer { + + private let _source: Observable + private let _other: Observable + + init(source: Observable, other: Observable) { + _source = source + _other = other + } + + override func run(observer: O) -> Disposable { + let sink = SkipUntilSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/SkipWhile.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/SkipWhile.swift new file mode 100644 index 0000000..d16304a --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/SkipWhile.swift @@ -0,0 +1,115 @@ +// +// SkipWhile.swift +// Rx +// +// Created by Yury Korolev on 10/9/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +class SkipWhileSink : Sink, ObserverType { + + typealias Parent = SkipWhile + typealias Element = ElementType + + private let _parent: Parent + private var _running = false + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + if !_running { + do { + _running = try !_parent._predicate(value) + } catch let e { + forwardOn(.Error(e)) + dispose() + return + } + } + + if _running { + forwardOn(.Next(value)) + } + case .Error, .Completed: + forwardOn(event) + dispose() + } + } +} + +class SkipWhileSinkWithIndex : Sink, ObserverType { + + typealias Parent = SkipWhile + typealias Element = ElementType + + private let _parent: Parent + private var _index = 0 + private var _running = false + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + if !_running { + do { + _running = try !_parent._predicateWithIndex(value, _index) + try incrementChecked(&_index) + } catch let e { + forwardOn(.Error(e)) + dispose() + return + } + } + + if _running { + forwardOn(.Next(value)) + } + case .Error, .Completed: + forwardOn(event) + dispose() + } + } +} + +class SkipWhile: Producer { + typealias Predicate = (Element) throws -> Bool + typealias PredicateWithIndex = (Element, Int) throws -> Bool + + private let _source: Observable + private let _predicate: Predicate! + private let _predicateWithIndex: PredicateWithIndex! + + init(source: Observable, predicate: Predicate) { + _source = source + _predicate = predicate + _predicateWithIndex = nil + } + + init(source: Observable, predicate: PredicateWithIndex) { + _source = source + _predicate = nil + _predicateWithIndex = predicate + } + + override func run(observer: O) -> Disposable { + if let _ = _predicate { + let sink = SkipWhileSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } + else { + let sink = SkipWhileSinkWithIndex(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/StartWith.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/StartWith.swift new file mode 100644 index 0000000..c60cb36 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/StartWith.swift @@ -0,0 +1,28 @@ +// +// StartWith.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class StartWith: Producer { + let elements: [Element] + let source: Observable + + init(source: Observable, elements: [Element]) { + self.source = source + self.elements = elements + super.init() + } + + override func run(observer: O) -> Disposable { + for e in elements { + observer.on(.Next(e)) + } + + return source.subscribe(observer) + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/SubscribeOn.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/SubscribeOn.swift new file mode 100644 index 0000000..1f16760 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/SubscribeOn.swift @@ -0,0 +1,60 @@ +// +// SubscribeOn.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class SubscribeOnSink : Sink, ObserverType { + typealias Element = O.E + typealias Parent = SubscribeOn + + let parent: Parent + + init(parent: Parent, observer: O) { + self.parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + forwardOn(event) + + if event.isStopEvent { + self.dispose() + } + } + + func run() -> Disposable { + let disposeEverything = SerialDisposable() + let cancelSchedule = SingleAssignmentDisposable() + + disposeEverything.disposable = cancelSchedule + + cancelSchedule.disposable = parent.scheduler.schedule(()) { (_) -> Disposable in + let subscription = self.parent.source.subscribe(self) + disposeEverything.disposable = ScheduledDisposable(scheduler: self.parent.scheduler, disposable: subscription) + return NopDisposable.instance + } + + return disposeEverything + } +} + +class SubscribeOn : Producer { + let source: Ob + let scheduler: ImmediateSchedulerType + + init(source: Ob, scheduler: ImmediateSchedulerType) { + self.source = source + self.scheduler = scheduler + } + + override func run(observer: O) -> Disposable { + let sink = SubscribeOnSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Switch.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Switch.swift new file mode 100644 index 0000000..ca31c0f --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Switch.swift @@ -0,0 +1,193 @@ +// +// Switch.swift +// Rx +// +// Created by Krunoslav Zaher on 3/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class SwitchSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = SourceType + + private let _subscriptions: SingleAssignmentDisposable = SingleAssignmentDisposable() + private let _innerSubscription: SerialDisposable = SerialDisposable() + + let _lock = NSRecursiveLock() + + // state + private var _stopped = false + private var _latest = 0 + private var _hasLatest = false + + override init(observer: O) { + super.init(observer: observer) + } + + func run(source: Observable) -> Disposable { + let subscription = source.subscribe(self) + _subscriptions.disposable = subscription + return StableCompositeDisposable.create(_subscriptions, _innerSubscription) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func performMap(element: SourceType) throws -> S { + abstractMethod() + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let element): + do { + let observable = try performMap(element).asObservable() + _hasLatest = true + _latest = _latest &+ 1 + let latest = _latest + + let d = SingleAssignmentDisposable() + _innerSubscription.disposable = d + + let observer = SwitchSinkIter(parent: self, id: latest, _self: d) + let disposable = observable.subscribe(observer) + d.disposable = disposable + } + catch let error { + forwardOn(.Error(error)) + dispose() + } + case .Error(let error): + forwardOn(.Error(error)) + dispose() + case .Completed: + _stopped = true + + _subscriptions.dispose() + + if !_hasLatest { + forwardOn(.Completed) + dispose() + } + } + } +} + +class SwitchSinkIter + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = S.E + typealias Parent = SwitchSink + + private let _parent: Parent + private let _id: Int + private let _self: Disposable + + var _lock: NSRecursiveLock { + return _parent._lock + } + + init(parent: Parent, id: Int, _self: Disposable) { + _parent = parent + _id = id + self._self = _self + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next: break + case .Error, .Completed: + _self.dispose() + } + + if _parent._latest != _id { + return + } + + switch event { + case .Next: + _parent.forwardOn(event) + case .Error: + _parent.forwardOn(event) + _parent.dispose() + case .Completed: + _parent._hasLatest = false + if _parent._stopped { + _parent.forwardOn(event) + _parent.dispose() + } + } + } +} + +// MARK: Specializations + +final class SwitchIdentitySink : SwitchSink { + override init(observer: O) { + super.init(observer: observer) + } + + override func performMap(element: S) throws -> S { + return element + } +} + +final class MapSwitchSink : SwitchSink { + typealias Selector = SourceType throws -> S + + private let _selector: Selector + + init(selector: Selector, observer: O) { + _selector = selector + super.init(observer: observer) + } + + override func performMap(element: SourceType) throws -> S { + return try _selector(element) + } +} + +// MARK: Producers + +final class Switch : Producer { + private let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(observer: O) -> Disposable { + let sink = SwitchIdentitySink(observer: observer) + sink.disposable = sink.run(_source) + return sink + } +} + +final class FlatMapLatest : Producer { + typealias Selector = SourceType throws -> S + + private let _source: Observable + private let _selector: Selector + + init(source: Observable, selector: Selector) { + _source = source + _selector = selector + } + + override func run(observer: O) -> Disposable { + let sink = MapSwitchSink(selector: _selector, observer: observer) + sink.disposable = sink.run(_source) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Take.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Take.swift new file mode 100644 index 0000000..10d1b30 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Take.swift @@ -0,0 +1,144 @@ +// +// Take.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// count version + +class TakeCountSink : Sink, ObserverType { + typealias Parent = TakeCount + typealias E = ElementType + + private let _parent: Parent + + private var _remaining: Int + + init(parent: Parent, observer: O) { + _parent = parent + _remaining = parent._count + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + + if _remaining > 0 { + _remaining -= 1 + + forwardOn(.Next(value)) + + if _remaining == 0 { + forwardOn(.Completed) + dispose() + } + } + case .Error: + forwardOn(event) + dispose() + case .Completed: + forwardOn(event) + dispose() + } + } + +} + +class TakeCount: Producer { + private let _source: Observable + private let _count: Int + + init(source: Observable, count: Int) { + if count < 0 { + rxFatalError("count can't be negative") + } + _source = source + _count = count + } + + override func run(observer: O) -> Disposable { + let sink = TakeCountSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} + +// time version + +class TakeTimeSink + : Sink + , LockOwnerType + , ObserverType + , SynchronizedOnType { + typealias Parent = TakeTime + typealias E = ElementType + + private let _parent: Parent + + let _lock = NSRecursiveLock() + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let value): + forwardOn(.Next(value)) + case .Error: + forwardOn(event) + dispose() + case .Completed: + forwardOn(event) + dispose() + } + } + + func tick() { + _lock.lock(); defer { _lock.unlock() } + + forwardOn(.Completed) + dispose() + } + + func run() -> Disposable { + let disposeTimer = _parent._scheduler.scheduleRelative((), dueTime: _parent._duration) { + self.tick() + return NopDisposable.instance + } + + let disposeSubscription = _parent._source.subscribe(self) + + return BinaryDisposable(disposeTimer, disposeSubscription) + } +} + +class TakeTime : Producer { + typealias TimeInterval = RxTimeInterval + + private let _source: Observable + private let _duration: TimeInterval + private let _scheduler: SchedulerType + + init(source: Observable, duration: TimeInterval, scheduler: SchedulerType) { + _source = source + _scheduler = scheduler + _duration = duration + } + + override func run(observer: O) -> Disposable { + let sink = TakeTimeSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/TakeLast.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/TakeLast.swift new file mode 100644 index 0000000..c5dd8a9 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/TakeLast.swift @@ -0,0 +1,63 @@ +// +// TakeLast.swift +// Rx +// +// Created by Tomi Koskinen on 25/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + + +class TakeLastSink : Sink, ObserverType { + typealias Parent = TakeLast + typealias E = ElementType + + private let _parent: Parent + + private var _elements: Queue + + init(parent: Parent, observer: O) { + _parent = parent + _elements = Queue(capacity: parent._count + 1) + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + _elements.enqueue(value) + if _elements.count > self._parent._count { + _elements.dequeue() + } + case .Error: + forwardOn(event) + dispose() + case .Completed: + for e in _elements { + forwardOn(.Next(e)) + } + forwardOn(.Completed) + dispose() + } + } +} + +class TakeLast: Producer { + private let _source: Observable + private let _count: Int + + init(source: Observable, count: Int) { + if count < 0 { + rxFatalError("count can't be negative") + } + _source = source + _count = count + } + + override func run(observer: O) -> Disposable { + let sink = TakeLastSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/TakeUntil.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/TakeUntil.swift new file mode 100644 index 0000000..c806e23 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/TakeUntil.swift @@ -0,0 +1,120 @@ +// +// TakeUntil.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class TakeUntilSinkOther + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Parent = TakeUntilSink + typealias E = Other + + private let _parent: Parent + + var _lock: NSRecursiveLock { + return _parent._lock + } + + private let _subscription = SingleAssignmentDisposable() + + init(parent: Parent) { + _parent = parent +#if TRACE_RESOURCES + AtomicIncrement(&resourceCount) +#endif + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next: + _parent.forwardOn(.Completed) + _parent.dispose() + case .Error(let e): + _parent.forwardOn(.Error(e)) + _parent.dispose() + case .Completed: + _parent._open = true + _subscription.dispose() + } + } + +#if TRACE_RESOURCES + deinit { + AtomicDecrement(&resourceCount) + } +#endif +} + +class TakeUntilSink + : Sink + , LockOwnerType + , ObserverType + , SynchronizedOnType { + typealias E = ElementType + typealias Parent = TakeUntil + + private let _parent: Parent + + let _lock = NSRecursiveLock() + + // state + private var _open = false + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next: + forwardOn(event) + case .Error: + forwardOn(event) + dispose() + case .Completed: + forwardOn(event) + dispose() + } + } + + func run() -> Disposable { + let otherObserver = TakeUntilSinkOther(parent: self) + let otherSubscription = _parent._other.subscribe(otherObserver) + otherObserver._subscription.disposable = otherSubscription + let sourceSubscription = _parent._source.subscribe(self) + + return StableCompositeDisposable.create(sourceSubscription, otherObserver._subscription) + } +} + +class TakeUntil: Producer { + + private let _source: Observable + private let _other: Observable + + init(source: Observable, other: Observable) { + _source = source + _other = other + } + + override func run(observer: O) -> Disposable { + let sink = TakeUntilSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/TakeWhile.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/TakeWhile.swift new file mode 100644 index 0000000..7db0752 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/TakeWhile.swift @@ -0,0 +1,132 @@ +// +// TakeWhile.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class TakeWhileSink + : Sink + , ObserverType { + typealias Parent = TakeWhile + typealias Element = ElementType + + private let _parent: Parent + + private var _running = true + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + if !_running { + return + } + + do { + _running = try _parent._predicate(value) + } catch let e { + forwardOn(.Error(e)) + dispose() + return + } + + if _running { + forwardOn(.Next(value)) + } else { + forwardOn(.Completed) + dispose() + } + case .Error, .Completed: + forwardOn(event) + dispose() + } + } + +} + +class TakeWhileSinkWithIndex + : Sink + , ObserverType { + typealias Parent = TakeWhile + typealias Element = ElementType + + private let _parent: Parent + + private var _running = true + private var _index = 0 + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + if !_running { + return + } + + do { + _running = try _parent._predicateWithIndex(value, _index) + try incrementChecked(&_index) + } catch let e { + forwardOn(.Error(e)) + dispose() + return + } + + if _running { + forwardOn(.Next(value)) + } else { + forwardOn(.Completed) + dispose() + } + case .Error, .Completed: + forwardOn(event) + dispose() + } + } + +} + +class TakeWhile: Producer { + typealias Predicate = (Element) throws -> Bool + typealias PredicateWithIndex = (Element, Int) throws -> Bool + + private let _source: Observable + private let _predicate: Predicate! + private let _predicateWithIndex: PredicateWithIndex! + + init(source: Observable, predicate: Predicate) { + _source = source + _predicate = predicate + _predicateWithIndex = nil + } + + init(source: Observable, predicate: PredicateWithIndex) { + _source = source + _predicate = nil + _predicateWithIndex = predicate + } + + override func run(observer: O) -> Disposable { + if let _ = _predicate { + let sink = TakeWhileSink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } else { + let sink = TakeWhileSinkWithIndex(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Throttle.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Throttle.swift new file mode 100644 index 0000000..b0db576 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Throttle.swift @@ -0,0 +1,104 @@ +// +// Throttle.swift +// Rx +// +// Created by Krunoslav Zaher on 3/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class ThrottleSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Element = O.E + typealias ParentType = Throttle + + private let _parent: ParentType + + let _lock = NSRecursiveLock() + + // state + private var _id = 0 as UInt64 + private var _value: Element? = nil + + let cancellable = SerialDisposable() + + init(parent: ParentType, observer: O) { + _parent = parent + + super.init(observer: observer) + } + + func run() -> Disposable { + let subscription = _parent._source.subscribe(self) + + return StableCompositeDisposable.create(subscription, cancellable) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case .Next(let element): + _id = _id &+ 1 + let currentId = _id + _value = element + + + let scheduler = _parent._scheduler + let dueTime = _parent._dueTime + + let d = SingleAssignmentDisposable() + self.cancellable.disposable = d + d.disposable = scheduler.scheduleRelative(currentId, dueTime: dueTime, action: self.propagate) + case .Error: + _value = nil + forwardOn(event) + dispose() + case .Completed: + if let value = _value { + _value = nil + forwardOn(.Next(value)) + } + forwardOn(.Completed) + dispose() + } + } + + func propagate(currentId: UInt64) -> Disposable { + _lock.lock(); defer { _lock.unlock() } // { + let originalValue = _value + + if let value = originalValue where _id == currentId { + _value = nil + forwardOn(.Next(value)) + } + // } + return NopDisposable.instance + } +} + +class Throttle : Producer { + + private let _source: Observable + private let _dueTime: RxTimeInterval + private let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _scheduler = scheduler + } + + override func run(observer: O) -> Disposable { + let sink = ThrottleSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } + +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Timeout.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Timeout.swift new file mode 100644 index 0000000..db210ca --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Timeout.swift @@ -0,0 +1,120 @@ +// +// Timeout.swift +// Rx +// +// Created by Tomi Koskinen on 13/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class TimeoutSink: Sink, LockOwnerType, ObserverType { + typealias E = ElementType + typealias Parent = Timeout + + private let _parent: Parent + + let _lock = NSRecursiveLock() + + private let _timerD = SerialDisposable() + private let _subscription = SerialDisposable() + + private var _id = 0 + private var _switched = false + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + let original = SingleAssignmentDisposable() + _subscription.disposable = original + + _createTimeoutTimer() + + original.disposable = _parent._source.subscribeSafe(self) + + return StableCompositeDisposable.create(_subscription, _timerD) + } + + func on(event: Event) { + switch event { + case .Next: + var onNextWins = false + + _lock.performLocked() { + onNextWins = !self._switched + if onNextWins { + self._id = self._id &+ 1 + } + } + + if onNextWins { + forwardOn(event) + self._createTimeoutTimer() + } + case .Error, .Completed: + var onEventWins = false + + _lock.performLocked() { + onEventWins = !self._switched + if onEventWins { + self._id = self._id &+ 1 + } + } + + if onEventWins { + forwardOn(event) + self.dispose() + } + } + } + + private func _createTimeoutTimer() { + if _timerD.disposed { + return + } + + let nextTimer = SingleAssignmentDisposable() + _timerD.disposable = nextTimer + + nextTimer.disposable = _parent._scheduler.scheduleRelative(_id, dueTime: _parent._dueTime) { state in + + var timerWins = false + + self._lock.performLocked() { + self._switched = (state == self._id) + timerWins = self._switched + } + + if timerWins { + self._subscription.disposable = self._parent._other.subscribeSafe(self.forwarder()) + } + + return NopDisposable.instance + } + } +} + + +class Timeout : Producer { + + private let _source: Observable + private let _dueTime: RxTimeInterval + private let _other: Observable + private let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, other: Observable, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _other = other + _scheduler = scheduler + } + + override func run(observer: O) -> Disposable { + let sink = TimeoutSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Timer.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Timer.swift new file mode 100644 index 0000000..a395bad --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Timer.swift @@ -0,0 +1,72 @@ +// +// Timer.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class TimerSink : Sink { + typealias Parent = Timer + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + return _parent._scheduler.schedulePeriodic(0 as O.E, startAfter: _parent._dueTime, period: _parent._period!) { state in + self.forwardOn(.Next(state)) + return state &+ 1 + } + } +} + +class TimerOneOffSink : Sink { + typealias Parent = Timer + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRelative((), dueTime: _parent._dueTime) { (_) -> Disposable in + self.forwardOn(.Next(0)) + self.forwardOn(.Completed) + + return NopDisposable.instance + } + } +} + +class Timer: Producer { + private let _scheduler: SchedulerType + private let _dueTime: RxTimeInterval + private let _period: RxTimeInterval? + + init(dueTime: RxTimeInterval, period: RxTimeInterval?, scheduler: SchedulerType) { + _scheduler = scheduler + _dueTime = dueTime + _period = period + } + + override func run(observer: O) -> Disposable { + if let _ = _period { + let sink = TimerSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } + else { + let sink = TimerOneOffSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/ToArray.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/ToArray.swift new file mode 100644 index 0000000..bac43db --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/ToArray.swift @@ -0,0 +1,50 @@ +// +// ToArray.swift +// Rx +// +// Created by Junior B. on 20/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class ToArraySink : Sink, ObserverType { + typealias Parent = ToArray + + let _parent: Parent + var _list = Array() + + init(parent: Parent, observer: O) { + _parent = parent + + super.init(observer: observer) + } + + func on(event: Event) { + switch event { + case .Next(let value): + self._list.append(value) + case .Error(let e): + forwardOn(.Error(e)) + self.dispose() + case .Completed: + forwardOn(.Next(_list)) + forwardOn(.Completed) + self.dispose() + } + } +} + +class ToArray : Producer<[SourceType]> { + let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(observer: O) -> Disposable { + let sink = ToArraySink(parent: self, observer: observer) + sink.disposable = _source.subscribe(sink) + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Using.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Using.swift new file mode 100644 index 0000000..84e7633 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Using.swift @@ -0,0 +1,78 @@ +// +// Using.swift +// Rx +// +// Created by Yury Korolev on 10/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class UsingSink : Sink, ObserverType { + + typealias Parent = Using + typealias E = O.E + + private let _parent: Parent + + init(parent: Parent, observer: O) { + _parent = parent + super.init(observer: observer) + } + + func run() -> Disposable { + var disposable = NopDisposable.instance + + do { + let resource = try _parent._resourceFactory() + disposable = resource + let source = try _parent._observableFactory(resource) + + return StableCompositeDisposable.create( + source.subscribe(self), + disposable + ) + } catch let error { + return StableCompositeDisposable.create( + Observable.error(error).subscribe(self), + disposable + ) + } + } + + func on(event: Event) { + switch event { + case let .Next(value): + forwardOn(.Next(value)) + case let .Error(error): + forwardOn(.Error(error)) + dispose() + case .Completed: + forwardOn(.Completed) + dispose() + } + } +} + +class Using: Producer { + + typealias E = SourceType + + typealias ResourceFactory = () throws -> ResourceType + typealias ObservableFactory = ResourceType throws -> Observable + + private let _resourceFactory: ResourceFactory + private let _observableFactory: ObservableFactory + + + init(resourceFactory: ResourceFactory, observableFactory: ObservableFactory) { + _resourceFactory = resourceFactory + _observableFactory = observableFactory + } + + override func run(observer: O) -> Disposable { + let sink = UsingSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Window.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Window.swift new file mode 100644 index 0000000..7001338 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Window.swift @@ -0,0 +1,152 @@ +// +// Window.swift +// Rx +// +// Created by Junior B. on 29/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class WindowTimeCountSink> + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Parent = WindowTimeCount + typealias E = Element + + private let _parent: Parent + + let _lock = NSRecursiveLock() + + private var _subject = PublishSubject() + private var _count = 0 + private var _windowId = 0 + + private let _timerD = SerialDisposable() + private let _refCountDisposable: RefCountDisposable + private let _groupDisposable = CompositeDisposable() + + init(parent: Parent, observer: O) { + _parent = parent + + _groupDisposable.addDisposable(_timerD) + + _refCountDisposable = RefCountDisposable(disposable: _groupDisposable) + super.init(observer: observer) + } + + func run() -> Disposable { + + forwardOn(.Next(AddRef(source: _subject, refCount: _refCountDisposable).asObservable())) + createTimer(_windowId) + + _groupDisposable.addDisposable(_parent._source.subscribeSafe(self)) + return _refCountDisposable + } + + func startNewWindowAndCompleteCurrentOne() { + _subject.on(.Completed) + _subject = PublishSubject() + + forwardOn(.Next(AddRef(source: _subject, refCount: _refCountDisposable).asObservable())) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + var newWindow = false + var newId = 0 + + switch event { + case .Next(let element): + _subject.on(.Next(element)) + + do { + try incrementChecked(&_count) + } catch (let e) { + _subject.on(.Error(e as ErrorType)) + dispose() + } + + if (_count == _parent._count) { + newWindow = true + _count = 0 + _windowId += 1 + newId = _windowId + self.startNewWindowAndCompleteCurrentOne() + } + + case .Error(let error): + _subject.on(.Error(error)) + forwardOn(.Error(error)) + dispose() + case .Completed: + _subject.on(.Completed) + forwardOn(.Completed) + dispose() + } + + if newWindow { + createTimer(newId) + } + } + + func createTimer(windowId: Int) { + if _timerD.disposed { + return + } + + if _windowId != windowId { + return + } + + let nextTimer = SingleAssignmentDisposable() + + _timerD.disposable = nextTimer + + nextTimer.disposable = _parent._scheduler.scheduleRelative(windowId, dueTime: _parent._timeSpan) { previousWindowId in + + var newId = 0 + + self._lock.performLocked { + if previousWindowId != self._windowId { + return + } + + self._count = 0 + self._windowId = self._windowId &+ 1 + newId = self._windowId + self.startNewWindowAndCompleteCurrentOne() + } + + self.createTimer(newId) + + return NopDisposable.instance + } + } +} + +class WindowTimeCount : Producer> { + + private let _timeSpan: RxTimeInterval + private let _count: Int + private let _scheduler: SchedulerType + private let _source: Observable + + init(source: Observable, timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) { + _source = source + _timeSpan = timeSpan + _count = count + _scheduler = scheduler + } + + override func run>(observer: O) -> Disposable { + let sink = WindowTimeCountSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/WithLatestFrom.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/WithLatestFrom.swift new file mode 100644 index 0000000..0ac25f7 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/WithLatestFrom.swift @@ -0,0 +1,122 @@ +// +// WithLatestFrom.swift +// RxExample +// +// Created by Yury Korolev on 10/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class WithLatestFromSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + + typealias Parent = WithLatestFrom + typealias E = FirstType + + private let _parent: Parent + + var _lock = NSRecursiveLock() + private var _latest: SecondType? + + init(parent: Parent, observer: O) { + _parent = parent + + super.init(observer: observer) + } + + func run() -> Disposable { + let sndSubscription = SingleAssignmentDisposable() + let sndO = WithLatestFromSecond(parent: self, disposable: sndSubscription) + + sndSubscription.disposable = _parent._second.subscribe(sndO) + let fstSubscription = _parent._first.subscribe(self) + + return StableCompositeDisposable.create(fstSubscription, sndSubscription) + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case let .Next(value): + guard let latest = _latest else { return } + do { + let res = try _parent._resultSelector(value, latest) + + forwardOn(.Next(res)) + } catch let e { + forwardOn(.Error(e)) + dispose() + } + case .Completed: + forwardOn(.Completed) + dispose() + case let .Error(error): + forwardOn(.Error(error)) + dispose() + } + } +} + +class WithLatestFromSecond + : ObserverType + , LockOwnerType + , SynchronizedOnType { + + typealias Parent = WithLatestFromSink + typealias E = SecondType + + private let _parent: Parent + private let _disposable: Disposable + + var _lock: NSRecursiveLock { + return _parent._lock + } + + init(parent: Parent, disposable: Disposable) { + _parent = parent + _disposable = disposable + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + switch event { + case let .Next(value): + _parent._latest = value + case .Completed: + _disposable.dispose() + case let .Error(error): + _parent.forwardOn(.Error(error)) + _parent.dispose() + } + } +} + +class WithLatestFrom: Producer { + typealias ResultSelector = (FirstType, SecondType) throws -> ResultType + + private let _first: Observable + private let _second: Observable + private let _resultSelector: ResultSelector + + init(first: Observable, second: Observable, resultSelector: ResultSelector) { + _first = first + _second = second + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = WithLatestFromSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Zip+CollectionType.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Zip+CollectionType.swift new file mode 100644 index 0000000..20d10de --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Zip+CollectionType.swift @@ -0,0 +1,137 @@ +// +// Zip+CollectionType.swift +// Rx +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class ZipCollectionTypeSink + : Sink { + typealias Parent = ZipCollectionType + typealias SourceElement = C.Generator.Element.E + + private let _parent: Parent + + private let _lock = NSRecursiveLock() + + // state + private var _numberOfValues = 0 + private var _values: [Queue] + private var _isDone: [Bool] + private var _numberOfDone = 0 + private var _subscriptions: [SingleAssignmentDisposable] + + init(parent: Parent, observer: O) { + _parent = parent + _values = [Queue](count: parent.count, repeatedValue: Queue(capacity: 4)) + _isDone = [Bool](count: parent.count, repeatedValue: false) + _subscriptions = Array() + _subscriptions.reserveCapacity(parent.count) + + for _ in 0 ..< parent.count { + _subscriptions.append(SingleAssignmentDisposable()) + } + + super.init(observer: observer) + } + + func on(event: Event, atIndex: Int) { + _lock.lock(); defer { _lock.unlock() } // { + switch event { + case .Next(let element): + _values[atIndex].enqueue(element) + + if _values[atIndex].count == 1 { + _numberOfValues += 1 + } + + if _numberOfValues < _parent.count { + let numberOfOthersThatAreDone = _numberOfDone - (_isDone[atIndex] ? 1 : 0) + if numberOfOthersThatAreDone == _parent.count - 1 { + self.forwardOn(.Completed) + self.dispose() + } + return + } + + do { + var arguments = [SourceElement]() + arguments.reserveCapacity(_parent.count) + + // recalculate number of values + _numberOfValues = 0 + + for i in 0 ..< _values.count { + arguments.append(_values[i].dequeue()!) + if _values[i].count > 0 { + _numberOfValues += 1 + } + } + + let result = try _parent.resultSelector(arguments) + self.forwardOn(.Next(result)) + } + catch let error { + self.forwardOn(.Error(error)) + self.dispose() + } + + case .Error(let error): + self.forwardOn(.Error(error)) + self.dispose() + case .Completed: + if _isDone[atIndex] { + return + } + + _isDone[atIndex] = true + _numberOfDone += 1 + + if _numberOfDone == _parent.count { + self.forwardOn(.Completed) + self.dispose() + } + else { + _subscriptions[atIndex].dispose() + } + } + // } + } + + func run() -> Disposable { + var j = 0 + for i in _parent.sources.startIndex ..< _parent.sources.endIndex { + let index = j + let source = _parent.sources[i].asObservable() + _subscriptions[j].disposable = source.subscribe(AnyObserver { event in + self.on(event, atIndex: index) + }) + j += 1 + } + + return CompositeDisposable(disposables: _subscriptions.map { $0 }) + } +} + +class ZipCollectionType : Producer { + typealias ResultSelector = [C.Generator.Element.E] throws -> R + + let sources: C + let resultSelector: ResultSelector + let count: Int + + init(sources: C, resultSelector: ResultSelector) { + self.sources = sources + self.resultSelector = resultSelector + self.count = Int(self.sources.count.toIntMax()) + } + + override func run(observer: O) -> Disposable { + let sink = ZipCollectionTypeSink(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Zip+arity.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Zip+arity.swift new file mode 100644 index 0000000..36679bf --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Zip+arity.swift @@ -0,0 +1,830 @@ +// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project +// +// Zip+arity.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + + + +// 2 + +extension Observable { + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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 + (source1: O1, _ source2: O2, resultSelector: (O1.E, O2.E) throws -> E) + -> Observable { + return Zip2( + source1: source1.asObservable(), source2: source2.asObservable(), + resultSelector: resultSelector + ) + } +} + +class ZipSink2_ : ZipSink { + typealias R = O.E + typealias Parent = Zip2 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 2, observer: observer) + } + + override func hasElements(index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + + subscription1.disposable = _parent.source1.subscribe(observer1) + subscription2.disposable = _parent.source2.subscribe(observer2) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!) + } +} + +class Zip2 : Producer { + typealias ResultSelector = (E1, E2) throws -> R + + let source1: Observable + let source2: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, resultSelector: ResultSelector) { + self.source1 = source1 + self.source2 = source2 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = ZipSink2_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 3 + +extension Observable { + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, resultSelector: (O1.E, O2.E, O3.E) throws -> E) + -> Observable { + return Zip3( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), + resultSelector: resultSelector + ) + } +} + +class ZipSink3_ : ZipSink { + typealias R = O.E + typealias Parent = Zip3 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 3, observer: observer) + } + + override func hasElements(index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + + subscription1.disposable = _parent.source1.subscribe(observer1) + subscription2.disposable = _parent.source2.subscribe(observer2) + subscription3.disposable = _parent.source3.subscribe(observer3) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!) + } +} + +class Zip3 : Producer { + typealias ResultSelector = (E1, E2, E3) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, resultSelector: ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = ZipSink3_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 4 + +extension Observable { + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> Observable { + return Zip4( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), + resultSelector: resultSelector + ) + } +} + +class ZipSink4_ : ZipSink { + typealias R = O.E + typealias Parent = Zip4 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 4, observer: observer) + } + + override func hasElements(index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + + subscription1.disposable = _parent.source1.subscribe(observer1) + subscription2.disposable = _parent.source2.subscribe(observer2) + subscription3.disposable = _parent.source3.subscribe(observer3) + subscription4.disposable = _parent.source4.subscribe(observer4) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!) + } +} + +class Zip4 : Producer { + typealias ResultSelector = (E1, E2, E3, E4) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, resultSelector: ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = ZipSink4_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 5 + +extension Observable { + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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 + (source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> Observable { + return Zip5( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), + resultSelector: resultSelector + ) + } +} + +class ZipSink5_ : ZipSink { + typealias R = O.E + typealias Parent = Zip5 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 5, observer: observer) + } + + override func hasElements(index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + + subscription1.disposable = _parent.source1.subscribe(observer1) + subscription2.disposable = _parent.source2.subscribe(observer2) + subscription3.disposable = _parent.source3.subscribe(observer3) + subscription4.disposable = _parent.source4.subscribe(observer4) + subscription5.disposable = _parent.source5.subscribe(observer5) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!) + } +} + +class Zip5 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, resultSelector: ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = ZipSink5_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 6 + +extension Observable { + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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 + (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) + -> Observable { + return Zip6( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), + resultSelector: resultSelector + ) + } +} + +class ZipSink6_ : ZipSink { + typealias R = O.E + typealias Parent = Zip6 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + var _values6: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 6, observer: observer) + } + + override func hasElements(index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + case 5: return _values6.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + let observer6 = ZipObserver(lock: _lock, parent: self, index: 5, setNextValue: { self._values6.enqueue($0) }, this: subscription6) + + subscription1.disposable = _parent.source1.subscribe(observer1) + subscription2.disposable = _parent.source2.subscribe(observer2) + subscription3.disposable = _parent.source3.subscribe(observer3) + subscription4.disposable = _parent.source4.subscribe(observer4) + subscription5.disposable = _parent.source5.subscribe(observer5) + subscription6.disposable = _parent.source6.subscribe(observer6) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!, _values6.dequeue()!) + } +} + +class Zip6 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + let source6: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, resultSelector: ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + self.source6 = source6 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = ZipSink6_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 7 + +extension Observable { + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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 + (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) + -> Observable { + return Zip7( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), + resultSelector: resultSelector + ) + } +} + +class ZipSink7_ : ZipSink { + typealias R = O.E + typealias Parent = Zip7 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + var _values6: Queue = Queue(capacity: 2) + var _values7: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 7, observer: observer) + } + + override func hasElements(index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + case 5: return _values6.count > 0 + case 6: return _values7.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + let observer6 = ZipObserver(lock: _lock, parent: self, index: 5, setNextValue: { self._values6.enqueue($0) }, this: subscription6) + let observer7 = ZipObserver(lock: _lock, parent: self, index: 6, setNextValue: { self._values7.enqueue($0) }, this: subscription7) + + subscription1.disposable = _parent.source1.subscribe(observer1) + subscription2.disposable = _parent.source2.subscribe(observer2) + subscription3.disposable = _parent.source3.subscribe(observer3) + subscription4.disposable = _parent.source4.subscribe(observer4) + subscription5.disposable = _parent.source5.subscribe(observer5) + subscription6.disposable = _parent.source6.subscribe(observer6) + subscription7.disposable = _parent.source7.subscribe(observer7) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!, _values6.dequeue()!, _values7.dequeue()!) + } +} + +class Zip7 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + let source6: Observable + let source7: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, resultSelector: ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + self.source6 = source6 + self.source7 = source7 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = ZipSink7_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + + + +// 8 + +extension Observable { + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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 + (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) + -> Observable { + return Zip8( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(), + resultSelector: resultSelector + ) + } +} + +class ZipSink8_ : ZipSink { + typealias R = O.E + typealias Parent = Zip8 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + var _values6: Queue = Queue(capacity: 2) + var _values7: Queue = Queue(capacity: 2) + var _values8: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O) { + _parent = parent + super.init(arity: 8, observer: observer) + } + + override func hasElements(index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + case 5: return _values6.count > 0 + case 6: return _values7.count > 0 + case 7: return _values8.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + let subscription8 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + let observer6 = ZipObserver(lock: _lock, parent: self, index: 5, setNextValue: { self._values6.enqueue($0) }, this: subscription6) + let observer7 = ZipObserver(lock: _lock, parent: self, index: 6, setNextValue: { self._values7.enqueue($0) }, this: subscription7) + let observer8 = ZipObserver(lock: _lock, parent: self, index: 7, setNextValue: { self._values8.enqueue($0) }, this: subscription8) + + subscription1.disposable = _parent.source1.subscribe(observer1) + subscription2.disposable = _parent.source2.subscribe(observer2) + subscription3.disposable = _parent.source3.subscribe(observer3) + subscription4.disposable = _parent.source4.subscribe(observer4) + subscription5.disposable = _parent.source5.subscribe(observer5) + subscription6.disposable = _parent.source6.subscribe(observer6) + subscription7.disposable = _parent.source7.subscribe(observer7) + subscription8.disposable = _parent.source8.subscribe(observer8) + + return CompositeDisposable(disposables: [ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7, + subscription8 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!, _values6.dequeue()!, _values7.dequeue()!, _values8.dequeue()!) + } +} + +class Zip8 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7, E8) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + let source6: Observable + let source7: Observable + let source8: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, source8: Observable, resultSelector: ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + self.source6 = source6 + self.source7 = source7 + self.source8 = source8 + + _resultSelector = resultSelector + } + + override func run(observer: O) -> Disposable { + let sink = ZipSink8_(parent: self, observer: observer) + sink.disposable = sink.run() + return sink + } +} + diff --git a/Pods/RxSwift/RxSwift/Observables/Implementations/Zip.swift b/Pods/RxSwift/RxSwift/Observables/Implementations/Zip.swift new file mode 100644 index 0000000..4590236 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Implementations/Zip.swift @@ -0,0 +1,157 @@ +// +// Zip.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol ZipSinkProtocol : class +{ + func next(index: Int) + func fail(error: ErrorType) + func done(index: Int) +} + +class ZipSink : Sink, ZipSinkProtocol { + typealias Element = O.E + + let _arity: Int + + let _lock = NSRecursiveLock() + + // state + private var _isDone: [Bool] + + init(arity: Int, observer: O) { + _isDone = [Bool](count: arity, repeatedValue: false) + _arity = arity + + super.init(observer: observer) + } + + func getResult() throws -> Element { + abstractMethod() + } + + func hasElements(index: Int) -> Bool { + abstractMethod() + } + + func next(index: Int) { + var hasValueAll = true + + for i in 0 ..< _arity { + if !hasElements(i) { + hasValueAll = false + break + } + } + + if hasValueAll { + do { + let result = try getResult() + self.forwardOn(.Next(result)) + } + catch let e { + self.forwardOn(.Error(e)) + dispose() + } + } + else { + var allOthersDone = true + + let arity = _isDone.count + for i in 0 ..< arity { + if i != index && !_isDone[i] { + allOthersDone = false + break + } + } + + if allOthersDone { + forwardOn(.Completed) + self.dispose() + } + } + } + + func fail(error: ErrorType) { + forwardOn(.Error(error)) + dispose() + } + + func done(index: Int) { + _isDone[index] = true + + var allDone = true + + for done in _isDone { + if !done { + allDone = false + break + } + } + + if allDone { + forwardOn(.Completed) + dispose() + } + } +} + +class ZipObserver + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = ElementType + typealias ValueSetter = (ElementType) -> () + + private var _parent: ZipSinkProtocol? + + let _lock: NSRecursiveLock + + // state + private let _index: Int + private let _this: Disposable + private let _setNextValue: ValueSetter + + init(lock: NSRecursiveLock, parent: ZipSinkProtocol, index: Int, setNextValue: ValueSetter, this: Disposable) { + _lock = lock + _parent = parent + _index = index + _this = this + _setNextValue = setNextValue + } + + func on(event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(event: Event) { + if let _ = _parent { + switch event { + case .Next(_): + break + case .Error(_): + _this.dispose() + case .Completed: + _this.dispose() + } + } + + if let parent = _parent { + switch event { + case .Next(let value): + _setNextValue(value) + parent.next(_index) + case .Error(let error): + parent.fail(error) + case .Completed: + parent.done(_index) + } + } + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Aggregate.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Aggregate.swift new file mode 100644 index 0000000..0acdce6 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Aggregate.swift @@ -0,0 +1,64 @@ +// +// Observable+Aggregate.swift +// Rx +// +// Created by Krunoslav Zaher on 3/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: reduce + +extension ObservableType { + + /** + Applies an `accumulator` function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified `seed` value is used as the initial accumulator value. + + For aggregation behavior with incremental intermediate results, see `scan`. + + - seealso: [reduce operator on reactivex.io](http://reactivex.io/documentation/operators/reduce.html) + + - parameter seed: The initial accumulator value. + - parameter accumulator: A accumulator function to be invoked on each element. + - parameter mapResult: A function to transform the final accumulator value into the result value. + - returns: An observable sequence containing a single element with the final accumulator value. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func reduce(seed: A, accumulator: (A, E) throws -> A, mapResult: (A) throws -> R) + -> Observable { + return Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: mapResult) + } + + /** + Applies an `accumulator` function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified `seed` value is used as the initial accumulator value. + + For aggregation behavior with incremental intermediate results, see `scan`. + + - seealso: [reduce operator on reactivex.io](http://reactivex.io/documentation/operators/reduce.html) + + - parameter seed: The initial accumulator value. + - parameter accumulator: A accumulator function to be invoked on each element. + - returns: An observable sequence containing a single element with the final accumulator value. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func reduce
(seed: A, accumulator: (A, E) throws -> A) + -> Observable { + return Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: { $0 }) + } + + /** + Converts an Observable into another Observable that emits the whole sequence as a single array and then terminates. + + For aggregation behavior see `reduce`. + + - seealso: [toArray operator on reactivex.io](http://reactivex.io/documentation/operators/to.html) + + - returns: An observable sequence containing all the emitted elements as array. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func toArray() + -> Observable<[E]> { + return ToArray(source: self.asObservable()) + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Binding.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Binding.swift new file mode 100644 index 0000000..afd3c51 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Binding.swift @@ -0,0 +1,190 @@ +// +// Observable+Binding.swift +// Rx +// +// Created by Krunoslav Zaher on 3/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: multicast + +extension ObservableType { + + /** + Multicasts the source sequence notifications through the specified subject to the resulting connectable observable. + + Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable. + + For specializations with fixed subject types, see `publish` and `replay`. + + - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html) + + - parameter subject: Subject to push source elements into. + - returns: A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func multicast(subject: S) + -> ConnectableObservable { + return ConnectableObservableAdapter(source: self.asObservable(), subject: subject) + } + + /** + Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. + + Each subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's invocation. + + For specializations with fixed subject types, see `publish` and `replay`. + + - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html) + + - parameter subjectSelector: Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function. + - parameter selector: Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func multicast(subjectSelector: () throws -> S, selector: (Observable) throws -> Observable) + -> Observable { + return Multicast( + source: self.asObservable(), + subjectSelector: subjectSelector, + selector: selector + ) + } +} + +// MARK: publish + +extension ObservableType { + + /** + Returns a connectable observable sequence that shares a single subscription to the underlying sequence. + + This operator is a specialization of `multicast` using a `PublishSubject`. + + - seealso: [publish operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html) + + - returns: A connectable observable sequence that shares a single subscription to the underlying sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func publish() -> ConnectableObservable { + return self.multicast(PublishSubject()) + } +} + +// MARK: replay + +extension ObservableType { + + /** + Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize elements. + + This operator is a specialization of `multicast` using a `ReplaySubject`. + + - seealso: [replay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - parameter bufferSize: Maximum element count of the replay buffer. + - returns: A connectable observable sequence that shares a single subscription to the underlying sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func replay(bufferSize: Int) + -> ConnectableObservable { + return self.multicast(ReplaySubject.create(bufferSize: bufferSize)) + } + + /** + Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all elements. + + This operator is a specialization of `multicast` using a `ReplaySubject`. + + - seealso: [replay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - returns: A connectable observable sequence that shares a single subscription to the underlying sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func replayAll() + -> ConnectableObservable { + return self.multicast(ReplaySubject.createUnbounded()) + } +} + +// MARK: refcount + +extension ConnectableObservableType { + + /** + Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence. + + - seealso: [refCount operator on reactivex.io](http://reactivex.io/documentation/operators/refCount.html) + + - returns: An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func refCount() -> Observable { + return RefCount(source: self) + } +} + +// MARK: share + +extension ObservableType { + + /** + Returns an observable sequence that shares a single subscription to the underlying sequence. + + This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. + + - seealso: [share operator on reactivex.io](http://reactivex.io/documentation/operators/refcount.html) + + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func share() -> Observable { + return self.publish().refCount() + } +} + +// MARK: shareReplay + +extension ObservableType { + + /** + Returns an observable sequence that shares a single subscription to the underlying sequence, and immediately upon subscription replays maximum number of elements in buffer. + + This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. + + - seealso: [shareReplay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - parameter bufferSize: Maximum element count of the replay buffer. + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func shareReplay(bufferSize: Int) + -> Observable { + if bufferSize == 1 { + return ShareReplay1(source: self.asObservable()) + } + else { + return self.replay(bufferSize).refCount() + } + } + + /** + Returns an observable sequence that shares a single subscription to the underlying sequence, and immediately upon subscription replays latest element in buffer. + + This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. + + Unlike `shareReplay(bufferSize: Int)`, this operator will clear latest element from replay buffer in case number of subscribers drops from one to zero. In case sequence + completes or errors out replay buffer is also cleared. + + - seealso: [shareReplay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func shareReplayLatestWhileConnected() + -> Observable { + return ShareReplay1WhileConnected(source: self.asObservable()) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Concurrency.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Concurrency.swift new file mode 100644 index 0000000..8af9111 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Concurrency.swift @@ -0,0 +1,62 @@ +// +// Observable+Concurrency.swift +// Rx +// +// Created by Krunoslav Zaher on 3/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: observeOn + +extension ObservableType { + + /** + Wraps the source sequence in order to run its observer callbacks on the specified scheduler. + + This only invokes observer callbacks on a `scheduler`. In case the subscription and/or unsubscription + actions have side-effects that require to be run on a scheduler, use `subscribeOn`. + + - seealso: [observeOn operator on reactivex.io](http://reactivex.io/documentation/operators/observeon.html) + + - parameter scheduler: Scheduler to notify observers on. + - returns: The source sequence whose observations happen on the specified scheduler. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func observeOn(scheduler: ImmediateSchedulerType) + -> Observable { + if let scheduler = scheduler as? SerialDispatchQueueScheduler { + return ObserveOnSerialDispatchQueue(source: self.asObservable(), scheduler: scheduler) + } + else { + return ObserveOn(source: self.asObservable(), scheduler: scheduler) + } + } +} + +// MARK: subscribeOn + +extension ObservableType { + + /** + Wraps the source sequence in order to run its subscription and unsubscription logic on the specified + scheduler. + + This operation is not commonly used. + + This only performs the side-effects of subscription and unsubscription on the specified scheduler. + + In order to invoke observer callbacks on a `scheduler`, use `observeOn`. + + - seealso: [subscribeOn operator on reactivex.io](http://reactivex.io/documentation/operators/subscribeon.html) + + - parameter scheduler: Scheduler to perform subscription and unsubscription actions on. + - returns: The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func subscribeOn(scheduler: ImmediateSchedulerType) + -> Observable { + return SubscribeOn(source: self, scheduler: scheduler) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Creation.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Creation.swift new file mode 100644 index 0000000..ff57d38 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Creation.swift @@ -0,0 +1,219 @@ +// +// Observable+Creation.swift +// Rx +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +extension Observable { + // MARK: create + + /** + Creates an observable sequence from a specified subscribe method implementation. + + - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html) + + - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method. + - returns: The observable sequence with the specified implementation for the `subscribe` method. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func create(subscribe: (AnyObserver) -> Disposable) -> Observable { + return AnonymousObservable(subscribe) + } + + // MARK: empty + + /** + Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message. + + - seealso: [empty operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) + + - returns: An observable sequence with no elements. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func empty() -> Observable { + return Empty() + } + + // MARK: never + + /** + Returns a non-terminating observable sequence, which can be used to denote an infinite duration. + + - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) + + - returns: An observable sequence whose observers will never get called. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func never() -> Observable { + return Never() + } + + // MARK: just + + /** + Returns an observable sequence that contains a single element. + + - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html) + + - 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) -> Observable { + return Just(element: element) + } + + /** + Returns an observable sequence that contains a single element. + + - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html) + + - parameter element: Single element in the resulting observable sequence. + - parameter: Scheduler to send the single element on. + - returns: An observable sequence containing the single specified element. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func just(element: E, scheduler: ImmediateSchedulerType) -> Observable { + return JustScheduled(element: element, scheduler: scheduler) + } + + // MARK: fail + + /** + Returns an observable sequence that terminates with an `error`. + + - seealso: [throw operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) + + - returns: The observable sequence that terminates with specified error. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func error(error: ErrorType) -> Observable { + return Error(error: error) + } + + // MARK: of + + /** + This method creates a new Observable instance with a variable number of elements. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter elements: Elements to generate. + - parameter scheduler: Scheduler to send elements on. If `nil`, elements are sent immediatelly on subscription. + - 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 ..., scheduler: ImmediateSchedulerType? = nil) -> Observable { + return Sequence(elements: elements, scheduler: scheduler) + } + + // MARK: defer + + /** + Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. + + - seealso: [defer operator on reactivex.io](http://reactivex.io/documentation/operators/defer.html) + + - 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: () throws -> Observable) + -> Observable { + return Deferred(observableFactory: observableFactory) + } + + /** + Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler + to run the loop send out observer messages. + + - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html) + + - parameter initialState: Initial state. + - parameter condition: Condition to terminate generation (upon returning `false`). + - parameter iterate: Iteration step function. + - parameter scheduler: Scheduler on which to run the generator loop. + - returns: The generated sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func generate(initialState initialState: E, condition: E throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: E throws -> E) -> Observable { + return Generate(initialState: initialState, condition: condition, iterate: iterate, resultSelector: { $0 }, scheduler: scheduler) + } + + /** + Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages. + + - seealso: [repeat operator on reactivex.io](http://reactivex.io/documentation/operators/repeat.html) + + - parameter element: Element to repeat. + - parameter scheduler: Scheduler to run the producer loop on. + - returns: An observable sequence that repeats the given element infinitely. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func repeatElement(element: E, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { + return RepeatElement(element: element, scheduler: scheduler) + } + + /** + Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. + + - seealso: [using operator on reactivex.io](http://reactivex.io/documentation/operators/using.html) + + - parameter resourceFactory: Factory function to obtain a resource object. + - parameter observableFactory: Factory function to obtain an observable sequence that depends on the obtained resource. + - returns: An observable sequence whose lifetime controls the lifetime of the dependent resource object. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func using(resourceFactory: () throws -> R, observableFactory: R throws -> Observable) -> Observable { + return Using(resourceFactory: resourceFactory, observableFactory: observableFactory) + } +} + +extension Observable where Element : SignedIntegerType { + /** + Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to generate and send out observer messages. + + - seealso: [range operator on reactivex.io](http://reactivex.io/documentation/operators/range.html) + + - parameter start: The value of the first integer in the sequence. + - parameter count: The number of sequential integers to generate. + - parameter scheduler: Scheduler to run the generator loop on. + - returns: An observable sequence that contains a range of sequential integral numbers. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public static func range(start start: E, count: E, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { + return RangeProducer(start: start, count: count, scheduler: scheduler) + } +} + +extension SequenceType { + /** + Converts a sequence to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - returns: The observable sequence whose elements are pulled from the given enumerable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func toObservable(scheduler: ImmediateSchedulerType? = nil) -> Observable { + return Sequence(elements: Array(self), scheduler: scheduler) + } +} + +extension Array { + /** + Converts a sequence to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - returns: The observable sequence whose elements are pulled from the given enumerable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func toObservable(scheduler: ImmediateSchedulerType? = nil) -> Observable { + return Sequence(elements: self, scheduler: scheduler) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Debug.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Debug.swift new file mode 100644 index 0000000..2aa355c --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Debug.swift @@ -0,0 +1,28 @@ +// +// Observable+Debug.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: debug + +extension ObservableType { + + /** + Prints received events for all observers on standard output. + + - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html) + + - 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) + -> Observable { + return Debug(source: self.asObservable(), identifier: identifier, file: file, line: line, function: function) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Multiple.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Multiple.swift new file mode 100644 index 0000000..99ee357 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Multiple.swift @@ -0,0 +1,330 @@ +// +// Observable+Multiple.swift +// Rx +// +// Created by Krunoslav Zaher on 3/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: combineLatest + +extension CollectionType where Generator.Element : ObservableType { + + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combinelatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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(resultSelector: [Generator.Element.E] throws -> R) -> Observable { + return CombineLatestCollectionType(sources: self, resultSelector: resultSelector) + } +} + +// MARK: zip + +extension CollectionType where Generator.Element : ObservableType { + + /** + 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. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - 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(resultSelector: [Generator.Element.E] throws -> R) -> Observable { + return ZipCollectionType(sources: self, resultSelector: resultSelector) + } +} + +// MARK: switch + +extension ObservableType where E : ObservableConvertibleType { + + /** + Transforms an observable sequence of observable sequences into an observable sequence + producing values only from the most recent observable sequence. + + Each time a new inner observable sequence is received, unsubscribe from the + previous inner observable sequence. + + - seealso: [switch operator on reactivex.io](http://reactivex.io/documentation/operators/switch.html) + + - 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") + public func switchLatest() -> Observable { + return Switch(source: asObservable()) + } +} + +// MARK: concat + +extension ObservableType { + + /** + Concatenates the second observable sequence to `self` upon successful termination of `self`. + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - parameter second: Second observable sequence. + - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func concat(second: O) -> Observable { + return [asObservable(), second.asObservable()].concat() + } +} + +extension SequenceType where Generator.Element : ObservableType { + + /** + Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully. + + This operator has tail recursive optimizations that will prevent stack overflow. + + Optimizations will be performed in cases equivalent to following: + + [1, [2, [3, .....].concat()].concat].concat() + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each given sequence, in sequential order. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func concat() + -> Observable { + return Concat(sources: self, count: nil) + } +} + +extension CollectionType where Generator.Element : ObservableType { + + /** + Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully. + + This operator has tail recursive optimizations that will prevent stack overflow and enable generating + infinite observable sequences while using limited amount of memory during generation. + + Optimizations will be performed in cases equivalent to following: + + [1, [2, [3, .....].concat()].concat].concat() + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each given sequence, in sequential order. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func concat() + -> Observable { + return Concat(sources: self, count: self.count.toIntMax()) + } +} + +extension ObservableType where E : ObservableConvertibleType { + + /** + Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully. + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each observed inner sequence, in sequential order. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func concat() -> Observable { + return merge(maxConcurrent: 1) + } +} + +// MARK: merge + +extension ObservableType where E : ObservableConvertibleType { + + /** + Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - returns: The observable sequence that merges the elements of the observable sequences. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func merge() -> Observable { + return Merge(source: asObservable()) + } + + /** + Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter maxConcurrent: Maximum number of inner observable sequences being subscribed to concurrently. + - 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) + -> Observable { + return MergeLimited(source: asObservable(), maxConcurrent: maxConcurrent) + } +} + +// MARK: catch + +extension ObservableType { + + /** + Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler. + + - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html) + + - parameter handler: Error handler function, producing another observable sequence. + - returns: An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an error occurred. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func catchError(handler: (ErrorType) throws -> Observable) + -> Observable { + return Catch(source: asObservable(), handler: handler) + } + + /** + Continues an observable sequence that is terminated by an error with a single element. + + - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html) + + - parameter element: Last element in an observable sequence in case error occurs. + - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func catchErrorJustReturn(element: E) + -> Observable { + return Catch(source: asObservable(), handler: { _ in Observable.just(element) }) + } + +} + +extension SequenceType where Generator.Element : ObservableType { + /** + Continues an observable sequence that is terminated by an error with the next observable sequence. + + - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html) + + - returns: An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func catchError() + -> Observable { + return CatchSequence(sources: self) + } +} + +// MARK: takeUntil + +extension ObservableType { + + /** + Returns the elements from the source observable sequence until the other observable sequence produces an element. + + - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html) + + - parameter other: Observable sequence that terminates propagation of elements of the source sequence. + - returns: An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func takeUntil(other: O) + -> Observable { + return TakeUntil(source: asObservable(), other: other.asObservable()) + } +} + +// MARK: skipUntil + +extension ObservableType { + + /** + Returns the elements from the source observable sequence until the other observable sequence produces an element. + + - seealso: [skipUntil operator on reactivex.io](http://reactivex.io/documentation/operators/skipuntil.html) + + - parameter other: Observable sequence that terminates propagation of elements of the source sequence. + - returns: An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func skipUntil(other: O) + -> Observable { + return SkipUntil(source: asObservable(), other: other.asObservable()) + } +} + +// MARK: amb + +extension ObservableType { + + /** + Propagates the observable sequence that reacts first. + + - seealso: [amb operator on reactivex.io](http://reactivex.io/documentation/operators/amb.html) + + - parameter right: Second observable sequence. + - returns: An observable sequence that surfaces either of the given sequences, whichever reacted first. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func amb + (right: O2) + -> Observable { + return Amb(left: asObservable(), right: right.asObservable()) + } +} + +extension SequenceType where Generator.Element : ObservableType { + + /** + Propagates the observable sequence that reacts first. + + - seealso: [amb operator on reactivex.io](http://reactivex.io/documentation/operators/amb.html) + + - returns: An observable sequence that surfaces any of the given sequences, whichever reacted first. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func amb() + -> Observable { + return self.reduce(Observable.never()) { a, o in + return a.amb(o.asObservable()) + } + } +} + +// withLatestFrom + +extension ObservableType { + + /** + Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter second: Second observable source. + - 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(second: SecondO, resultSelector: (E, SecondO.E) throws -> ResultType) -> Observable { + return WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: resultSelector) + } + + /** + Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emitts an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - 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(second: SecondO) -> Observable { + return WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: { $1 }) + } +} diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Single.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Single.swift new file mode 100644 index 0000000..969f641 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Single.swift @@ -0,0 +1,258 @@ +// +// Observable+Single.swift +// Rx +// +// Created by Krunoslav Zaher on 2/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: distinct until changed + +extension ObservableType where E: Equatable { + + /** + Returns an observable sequence that contains only distinct contiguous elements according to equality operator. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - 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") + public func distinctUntilChanged() + -> Observable { + return self.distinctUntilChanged({ $0 }, comparer: { ($0 == $1) }) + } +} + +extension ObservableType { + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `keySelector`. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - 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(keySelector: (E) throws -> K) + -> Observable { + return self.distinctUntilChanged(keySelector, comparer: { $0 == $1 }) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `comparer`. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - 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) throws -> Bool) + -> Observable { + return self.distinctUntilChanged({ $0 }, comparer: comparer) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - parameter keySelector: A function to compute the comparison key for each element. + - 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(keySelector: (E) throws -> K, comparer: (lhs: K, rhs: K) throws -> Bool) + -> Observable { + return DistinctUntilChanged(source: self.asObservable(), selector: keySelector, comparer: comparer) + } +} + +// MARK: doOn + +extension ObservableType { + + /** + Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence. + + - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html) + + - 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) throws -> Void) + -> Observable { + return Do(source: self.asObservable(), eventHandler: eventHandler) + } + + /** + Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence. + + - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html) + + - parameter onNext: Action to invoke for each element in the observable sequence. + - parameter onError: Action to invoke upon errored termination of the observable sequence. + - 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 throws -> Void)? = nil, onError: (ErrorType throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil) + -> Observable { + return Do(source: self.asObservable()) { e in + switch e { + case .Next(let element): + try onNext?(element) + case .Error(let e): + try onError?(e) + case .Completed: + try onCompleted?() + } + } + } + + /** + Invokes an action for each Next 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. + - returns: The source sequence with the side-effecting behavior applied. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func doOnNext(onNext: (E throws -> Void)) + -> Observable { + return self.doOn(onNext: onNext) + } + + /** + Invokes an action for the Error event in the observable sequence, and propagates all observer messages through the result sequence. + + - parameter onError: Action to invoke upon errored 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 doOnError(onError: (ErrorType throws -> Void)) + -> Observable { + return self.doOn(onError: onError) + } + + /** + Invokes an action for the Completed event in the observable sequence, and propagates all observer messages through the result sequence. + + - 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: (() throws -> Void)) + -> Observable { + return self.doOn(onCompleted: onCompleted) + } +} + +// MARK: startWith + +extension ObservableType { + + /** + Prepends a sequence of values to an observable sequence. + + - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html) + + - parameter elements: Elements 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(elements: E ...) + -> Observable { + return StartWith(source: self.asObservable(), elements: elements) + } +} + +// MARK: retry + +extension ObservableType { + + /** + Repeats the source observable sequence until it successfully terminates. + + **This could potentially create an infinite sequence.** + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - returns: Observable sequence to repeat until it successfully terminates. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func retry() -> Observable { + return CatchSequence(sources: InfiniteSequence(repeatedValue: self.asObservable())) + } + + /** + Repeats the source observable sequence the specified number of times in case of an error or until it successfully terminates. + + If you encounter an error and want it to retry once, then you must use `retry(2)` + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - parameter maxAttemptCount: Maximum number of times to repeat the sequence. + - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func retry(maxAttemptCount: Int) + -> Observable { + return CatchSequence(sources: Repeat(count: maxAttemptCount, repeatedValue: self.asObservable())) + } + + /** + Repeats the source observable sequence on error when the notifier emits a next value. + If the source observable errors and the notifier completes, it will complete the source sequence. + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable. + - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func retryWhen(notificationHandler: Observable -> TriggerObservable) + -> Observable { + return RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler) + } + + /** + Repeats the source observable sequence on error when the notifier emits a next value. + If the source observable errors and the notifier completes, it will complete the source sequence. + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable. + - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func retryWhen(notificationHandler: Observable -> TriggerObservable) + -> Observable { + return RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler) + } +} + +// MARK: scan + +extension ObservableType { + + /** + Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. + + For aggregation behavior with no intermediate results, see `reduce`. + + - seealso: [scan operator on reactivex.io](http://reactivex.io/documentation/operators/scan.html) + + - parameter seed: The initial accumulator value. + - 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(seed: A, accumulator: (A, E) throws -> A) + -> Observable { + return Scan(source: self.asObservable(), seed: seed, accumulator: accumulator) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+StandardSequenceOperators.swift b/Pods/RxSwift/RxSwift/Observables/Observable+StandardSequenceOperators.swift new file mode 100644 index 0000000..2fa425a --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+StandardSequenceOperators.swift @@ -0,0 +1,323 @@ +// +// Observable+StandardSequenceOperators.swift +// Rx +// +// Created by Krunoslav Zaher on 2/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: filter aka where + +extension ObservableType { + + /** + Filters the elements of an observable sequence based on a predicate. + + - seealso: [filter operator on reactivex.io](http://reactivex.io/documentation/operators/filter.html) + + - 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) throws -> Bool) + -> Observable { + return Filter(source: asObservable(), predicate: predicate) + } +} + +// MARK: takeWhile + +extension ObservableType { + + /** + Returns elements from an observable sequence as long as a specified condition is true. + + - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html) + + - parameter predicate: A function to test each element for a condition. + - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func takeWhile(predicate: (E) throws -> Bool) + -> Observable { + return TakeWhile(source: asObservable(), predicate: predicate) + } + + /** + Returns elements from an observable sequence as long as a specified condition is true. + + The element's index is used in the logic of the predicate function. + + - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html) + + - parameter predicate: A function to test each element for a condition; the second parameter of the function represents the index of the source element. + - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func takeWhileWithIndex(predicate: (E, Int) throws -> Bool) + -> Observable { + return TakeWhile(source: asObservable(), predicate: predicate) + } +} + +// MARK: take + +extension ObservableType { + + /** + Returns a specified number of contiguous elements from the start of an observable sequence. + + - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html) + + - parameter count: The number of elements to return. + - returns: An observable sequence that contains the specified number of elements from the start of the input sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func take(count: Int) + -> Observable { + if count == 0 { + return Observable.empty() + } + else { + return TakeCount(source: asObservable(), count: count) + } + } +} + +// MARK: takeLast + +extension ObservableType { + + /** + Returns a specified number of contiguous elements from the end of an observable sequence. + + This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. + + - seealso: [takeLast operator on reactivex.io](http://reactivex.io/documentation/operators/takelast.html) + + - parameter count: Number of elements to take from the end of the source sequence. + - returns: An observable sequence containing the specified number of elements from the end of the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func takeLast(count: Int) + -> Observable { + return TakeLast(source: asObservable(), count: count) + } +} + + +// MARK: skip + +extension ObservableType { + + /** + Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. + + - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html) + + - 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) + -> Observable { + return SkipCount(source: asObservable(), count: count) + } +} + +// MARK: SkipWhile + +extension ObservableType { + + /** + Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. + + - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html) + + - parameter predicate: A function to test each element for a condition. + - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func skipWhile(predicate: (E) throws -> Bool) -> Observable { + return SkipWhile(source: asObservable(), predicate: predicate) + } + + /** + Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. + The element's index is used in the logic of the predicate function. + + - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html) + + - parameter predicate: A function to test each element for a condition; the second parameter of the function represents the index of the source element. + - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func skipWhileWithIndex(predicate: (E, Int) throws -> Bool) -> Observable { + return SkipWhile(source: asObservable(), predicate: predicate) + } +} + +// MARK: map aka select + +extension ObservableType { + + /** + Projects each element of an observable sequence into a new form. + + - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html) + + - 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(selector: E throws -> R) + -> Observable { + return self.asObservable().composeMap(selector) + } + + /** + Projects each element of an observable sequence into a new form by incorporating the element's index. + + - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html) + + - parameter selector: A transform function to apply to each source element; the second parameter of the function represents the index of the 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 mapWithIndex(selector: (E, Int) throws -> R) + -> Observable { + return MapWithIndex(source: asObservable(), selector: selector) + } +} + +// MARK: flatMap + +extension ObservableType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + + - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - 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(selector: (E) throws -> O) + -> Observable { + return FlatMap(source: asObservable(), selector: selector) + } + + /** + Projects each element of an observable sequence to an observable sequence by incorporating the element's index and merges the resulting observable sequences into one observable sequence. + + - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - parameter selector: A transform function to apply to each element; the second parameter of the function represents the index of the source 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 flatMapWithIndex(selector: (E, Int) throws -> O) + -> Observable { + return FlatMapWithIndex(source: asObservable(), selector: selector) + } +} + +// MARK: flatMapFirst + +extension ObservableType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + If element is received while there is some projected observable sequence being merged it will simply be ignored. + + - seealso: [flatMapFirst operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - 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(selector: (E) throws -> O) + -> Observable { + return FlatMapFirst(source: asObservable(), selector: selector) + } +} + +// MARK: flatMapLatest + +extension ObservableType { + /** + Projects each element of an observable sequence into a new sequence of observable sequences and then + transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. + + It is a combination of `map` + `switchLatest` operator + + - seealso: [flatMapLatest operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - parameter selector: A transform function to apply to each element. + - 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(selector: (E) throws -> O) + -> Observable { + return FlatMapLatest(source: asObservable(), selector: selector) + } +} + +// MARK: elementAt + +extension ObservableType { + + /** + Returns a sequence emitting only item _n_ emitted by an Observable + + - seealso: [elementAt operator on reactivex.io](http://reactivex.io/documentation/operators/elementat.html) + + - parameter index: The index of the required item (starting from 0). + - returns: An observable sequence that emits the desired item as its own sole emission. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func elementAt(index: Int) + -> Observable { + return ElementAt(source: asObservable(), index: index, throwOnEmpty: true) + } +} + +// MARK: single + +extension ObservableType { + + /** + The single operator is similar to first, but throws a `RxError.NoElements` or `RxError.MoreThanOneElement` + if the source Observable does not emit exactly one item before successfully completing. + + - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html) + + - returns: An observable sequence that emits a single item or throws an exception if more (or none) of them are emitted. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func single() + -> Observable { + return SingleAsync(source: asObservable()) + } + + /** + The single operator is similar to first, but throws a `RxError.NoElements` or `RxError.MoreThanOneElement` + if the source Observable does not emit exactly one item before successfully completing. + + - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html) + + - parameter predicate: A function to test each source element for a condition. + - returns: An observable sequence that emits a single item or throws an exception if more (or none) of them are emitted. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func single(predicate: (E) throws -> Bool) + -> Observable { + return SingleAsync(source: asObservable(), predicate: predicate) + } + +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Observables/Observable+Time.swift b/Pods/RxSwift/RxSwift/Observables/Observable+Time.swift new file mode 100644 index 0000000..9050ce5 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observables/Observable+Time.swift @@ -0,0 +1,274 @@ +// +// Observable+Time.swift +// Rx +// +// Created by Krunoslav Zaher on 3/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +// MARK: throttle +extension ObservableType { + + /** + Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers. + + `throttle` and `debounce` are synonyms. + + - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html) + + - parameter dueTime: Throttling duration for each element. + - parameter scheduler: Scheduler to run the throttle timers and send events on. + - returns: The throttled sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func throttle(dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return Throttle(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler) + } + + /** + Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers. + + `throttle` and `debounce` are synonyms. + + - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html) + + - parameter dueTime: Throttling duration for each element. + - parameter scheduler: Scheduler to run the throttle timers and send events on. + - returns: The throttled sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func debounce(dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return Throttle(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler) + } +} + +// MARK: sample + +extension ObservableType { + + /** + Samples the source observable sequence using a samper observable sequence producing sampling ticks. + + Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence. + + **In case there were no new elements between sampler ticks, no element is sent to the resulting sequence.** + + - seealso: [sample operator on reactivex.io](http://reactivex.io/documentation/operators/sample.html) + + - parameter sampler: Sampling tick sequence. + - returns: Sampled observable sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func sample(sampler: O) + -> Observable { + return Sample(source: self.asObservable(), sampler: sampler.asObservable(), onlyNew: true) + } +} + +extension Observable where Element : SignedIntegerType { + /** + Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages. + + - seealso: [interval operator on reactivex.io](http://reactivex.io/documentation/operators/interval.html) + + - parameter period: Period for producing the values in the resulting sequence. + - parameter scheduler: Scheduler to run the timer on. + - 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, scheduler: SchedulerType) + -> Observable { + return Timer(dueTime: period, + period: period, + scheduler: scheduler + ) + } +} + +// MARK: timer + +extension Observable where Element: SignedIntegerType { + /** + 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. + + - seealso: [timer operator on reactivex.io](http://reactivex.io/documentation/operators/timer.html) + + - parameter dueTime: Relative time at which to produce the first value. + - parameter period: Period to produce subsequent values. + - parameter scheduler: Scheduler to run timers on. + - 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? = nil, scheduler: SchedulerType) + -> Observable { + return Timer( + dueTime: dueTime, + period: period, + scheduler: scheduler + ) + } +} + +// MARK: take + +extension ObservableType { + + /** + Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. + + - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html) + + - parameter duration: Duration for taking elements from the start of the sequence. + - parameter scheduler: Scheduler to run the timer on. + - returns: An observable sequence with the elements taken during the specified duration from the start of the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func take(duration: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return TakeTime(source: self.asObservable(), duration: duration, scheduler: scheduler) + } +} + +// MARK: skip + +extension ObservableType { + + /** + Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. + + - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html) + + - parameter duration: Duration for skipping elements from the start of the sequence. + - parameter scheduler: Scheduler to run the timer on. + - returns: An observable sequence with the elements skipped during the specified duration from the start of the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func skip(duration: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return SkipTime(source: self.asObservable(), duration: duration, scheduler: scheduler) + } +} + +// MARK: ignoreElements + +extension ObservableType { + + /** + Skips elements and completes (or errors) when the receiver completes (or errors). Equivalent to filter that always returns false. + + - seealso: [ignoreElements operator on reactivex.io](http://reactivex.io/documentation/operators/ignoreelements.html) + + - returns: An observable sequence that skips all elements of the source sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func ignoreElements() + -> Observable { + return filter { _ -> Bool in + return false + } + } +} + +// MARK: delaySubscription + +extension ObservableType { + + /** + Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers. + + - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html) + + - parameter dueTime: Relative time shift of the subscription. + - parameter scheduler: Scheduler to run the subscription delay timer on. + - returns: Time-shifted sequence. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func delaySubscription(dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return DelaySubscription(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler) + } +} + +// MARK: buffer + +extension ObservableType { + + /** + Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers. + + A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first. + + - seealso: [buffer operator on reactivex.io](http://reactivex.io/documentation/operators/buffer.html) + + - parameter timeSpan: Maximum time length of a buffer. + - parameter count: Maximum element count of a buffer. + - parameter scheduler: Scheduler to run buffering timers on. + - returns: An observable sequence of buffers. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func buffer(timeSpan timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) + -> Observable<[E]> { + return BufferTimeCount(source: self.asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler) + } +} + +// MARK: window + +extension ObservableType { + + /** + Projects each element of an observable sequence into a window that is completed when either it’s full or a given amount of time has elapsed. + + - seealso: [window operator on reactivex.io](http://reactivex.io/documentation/operators/window.html) + + - parameter timeSpan: Maximum time length of a window. + - parameter count: Maximum element count of a window. + - parameter scheduler: Scheduler to run windowing timers on. + - returns: An observable sequence of windows (instances of `Observable`). + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func window(timeSpan timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) + -> Observable> { + return WindowTimeCount(source: self.asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler) + } +} + +// MARK: timeout + +extension ObservableType { + + /** + Applies a timeout policy for each element in the observable sequence. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutError is propagated to the observer. + + - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html) + + - parameter dueTime: Maximum duration between values before a timeout occurs. + - parameter scheduler: Scheduler to run the timeout timer on. + - returns: An observable sequence with a TimeoutError in case of a timeout. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func timeout(dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return Timeout(source: self.asObservable(), dueTime: dueTime, other: Observable.error(RxError.Timeout), scheduler: scheduler) + } + + /** + Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on. + + - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html) + + - parameter dueTime: Maximum duration between values before a timeout occurs. + - parameter other: Sequence to return in case of a timeout. + - parameter scheduler: Scheduler to run the timeout timer on. + - returns: The source sequence switching to the other sequence in case of a timeout. + */ + @warn_unused_result(message="http://git.io/rxs.uo") + public func timeout(dueTime: RxTimeInterval, other: O, scheduler: SchedulerType) + -> Observable { + return Timeout(source: self.asObservable(), dueTime: dueTime, other: other.asObservable(), scheduler: scheduler) + } +} diff --git a/Pods/RxSwift/RxSwift/ObserverType.swift b/Pods/RxSwift/RxSwift/ObserverType.swift new file mode 100644 index 0000000..396d167 --- /dev/null +++ b/Pods/RxSwift/RxSwift/ObserverType.swift @@ -0,0 +1,56 @@ +// +// ObserverType.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Supports push-style iteration over an observable sequence. +*/ +public protocol ObserverType { + /** + The type of elements in sequence that observer can observe. + */ + associatedtype E + + /** + Notify observer about sequence event. + + - parameter event: Event that occured. + */ + func on(event: Event) +} + +/** +Convenience API extensions to provide alternate next, error, completed events +*/ +public extension ObserverType { + + /** + Convenience method equivalent to `on(.Next(element: E))` + + - parameter element: Next element to send to observer(s) + */ + final func onNext(element: E) { + on(.Next(element)) + } + + /** + Convenience method equivalent to `on(.Completed)` + */ + final func onCompleted() { + on(.Completed) + } + + /** + Convenience method equivalent to `on(.Error(error: ErrorType))` + - parameter error: ErrorType to send to observer(s) + */ + final func onError(error: ErrorType) { + on(.Error(error)) + } +} diff --git a/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift b/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift new file mode 100644 index 0000000..6090fef --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift @@ -0,0 +1,34 @@ +// +// AnonymousObserver.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class AnonymousObserver : ObserverBase { + typealias Element = ElementType + + typealias EventHandler = Event -> Void + + private let _eventHandler : EventHandler + + init(_ eventHandler: EventHandler) { +#if TRACE_RESOURCES + AtomicIncrement(&resourceCount) +#endif + _eventHandler = eventHandler + } + + override func onCore(event: Event) { + return _eventHandler(event) + } + +#if TRACE_RESOURCES + deinit { + AtomicDecrement(&resourceCount) + } +#endif +} diff --git a/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift b/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift new file mode 100644 index 0000000..0795952 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift @@ -0,0 +1,39 @@ +// +// ObserverBase.swift +// Rx +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +class ObserverBase : Disposable, ObserverType { + typealias E = ElementType + + private var _isStopped: AtomicInt = 0 + + func on(event: Event) { + switch event { + case .Next: + if _isStopped == 0 { + onCore(event) + } + case .Error, .Completed: + + if !AtomicCompareAndSwap(0, 1, &_isStopped) { + return + } + + onCore(event) + } + } + + func onCore(event: Event) { + abstractMethod() + } + + func dispose() { + _isStopped = 1 + } +} diff --git a/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift b/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift new file mode 100644 index 0000000..f8f800e --- /dev/null +++ b/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift @@ -0,0 +1,152 @@ +// +// TailRecursiveSink.swift +// Rx +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +enum TailRecursiveSinkCommand { + case MoveNext + case Dispose +} + +#if DEBUG || TRACE_RESOURCES + public var maxTailRecursiveSinkStackSize = 0 +#endif + +/// This class is usually used with `Generator` version of the operators. +class TailRecursiveSink + : Sink + , InvocableWithValueType { + typealias Value = TailRecursiveSinkCommand + typealias E = O.E + typealias SequenceGenerator = (generator: S.Generator, remaining: IntMax?) + + var _generators: [SequenceGenerator] = [] + var _disposed = false + var _subscription = SerialDisposable() + + // this is thread safe object + var _gate = AsyncLock>>() + + override init(observer: O) { + super.init(observer: observer) + } + + func run(sources: SequenceGenerator) -> Disposable { + _generators.append(sources) + + schedule(.MoveNext) + + return _subscription + } + + func invoke(command: TailRecursiveSinkCommand) { + switch command { + case .Dispose: + disposeCommand() + case .MoveNext: + moveNextCommand() + } + } + + // simple implementation for now + func schedule(command: TailRecursiveSinkCommand) { + _gate.invoke(InvocableScheduledItem(invocable: self, state: command)) + } + + func done() { + forwardOn(.Completed) + dispose() + } + + func extract(observable: Observable) -> SequenceGenerator? { + abstractMethod() + } + + // should be done on gate locked + + private func moveNextCommand() { + var next: Observable? = nil + + repeat { + if _generators.count == 0 { + break + } + + if _disposed { + return + } + + var (e, left) = _generators.last! + + _generators.removeLast() + + guard let nextCandidate = e.next()?.asObservable() else { + continue + } + + // `left` is a hint of how many elements are left in generator. + // In case this is the last element, then there is no need to push + // that generator on stack. + // + // This is an optimization used to make sure in tail recursive case + // there is no memory leak in case this operator is used to generate non terminating + // sequence. + + if let knownOriginalLeft = left { + // `- 1` because generator.next() has just been called + if knownOriginalLeft - 1 >= 1 { + _generators.append((e, knownOriginalLeft - 1)) + } + } + else { + _generators.append((e, nil)) + } + + let nextGenerator = extract(nextCandidate) + + if let nextGenerator = nextGenerator { + _generators.append(nextGenerator) + #if DEBUG || TRACE_RESOURCES + if maxTailRecursiveSinkStackSize < _generators.count { + maxTailRecursiveSinkStackSize = _generators.count + } + #endif + } + else { + next = nextCandidate + } + } while next == nil + + if next == nil { + done() + return + } + + let disposable = SingleAssignmentDisposable() + _subscription.disposable = disposable + disposable.disposable = subscribeToNext(next!) + } + + func subscribeToNext(source: Observable) -> Disposable { + abstractMethod() + } + + func disposeCommand() { + _disposed = true + _generators.removeAll(keepCapacity: false) + } + + override func dispose() { + super.dispose() + + _subscription.dispose() + + schedule(.Dispose) + } +} + diff --git a/Pods/RxSwift/RxSwift/Platform/Platform.Darwin.swift b/Pods/RxSwift/RxSwift/Platform/Platform.Darwin.swift new file mode 100644 index 0000000..4f1cf44 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Platform/Platform.Darwin.swift @@ -0,0 +1,45 @@ +// +// Platform.Darwin.swift +// Rx +// +// Created by Krunoslav Zaher on 12/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS) + + import Darwin + import Foundation + + #if TRACE_RESOURCES + public typealias AtomicInt = Int32 + #else + typealias AtomicInt = Int32 + #endif + + let AtomicCompareAndSwap = OSAtomicCompareAndSwap32 + let AtomicIncrement = OSAtomicIncrement32 + let AtomicDecrement = OSAtomicDecrement32 + + extension NSThread { + static func setThreadLocalStorageValue(value: T?, forKey key: protocol) { + let currentThread = NSThread.currentThread() + let threadDictionary = currentThread.threadDictionary + + if let newValue = value { + threadDictionary.setObject(newValue, forKey: key) + } + else { + threadDictionary.removeObjectForKey(key) + } + + } + static func getThreadLocalStorageValueForKey(key: protocol) -> T? { + let currentThread = NSThread.currentThread() + let threadDictionary = currentThread.threadDictionary + + return threadDictionary[key] as? T + } + } + +#endif diff --git a/Pods/RxSwift/RxSwift/Platform/Platform.Linux.swift b/Pods/RxSwift/RxSwift/Platform/Platform.Linux.swift new file mode 100644 index 0000000..f5b9368 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Platform/Platform.Linux.swift @@ -0,0 +1,222 @@ +// +// Platform.Linux.swift +// Rx +// +// Created by Krunoslav Zaher on 12/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(Linux) + //////////////////////////////////////////////////////////////////////////////// + // This is not the greatest API in the world, this is just a tribute. + // !!! Proof of concept until libdispatch becomes operational. !!! + //////////////////////////////////////////////////////////////////////////////// + + import Foundation + import XCTest + import Glibc + import SwiftShims + + // MARK: CoreFoundation run loop mock + + public typealias CFRunLoopRef = Int + public let kCFRunLoopDefaultMode = "CFRunLoopDefaultMode" + + typealias Action = () -> () + + var queue = Queue(capacity: 100) + + var runLoopCounter = 0 + + extension NSThread { + public var isMainThread: Bool { + return true + } + } + + public func CFRunLoopWakeUp(runLoop: CFRunLoopRef) { + } + + public func CFRunLoopStop(runLoop: CFRunLoopRef) { + runLoopCounter -= 1 + } + + public func CFRunLoopPerformBlock(runLoop: CFRunLoopRef, _ mode: String, _ action: () -> ()) { + queue.enqueue(action) + } + + public func CFRunLoopRun() { + runLoopCounter += 1 + let currentValueOfCounter = runLoopCounter + while let front = queue.dequeue() { + front() + if runLoopCounter < currentValueOfCounter - 1 { + fatalError("called stop twice") + } + + if runLoopCounter == currentValueOfCounter - 1 { + break + } + } + } + + public func CFRunLoopGetCurrent() -> CFRunLoopRef { + return 0 + } + + // MARK: Atomic, just something that works for single thread case + + #if TRACE_RESOURCES + public typealias AtomicInt = Int64 + #else + typealias AtomicInt = Int64 + #endif + + func AtomicIncrement(increment: UnsafeMutablePointer) -> AtomicInt { + increment.memory = increment.memory + 1 + return increment.memory + } + + func AtomicDecrement(increment: UnsafeMutablePointer) -> AtomicInt { + increment.memory = increment.memory - 1 + return increment.memory + } + + func AtomicCompareAndSwap(l: AtomicInt, _ r: AtomicInt, _ target: UnsafeMutablePointer) -> Bool { + //return __sync_val_compare_and_swap(target, l, r) + if target.memory == l { + target.memory = r + return true + } + + return false + } + + extension NSThread { + static func setThreadLocalStorageValue(value: T?, forKey key: String) { + let currentThread = NSThread.currentThread() + var threadDictionary = currentThread.threadDictionary + + if let newValue = value { + threadDictionary[key] = newValue + } + else { + threadDictionary[key] = nil + } + + currentThread.threadDictionary = threadDictionary + } + + static func getThreadLocalStorageValueForKey(key: String) -> T? { + let currentThread = NSThread.currentThread() + let threadDictionary = currentThread.threadDictionary + + return threadDictionary[key] as? T + } + } + + // + + // MARK: objc mock + + public func objc_sync_enter(lock: AnyObject) { + } + + public func objc_sync_exit(lock: AnyObject) { + + } + + + // MARK: libdispatch + + public typealias dispatch_time_t = Int + public typealias dispatch_source_t = Int + public typealias dispatch_source_type_t = Int + public typealias dispatch_queue_t = Int + public typealias dispatch_object_t = Int + public typealias dispatch_block_t = () -> () + public typealias dispatch_queue_attr_t = Int + public typealias qos_class_t = Int + + public let DISPATCH_QUEUE_SERIAL = 0 + + public let DISPATCH_QUEUE_PRIORITY_HIGH = 1 + public let DISPATCH_QUEUE_PRIORITY_DEFAULT = 2 + public let DISPATCH_QUEUE_PRIORITY_LOW = 3 + + public let QOS_CLASS_USER_INTERACTIVE = 0 + public let QOS_CLASS_USER_INITIATED = 1 + public let QOS_CLASS_DEFAULT = 2 + public let QOS_CLASS_UTILITY = 3 + public let QOS_CLASS_BACKGROUND = 4 + + public let DISPATCH_SOURCE_TYPE_TIMER = 0 + public let DISPATCH_TIME_FOREVER = 1 as UInt64 + public let NSEC_PER_SEC = 1 + + public let DISPATCH_TIME_NOW = -1 + + public func dispatch_time(when: dispatch_time_t, _ delta: Int64) -> dispatch_time_t { + return when + Int(delta) + } + + public func dispatch_queue_create(label: UnsafePointer, _ attr: dispatch_queue_attr_t!) -> dispatch_queue_t! { + return 0 + } + + public func dispatch_set_target_queue(object: dispatch_object_t!, _ queue: dispatch_queue_t!) { + } + + public func dispatch_async(queue2: dispatch_queue_t, _ block: dispatch_block_t) { + queue.enqueue(block) + } + + public func dispatch_source_create(type: dispatch_source_type_t, _ handle: UInt, _ mask: UInt, _ queue: dispatch_queue_t!) -> dispatch_source_t! { + return 0 + } + + public func dispatch_source_set_timer(source: dispatch_source_t, _ start: dispatch_time_t, _ interval: UInt64, _ leeway: UInt64) { + + } + + public func dispatch_source_set_event_handler(source: dispatch_source_t, _ handler: dispatch_block_t!) { + queue.enqueue(handler) + } + + public func dispatch_resume(object: dispatch_object_t) { + } + + public func dispatch_source_cancel(source: dispatch_source_t) { + } + + public func dispatch_get_global_queue(identifier: Int, _ flags: UInt) -> dispatch_queue_t! { + return 0 + } + + public func dispatch_get_main_queue() -> dispatch_queue_t! { + return 0 + } + + // MARK: XCTest + + public class Expectation { + public func fulfill() { + } + } + + extension XCTestCase { + public func setUp() { + } + + public func tearDown() { + } + + public func expectationWithDescription(description: String) -> Expectation { + return Expectation() + } + + public func waitForExpectationsWithTimeout(time: NSTimeInterval, action: ErrorType? -> Void) { + } + } + +#endif diff --git a/Pods/RxSwift/RxSwift/Rx.swift b/Pods/RxSwift/RxSwift/Rx.swift new file mode 100644 index 0000000..5b6d9ff --- /dev/null +++ b/Pods/RxSwift/RxSwift/Rx.swift @@ -0,0 +1,47 @@ +// +// Rx.swift +// Rx +// +// Created by Krunoslav Zaher on 2/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if TRACE_RESOURCES +/** +Counts internal Rx resources (Observables, Observers, Disposables ...). + +It provides a really simple way to detect leaks early during development. +*/ +public var resourceCount: AtomicInt = 0 +#endif + +// Swift doesn't have a concept of abstract metods. +// This function is being used as a runtime check that abstract methods aren't being called. +@noreturn func abstractMethod() -> Void { + rxFatalError("Abstract method") +} + +@noreturn func rxFatalError(lastMessage: String) { + // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours. + fatalError(lastMessage) +} + +func incrementChecked(inout i: Int) throws -> Int { + if i == Int.max { + throw RxError.Overflow + } + let result = i + i += 1 + return result +} + +func decrementChecked(inout i: Int) throws -> Int { + if i == Int.min { + throw RxError.Overflow + } + let result = i + i -= 1 + return result +} diff --git a/Pods/RxSwift/RxSwift/RxMutableBox.swift b/Pods/RxSwift/RxSwift/RxMutableBox.swift new file mode 100644 index 0000000..83ff9f7 --- /dev/null +++ b/Pods/RxSwift/RxSwift/RxMutableBox.swift @@ -0,0 +1,37 @@ +// +// RxMutableBox.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Creates mutable reference wrapper for any type. +*/ +class RxMutableBox : CustomDebugStringConvertible { + /** + Wrapped value + */ + var value : T + + /** + Creates reference wrapper for `value`. + + - parameter value: Value to wrap. + */ + init (_ value: T) { + self.value = value + } +} + +extension RxMutableBox { + /** + - returns: Box description. + */ + var debugDescription: String { + return "MutatingBox(\(self.value))" + } +} diff --git a/Pods/RxSwift/RxSwift/SchedulerType.swift b/Pods/RxSwift/RxSwift/SchedulerType.swift new file mode 100644 index 0000000..eceea3e --- /dev/null +++ b/Pods/RxSwift/RxSwift/SchedulerType.swift @@ -0,0 +1,80 @@ +// +// SchedulerType.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Type that represents time interval in the context of RxSwift. +*/ +public typealias RxTimeInterval = NSTimeInterval + +/** +Type that represents absolute time in the context of RxSwift. +*/ +public typealias RxTime = NSDate + +/** +Represents an object that schedules units of work. +*/ +public protocol SchedulerType: ImmediateSchedulerType { + + /** + - returns: Current time. + */ + var now : RxTime { + get + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + func scheduleRelative(state: StateType, dueTime: RxTimeInterval, action: (StateType) -> Disposable) -> Disposable + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + func schedulePeriodic(state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: (StateType) -> StateType) -> Disposable +} + +extension SchedulerType { + + /** + Periodic task will be emulated using recursive scheduling. + + - parameter state: Initial state passed to the action upon the first iteration. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - returns: The disposable object used to cancel the scheduled recurring action (best effort). + */ + public func schedulePeriodic(state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: (StateType) -> StateType) -> Disposable { + let schedule = SchedulePeriodicRecursive(scheduler: self, startAfter: startAfter, period: period, action: action, state: state) + + return schedule.start() + } + + func scheduleRecursive(state: State, dueTime: RxTimeInterval, action: (state: State, scheduler: AnyRecursiveScheduler) -> ()) -> Disposable { + let scheduler = AnyRecursiveScheduler(scheduler: self, action: action) + + scheduler.schedule(state, dueTime: dueTime) + + return AnonymousDisposable { + scheduler.dispose() + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift new file mode 100644 index 0000000..41cebae --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift @@ -0,0 +1,147 @@ +// +// ConcurrentDispatchQueueScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 7/5/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. You can also pass a serial dispatch queue, it shouldn't cause any problems. + +This scheduler is suitable when some work needs to be performed in background. +*/ +public class ConcurrentDispatchQueueScheduler: SchedulerType { + public typealias TimeInterval = NSTimeInterval + public typealias Time = NSDate + + private let _queue : dispatch_queue_t + + public var now : NSDate { + return NSDate() + } + + // leeway for scheduling timers + private var _leeway: Int64 = 0 + + /** + Constructs new `ConcurrentDispatchQueueScheduler` that wraps `queue`. + + - parameter queue: Target dispatch queue. + */ + public init(queue: dispatch_queue_t) { + _queue = queue + } + + /** + Convenience init for scheduler that wraps one of the global concurrent dispatch queues. + + - parameter globalConcurrentQueueQOS: Target global dispatch queue, by quality of service class. + */ + @available(iOS 8, OSX 10.10, *) + public convenience init(globalConcurrentQueueQOS: DispatchQueueSchedulerQOS) { + let priority = globalConcurrentQueueQOS.QOSClass + self.init(queue: dispatch_get_global_queue(priority, UInt(0))) + } + + + class func convertTimeIntervalToDispatchInterval(timeInterval: NSTimeInterval) -> Int64 { + return Int64(timeInterval * Double(NSEC_PER_SEC)) + } + + class func convertTimeIntervalToDispatchTime(timeInterval: NSTimeInterval) -> dispatch_time_t { + return dispatch_time(DISPATCH_TIME_NOW, convertTimeIntervalToDispatchInterval(timeInterval)) + } + + /** + Schedules an action to be executed immediatelly. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func schedule(state: StateType, action: StateType -> Disposable) -> Disposable { + return self.scheduleInternal(state, action: action) + } + + func scheduleInternal(state: StateType, action: StateType -> Disposable) -> Disposable { + let cancel = SingleAssignmentDisposable() + + dispatch_async(_queue) { + if cancel.disposed { + return + } + + cancel.disposable = action(state) + } + + return cancel + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func scheduleRelative(state: StateType, dueTime: NSTimeInterval, action: (StateType) -> Disposable) -> Disposable { + let timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, _queue) + + let dispatchInterval = MainScheduler.convertTimeIntervalToDispatchTime(dueTime) + + let compositeDisposable = CompositeDisposable() + + dispatch_source_set_timer(timer, dispatchInterval, DISPATCH_TIME_FOREVER, 0) + dispatch_source_set_event_handler(timer, { + if compositeDisposable.disposed { + return + } + compositeDisposable.addDisposable(action(state)) + }) + dispatch_resume(timer) + + compositeDisposable.addDisposable(AnonymousDisposable { + dispatch_source_cancel(timer) + }) + + return compositeDisposable + } + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedulePeriodic(state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> Disposable { + let timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, _queue) + + let initial = MainScheduler.convertTimeIntervalToDispatchTime(startAfter) + let dispatchInterval = MainScheduler.convertTimeIntervalToDispatchInterval(period) + + var timerState = state + + let validDispatchInterval = dispatchInterval < 0 ? 0 : UInt64(dispatchInterval) + + dispatch_source_set_timer(timer, initial, validDispatchInterval, 0) + let cancel = AnonymousDisposable { + dispatch_source_cancel(timer) + } + dispatch_source_set_event_handler(timer, { + if cancel.disposed { + return + } + timerState = action(timerState) + }) + dispatch_resume(timer) + + return cancel + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift new file mode 100644 index 0000000..c26be80 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift @@ -0,0 +1,90 @@ +// +// ConcurrentMainScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 10/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Abstracts work that needs to be performed on `MainThread`. In case `schedule` methods are called from main thread, it will perform action immediately without scheduling. + +This scheduler is optimized for `subscribeOn` operator. If you want to observe observable sequence elements on main thread using `observeOn` operator, +`MainScheduler` is more suitable for that purpose. +*/ +public final class ConcurrentMainScheduler : SchedulerType { + public typealias TimeInterval = NSTimeInterval + public typealias Time = NSDate + + private let _mainScheduler: MainScheduler + private let _mainQueue: dispatch_queue_t + + /** + - returns: Current time. + */ + public var now : NSDate { + return _mainScheduler.now + } + + private init(mainScheduler: MainScheduler) { + _mainQueue = dispatch_get_main_queue() + _mainScheduler = mainScheduler + } + + /** + Singleton instance of `ConcurrentMainScheduler` + */ + public static let instance = ConcurrentMainScheduler(mainScheduler: MainScheduler.instance) + + /** + Schedules an action to be executed immediatelly. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(state: StateType, action: (StateType) -> Disposable) -> Disposable { + if NSThread.currentThread().isMainThread { + return action(state) + } + + let cancel = SingleAssignmentDisposable() + + dispatch_async(_mainQueue) { + if cancel.disposed { + return + } + + cancel.disposable = action(state) + } + + return cancel + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func scheduleRelative(state: StateType, dueTime: NSTimeInterval, action: (StateType) -> Disposable) -> Disposable { + return _mainScheduler.scheduleRelative(state, dueTime: dueTime, action: action) + } + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedulePeriodic(state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> Disposable { + return _mainScheduler.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift new file mode 100644 index 0000000..16882fe --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift @@ -0,0 +1,149 @@ +// +// CurrentThreadScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if os(Linux) + let CurrentThreadSchedulerKeyInstance = "RxSwift.CurrentThreadScheduler.SchedulerKey" + let CurrentThreadSchedulerQueueKeyInstance = "RxSwift.CurrentThreadScheduler.Queue" + + typealias CurrentThreadSchedulerValue = NSString + let CurrentThreadSchedulerValueInstance = "RxSwift.CurrentThreadScheduler.SchedulerKey" as NSString +#else + let CurrentThreadSchedulerKeyInstance = CurrentThreadSchedulerKey() + let CurrentThreadSchedulerQueueKeyInstance = CurrentThreadSchedulerQueueKey() + + typealias CurrentThreadSchedulerValue = CurrentThreadSchedulerKey + let CurrentThreadSchedulerValueInstance = CurrentThreadSchedulerKeyInstance + + class CurrentThreadSchedulerKey : NSObject, NSCopying { + override func isEqual(object: AnyObject?) -> Bool { + return object === CurrentThreadSchedulerKeyInstance + } + + override var hash: Int { return -904739208 } + + override func copy() -> AnyObject { + return CurrentThreadSchedulerKeyInstance + } + + func copyWithZone(zone: NSZone) -> AnyObject { + return CurrentThreadSchedulerKeyInstance + } + } + + class CurrentThreadSchedulerQueueKey : NSObject, NSCopying { + override func isEqual(object: AnyObject?) -> Bool { + return object === CurrentThreadSchedulerQueueKeyInstance + } + + override var hash: Int { return -904739207 } + + override func copy() -> AnyObject { + return CurrentThreadSchedulerQueueKeyInstance + } + + func copyWithZone(zone: NSZone) -> AnyObject { + return CurrentThreadSchedulerQueueKeyInstance + } + } +#endif + +/** +Represents an object that schedules units of work on the current thread. + +This is the default scheduler for operators that generate elements. + +This scheduler is also sometimes called `trampoline scheduler`. +*/ +public class CurrentThreadScheduler : ImmediateSchedulerType { + typealias ScheduleQueue = RxMutableBox> + + /** + The singleton instance of the current thread scheduler. + */ + public static let instance = CurrentThreadScheduler() + + static var queue : ScheduleQueue? { + get { + return NSThread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerQueueKeyInstance) + } + set { + NSThread.setThreadLocalStorageValue(newValue, forKey: CurrentThreadSchedulerQueueKeyInstance) + } + } + + /** + Gets a value that indicates whether the caller must call a `schedule` method. + */ + public static private(set) var isScheduleRequired: Bool { + get { + let value: CurrentThreadSchedulerValue? = NSThread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerKeyInstance) + return value == nil + } + set(isScheduleRequired) { + NSThread.setThreadLocalStorageValue(isScheduleRequired ? nil : CurrentThreadSchedulerValueInstance, forKey: CurrentThreadSchedulerKeyInstance) + } + } + + /** + Schedules an action to be executed as soon as possible on current thread. + + If this method is called on some thread that doesn't have `CurrentThreadScheduler` installed, scheduler will be + automatically installed and uninstalled after all work is performed. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(state: StateType, action: (StateType) -> Disposable) -> Disposable { + if CurrentThreadScheduler.isScheduleRequired { + CurrentThreadScheduler.isScheduleRequired = false + + let disposable = action(state) + + defer { + CurrentThreadScheduler.isScheduleRequired = true + CurrentThreadScheduler.queue = nil + } + + guard let queue = CurrentThreadScheduler.queue else { + return disposable + } + + while let latest = queue.value.dequeue() { + if latest.disposed { + continue + } + latest.invoke() + } + + return disposable + } + + let existingQueue = CurrentThreadScheduler.queue + + let queue: RxMutableBox> + if let existingQueue = existingQueue { + queue = existingQueue + } + else { + queue = RxMutableBox(Queue(capacity: 1)) + CurrentThreadScheduler.queue = queue + } + + let scheduledItem = ScheduledItem(action: action, state: state) + queue.value.enqueue(scheduledItem) + + // In Xcode 7.3, `return scheduledItem` causes segmentation fault 11 on release build. + // To workaround this compiler issue, returns AnonymousDisposable that disposes scheduledItem. + return AnonymousDisposable { + scheduledItem.dispose() + } + } +} diff --git a/Pods/RxSwift/RxSwift/Schedulers/DispatchQueueSchedulerQOS.swift b/Pods/RxSwift/RxSwift/Schedulers/DispatchQueueSchedulerQOS.swift new file mode 100644 index 0000000..571f6bf --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/DispatchQueueSchedulerQOS.swift @@ -0,0 +1,54 @@ +// +// DispatchQueueSchedulerQOS.swift +// RxSwift +// +// Created by John C. "Hsoi" Daub on 12/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Identifies one of the global concurrent dispatch queues with specified quality of service class. +*/ +public enum DispatchQueueSchedulerQOS { + + /** + Identifies global dispatch queue with `QOS_CLASS_USER_INTERACTIVE` + */ + case UserInteractive + + /** + Identifies global dispatch queue with `QOS_CLASS_USER_INITIATED` + */ + case UserInitiated + + /** + Identifies global dispatch queue with `QOS_CLASS_DEFAULT` + */ + case Default + + /** + Identifies global dispatch queue with `QOS_CLASS_UTILITY` + */ + case Utility + + /** + Identifies global dispatch queue with `QOS_CLASS_BACKGROUND` + */ + case Background +} + + +@available(iOS 8, OSX 10.10, *) +extension DispatchQueueSchedulerQOS { + var QOSClass: qos_class_t { + switch self { + case .UserInteractive: return QOS_CLASS_USER_INTERACTIVE + case .UserInitiated: return QOS_CLASS_USER_INITIATED + case .Default: return QOS_CLASS_DEFAULT + case .Utility: return QOS_CLASS_UTILITY + case .Background: return QOS_CLASS_BACKGROUND + } + } +} diff --git a/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift new file mode 100644 index 0000000..bcb15b5 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift @@ -0,0 +1,25 @@ +// +// HistoricalScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 12/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** + Provides a virtual time scheduler that uses `NSDate` for absolute time and `NSTimeInterval` for relative time. +*/ +public class HistoricalScheduler : VirtualTimeScheduler { + + /** + Creates a new historical scheduler with initial clock value. + + - parameter initialClock: Initial value for virtual clock. + */ + public init(initialClock: RxTime = NSDate(timeIntervalSince1970: 0)) { + super.init(initialClock: initialClock, converter: HistoricalSchedulerTimeConverter()) + } + +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift b/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift new file mode 100644 index 0000000..b16b8a2 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift @@ -0,0 +1,83 @@ +// +// HistoricalSchedulerTimeConverter.swift +// Rx +// +// Created by Krunoslav Zaher on 12/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** + Converts historial virtual time into real time. + + Since historical virtual time is also measured in `NSDate`, this converter is identity function. + */ +public struct HistoricalSchedulerTimeConverter : VirtualTimeConverterType { + /** + Virtual time unit used that represents ticks of virtual clock. + */ + public typealias VirtualTimeUnit = RxTime + + /** + Virtual time unit used to represent differences of virtual times. + */ + public typealias VirtualTimeIntervalUnit = RxTimeInterval + + /** + Returns identical value of argument passed because historical virtual time is equal to real time, just + decoupled from local machine clock. + */ + public func convertFromVirtualTime(virtualTime: VirtualTimeUnit) -> RxTime { + return virtualTime + } + + /** + Returns identical value of argument passed because historical virtual time is equal to real time, just + decoupled from local machine clock. + */ + public func convertToVirtualTime(time: RxTime) -> VirtualTimeUnit { + return time + } + + /** + Returns identical value of argument passed because historical virtual time is equal to real time, just + decoupled from local machine clock. + */ + public func convertFromVirtualTimeInterval(virtualTimeInterval: VirtualTimeIntervalUnit) -> RxTimeInterval { + return virtualTimeInterval + } + + /** + Returns identical value of argument passed because historical virtual time is equal to real time, just + decoupled from local machine clock. + */ + public func convertToVirtualTimeInterval(timeInterval: RxTimeInterval) -> VirtualTimeIntervalUnit { + return timeInterval + } + + /** + Offsets `NSDate` by time interval. + + - parameter time: Time. + - parameter timeInterval: Time interval offset. + - returns: Time offsetted by time interval. + */ + public func offsetVirtualTime(time time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit { + return time.dateByAddingTimeInterval(offset) + } + + /** + Compares two `NSDate`s. + */ + public func compareVirtualTime(lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison { + switch lhs.compare(rhs) { + case .OrderedAscending: + return .LessThan + case .OrderedSame: + return .Equal + case .OrderedDescending: + return .GreaterThan + } + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift new file mode 100644 index 0000000..fc54fd5 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift @@ -0,0 +1,39 @@ +// +// ImmediateScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 10/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Represents an object that schedules units of work to run immediately on the current thread. +*/ +private class ImmediateScheduler : ImmediateSchedulerType { + + private let _asyncLock = AsyncLock() + + /** + Schedules an action to be executed immediatelly. + + In case `schedule` is called recursively from inside of `action` callback, scheduled `action` will be enqueued + and executed after current `action`. (`AsyncLock` behavior) + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + func schedule(state: StateType, action: (StateType) -> Disposable) -> Disposable { + let disposable = SingleAssignmentDisposable() + _asyncLock.invoke(AnonymousInvocable { + if disposable.disposed { + return + } + disposable.disposable = action(state) + }) + + return disposable + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift b/Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift new file mode 100644 index 0000000..8525db4 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift @@ -0,0 +1,21 @@ +// +// AnonymousInvocable.swift +// Rx +// +// Created by Krunoslav Zaher on 11/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +struct AnonymousInvocable : InvocableType { + private let _action: () -> () + + init(_ action: () -> ()) { + _action = action + } + + func invoke() { + _action() + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift b/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift new file mode 100644 index 0000000..1a4e3aa --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift @@ -0,0 +1,24 @@ +// +// InvocableScheduledItem.swift +// Rx +// +// Created by Krunoslav Zaher on 11/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +struct InvocableScheduledItem : InvocableType { + + let _invocable: I + let _state: I.Value + + init(invocable: I, state: I.Value) { + _invocable = invocable + _state = state + } + + func invoke() { + _invocable.invoke(_state) + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift b/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift new file mode 100644 index 0000000..1632e71 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift @@ -0,0 +1,19 @@ +// +// InvocableType.swift +// Rx +// +// Created by Krunoslav Zaher on 11/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol InvocableType { + func invoke() +} + +protocol InvocableWithValueType { + associatedtype Value + + func invoke(value: Value) +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift b/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift new file mode 100644 index 0000000..0b58332 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift @@ -0,0 +1,37 @@ +// +// ScheduledItem.swift +// Rx +// +// Created by Krunoslav Zaher on 9/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +struct ScheduledItem + : ScheduledItemType + , InvocableType { + typealias Action = T -> Disposable + + private let _action: Action + private let _state: T + + private let _disposable = SingleAssignmentDisposable() + + var disposed: Bool { + return _disposable.disposed + } + + init(action: Action, state: T) { + _action = action + _state = state + } + + func invoke() { + _disposable.disposable = _action(_state) + } + + func dispose() { + _disposable.dispose() + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift b/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift new file mode 100644 index 0000000..2a1eca2 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift @@ -0,0 +1,15 @@ +// +// ScheduledItemType.swift +// Rx +// +// Created by Krunoslav Zaher on 11/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +protocol ScheduledItemType + : Cancelable + , InvocableType { + func invoke() +} diff --git a/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift new file mode 100644 index 0000000..dfda88c --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift @@ -0,0 +1,73 @@ +// +// MainScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Abstracts work that needs to be performed on `MainThread`. In case `schedule` methods are called from main thread, it will perform action immediately without scheduling. + +This scheduler is usually used to perform UI work. + +Main scheduler is a specialization of `SerialDispatchQueueScheduler`. + +This scheduler is optimized for `observeOn` operator. To ensure observable sequence is subscribed on main thread using `subscribeOn` +operator please use `ConcurrentMainScheduler` because it is more optimized for that purpose. +*/ +public final class MainScheduler : SerialDispatchQueueScheduler { + + private let _mainQueue: dispatch_queue_t + + var numberEnqueued: AtomicInt = 0 + + private init() { + _mainQueue = dispatch_get_main_queue() + super.init(serialQueue: _mainQueue) + } + + /** + Singleton instance of `MainScheduler` + */ + public static let instance = MainScheduler() + + /** + Singleton instance of `MainScheduler` that always schedules work asynchronously + and doesn't perform optimizations for calls scheduled from main thread. + */ + public static let asyncInstance = SerialDispatchQueueScheduler(serialQueue: dispatch_get_main_queue()) + + /** + In case this method is called on a background thread it will throw an exception. + */ + public class func ensureExecutingOnScheduler() { + if !NSThread.currentThread().isMainThread { + rxFatalError("Executing on backgound thread. Please use `MainScheduler.instance.schedule` to schedule work on main thread.") + } + } + + override func scheduleInternal(state: StateType, action: StateType -> Disposable) -> Disposable { + let currentNumberEnqueued = AtomicIncrement(&numberEnqueued) + + if NSThread.currentThread().isMainThread && currentNumberEnqueued == 1 { + let disposable = action(state) + AtomicDecrement(&numberEnqueued) + return disposable + } + + let cancel = SingleAssignmentDisposable() + + dispatch_async(_mainQueue) { + if !cancel.disposed { + action(state) + } + + AtomicDecrement(&self.numberEnqueued) + } + + return cancel + } +} diff --git a/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift new file mode 100644 index 0000000..622cd0e --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift @@ -0,0 +1,59 @@ +// +// OperationQueueScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 4/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Abstracts the work that needs to be performed on a specific `NSOperationQueue`. + +This scheduler is suitable for cases when there is some bigger chunk of work that needs to be performed in background and you want to fine tune concurrent processing using `maxConcurrentOperationCount`. +*/ +public class OperationQueueScheduler: ImmediateSchedulerType { + public let operationQueue: NSOperationQueue + + /** + Constructs new instance of `OperationQueueScheduler` that performs work on `operationQueue`. + + - parameter operationQueue: Operation queue targeted to perform work on. + */ + public init(operationQueue: NSOperationQueue) { + self.operationQueue = operationQueue + } + + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(state: StateType, action: (StateType) -> Disposable) -> Disposable { + + let compositeDisposable = CompositeDisposable() + + weak var compositeDisposableWeak = compositeDisposable + + let operation = NSBlockOperation { + if compositeDisposableWeak?.disposed ?? false { + return + } + + let disposable = action(state) + compositeDisposableWeak?.addDisposable(disposable) + } + + self.operationQueue.addOperation(operation) + + compositeDisposable.addDisposable(AnonymousDisposable { + operation.cancel() + }) + + return compositeDisposable + } + +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift new file mode 100644 index 0000000..731d202 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift @@ -0,0 +1,193 @@ +// +// RecursiveScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Type erased recursive scheduler. +*/ +class AnyRecursiveScheduler { + typealias Action = (state: State, scheduler: AnyRecursiveScheduler) -> Void + + private let _lock = NSRecursiveLock() + + // state + private let _group = CompositeDisposable() + + private var _scheduler: SchedulerType + private var _action: Action? + + init(scheduler: SchedulerType, action: Action) { + _action = action + _scheduler = scheduler + } + + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the recursive action. + */ + func schedule(state: State, dueTime: RxTimeInterval) { + + var isAdded = false + var isDone = false + + var removeKey: CompositeDisposable.DisposeKey? = nil + let d = _scheduler.scheduleRelative(state, dueTime: dueTime) { (state) -> Disposable in + // best effort + if self._group.disposed { + return NopDisposable.instance + } + + let action = self._lock.calculateLocked { () -> Action? in + if isAdded { + self._group.removeDisposable(removeKey!) + } + else { + isDone = true + } + + return self._action + } + + if let action = action { + action(state: state, scheduler: self) + } + + return NopDisposable.instance + } + + _lock.performLocked { + if !isDone { + removeKey = _group.addDisposable(d) + isAdded = true + } + } + } + + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + */ + func schedule(state: State) { + + var isAdded = false + var isDone = false + + var removeKey: CompositeDisposable.DisposeKey? = nil + let d = _scheduler.schedule(state) { (state) -> Disposable in + // best effort + if self._group.disposed { + return NopDisposable.instance + } + + let action = self._lock.calculateLocked { () -> Action? in + if isAdded { + self._group.removeDisposable(removeKey!) + } + else { + isDone = true + } + + return self._action + } + + if let action = action { + action(state: state, scheduler: self) + } + + return NopDisposable.instance + } + + _lock.performLocked { + if !isDone { + removeKey = _group.addDisposable(d) + isAdded = true + } + } + } + + func dispose() { + _lock.performLocked { + _action = nil + } + _group.dispose() + } +} + +/** +Type erased recursive scheduler. +*/ +class RecursiveImmediateScheduler { + typealias Action = (state: State, recurse: State -> Void) -> Void + + private var _lock = SpinLock() + private let _group = CompositeDisposable() + + private var _action: Action? + private let _scheduler: ImmediateSchedulerType + + init(action: Action, scheduler: ImmediateSchedulerType) { + _action = action + _scheduler = scheduler + } + + // immediate scheduling + + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + */ + func schedule(state: State) { + + var isAdded = false + var isDone = false + + var removeKey: CompositeDisposable.DisposeKey? = nil + let d = _scheduler.schedule(state) { (state) -> Disposable in + // best effort + if self._group.disposed { + return NopDisposable.instance + } + + let action = self._lock.calculateLocked { () -> Action? in + if isAdded { + self._group.removeDisposable(removeKey!) + } + else { + isDone = true + } + + return self._action + } + + if let action = action { + action(state: state, recurse: self.schedule) + } + + return NopDisposable.instance + } + + _lock.performLocked { + if !isDone { + removeKey = _group.addDisposable(d) + isAdded = true + } + } + } + + func dispose() { + _lock.performLocked { + _action = nil + } + _group.dispose() + } +} \ No newline at end of file diff --git a/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift b/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift new file mode 100644 index 0000000..3906d7a --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift @@ -0,0 +1,63 @@ +// +// SchedulerServices+Emulation.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +enum SchedulePeriodicRecursiveCommand { + case Tick + case DispatchStart +} + +class SchedulePeriodicRecursive { + typealias RecursiveAction = State -> State + typealias RecursiveScheduler = AnyRecursiveScheduler + + private let _scheduler: SchedulerType + private let _startAfter: RxTimeInterval + private let _period: RxTimeInterval + private let _action: RecursiveAction + + private var _state: State + private var _pendingTickCount: AtomicInt = 0 + + init(scheduler: SchedulerType, startAfter: RxTimeInterval, period: RxTimeInterval, action: RecursiveAction, state: State) { + _scheduler = scheduler + _startAfter = startAfter + _period = period + _action = action + _state = state + } + + func start() -> Disposable { + return _scheduler.scheduleRecursive(SchedulePeriodicRecursiveCommand.Tick, dueTime: _startAfter, action: self.tick) + } + + func tick(command: SchedulePeriodicRecursiveCommand, scheduler: RecursiveScheduler) -> Void { + // Tries to emulate periodic scheduling as best as possible. + // The problem that could arise is if handling periodic ticks take too long, or + // tick interval is short. + switch command { + case .Tick: + scheduler.schedule(.Tick, dueTime: _period) + + // The idea is that if on tick there wasn't any item enqueued, schedule to perform work immediatelly. + // Else work will be scheduled after previous enqueued work completes. + if AtomicIncrement(&_pendingTickCount) == 1 { + self.tick(.DispatchStart, scheduler: scheduler) + } + + case .DispatchStart: + _state = _action(_state) + // Start work and schedule check is this last batch of work + if AtomicDecrement(&_pendingTickCount) > 0 { + // This gives priority to scheduler emulation, it's not perfect, but helps + scheduler.schedule(SchedulePeriodicRecursiveCommand.DispatchStart) + } + } + } +} diff --git a/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift new file mode 100644 index 0000000..82e83e3 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift @@ -0,0 +1,184 @@ +// +// SerialDispatchQueueScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. It will make sure +that even if concurrent dispatch queue is passed, it's transformed into a serial one. + +It is extemely important that this scheduler is serial, because +certain operator perform optimizations that rely on that property. + +Because there is no way of detecting is passed dispatch queue serial or +concurrent, for every queue that is being passed, worst case (concurrent) +will be assumed, and internal serial proxy dispatch queue will be created. + +This scheduler can also be used with internal serial queue alone. + +In case some customization need to be made on it before usage, +internal serial queue can be customized using `serialQueueConfiguration` +callback. +*/ +public class SerialDispatchQueueScheduler: SchedulerType { + public typealias TimeInterval = NSTimeInterval + public typealias Time = NSDate + + private let _serialQueue : dispatch_queue_t + + /** + - returns: Current time. + */ + public var now : NSDate { + return NSDate() + } + + // leeway for scheduling timers + private var _leeway: Int64 = 0 + + init(serialQueue: dispatch_queue_t) { + _serialQueue = serialQueue + } + + /** + Constructs new `SerialDispatchQueueScheduler` with internal serial queue named `internalSerialQueueName`. + + Additional dispatch queue properties can be set after dispatch queue is created using `serialQueueConfiguration`. + + - parameter internalSerialQueueName: Name of internal serial dispatch queue. + - parameter serialQueueConfiguration: Additional configuration of internal serial dispatch queue. + */ + public convenience init(internalSerialQueueName: String, serialQueueConfiguration: ((dispatch_queue_t) -> Void)? = nil) { + let queue = dispatch_queue_create(internalSerialQueueName, DISPATCH_QUEUE_SERIAL) + serialQueueConfiguration?(queue) + self.init(serialQueue: queue) + } + + /** + Constructs new `SerialDispatchQueueScheduler` named `internalSerialQueueName` that wraps `queue`. + + - parameter queue: Possibly concurrent dispatch queue used to perform work. + - parameter internalSerialQueueName: Name of internal serial dispatch queue proxy. + */ + public convenience init(queue: dispatch_queue_t, internalSerialQueueName: String) { + let serialQueue = dispatch_queue_create(internalSerialQueueName, DISPATCH_QUEUE_SERIAL) + dispatch_set_target_queue(serialQueue, queue) + self.init(serialQueue: serialQueue) + } + + /** + Constructs new `SerialDispatchQueueScheduler` that wraps on of the global concurrent dispatch queues. + + - parameter globalConcurrentQueueQOS: Identifier for global dispatch queue with specified quality of service class. + - parameter internalSerialQueueName: Custom name for internal serial dispatch queue proxy. + */ + @available(iOS 8, OSX 10.10, *) + public convenience init(globalConcurrentQueueQOS: DispatchQueueSchedulerQOS, internalSerialQueueName: String = "rx.global_dispatch_queue.serial") { + let priority = globalConcurrentQueueQOS.QOSClass + self.init(queue: dispatch_get_global_queue(priority, UInt(0)), internalSerialQueueName: internalSerialQueueName) + } + + class func convertTimeIntervalToDispatchInterval(timeInterval: NSTimeInterval) -> Int64 { + return Int64(timeInterval * Double(NSEC_PER_SEC)) + } + + class func convertTimeIntervalToDispatchTime(timeInterval: NSTimeInterval) -> dispatch_time_t { + return dispatch_time(DISPATCH_TIME_NOW, convertTimeIntervalToDispatchInterval(timeInterval)) + } + + /** + Schedules an action to be executed immediatelly. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func schedule(state: StateType, action: (StateType) -> Disposable) -> Disposable { + return self.scheduleInternal(state, action: action) + } + + func scheduleInternal(state: StateType, action: (StateType) -> Disposable) -> Disposable { + let cancel = SingleAssignmentDisposable() + + dispatch_async(_serialQueue) { + if cancel.disposed { + return + } + + + cancel.disposable = action(state) + } + + return cancel + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func scheduleRelative(state: StateType, dueTime: NSTimeInterval, action: (StateType) -> Disposable) -> Disposable { + let timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, _serialQueue) + + let dispatchInterval = MainScheduler.convertTimeIntervalToDispatchTime(dueTime) + + let compositeDisposable = CompositeDisposable() + + dispatch_source_set_timer(timer, dispatchInterval, DISPATCH_TIME_FOREVER, 0) + dispatch_source_set_event_handler(timer, { + if compositeDisposable.disposed { + return + } + compositeDisposable.addDisposable(action(state)) + }) + dispatch_resume(timer) + + compositeDisposable.addDisposable(AnonymousDisposable { + dispatch_source_cancel(timer) + }) + + return compositeDisposable + } + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedulePeriodic(state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> Disposable { + let timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, _serialQueue) + + let initial = MainScheduler.convertTimeIntervalToDispatchTime(startAfter) + let dispatchInterval = MainScheduler.convertTimeIntervalToDispatchInterval(period) + + var timerState = state + + let validDispatchInterval = dispatchInterval < 0 ? 0 : UInt64(dispatchInterval) + + dispatch_source_set_timer(timer, initial, validDispatchInterval, 0) + let cancel = AnonymousDisposable { + dispatch_source_cancel(timer) + } + dispatch_source_set_event_handler(timer, { + if cancel.disposed { + return + } + timerState = action(timerState) + }) + dispatch_resume(timer) + + return cancel + } +} diff --git a/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift b/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift new file mode 100644 index 0000000..ab506c4 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift @@ -0,0 +1,127 @@ +// +// VirtualTimeConverterType.swift +// Rx +// +// Created by Krunoslav Zaher on 12/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Parametrization for virtual time used by `VirtualTimeScheduler`s. +*/ +public protocol VirtualTimeConverterType { + /** + Virtual time unit used that represents ticks of virtual clock. + */ + associatedtype VirtualTimeUnit + + /** + Virtual time unit used to represent differences of virtual times. + */ + associatedtype VirtualTimeIntervalUnit + + /** + Converts virtual time to real time. + + - parameter virtualTime: Virtual time to convert to `NSDate`. + - returns: `NSDate` corresponding to virtual time. + */ + func convertFromVirtualTime(virtualTime: VirtualTimeUnit) -> RxTime + + /** + Converts real time to virtual time. + + - parameter time: `NSDate` to convert to virtual time. + - returns: Virtual time corresponding to `NSDate`. + */ + func convertToVirtualTime(time: RxTime) -> VirtualTimeUnit + + /** + Converts from virtual time interval to `NSTimeInterval`. + + - parameter virtualTimeInterval: Virtual time interval to convert to `NSTimeInterval`. + - returns: `NSTimeInterval` corresponding to virtual time interval. + */ + func convertFromVirtualTimeInterval(virtualTimeInterval: VirtualTimeIntervalUnit) -> RxTimeInterval + + /** + Converts from virtual time interval to `NSTimeInterval`. + + - parameter timeInterval: `NSTimeInterval` to convert to virtual time interval. + - returns: Virtual time interval corresponding to time interval. + */ + func convertToVirtualTimeInterval(timeInterval: RxTimeInterval) -> VirtualTimeIntervalUnit + + /** + Offsets virtual time by virtual time interval. + + - parameter time: Virtual time. + - parameter offset: Virtual time interval. + - returns: Time corresponding to time offsetted by virtual time interval. + */ + func offsetVirtualTime(time time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit + + /** + This is aditional abstraction because `NSDate` is unfortunately not comparable. + Extending `NSDate` with `Comparable` would be too risky because of possible collisions with other libraries. + */ + func compareVirtualTime(lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison +} + +/** + Virtual time comparison result. + + This is aditional abstraction because `NSDate` is unfortunately not comparable. + Extending `NSDate` with `Comparable` would be too risky because of possible collisions with other libraries. +*/ +public enum VirtualTimeComparison { + /** + lhs < rhs. + */ + case LessThan + /** + lhs == rhs. + */ + case Equal + /** + lhs > rhs. + */ + case GreaterThan +} + +extension VirtualTimeComparison { + /** + lhs < rhs. + */ + var lessThen: Bool { + if case .LessThan = self { + return true + } + + return false + } + + /** + lhs > rhs + */ + var greaterThan: Bool { + if case .GreaterThan = self { + return true + } + + return false + } + + /** + lhs == rhs + */ + var equal: Bool { + if case .Equal = self { + return true + } + + return false + } +} diff --git a/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift b/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift new file mode 100644 index 0000000..4171683 --- /dev/null +++ b/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift @@ -0,0 +1,292 @@ +// +// VirtualTimeScheduler.swift +// Rx +// +// Created by Krunoslav Zaher on 2/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +/** +Base class for virtual time schedulers using a priority queue for scheduled items. +*/ +public class VirtualTimeScheduler + : SchedulerType + , CustomDebugStringConvertible { + + public typealias VirtualTime = Converter.VirtualTimeUnit + public typealias VirtualTimeInterval = Converter.VirtualTimeIntervalUnit + + private var _running : Bool + + private var _clock: VirtualTime + + private var _schedulerQueue : PriorityQueue> + private var _converter: Converter + + private var _nextId = 0 + + /** + - returns: Current time. + */ + public var now: RxTime { + return _converter.convertFromVirtualTime(clock) + } + + /** + - returns: Scheduler's absolute time clock value. + */ + public var clock: VirtualTime { + return _clock + } + + /** + Creates a new virtual time scheduler. + + - parameter initialClock: Initial value for the clock. + */ + public init(initialClock: VirtualTime, converter: Converter) { + _clock = initialClock + _running = false + _converter = converter + _schedulerQueue = PriorityQueue(hasHigherPriority: { + switch converter.compareVirtualTime($0.time, $1.time) { + case .LessThan: + return true + case .Equal: + return $0.id < $1.id + case .GreaterThan: + return false + } + }) + #if TRACE_RESOURCES + AtomicIncrement(&resourceCount) + #endif + } + + /** + Schedules an action to be executed immediatelly. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(state: StateType, action: StateType -> Disposable) -> Disposable { + return self.scheduleRelative(state, dueTime: 0.0) { a in + return action(a) + } + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleRelative(state: StateType, dueTime: RxTimeInterval, action: StateType -> Disposable) -> Disposable { + let time = self.now.dateByAddingTimeInterval(dueTime) + let absoluteTime = _converter.convertToVirtualTime(time) + let adjustedTime = self.adjustScheduledTime(absoluteTime) + return scheduleAbsoluteVirtual(state, time: adjustedTime, action: action) + } + + /** + Schedules an action to be executed after relative time has passed. + + - parameter state: State passed to the action to be executed. + - parameter time: Absolute time when to execute the action. If this is less or equal then `now`, `now + 1` will be used. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleRelativeVirtual(state: StateType, dueTime: VirtualTimeInterval, action: StateType -> Disposable) -> Disposable { + let time = _converter.offsetVirtualTime(time: self.clock, offset: dueTime) + return scheduleAbsoluteVirtual(state, time: time, action: action) + } + + /** + Schedules an action to be executed at absolute virtual time. + + - parameter state: State passed to the action to be executed. + - parameter time: Absolute time when to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleAbsoluteVirtual(state: StateType, time: Converter.VirtualTimeUnit, action: StateType -> Disposable) -> Disposable { + MainScheduler.ensureExecutingOnScheduler() + + let compositeDisposable = CompositeDisposable() + + let item = VirtualSchedulerItem(action: { + let dispose = action(state) + return dispose + }, time: time, id: _nextId) + + _nextId += 1 + + _schedulerQueue.enqueue(item) + + compositeDisposable.addDisposable(item) + + return compositeDisposable + } + + /** + Adjusts time of scheduling before adding item to schedule queue. + */ + public func adjustScheduledTime(time: Converter.VirtualTimeUnit) -> Converter.VirtualTimeUnit { + return time + } + + /** + Starts the virtual time scheduler. + */ + public func start() { + MainScheduler.ensureExecutingOnScheduler() + + if _running { + return + } + + _running = true + repeat { + guard let next = findNext() else { + break + } + + if _converter.compareVirtualTime(next.time, self.clock).greaterThan { + _clock = next.time + } + + next.invoke() + _schedulerQueue.remove(next) + } while _running + + _running = false + } + + func findNext() -> VirtualSchedulerItem? { + while let front = _schedulerQueue.peek() { + if front.disposed { + _schedulerQueue.remove(front) + continue + } + + return front + } + + return nil + } + + /** + Advances the scheduler's clock to the specified time, running all work till that point. + + - parameter virtualTime: Absolute time to advance the scheduler's clock to. + */ + public func advanceTo(virtualTime: VirtualTime) { + MainScheduler.ensureExecutingOnScheduler() + + if _running { + fatalError("Scheduler is already running") + } + + _running = true + repeat { + guard let next = findNext() else { + break + } + + if _converter.compareVirtualTime(next.time, virtualTime).greaterThan { + break + } + + if _converter.compareVirtualTime(next.time, self.clock).greaterThan { + _clock = next.time + } + + next.invoke() + _schedulerQueue.remove(next) + } while _running + + _clock = virtualTime + _running = false + } + + /** + Advances the scheduler's clock by the specified relative time. + */ + public func sleep(virtualInterval: VirtualTimeInterval) { + MainScheduler.ensureExecutingOnScheduler() + + let sleepTo = _converter.offsetVirtualTime(time: clock, offset: virtualInterval) + if _converter.compareVirtualTime(sleepTo, clock).lessThen { + fatalError("Can't sleep to past.") + } + + _clock = sleepTo + } + + /** + Stops the virtual time scheduler. + */ + public func stop() { + MainScheduler.ensureExecutingOnScheduler() + + _running = false + } + + #if TRACE_RESOURCES + deinit { + AtomicDecrement(&resourceCount) + } + #endif +} + +// MARK: description + +extension VirtualTimeScheduler { + /** + A textual representation of `self`, suitable for debugging. + */ + public var debugDescription: String { + return self._schedulerQueue.debugDescription + } +} + +class VirtualSchedulerItem