├── .gitignore ├── Assets └── RxSwiftPlayer.png ├── Podfile ├── Podfile.lock ├── Pods ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj ├── RxCocoa │ ├── LICENSE.md │ ├── Platform │ │ ├── DataStructures │ │ │ ├── Bag.swift │ │ │ ├── InfiniteSequence.swift │ │ │ ├── PriorityQueue.swift │ │ │ └── Queue.swift │ │ ├── DispatchQueue+Extensions.swift │ │ ├── Platform.Darwin.swift │ │ └── Platform.Linux.swift │ ├── README.md │ └── RxCocoa │ │ ├── CocoaUnits │ │ ├── ControlEvent.swift │ │ ├── ControlProperty.swift │ │ ├── Driver │ │ │ ├── ControlEvent+Driver.swift │ │ │ ├── ControlProperty+Driver.swift │ │ │ ├── Driver+Subscription.swift │ │ │ ├── Driver.swift │ │ │ ├── ObservableConvertibleType+Driver.swift │ │ │ └── Variable+Driver.swift │ │ ├── SharedSequence │ │ │ ├── ObservableConvertibleType+SharedSequence.swift │ │ │ ├── SharedSequence+Operators+arity.swift │ │ │ ├── SharedSequence+Operators.swift │ │ │ ├── SharedSequence.swift │ │ │ └── Variable+SharedSequence.swift │ │ └── UIBindingObserver.swift │ │ ├── Common │ │ ├── ControlTarget.swift │ │ ├── DelegateProxy.swift │ │ ├── DelegateProxyType.swift │ │ ├── NSLayoutConstraint+Rx.swift │ │ ├── Observable+Bind.swift │ │ ├── RxCocoaObjCRuntimeError+Extensions.swift │ │ ├── RxTarget.swift │ │ ├── SectionedViewDataSourceType.swift │ │ └── TextInput.swift │ │ ├── Foundation │ │ ├── KVORepresentable+CoreGraphics.swift │ │ ├── KVORepresentable+Swift.swift │ │ ├── KVORepresentable.swift │ │ ├── Logging.swift │ │ ├── NSNotificationCenter+Rx.swift │ │ ├── NSObject+Rx+KVORepresentable.swift │ │ ├── NSObject+Rx+RawRepresentable.swift │ │ ├── NSObject+Rx.swift │ │ └── URLSession+Rx.swift │ │ ├── Runtime │ │ ├── _RX.m │ │ ├── _RXDelegateProxy.m │ │ ├── _RXKVOObserver.m │ │ ├── _RXObjCRuntime.m │ │ └── include │ │ │ ├── RxCocoaRuntime.h │ │ │ ├── _RX.h │ │ │ ├── _RXDelegateProxy.h │ │ │ ├── _RXKVOObserver.h │ │ │ └── _RXObjCRuntime.h │ │ ├── RxCocoa.h │ │ ├── RxCocoa.swift │ │ └── iOS │ │ ├── DataSources │ │ ├── RxCollectionViewReactiveArrayDataSource.swift │ │ └── RxTableViewReactiveArrayDataSource.swift │ │ ├── Events │ │ └── ItemEvents.swift │ │ ├── NSTextStorage+Rx.swift │ │ ├── Protocols │ │ ├── RxCollectionViewDataSourceType.swift │ │ └── RxTableViewDataSourceType.swift │ │ ├── Proxies │ │ ├── RxCollectionViewDataSourceProxy.swift │ │ ├── RxCollectionViewDelegateProxy.swift │ │ ├── RxPickerViewDelegateProxy.swift │ │ ├── RxScrollViewDelegateProxy.swift │ │ ├── RxSearchBarDelegateProxy.swift │ │ ├── RxSearchControllerDelegateProxy.swift │ │ ├── RxTabBarDelegateProxy.swift │ │ ├── RxTableViewDataSourceProxy.swift │ │ ├── RxTableViewDelegateProxy.swift │ │ ├── RxTextStorageDelegateProxy.swift │ │ └── RxTextViewDelegateProxy.swift │ │ ├── UIActivityIndicatorView+Rx.swift │ │ ├── UIAlertAction+Rx.swift │ │ ├── UIApplication+Rx.swift │ │ ├── UIBarButtonItem+Rx.swift │ │ ├── UIButton+Rx.swift │ │ ├── UICollectionView+Rx.swift │ │ ├── UIControl+Rx.swift │ │ ├── UIDatePicker+Rx.swift │ │ ├── UIGestureRecognizer+Rx.swift │ │ ├── UIImageView+Rx.swift │ │ ├── UILabel+Rx.swift │ │ ├── UINavigationItem+Rx.swift │ │ ├── UIPageControl+Rx.swift │ │ ├── UIPickerView+Rx.swift │ │ ├── UIProgressView+Rx.swift │ │ ├── UIRefreshControl+Rx.swift │ │ ├── UIScrollView+Rx.swift │ │ ├── UISearchBar+Rx.swift │ │ ├── UISearchController+Rx.swift │ │ ├── UISegmentedControl+Rx.swift │ │ ├── UISlider+Rx.swift │ │ ├── UIStepper+Rx.swift │ │ ├── UISwitch+Rx.swift │ │ ├── UITabBar+Rx.swift │ │ ├── UITabBarItem+Rx.swift │ │ ├── UITableView+Rx.swift │ │ ├── UITextField+Rx.swift │ │ ├── UITextView+Rx.swift │ │ ├── UIView+Rx.swift │ │ └── UIViewController+Rx.swift ├── RxDataSources │ ├── LICENSE.md │ ├── README.md │ └── Sources │ │ ├── DataSources+Rx │ │ ├── RxCollectionViewSectionedAnimatedDataSource.swift │ │ ├── RxCollectionViewSectionedReloadDataSource.swift │ │ ├── RxTableViewSectionedAnimatedDataSource.swift │ │ └── RxTableViewSectionedReloadDataSource.swift │ │ └── DataSources │ │ ├── AnimatableSectionModel.swift │ │ ├── AnimatableSectionModelType+ItemPath.swift │ │ ├── AnimatableSectionModelType.swift │ │ ├── AnimationConfiguration.swift │ │ ├── Array+Extensions.swift │ │ ├── Changeset.swift │ │ ├── CollectionViewSectionedDataSource.swift │ │ ├── DataSources.swift │ │ ├── Differentiator.swift │ │ ├── FloatingPointType+IdentifiableType.swift │ │ ├── IdentifiableType.swift │ │ ├── IdentifiableValue.swift │ │ ├── IntegerType+IdentifiableType.swift │ │ ├── ItemPath.swift │ │ ├── Optional+Extensions.swift │ │ ├── SectionModel.swift │ │ ├── SectionModelType.swift │ │ ├── String+IdentifiableType.swift │ │ ├── TableViewSectionedDataSource.swift │ │ └── UI+SectionedViewType.swift ├── RxSwift │ ├── LICENSE.md │ ├── Platform │ │ ├── DataStructures │ │ │ ├── Bag.swift │ │ │ ├── InfiniteSequence.swift │ │ │ ├── PriorityQueue.swift │ │ │ └── Queue.swift │ │ ├── DispatchQueue+Extensions.swift │ │ ├── Platform.Darwin.swift │ │ └── Platform.Linux.swift │ ├── README.md │ └── RxSwift │ │ ├── AnyObserver.swift │ │ ├── Cancelable.swift │ │ ├── Concurrency │ │ ├── AsyncLock.swift │ │ ├── Lock.swift │ │ ├── LockOwnerType.swift │ │ ├── SynchronizedDisposeType.swift │ │ ├── SynchronizedOnType.swift │ │ ├── SynchronizedSubscribeType.swift │ │ └── SynchronizedUnsubscribeType.swift │ │ ├── ConnectableObservableType.swift │ │ ├── Disposable.swift │ │ ├── Disposables │ │ ├── AnonymousDisposable.swift │ │ ├── BinaryDisposable.swift │ │ ├── BooleanDisposable.swift │ │ ├── CompositeDisposable.swift │ │ ├── Disposables.swift │ │ ├── DisposeBag.swift │ │ ├── DisposeBase.swift │ │ ├── NopDisposable.swift │ │ ├── RefCountDisposable.swift │ │ ├── ScheduledDisposable.swift │ │ ├── SerialDisposable.swift │ │ ├── SingleAssignmentDisposable.swift │ │ └── SubscriptionDisposable.swift │ │ ├── Errors.swift │ │ ├── Event.swift │ │ ├── Extensions │ │ ├── Bag+Rx.swift │ │ └── String+Rx.swift │ │ ├── ImmediateSchedulerType.swift │ │ ├── Observable.swift │ │ ├── ObservableConvertibleType.swift │ │ ├── ObservableType+Extensions.swift │ │ ├── ObservableType.swift │ │ ├── Observables │ │ ├── Implementations │ │ │ ├── AddRef.swift │ │ │ ├── Amb.swift │ │ │ ├── AnonymousObservable.swift │ │ │ ├── Buffer.swift │ │ │ ├── Catch.swift │ │ │ ├── CombineLatest+Collection.swift │ │ │ ├── CombineLatest+arity.swift │ │ │ ├── CombineLatest.swift │ │ │ ├── Concat.swift │ │ │ ├── ConnectableObservable.swift │ │ │ ├── Debug.swift │ │ │ ├── Debunce.swift │ │ │ ├── Deferred.swift │ │ │ ├── Delay.swift │ │ │ ├── DelaySubscription.swift │ │ │ ├── DistinctUntilChanged.swift │ │ │ ├── Do.swift │ │ │ ├── ElementAt.swift │ │ │ ├── Empty.swift │ │ │ ├── Error.swift │ │ │ ├── Filter.swift │ │ │ ├── Generate.swift │ │ │ ├── Just.swift │ │ │ ├── Map.swift │ │ │ ├── Merge.swift │ │ │ ├── Multicast.swift │ │ │ ├── Never.swift │ │ │ ├── ObserveOn.swift │ │ │ ├── ObserveOnSerialDispatchQueue.swift │ │ │ ├── Producer.swift │ │ │ ├── Range.swift │ │ │ ├── Reduce.swift │ │ │ ├── RefCount.swift │ │ │ ├── Repeat.swift │ │ │ ├── RetryWhen.swift │ │ │ ├── Sample.swift │ │ │ ├── Scan.swift │ │ │ ├── Sequence.swift │ │ │ ├── ShareReplay1.swift │ │ │ ├── ShareReplay1WhileConnected.swift │ │ │ ├── SingleAsync.swift │ │ │ ├── Sink.swift │ │ │ ├── Skip.swift │ │ │ ├── SkipUntil.swift │ │ │ ├── SkipWhile.swift │ │ │ ├── StartWith.swift │ │ │ ├── SubscribeOn.swift │ │ │ ├── Switch.swift │ │ │ ├── Take.swift │ │ │ ├── TakeLast.swift │ │ │ ├── TakeUntil.swift │ │ │ ├── TakeWhile.swift │ │ │ ├── Throttle.swift │ │ │ ├── Timeout.swift │ │ │ ├── Timer.swift │ │ │ ├── ToArray.swift │ │ │ ├── Using.swift │ │ │ ├── Window.swift │ │ │ ├── WithLatestFrom.swift │ │ │ ├── Zip+Collection.swift │ │ │ ├── Zip+arity.swift │ │ │ └── Zip.swift │ │ ├── Observable+Aggregate.swift │ │ ├── Observable+Binding.swift │ │ ├── Observable+Concurrency.swift │ │ ├── Observable+Creation.swift │ │ ├── Observable+Debug.swift │ │ ├── Observable+Multiple.swift │ │ ├── Observable+Single.swift │ │ ├── Observable+StandardSequenceOperators.swift │ │ └── Observable+Time.swift │ │ ├── ObserverType.swift │ │ ├── Observers │ │ ├── AnonymousObserver.swift │ │ ├── ObserverBase.swift │ │ └── TailRecursiveSink.swift │ │ ├── Reactive.swift │ │ ├── Rx.swift │ │ ├── RxMutableBox.swift │ │ ├── SchedulerType.swift │ │ ├── Schedulers │ │ ├── ConcurrentDispatchQueueScheduler.swift │ │ ├── ConcurrentMainScheduler.swift │ │ ├── CurrentThreadScheduler.swift │ │ ├── HistoricalScheduler.swift │ │ ├── HistoricalSchedulerTimeConverter.swift │ │ ├── ImmediateScheduler.swift │ │ ├── Internal │ │ │ ├── AnonymousInvocable.swift │ │ │ ├── DispatchQueueConfiguration.swift │ │ │ ├── InvocableScheduledItem.swift │ │ │ ├── InvocableType.swift │ │ │ ├── ScheduledItem.swift │ │ │ └── ScheduledItemType.swift │ │ ├── MainScheduler.swift │ │ ├── OperationQueueScheduler.swift │ │ ├── RecursiveScheduler.swift │ │ ├── SchedulerServices+Emulation.swift │ │ ├── SerialDispatchQueueScheduler.swift │ │ ├── VirtualTimeConverterType.swift │ │ └── VirtualTimeScheduler.swift │ │ └── Subjects │ │ ├── BehaviorSubject.swift │ │ ├── PublishSubject.swift │ │ ├── ReplaySubject.swift │ │ ├── SubjectType.swift │ │ └── Variable.swift └── Target Support Files │ ├── Pods-RxSwiftPlayer │ ├── Info.plist │ ├── Pods-RxSwiftPlayer-acknowledgements.markdown │ ├── Pods-RxSwiftPlayer-acknowledgements.plist │ ├── Pods-RxSwiftPlayer-dummy.m │ ├── Pods-RxSwiftPlayer-frameworks.sh │ ├── Pods-RxSwiftPlayer-resources.sh │ ├── Pods-RxSwiftPlayer-umbrella.h │ ├── Pods-RxSwiftPlayer.debug.xcconfig │ ├── Pods-RxSwiftPlayer.modulemap │ └── Pods-RxSwiftPlayer.release.xcconfig │ ├── RxCocoa │ ├── Info.plist │ ├── RxCocoa-dummy.m │ ├── RxCocoa-prefix.pch │ ├── RxCocoa-umbrella.h │ ├── RxCocoa.modulemap │ └── RxCocoa.xcconfig │ ├── RxDataSources │ ├── Info.plist │ ├── RxDataSources-dummy.m │ ├── RxDataSources-prefix.pch │ ├── RxDataSources-umbrella.h │ ├── RxDataSources.modulemap │ └── RxDataSources.xcconfig │ └── RxSwift │ ├── Info.plist │ ├── RxSwift-dummy.m │ ├── RxSwift-prefix.pch │ ├── RxSwift-umbrella.h │ ├── RxSwift.modulemap │ └── RxSwift.xcconfig ├── README.md ├── RxSwiftPlayer.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── RxSwiftPlayer.xcworkspace └── contents.xcworkspacedata └── RxSwiftPlayer ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ ├── Contents.json │ ├── Icon-40.png │ ├── Icon-40@2x.png │ ├── Icon-40@3x.png │ ├── Icon-60@2x.png │ ├── Icon-60@3x.png │ ├── Icon-76.png │ ├── Icon-76@2x.png │ ├── Icon-83.5@2x.png │ ├── Icon-Small.png │ ├── Icon-Small@2x.png │ └── Icon-Small@3x.png └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── BasicControlsViewController.swift ├── Button.swift ├── ContainedTextViewViewController.swift ├── ExamplesViewController.swift ├── Info.plist ├── PresentedTextViewViewController.swift ├── RxSwiftPlayer.ttf ├── SectionedTableViewAnimatedViewController.swift ├── SectionedTableViewReloadViewController.swift ├── TextView.swift └── TwoWayBindingViewController.swift /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | gitignore 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | # CocoaPods 24 | # 25 | # We recommend against adding the Pods directory to your .gitignore. However 26 | # you should judge for yourself, the pros and cons are mentioned at: 27 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 28 | # 29 | # Pods/ 30 | -------------------------------------------------------------------------------- /Assets/RxSwiftPlayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/Assets/RxSwiftPlayer.png -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | target 'RxSwiftPlayer' do 2 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 3 | use_frameworks! 4 | 5 | pod 'RxSwift' 6 | pod 'RxCocoa' 7 | pod 'RxDataSources' 8 | 9 | end 10 | 11 | post_install do |installer| 12 | installer.pods_project.targets.each do |target| 13 | if target.name == 'RxSwift' 14 | target.build_configurations.each do |config| 15 | if config.name == 'Debug' 16 | config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['-D', 'TRACE_RESOURCES'] 17 | end 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - RxCocoa (3.0.1): 3 | - RxSwift (~> 3.0) 4 | - RxDataSources (1.0.0): 5 | - RxCocoa (~> 3.0) 6 | - RxSwift (~> 3.0) 7 | - RxSwift (3.0.1) 8 | 9 | DEPENDENCIES: 10 | - RxCocoa 11 | - RxDataSources 12 | - RxSwift 13 | 14 | SPEC CHECKSUMS: 15 | RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 16 | RxDataSources: 824693e84d00781d0a5e5cedc1ff95ce9250aacd 17 | RxSwift: af5680055c4ad04480189c52d28385b1029493a6 18 | 19 | PODFILE CHECKSUM: 96d70417d4389703a70f440507411c662a23214f 20 | 21 | COCOAPODS: 1.1.1 22 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - RxCocoa (3.0.1): 3 | - RxSwift (~> 3.0) 4 | - RxDataSources (1.0.0): 5 | - RxCocoa (~> 3.0) 6 | - RxSwift (~> 3.0) 7 | - RxSwift (3.0.1) 8 | 9 | DEPENDENCIES: 10 | - RxCocoa 11 | - RxDataSources 12 | - RxSwift 13 | 14 | SPEC CHECKSUMS: 15 | RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 16 | RxDataSources: 824693e84d00781d0a5e5cedc1ff95ce9250aacd 17 | RxSwift: af5680055c4ad04480189c52d28385b1029493a6 18 | 19 | PODFILE CHECKSUM: 96d70417d4389703a70f440507411c662a23214f 20 | 21 | COCOAPODS: 1.1.1 22 | -------------------------------------------------------------------------------- /Pods/RxCocoa/LICENSE.md: -------------------------------------------------------------------------------- 1 | **The MIT License** 2 | **Copyright © 2015 Krunoslav Zaher** 3 | **All rights reserved.** 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. -------------------------------------------------------------------------------- /Pods/RxCocoa/Platform/DataStructures/InfiniteSequence.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InfiniteSequence.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 6/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Sequence that repeats `repeatedValue` infinite number of times. 12 | struct InfiniteSequence : Sequence { 13 | typealias Element = E 14 | typealias Iterator = AnyIterator 15 | 16 | private let _repeatedValue: E 17 | 18 | init(repeatedValue: E) { 19 | _repeatedValue = repeatedValue 20 | } 21 | 22 | func makeIterator() -> Iterator { 23 | let repeatedValue = _repeatedValue 24 | return AnyIterator { 25 | return repeatedValue 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Pods/RxCocoa/Platform/DispatchQueue+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DispatchQueue+Extensions.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 10/22/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Dispatch 11 | 12 | extension DispatchQueue { 13 | private static var token: DispatchSpecificKey<()> = { 14 | let key = DispatchSpecificKey<()>() 15 | DispatchQueue.main.setSpecific(key: key, value: ()) 16 | return key 17 | }() 18 | 19 | static var isMain: Bool { 20 | return DispatchQueue.getSpecific(key: token) != nil 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pods/RxCocoa/Platform/Platform.Darwin.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Platform.Darwin.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 12/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 10 | 11 | import Darwin 12 | import Foundation 13 | 14 | typealias AtomicInt = Int32 15 | 16 | let AtomicCompareAndSwap = OSAtomicCompareAndSwap32Barrier 17 | let AtomicIncrement = OSAtomicIncrement32Barrier 18 | let AtomicDecrement = OSAtomicDecrement32Barrier 19 | 20 | extension Thread { 21 | 22 | static func setThreadLocalStorageValue(_ value: T?, forKey key: String 23 | ) { 24 | let currentThread = Thread.current 25 | let threadDictionary = currentThread.threadDictionary 26 | 27 | if let newValue = value { 28 | threadDictionary[key] = newValue 29 | } 30 | else { 31 | threadDictionary[key] = nil 32 | } 33 | 34 | } 35 | static func getThreadLocalStorageValueForKey(_ key: String) -> T? { 36 | let currentThread = Thread.current 37 | let threadDictionary = currentThread.threadDictionary 38 | 39 | return threadDictionary[key] as? T 40 | } 41 | } 42 | 43 | extension AtomicInt { 44 | func valueSnapshot() -> Int32 { 45 | return self 46 | } 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/CocoaUnits/Driver/ControlEvent+Driver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ControlEvent+Driver.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 9/19/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | extension ControlEvent { 15 | /// Converts `ControlEvent` to `Driver` unit. 16 | /// 17 | /// `ControlEvent` already can't fail, so no special case needs to be handled. 18 | public func asDriver() -> Driver { 19 | return self.asDriver { (error) -> Driver in 20 | #if DEBUG 21 | rxFatalError("Somehow driver received error from a source that shouldn't fail.") 22 | #else 23 | return Driver.empty() 24 | #endif 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/CocoaUnits/Driver/ControlProperty+Driver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ControlProperty+Driver.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 9/19/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | extension ControlProperty { 15 | /// Converts `ControlProperty` to `Driver` unit. 16 | /// 17 | /// `ControlProperty` already can't fail, so no special case needs to be handled. 18 | public func asDriver() -> Driver { 19 | return self.asDriver { (error) -> Driver in 20 | #if DEBUG 21 | rxFatalError("Somehow driver received error from a source that shouldn't fail.") 22 | #else 23 | return Driver.empty() 24 | #endif 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObservableConvertibleType+Driver.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 9/19/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | extension ObservableConvertibleType { 15 | /** 16 | Converts anything convertible to `Observable` to `Driver` unit. 17 | 18 | - parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence. 19 | - returns: Driving observable sequence. 20 | */ 21 | public func asDriver(onErrorJustReturn: E) -> Driver { 22 | let source = self 23 | .asObservable() 24 | .observeOn(DriverSharingStrategy.scheduler) 25 | .catchErrorJustReturn(onErrorJustReturn) 26 | return Driver(source) 27 | } 28 | 29 | /** 30 | Converts anything convertible to `Observable` to `Driver` unit. 31 | 32 | - parameter onErrorDriveWith: Driver that continues to drive the sequence in case of error. 33 | - returns: Driving observable sequence. 34 | */ 35 | public func asDriver(onErrorDriveWith: Driver) -> Driver { 36 | let source = self 37 | .asObservable() 38 | .observeOn(DriverSharingStrategy.scheduler) 39 | .catchError { _ in 40 | onErrorDriveWith.asObservable() 41 | } 42 | return Driver(source) 43 | } 44 | 45 | /** 46 | Converts anything convertible to `Observable` to `Driver` unit. 47 | 48 | - parameter onErrorRecover: Calculates driver that continues to drive the sequence in case of error. 49 | - returns: Driving observable sequence. 50 | */ 51 | public func asDriver(onErrorRecover: @escaping (_ error: Swift.Error) -> Driver) -> Driver { 52 | let source = self 53 | .asObservable() 54 | .observeOn(DriverSharingStrategy.scheduler) 55 | .catchError { error in 56 | onErrorRecover(error).asObservable() 57 | } 58 | return Driver(source) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/CocoaUnits/Driver/Variable+Driver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Variable+Driver.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 12/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | extension Variable { 15 | /// Converts `Variable` to `Driver` unit. 16 | /// 17 | /// - returns: Driving observable sequence. 18 | public func asDriver() -> Driver { 19 | let source = self.asObservable() 20 | .observeOn(DriverSharingStrategy.scheduler) 21 | return Driver(source) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/CocoaUnits/SharedSequence/Variable+SharedSequence.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Variable+SharedSequence.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 12/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | extension Variable { 15 | /// Converts `Variable` to `SharedSequence` unit. 16 | /// 17 | /// - returns: Observable sequence. 18 | public func asSharedSequence(strategy: SharingStrategy.Type = SharingStrategy.self) -> SharedSequence { 19 | let source = self.asObservable() 20 | .observeOn(SharingStrategy.scheduler) 21 | return SharedSequence(source) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/CocoaUnits/UIBindingObserver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIBindingObserver.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 2/7/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | /** 15 | Observer that enforces interface binding rules: 16 | * can't bind errors (in debug builds binding of errors causes `fatalError` in release builds errors are being logged) 17 | * ensures binding is performed on main thread 18 | 19 | `UIBindingObserver` doesn't retain target interface and in case owned interface element is released, element isn't bound. 20 | */ 21 | public class UIBindingObserver : ObserverType where UIElementType: AnyObject { 22 | public typealias E = Value 23 | 24 | weak var UIElement: UIElementType? 25 | 26 | let binding: (UIElementType, Value) -> Void 27 | 28 | /// Initializes `ViewBindingObserver` using 29 | public init(UIElement: UIElementType, binding: @escaping (UIElementType, Value) -> Void) { 30 | self.UIElement = UIElement 31 | self.binding = binding 32 | } 33 | 34 | /// Binds next element to owner view as described in `binding`. 35 | public func on(_ event: Event) { 36 | MainScheduler.ensureExecutingOnScheduler(errorMessage: "Element can be bound to user interface only on MainThread.") 37 | 38 | switch event { 39 | case .next(let element): 40 | if let view = self.UIElement { 41 | binding(view, element) 42 | } 43 | case .error(let error): 44 | bindingErrorToInterface(error) 45 | case .completed: 46 | break 47 | } 48 | } 49 | 50 | /// Erases type of observer. 51 | /// 52 | /// - returns: type erased observer. 53 | public func asObserver() -> AnyObserver { 54 | return AnyObserver(eventHandler: on) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 12/6/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if !os(Linux) 10 | 11 | import Foundation 12 | 13 | #if os(macOS) 14 | import Cocoa 15 | #else 16 | import UIKit 17 | #endif 18 | 19 | #if !RX_NO_MODULE 20 | import RxSwift 21 | #endif 22 | 23 | #if os(iOS) || os(macOS) || os(tvOS) 24 | extension Reactive where Base: NSLayoutConstraint { 25 | /// Bindable sink for `constant` property. 26 | public var constant: UIBindingObserver { 27 | return UIBindingObserver(UIElement: self.base) { constraint, constant in 28 | constraint.constant = constant 29 | } 30 | } 31 | 32 | /// Bindable sink for `active` property. 33 | @available(iOS 8, OSX 10.10, *) 34 | public var active: UIBindingObserver { 35 | return UIBindingObserver(UIElement: self.base) { constraint, value in 36 | constraint.isActive = value 37 | } 38 | } 39 | } 40 | 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Common/RxTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTarget.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 7/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | class RxTarget : NSObject 15 | , Disposable { 16 | 17 | private var retainSelf: RxTarget? 18 | 19 | override init() { 20 | super.init() 21 | self.retainSelf = self 22 | 23 | #if TRACE_RESOURCES 24 | _ = Resources.incrementTotal() 25 | #endif 26 | 27 | #if DEBUG 28 | MainScheduler.ensureExecutingOnScheduler() 29 | #endif 30 | } 31 | 32 | func dispose() { 33 | #if DEBUG 34 | MainScheduler.ensureExecutingOnScheduler() 35 | #endif 36 | self.retainSelf = nil 37 | } 38 | 39 | #if TRACE_RESOURCES 40 | deinit { 41 | _ = Resources.decrementTotal() 42 | } 43 | #endif 44 | } 45 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SectionedViewDataSourceType.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 1/10/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Data source with access to underlying sectioned model. 12 | public protocol SectionedViewDataSourceType { 13 | /// Returns model at index path. 14 | /// 15 | /// In case data source doesn't contain any sections when this method is being called, `RxCocoaError.ItemsNotYetBound(object: self)` is thrown. 16 | 17 | /// - parameter indexPath: Model index path 18 | /// - returns: Model at index path. 19 | func model(at indexPath: IndexPath) throws -> Any 20 | } 21 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Common/TextInput.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextInput.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 5/12/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if !RX_NO_MODULE 12 | import RxSwift 13 | #endif 14 | 15 | #if os(iOS) || os(tvOS) 16 | import UIKit 17 | 18 | /// Represents text input with reactive extensions. 19 | public struct TextInput { 20 | /// Base text input to extend. 21 | public let base: Base 22 | 23 | /// Reactive wrapper for `text` property. 24 | public let text: ControlProperty 25 | 26 | /// Initializes new text input. 27 | /// 28 | /// - parameter base: Base object. 29 | /// - parameter text: Textual control property. 30 | public init(base: Base, text: ControlProperty) { 31 | self.base = base 32 | self.text = text 33 | } 34 | } 35 | 36 | extension Reactive where Base: UITextField { 37 | /// Reactive text input. 38 | public var textInput: TextInput { 39 | return TextInput(base: base, text: self.text) 40 | } 41 | } 42 | 43 | extension Reactive where Base: UITextView { 44 | /// Reactive text input. 45 | public var textInput: TextInput { 46 | return TextInput(base: base, text: self.text) 47 | } 48 | } 49 | 50 | #endif 51 | 52 | #if os(macOS) 53 | import Cocoa 54 | 55 | /// Represents text input with reactive extensions. 56 | public struct TextInput { 57 | /// Base text input to extend. 58 | public let base: Base 59 | 60 | /// Reactive wrapper for `text` property. 61 | public let text: ControlProperty 62 | 63 | /// Initializes new text input. 64 | /// 65 | /// - parameter base: Base object. 66 | /// - parameter text: Textual control property. 67 | public init(base: Base, text: ControlProperty) { 68 | self.base = base 69 | self.text = text 70 | } 71 | } 72 | 73 | extension Reactive where Base: NSTextField, Base: NSTextInputClient { 74 | /// Reactive text input. 75 | public var textInput: TextInput { 76 | return TextInput(base: base, text: self.text) 77 | } 78 | } 79 | 80 | #endif 81 | 82 | 83 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KVORepresentable+CoreGraphics.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 11/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if !os(Linux) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import CoreGraphics 16 | 17 | #if arch(x86_64) || arch(arm64) 18 | let CGRectType = "{CGRect={CGPoint=dd}{CGSize=dd}}" 19 | let CGSizeType = "{CGSize=dd}" 20 | let CGPointType = "{CGPoint=dd}" 21 | #elseif arch(i386) || arch(arm) 22 | let CGRectType = "{CGRect={CGPoint=ff}{CGSize=ff}}" 23 | let CGSizeType = "{CGSize=ff}" 24 | let CGPointType = "{CGPoint=ff}" 25 | #endif 26 | 27 | extension CGRect : KVORepresentable { 28 | public typealias KVOType = NSValue 29 | 30 | /// Constructs self from `NSValue`. 31 | public init?(KVOValue: KVOType) { 32 | if strcmp(KVOValue.objCType, CGRectType) != 0 { 33 | return nil 34 | } 35 | var typedValue = CGRect(x: 0, y: 0, width: 0, height: 0) 36 | KVOValue.getValue(&typedValue) 37 | self = typedValue 38 | } 39 | } 40 | 41 | extension CGPoint : KVORepresentable { 42 | public typealias KVOType = NSValue 43 | 44 | /// Constructs self from `NSValue`. 45 | public init?(KVOValue: KVOType) { 46 | if strcmp(KVOValue.objCType, CGPointType) != 0 { 47 | return nil 48 | } 49 | var typedValue = CGPoint(x: 0, y: 0) 50 | KVOValue.getValue(&typedValue) 51 | self = typedValue 52 | } 53 | } 54 | 55 | extension CGSize : KVORepresentable { 56 | public typealias KVOType = NSValue 57 | 58 | /// Constructs self from `NSValue`. 59 | public init?(KVOValue: KVOType) { 60 | if strcmp(KVOValue.objCType, CGSizeType) != 0 { 61 | return nil 62 | } 63 | var typedValue = CGSize(width: 0, height: 0) 64 | KVOValue.getValue(&typedValue) 65 | self = typedValue 66 | } 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+Swift.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KVORepresentable+Swift.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 11/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Int : KVORepresentable { 12 | public typealias KVOType = NSNumber 13 | 14 | /// Constructs `Self` using KVO value. 15 | public init?(KVOValue: KVOType) { 16 | self.init(KVOValue.int32Value) 17 | } 18 | } 19 | 20 | extension Int32 : KVORepresentable { 21 | public typealias KVOType = NSNumber 22 | 23 | /// Constructs `Self` using KVO value. 24 | public init?(KVOValue: KVOType) { 25 | self.init(KVOValue.int32Value) 26 | } 27 | } 28 | 29 | extension Int64 : KVORepresentable { 30 | public typealias KVOType = NSNumber 31 | 32 | /// Constructs `Self` using KVO value. 33 | public init?(KVOValue: KVOType) { 34 | self.init(KVOValue.int64Value) 35 | } 36 | } 37 | 38 | extension UInt : KVORepresentable { 39 | public typealias KVOType = NSNumber 40 | 41 | /// Constructs `Self` using KVO value. 42 | public init?(KVOValue: KVOType) { 43 | self.init(KVOValue.uintValue) 44 | } 45 | } 46 | 47 | extension UInt32 : KVORepresentable { 48 | public typealias KVOType = NSNumber 49 | 50 | /// Constructs `Self` using KVO value. 51 | public init?(KVOValue: KVOType) { 52 | self.init(KVOValue.uint32Value) 53 | } 54 | } 55 | 56 | extension UInt64 : KVORepresentable { 57 | public typealias KVOType = NSNumber 58 | 59 | /// Constructs `Self` using KVO value. 60 | public init?(KVOValue: KVOType) { 61 | self.init(KVOValue.uint64Value) 62 | } 63 | } 64 | 65 | extension Bool : KVORepresentable { 66 | public typealias KVOType = NSNumber 67 | 68 | /// Constructs `Self` using KVO value. 69 | public init?(KVOValue: KVOType) { 70 | self.init(KVOValue.boolValue) 71 | } 72 | } 73 | 74 | 75 | extension RawRepresentable where RawValue: KVORepresentable { 76 | /// Constructs `Self` using optional KVO value. 77 | init?(KVOValue: RawValue.KVOType?) { 78 | guard let KVOValue = KVOValue else { 79 | return nil 80 | } 81 | 82 | guard let rawValue = RawValue(KVOValue: KVOValue) else { 83 | return nil 84 | } 85 | 86 | self.init(rawValue: rawValue) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KVORepresentable.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 11/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Type that is KVO representable (KVO mechanism can be used to observe it). 12 | public protocol KVORepresentable { 13 | /// Associated KVO type. 14 | associatedtype KVOType 15 | 16 | /// Constructs `Self` using KVO value. 17 | init?(KVOValue: KVOType) 18 | } 19 | 20 | extension KVORepresentable { 21 | /// Initializes `KVORepresentable` with optional value. 22 | init?(KVOValue: KVOType?) { 23 | guard let KVOValue = KVOValue else { 24 | return nil 25 | } 26 | 27 | self.init(KVOValue: KVOValue) 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Foundation/Logging.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Logging.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 4/3/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Simple logging settings for RxCocoa library. 12 | public struct Logging { 13 | public typealias LogURLRequest = (URLRequest) -> Bool 14 | 15 | /// Log URL requests to standard output in curl format. 16 | public static var URLRequests: LogURLRequest = { _ in 17 | #if DEBUG 18 | return true 19 | #else 20 | return false 21 | #endif 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Foundation/NSNotificationCenter+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSNotificationCenter+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 5/2/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if !RX_NO_MODULE 11 | import RxSwift 12 | #endif 13 | 14 | extension Reactive where Base: NotificationCenter { 15 | /** 16 | Transforms notifications posted to notification center to observable sequence of notifications. 17 | 18 | - parameter name: Optional name used to filter notifications. 19 | - parameter object: Optional object used to filter notifications. 20 | - returns: Observable sequence of posted notifications. 21 | */ 22 | public func notification(_ name: Notification.Name?, object: AnyObject? = nil) -> Observable { 23 | return Observable.create { [weak object] observer in 24 | let nsObserver = self.base.addObserver(forName: name, object: object, queue: nil) { notification in 25 | observer.on(.next(notification)) 26 | } 27 | 28 | return Disposables.create { 29 | self.base.removeObserver(nsObserver) 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Rx+KVORepresentable.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 11/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if !os(Linux) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | extension Reactive where Base: NSObject { 17 | 18 | /** 19 | Specialization of generic `observe` method. 20 | 21 | This is a special overload because to observe values of some type (for example `Int`), first values of KVO type 22 | need to be observed (`NSNumber`), and then converted to result type. 23 | 24 | For more information take a look at `observe` method. 25 | */ 26 | public func observe(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable { 27 | return observe(E.KVOType.self, keyPath, options: options, retainSelf: retainSelf) 28 | .map(E.init) 29 | } 30 | } 31 | 32 | #if !DISABLE_SWIZZLING && !os(Linux) 33 | // KVO 34 | extension Reactive where Base: NSObject { 35 | /** 36 | Specialization of generic `observeWeakly` method. 37 | 38 | For more information take a look at `observeWeakly` method. 39 | */ 40 | public func observeWeakly(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial]) -> Observable { 41 | return observeWeakly(E.KVOType.self, keyPath, options: options) 42 | .map(E.init) 43 | } 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Rx+RawRepresentable.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 11/9/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if !os(Linux) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | extension Reactive where Base: NSObject { 17 | /** 18 | Specialization of generic `observe` method. 19 | 20 | This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value. 21 | 22 | It is useful for observing bridged ObjC enum values. 23 | 24 | For more information take a look at `observe` method. 25 | */ 26 | public func observe(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable where E.RawValue: KVORepresentable { 27 | return observe(E.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf) 28 | .map(E.init) 29 | } 30 | } 31 | 32 | #if !DISABLE_SWIZZLING 33 | 34 | // observeWeakly + RawRepresentable 35 | extension Reactive where Base: NSObject { 36 | 37 | /** 38 | Specialization of generic `observeWeakly` method. 39 | 40 | This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value. 41 | 42 | It is useful for observing bridged ObjC enum values. 43 | 44 | For more information take a look at `observeWeakly` method. 45 | */ 46 | public func observeWeakly(_ type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.new, .initial]) -> Observable where E.RawValue: KVORepresentable { 47 | return observeWeakly(E.RawValue.KVOType.self, keyPath, options: options) 48 | .map(E.init) 49 | } 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Runtime/_RX.m: -------------------------------------------------------------------------------- 1 | // 2 | // _RX.m 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 7/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #import "include/_RX.h" 10 | 11 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Runtime/_RXKVOObserver.m: -------------------------------------------------------------------------------- 1 | // 2 | // _RXKVOObserver.m 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 7/11/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #import "include/_RXKVOObserver.h" 10 | 11 | @interface _RXKVOObserver () 12 | 13 | @property (nonatomic, unsafe_unretained) id target; 14 | @property (nonatomic, strong ) id retainedTarget; 15 | @property (nonatomic, copy ) NSString *keyPath; 16 | @property (nonatomic, copy ) void (^callback)(id); 17 | 18 | @end 19 | 20 | @implementation _RXKVOObserver 21 | 22 | -(instancetype)initWithTarget:(id)target 23 | retainTarget:(BOOL)retainTarget 24 | keyPath:(NSString*)keyPath 25 | options:(NSKeyValueObservingOptions)options 26 | callback:(void (^)(id))callback { 27 | self = [super init]; 28 | if (!self) return nil; 29 | 30 | self.target = target; 31 | if (retainTarget) { 32 | self.retainedTarget = target; 33 | } 34 | self.keyPath = keyPath; 35 | self.callback = callback; 36 | 37 | [self.target addObserver:self forKeyPath:self.keyPath options:options context:nil]; 38 | 39 | return self; 40 | } 41 | 42 | -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 43 | @synchronized(self) { 44 | self.callback(change[NSKeyValueChangeNewKey]); 45 | } 46 | } 47 | 48 | -(void)dispose { 49 | [self.target removeObserver:self forKeyPath:self.keyPath context:nil]; 50 | self.target = nil; 51 | self.retainedTarget = nil; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h: -------------------------------------------------------------------------------- 1 | // 2 | // RxCocoaRuntime.h 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 2/21/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "_RX.h" 11 | #import "_RXDelegateProxy.h" 12 | #import "_RXKVOObserver.h" 13 | #import "_RXObjCRuntime.h" 14 | 15 | //! Project version number for RxCocoa. 16 | FOUNDATION_EXPORT double RxCocoaVersionNumber; 17 | 18 | //! Project version string for RxCocoa. 19 | FOUNDATION_EXPORT const unsigned char RxCocoaVersionString[]; 20 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // _RXDelegateProxy.h 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 7/4/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface _RXDelegateProxy : NSObject 14 | 15 | @property (nonatomic, weak, readonly) id _forwardToDelegate; 16 | 17 | -(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate; 18 | 19 | -(BOOL)hasWiredImplementationForSelector:(SEL)selector; 20 | 21 | -(void)_sentMessage:(SEL)selector withArguments:(NSArray*)arguments; 22 | -(void)_methodInvoked:(SEL)selector withArguments:(NSArray*)arguments; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h: -------------------------------------------------------------------------------- 1 | // 2 | // _RXKVOObserver.h 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 7/11/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | ################################################################################ 13 | This file is part of RX private API 14 | ################################################################################ 15 | */ 16 | 17 | // Exists because if written in Swift, reading unowned is disabled during dealloc process 18 | @interface _RXKVOObserver : NSObject 19 | 20 | -(instancetype)initWithTarget:(id)target 21 | retainTarget:(BOOL)retainTarget 22 | keyPath:(NSString*)keyPath 23 | options:(NSKeyValueObservingOptions)options 24 | callback:(void (^)(id))callback; 25 | 26 | -(void)dispose; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/RxCocoa.h: -------------------------------------------------------------------------------- 1 | // 2 | // RxCocoa.h 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 2/21/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "_RX.h" 11 | #import "_RXDelegateProxy.h" 12 | #import "_RXKVOObserver.h" 13 | #import "_RXObjCRuntime.h" 14 | 15 | //! Project version number for RxCocoa. 16 | FOUNDATION_EXPORT double RxCocoaVersionNumber; 17 | 18 | //! Project version string for RxCocoa. 19 | FOUNDATION_EXPORT const unsigned char RxCocoaVersionString[]; -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemEvents.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 6/20/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if os(iOS) || os(tvOS) 11 | import UIKit 12 | 13 | public typealias ItemMovedEvent = (sourceIndex: IndexPath, destinationIndex: IndexPath) 14 | public typealias WillDisplayCellEvent = (cell: UITableViewCell, indexPath: IndexPath) 15 | public typealias DidEndDisplayingCellEvent = (cell: UITableViewCell, indexPath: IndexPath) 16 | #endif 17 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSTextStorage+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Segii Shulga on 12/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | import Foundation 11 | 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: NSTextStorage { 18 | 19 | /// Reactive wrapper for `delegate`. 20 | /// 21 | /// For more information take a look at `DelegateProxyType` protocol documentation. 22 | public var delegate:DelegateProxy { 23 | return RxTextStorageDelegateProxy.proxyForObject(base) 24 | } 25 | 26 | /// Reactive wrapper for `delegate` message. 27 | public var didProcessEditingRangeChangeInLength: Observable<(editedMask:NSTextStorageEditActions, editedRange:NSRange, delta:Int)> { 28 | return delegate 29 | .methodInvoked(#selector(NSTextStorageDelegate.textStorage(_:didProcessEditing:range:changeInLength:))) 30 | .map { a in 31 | let editedMask = NSTextStorageEditActions(rawValue: try castOrThrow(UInt.self, a[1]) ) 32 | let editedRange = try castOrThrow(NSValue.self, a[2]).rangeValue 33 | let delta = try castOrThrow(Int.self, a[3]) 34 | 35 | return (editedMask, editedRange, delta) 36 | } 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxCollectionViewDataSourceType.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 6/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | /// Marks data source as `UICollectionView` reactive data source enabling it to be used with one of the `bindTo` methods. 18 | public protocol RxCollectionViewDataSourceType /*: UICollectionViewDataSource*/ { 19 | 20 | /// Type of elements that can be bound to collection view. 21 | associatedtype Element 22 | 23 | /// New observable sequence event observed. 24 | /// 25 | /// - parameter collectionView: Bound collection view. 26 | /// - parameter observedEvent: Event 27 | func collectionView(_ collectionView: UICollectionView, observedEvent: Event) -> Void 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTableViewDataSourceType.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 6/26/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | /// Marks data source as `UITableView` reactive data source enabling it to be used with one of the `bindTo` methods. 18 | public protocol RxTableViewDataSourceType /*: UITableViewDataSource*/ { 19 | 20 | /// Type of elements that can be bound to table view. 21 | associatedtype Element 22 | 23 | /// New observable sequence event observed. 24 | /// 25 | /// - parameter tableView: Bound table view. 26 | /// - parameter observedEvent: Event 27 | func tableView(_ tableView: UITableView, observedEvent: Event) -> Void 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxCollectionViewDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 6/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | /// For more information take a look at `DelegateProxyType`. 18 | public class RxCollectionViewDelegateProxy 19 | : RxScrollViewDelegateProxy 20 | , UICollectionViewDelegate 21 | , UICollectionViewDelegateFlowLayout { 22 | 23 | /// Typed parent object. 24 | public weak private(set) var collectionView: UICollectionView? 25 | 26 | /// Initializes `RxCollectionViewDelegateProxy` 27 | /// 28 | /// - parameter parentObject: Parent object for delegate proxy. 29 | public required init(parentObject: AnyObject) { 30 | self.collectionView = (parentObject as! UICollectionView) 31 | super.init(parentObject: parentObject) 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxPickerViewDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Segii Shulga on 5/12/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | public class RxPickerViewDelegateProxy 18 | : DelegateProxy 19 | , DelegateProxyType 20 | , UIPickerViewDelegate { 21 | 22 | /// For more information take a look at `DelegateProxyType`. 23 | public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { 24 | let pickerView: UIPickerView = castOrFatalError(object) 25 | pickerView.delegate = castOptionalOrFatalError(delegate) 26 | } 27 | 28 | /// For more information take a look at `DelegateProxyType`. 29 | public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { 30 | let pickerView: UIPickerView = castOrFatalError(object) 31 | return pickerView.delegate 32 | } 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxSearchBarDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 7/4/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | /// For more information take a look at `DelegateProxyType`. 18 | public class RxSearchBarDelegateProxy 19 | : DelegateProxy 20 | , UISearchBarDelegate 21 | , DelegateProxyType { 22 | 23 | /// For more information take a look at `DelegateProxyType`. 24 | public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { 25 | let searchBar: UISearchBar = castOrFatalError(object) 26 | return searchBar.delegate 27 | } 28 | 29 | /// For more information take a look at `DelegateProxyType`. 30 | public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { 31 | let searchBar: UISearchBar = castOrFatalError(object) 32 | searchBar.delegate = castOptionalOrFatalError(delegate) 33 | } 34 | 35 | // MARK: Delegate proxy methods 36 | 37 | #if os(iOS) 38 | /// For more information take a look at `DelegateProxyType`. 39 | public override class func createProxyForObject(_ object: AnyObject) -> AnyObject { 40 | let searchBar = (object as! UISearchBar) 41 | 42 | return castOrFatalError(searchBar.createRxDelegateProxy()) 43 | } 44 | #endif 45 | 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxSearchControllerDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Segii Shulga on 3/17/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | /// For more information take a look at `DelegateProxyType`. 18 | @available(iOS 8.0, *) 19 | public class RxSearchControllerDelegateProxy 20 | : DelegateProxy 21 | , DelegateProxyType 22 | , UISearchControllerDelegate { 23 | 24 | /// For more information take a look at `DelegateProxyType`. 25 | public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { 26 | let searchController: UISearchController = castOrFatalError(object) 27 | searchController.delegate = castOptionalOrFatalError(delegate) 28 | } 29 | 30 | /// For more information take a look at `DelegateProxyType`. 31 | public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { 32 | let searchController: UISearchController = castOrFatalError(object) 33 | return searchController.delegate 34 | } 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTabBarDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Jesse Farless on 5/14/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | import Foundation 11 | import UIKit 12 | 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | /// For more information take a look at `DelegateProxyType`. 18 | public class RxTabBarDelegateProxy 19 | : DelegateProxy 20 | , UITabBarDelegate 21 | , DelegateProxyType { 22 | 23 | /// For more information take a look at `DelegateProxyType`. 24 | public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { 25 | let tabBar: UITabBar = castOrFatalError(object) 26 | return tabBar.delegate 27 | } 28 | 29 | /// For more information take a look at `DelegateProxyType`. 30 | public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { 31 | let tabBar: UITabBar = castOrFatalError(object) 32 | tabBar.delegate = castOptionalOrFatalError(delegate) 33 | } 34 | 35 | /// For more information take a look at `DelegateProxyType`. 36 | public override class func createProxyForObject(_ object: AnyObject) -> AnyObject { 37 | let tabBar = (object as! UITabBar) 38 | 39 | return castOrFatalError(tabBar.createRxDelegateProxy()) 40 | } 41 | 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTableViewDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 6/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | /// For more information take a look at `DelegateProxyType`. 18 | public class RxTableViewDelegateProxy 19 | : RxScrollViewDelegateProxy 20 | , UITableViewDelegate { 21 | 22 | 23 | /// Typed parent object. 24 | public weak private(set) var tableView: UITableView? 25 | 26 | /// Initializes `RxTableViewDelegateProxy` 27 | /// 28 | /// - parameter parentObject: Parent object for delegate proxy. 29 | public required init(parentObject: AnyObject) { 30 | self.tableView = (parentObject as! UITableView) 31 | super.init(parentObject: parentObject) 32 | } 33 | 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTextStorageDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Segii Shulga on 12/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | public class RxTextStorageDelegateProxy 18 | : DelegateProxy 19 | , DelegateProxyType 20 | , NSTextStorageDelegate { 21 | 22 | 23 | /// For more information take a look at `DelegateProxyType`. 24 | public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { 25 | let textStorage: NSTextStorage = castOrFatalError(object) 26 | textStorage.delegate = castOptionalOrFatalError(delegate) 27 | } 28 | 29 | /// For more information take a look at `DelegateProxyType`. 30 | public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { 31 | let textStorage: NSTextStorage = castOrFatalError(object) 32 | return textStorage.delegate 33 | } 34 | 35 | 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTextViewDelegateProxy.swift 3 | // RxCocoa 4 | // 5 | // Created by Yuta ToKoRo on 7/19/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | /// For more information take a look at `DelegateProxyType`. 18 | public class RxTextViewDelegateProxy 19 | : RxScrollViewDelegateProxy 20 | , UITextViewDelegate { 21 | 22 | /// Typed parent object. 23 | public weak private(set) var textView: UITextView? 24 | 25 | /// Initializes `RxTextViewDelegateProxy` 26 | /// 27 | /// - parameter parentObject: Parent object for delegate proxy. 28 | public required init(parentObject: AnyObject) { 29 | self.textView = (parentObject as! UITextView) 30 | super.init(parentObject: parentObject) 31 | } 32 | 33 | // MARK: delegate methods 34 | 35 | /// For more information take a look at `DelegateProxyType`. 36 | @objc public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { 37 | /** 38 | We've had some issues with observing text changes. This is here just in case we need the same hack in future and that 39 | we wouldn't need to change the public interface. 40 | */ 41 | let forwardToDelegate = self.forwardToDelegate() as? UITextViewDelegate 42 | return forwardToDelegate?.textView?(textView, 43 | shouldChangeTextIn: range, 44 | replacementText: text) ?? true 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIActivityIndicatorView+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Ivan Persidskiy on 02/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | import UIKit 11 | 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | extension Reactive where Base: UIActivityIndicatorView { 17 | 18 | /// Bindable sink for `startAnimating()`, `stopAnimating()` methods. 19 | public var isAnimating: UIBindingObserver { 20 | return UIBindingObserver(UIElement: self.base) { activityIndicator, active in 21 | if active { 22 | activityIndicator.startAnimating() 23 | } else { 24 | activityIndicator.stopAnimating() 25 | } 26 | } 27 | } 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIAlertAction+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertAction+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Andrew Breckenridge on 5/7/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(iOS) || os(tvOS) 12 | 13 | import Foundation 14 | import UIKit 15 | 16 | #if !RX_NO_MODULE 17 | import RxSwift 18 | #endif 19 | 20 | extension Reactive where Base: UIAlertAction { 21 | 22 | /// Bindable sink for `enabled` property. 23 | public var isEnabled: UIBindingObserver { 24 | return UIBindingObserver(UIElement: self.base) { alertAction, value in 25 | alertAction.isEnabled = value 26 | } 27 | } 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Mads Bøgeskov on 18/01/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(iOS) 12 | import UIKit 13 | 14 | #if !RX_NO_MODULE 15 | import RxSwift 16 | #endif 17 | 18 | extension Reactive where Base: UIApplication { 19 | 20 | /// Bindable sink for `networkActivityIndicatorVisible`. 21 | public var isNetworkActivityIndicatorVisible: UIBindingObserver { 22 | return UIBindingObserver(UIElement: self.base) { application, active in 23 | application.isNetworkActivityIndicatorVisible = active 24 | } 25 | } 26 | } 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarButtonItem+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Daniel Tartaglia on 5/31/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import UIKit 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | fileprivate var rx_tap_key: UInt8 = 0 17 | 18 | extension Reactive where Base: UIBarButtonItem { 19 | 20 | /// Bindable sink for `enabled` property. 21 | public var isEnabled: UIBindingObserver { 22 | return UIBindingObserver(UIElement: self.base) { UIElement, value in 23 | UIElement.isEnabled = value 24 | } 25 | } 26 | 27 | /// Reactive wrapper for target action pattern on `self`. 28 | public var tap: ControlEvent { 29 | let source = lazyInstanceObservable(&rx_tap_key) { () -> Observable in 30 | Observable.create { [weak control = self.base] observer in 31 | guard let control = control else { 32 | observer.on(.completed) 33 | return Disposables.create() 34 | } 35 | let target = BarButtonItemTarget(barButtonItem: control) { 36 | observer.on(.next()) 37 | } 38 | return target 39 | } 40 | .takeUntil(self.deallocated) 41 | .share() 42 | } 43 | 44 | return ControlEvent(events: source) 45 | } 46 | } 47 | 48 | 49 | @objc 50 | class BarButtonItemTarget: RxTarget { 51 | typealias Callback = () -> Void 52 | 53 | weak var barButtonItem: UIBarButtonItem? 54 | var callback: Callback! 55 | 56 | init(barButtonItem: UIBarButtonItem, callback: @escaping () -> Void) { 57 | self.barButtonItem = barButtonItem 58 | self.callback = callback 59 | super.init() 60 | barButtonItem.target = self 61 | barButtonItem.action = #selector(BarButtonItemTarget.action(_:)) 62 | } 63 | 64 | override func dispose() { 65 | super.dispose() 66 | #if DEBUG 67 | MainScheduler.ensureExecutingOnScheduler() 68 | #endif 69 | 70 | barButtonItem?.target = nil 71 | barButtonItem?.action = nil 72 | 73 | callback = nil 74 | } 75 | 76 | func action(_ sender: AnyObject) { 77 | callback() 78 | } 79 | 80 | } 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 3/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UIButton { 18 | 19 | /** 20 | Reactive wrapper for `TouchUpInside` control event. 21 | */ 22 | public var tap: ControlEvent { 23 | return controlEvent(.touchUpInside) 24 | } 25 | } 26 | 27 | #endif 28 | 29 | #if os(tvOS) 30 | 31 | import Foundation 32 | #if !RX_NO_MODULE 33 | import RxSwift 34 | #endif 35 | import UIKit 36 | 37 | extension Reactive where Base: UIButton { 38 | 39 | /// Reactive wrapper for `PrimaryActionTriggered` control event. 40 | public var primaryAction: ControlEvent { 41 | return controlEvent(.primaryActionTriggered) 42 | } 43 | 44 | } 45 | 46 | #endif 47 | 48 | #if os(iOS) || os(tvOS) 49 | 50 | import Foundation 51 | #if !RX_NO_MODULE 52 | import RxSwift 53 | #endif 54 | import UIKit 55 | 56 | extension Reactive where Base: UIButton { 57 | 58 | /// Reactive wrapper for `setTitle(_:controlState:)` 59 | public func title(for controlState: UIControlState = []) -> UIBindingObserver { 60 | return UIBindingObserver(UIElement: self.base) { (button, title) -> () in 61 | button.setTitle(title, for: controlState) 62 | } 63 | } 64 | 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIDatePicker+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Daniel Tartaglia on 5/31/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UIDatePicker { 18 | 19 | /// Reactive wrapper for `date` property. 20 | public var date: ControlProperty { 21 | return UIControl.rx.value( 22 | self.base, 23 | getter: { datePicker in 24 | datePicker.date 25 | }, setter: { datePicker, value in 26 | datePicker.date = value 27 | } 28 | ) 29 | } 30 | 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Carlos García on 10/6/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import UIKit 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | 17 | // This should be only used from `MainScheduler` 18 | class GestureTarget: RxTarget { 19 | typealias Callback = (Recognizer) -> Void 20 | 21 | let selector = #selector(ControlTarget.eventHandler(_:)) 22 | 23 | weak var gestureRecognizer: Recognizer? 24 | var callback: Callback? 25 | 26 | init(_ gestureRecognizer: Recognizer, callback: @escaping Callback) { 27 | self.gestureRecognizer = gestureRecognizer 28 | self.callback = callback 29 | 30 | super.init() 31 | 32 | gestureRecognizer.addTarget(self, action: selector) 33 | 34 | let method = self.method(for: selector) 35 | if method == nil { 36 | fatalError("Can't find method") 37 | } 38 | } 39 | 40 | func eventHandler(_ sender: UIGestureRecognizer!) { 41 | if let callback = self.callback, let gestureRecognizer = self.gestureRecognizer { 42 | callback(gestureRecognizer) 43 | } 44 | } 45 | 46 | override func dispose() { 47 | super.dispose() 48 | 49 | self.gestureRecognizer?.removeTarget(self, action: self.selector) 50 | self.callback = nil 51 | } 52 | } 53 | 54 | extension Reactive where Base: UIGestureRecognizer { 55 | 56 | /// Reactive wrapper for gesture recognizer events. 57 | public var event: ControlEvent { 58 | let source: Observable = Observable.create { [weak control = self.base] observer in 59 | MainScheduler.ensureExecutingOnScheduler() 60 | 61 | guard let control = control else { 62 | observer.on(.completed) 63 | return Disposables.create() 64 | } 65 | 66 | let observer = GestureTarget(control) { 67 | control in 68 | observer.on(.next(control)) 69 | } 70 | 71 | return observer 72 | }.takeUntil(deallocated) 73 | 74 | return ControlEvent(events: source) 75 | } 76 | 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageView+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 4/1/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UIImageView { 18 | 19 | /// Bindable sink for `image` property. 20 | public var image: UIBindingObserver { 21 | return image(transitionType: nil) 22 | } 23 | 24 | /// Bindable sink for `image` property. 25 | 26 | /// - parameter transitionType: Optional transition type while setting the image (kCATransitionFade, kCATransitionMoveIn, ...) 27 | public func image(transitionType: String? = nil) -> UIBindingObserver { 28 | return UIBindingObserver(UIElement: base) { imageView, image in 29 | if let transitionType = transitionType { 30 | if image != nil { 31 | let transition = CATransition() 32 | transition.duration = 0.25 33 | transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) 34 | transition.type = transitionType 35 | imageView.layer.add(transition, forKey: kCATransition) 36 | } 37 | } 38 | else { 39 | imageView.layer.removeAllAnimations() 40 | } 41 | imageView.image = image 42 | } 43 | } 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 4/1/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UILabel { 18 | 19 | /// Bindable sink for `text` property. 20 | public var text: UIBindingObserver { 21 | return UIBindingObserver(UIElement: self.base) { label, text in 22 | label.text = text 23 | } 24 | } 25 | 26 | /// Bindable sink for `attributedText` property. 27 | public var attributedText: UIBindingObserver { 28 | return UIBindingObserver(UIElement: self.base) { label, text in 29 | label.attributedText = text 30 | } 31 | } 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UINavigationItem+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationItem+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by kumapo on 2016/05/09. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | extension Reactive where Base: UINavigationItem { 18 | 19 | /// Bindable sink for `title` property. 20 | public var title: UIBindingObserver { 21 | return UIBindingObserver(UIElement: self.base) { navigationItem, text in 22 | navigationItem.title = text 23 | } 24 | } 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIPageControl+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIPageControl+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Francesco Puntillo on 14/04/2016. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UIPageControl { 18 | 19 | /// Bindable sink for `currentPage` property. 20 | public var currentPage: UIBindingObserver { 21 | return UIBindingObserver(UIElement: self.base) { controller, page in 22 | controller.currentPage = page 23 | } 24 | } 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIPickerView+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIPickerView+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Segii Shulga on 5/12/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UIPickerView { 18 | 19 | /// Reactive wrapper for `delegate`. 20 | /// For more information take a look at `DelegateProxyType` protocol documentation. 21 | public var delegate: DelegateProxy { 22 | return RxPickerViewDelegateProxy.proxyForObject(base) 23 | } 24 | 25 | public var itemSelected: ControlEvent<(Int, Int)> { 26 | let source = delegate 27 | .methodInvoked(#selector(UIPickerViewDelegate.pickerView(_:didSelectRow:inComponent:))) 28 | .map { 29 | return (try castOrThrow(Int.self, $0[1]), try castOrThrow(Int.self, $0[2])) 30 | } 31 | return ControlEvent(events: source) 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIProgressView+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Samuel Bae on 2/27/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UIProgressView { 18 | 19 | /// Bindable sink for `progress` property 20 | public var progress: UIBindingObserver { 21 | return UIBindingObserver(UIElement: self.base) { progressView, progress in 22 | progressView.progress = progress 23 | } 24 | } 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIRefreshControl+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Yosuke Ishikawa on 1/31/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | import UIKit 11 | 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | extension Reactive where Base: UIRefreshControl { 17 | 18 | /// Bindable sink for `beginRefreshing()`, `endRefreshing()` methods. 19 | public var refreshing: UIBindingObserver { 20 | return UIBindingObserver(UIElement: self.base) { refreshControl, refresh in 21 | if refresh { 22 | refreshControl.beginRefreshing() 23 | } else { 24 | refreshControl.endRefreshing() 25 | } 26 | } 27 | } 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 4/3/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension UIScrollView { 18 | 19 | /// Factory method that enables subclasses to implement their own `delegate`. 20 | /// 21 | /// - returns: Instance of delegate proxy that wraps `delegate`. 22 | public func createRxDelegateProxy() -> RxScrollViewDelegateProxy { 23 | return RxScrollViewDelegateProxy(parentObject: self) 24 | } 25 | 26 | } 27 | 28 | extension Reactive where Base: UIScrollView { 29 | 30 | /// Reactive wrapper for `delegate`. 31 | /// 32 | /// For more information take a look at `DelegateProxyType` protocol documentation. 33 | public var delegate: DelegateProxy { 34 | return RxScrollViewDelegateProxy.proxyForObject(base) 35 | } 36 | 37 | /// Reactive wrapper for `contentOffset`. 38 | public var contentOffset: ControlProperty { 39 | let proxy = RxScrollViewDelegateProxy.proxyForObject(base) 40 | 41 | let bindingObserver = UIBindingObserver(UIElement: self.base) { scrollView, contentOffset in 42 | scrollView.contentOffset = contentOffset 43 | } 44 | 45 | return ControlProperty(values: proxy.contentOffsetSubject, valueSink: bindingObserver) 46 | } 47 | 48 | /// Bindable sink for `scrollEnabled` property. 49 | public var isScrollEnabled: UIBindingObserver { 50 | return UIBindingObserver(UIElement: self.base) { scrollView, scrollEnabled in 51 | scrollView.isScrollEnabled = scrollEnabled 52 | } 53 | } 54 | 55 | /// Installs delegate as forwarding delegate on `delegate`. 56 | /// Delegate won't be retained. 57 | /// 58 | /// It enables using normal delegate mechanism with reactive delegate mechanism. 59 | /// 60 | /// - parameter delegate: Delegate object. 61 | /// - returns: Disposable object that can be used to unbind the delegate. 62 | public func setDelegate(_ delegate: UIScrollViewDelegate) 63 | -> Disposable { 64 | return RxScrollViewDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base) 65 | } 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UISearchController+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UISearchController+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Segii Shulga on 3/17/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(iOS) 12 | import Foundation 13 | 14 | #if !RX_NO_MODULE 15 | import RxSwift 16 | #endif 17 | import UIKit 18 | 19 | @available(iOS 8.0, *) 20 | extension Reactive where Base: UISearchController { 21 | /// Reactive wrapper for `delegate`. 22 | /// For more information take a look at `DelegateProxyType` protocol documentation. 23 | public var delegate: DelegateProxy { 24 | return RxSearchControllerDelegateProxy.proxyForObject(base) 25 | } 26 | 27 | /// Reactive wrapper for `delegate` message. 28 | public var didDismiss: Observable { 29 | return delegate 30 | .methodInvoked( #selector(UISearchControllerDelegate.didDismissSearchController(_:))) 31 | .map {_ in} 32 | } 33 | 34 | /// Reactive wrapper for `delegate` message. 35 | public var didPresent: Observable { 36 | return delegate 37 | .methodInvoked(#selector(UISearchControllerDelegate.didPresentSearchController(_:))) 38 | .map {_ in} 39 | } 40 | 41 | /// Reactive wrapper for `delegate` message. 42 | public var present: Observable { 43 | return delegate 44 | .methodInvoked( #selector(UISearchControllerDelegate.presentSearchController(_:))) 45 | .map {_ in} 46 | } 47 | 48 | /// Reactive wrapper for `delegate` message. 49 | public var willDismiss: Observable { 50 | return delegate 51 | .methodInvoked(#selector(UISearchControllerDelegate.willDismissSearchController(_:))) 52 | .map {_ in} 53 | } 54 | 55 | /// Reactive wrapper for `delegate` message. 56 | public var willPresent: Observable { 57 | return delegate 58 | .methodInvoked( #selector(UISearchControllerDelegate.willPresentSearchController(_:))) 59 | .map {_ in} 60 | } 61 | 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentedControl+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Carlos García on 8/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import UIKit 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | 17 | extension Reactive where Base: UISegmentedControl { 18 | 19 | /// Reactive wrapper for `selectedSegmentIndex` property. 20 | public var value: ControlProperty { 21 | return UIControl.rx.value( 22 | self.base, 23 | getter: { segmentedControl in 24 | segmentedControl.selectedSegmentIndex 25 | }, setter: { segmentedControl, value in 26 | segmentedControl.selectedSegmentIndex = value 27 | } 28 | ) 29 | } 30 | 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UISlider+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Alexander van der Werff on 28/05/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UISlider { 18 | 19 | /// Reactive wrapper for `value` property. 20 | public var value: ControlProperty { 21 | return UIControl.rx.value( 22 | self.base, 23 | getter: { slider in 24 | slider.value 25 | }, setter: { slider, value in 26 | slider.value = value 27 | } 28 | ) 29 | } 30 | 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIStepper+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Yuta ToKoRo on 9/1/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | extension Reactive where Base: UIStepper { 18 | 19 | /// Reactive wrapper for `value` property. 20 | public var value: ControlProperty { 21 | return UIControl.rx.value( 22 | self.base, 23 | getter: { stepper in 24 | stepper.value 25 | }, setter: { stepper, value in 26 | stepper.value = value 27 | } 28 | ) 29 | } 30 | 31 | } 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UISwitch+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Carlos García on 8/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | 11 | import UIKit 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | 16 | 17 | extension Reactive where Base: UISwitch { 18 | 19 | /** 20 | Reactive wrapper for `on` property. 21 | 22 | **⚠️Unlike other controls, Apple is reusing instances of UISwitch or a there is a leak, 23 | so underlying observable sequence won't complete when nothing holds a strong reference 24 | to UISwitch.⚠️** 25 | */ 26 | public var value: ControlProperty { 27 | return UIControl.rx.value( 28 | self.base, 29 | getter: { uiSwitch in 30 | uiSwitch.isOn 31 | }, setter: { uiSwitch, value in 32 | uiSwitch.isOn = value 33 | } 34 | ) 35 | } 36 | 37 | } 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarItem+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Mateusz Derks on 04/03/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | extension Reactive where Base: UITabBarItem { 18 | 19 | /// Bindable sink for `badgeValue` property. 20 | public var badgeValue: UIBindingObserver { 21 | return UIBindingObserver(UIElement: self.base) { tabBarItem, badgeValue in 22 | tabBarItem.badgeValue = badgeValue 23 | } 24 | } 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 2/21/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | #if !RX_NO_MODULE 13 | import RxSwift 14 | #endif 15 | import UIKit 16 | 17 | extension Reactive where Base: UITextField { 18 | 19 | /// Reactive wrapper for `text` property. 20 | public var text: ControlProperty { 21 | return UIControl.rx.value( 22 | base, 23 | getter: { textField in 24 | textField.text 25 | }, setter: { textField, value in 26 | // This check is important because setting text value always clears control state 27 | // including marked text selection which is imporant for proper input 28 | // when IME input method is used. 29 | if textField.text != value { 30 | textField.text = value 31 | } 32 | } 33 | ) 34 | } 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Krunoslav Zaher on 12/6/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(iOS) || os(tvOS) 10 | 11 | import Foundation 12 | import UIKit 13 | #if !RX_NO_MODULE 14 | import RxSwift 15 | #endif 16 | 17 | extension Reactive where Base: UIView { 18 | /// Bindable sink for `hidden` property. 19 | public var isHidden: UIBindingObserver { 20 | return UIBindingObserver(UIElement: self.base) { view, hidden in 21 | view.isHidden = hidden 22 | } 23 | } 24 | 25 | /// Bindable sink for `alpha` property. 26 | public var alpha: UIBindingObserver { 27 | return UIBindingObserver(UIElement: self.base) { view, alpha in 28 | view.alpha = alpha 29 | } 30 | } 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Pods/RxCocoa/RxCocoa/iOS/UIViewController+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Rx.swift 3 | // RxCocoa 4 | // 5 | // Created by Kyle Fuller on 27/05/2016. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(iOS) 12 | import UIKit 13 | 14 | #if !RX_NO_MODULE 15 | import RxSwift 16 | #endif 17 | 18 | extension Reactive where Base: UIViewController { 19 | 20 | /// Bindable sink for `title`. 21 | public var title: UIBindingObserver { 22 | return UIBindingObserver(UIElement: self.base) { viewController, title in 23 | viewController.title = title 24 | } 25 | } 26 | 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /Pods/RxDataSources/LICENSE.md: -------------------------------------------------------------------------------- 1 | **The MIT License** 2 | **Copyright © 2015 Krunoslav Zaher** 3 | **All rights reserved.** 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources+Rx/RxCollectionViewSectionedReloadDataSource.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxCollectionViewSectionedReloadDataSource.swift 3 | // RxExample 4 | // 5 | // Created by Krunoslav Zaher on 7/2/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | #if !RX_NO_MODULE 12 | import RxSwift 13 | import RxCocoa 14 | #endif 15 | 16 | open class RxCollectionViewSectionedReloadDataSource 17 | : CollectionViewSectionedDataSource 18 | , RxCollectionViewDataSourceType { 19 | 20 | public typealias Element = [S] 21 | 22 | public override init() { 23 | super.init() 24 | } 25 | 26 | open func collectionView(_ collectionView: UICollectionView, observedEvent: Event) { 27 | UIBindingObserver(UIElement: self) { dataSource, element in 28 | #if DEBUG 29 | self._dataSourceBound = true 30 | #endif 31 | dataSource.setSections(element) 32 | collectionView.reloadData() 33 | }.on(observedEvent) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources+Rx/RxTableViewSectionedAnimatedDataSource.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTableViewSectionedAnimatedDataSource.swift 3 | // RxExample 4 | // 5 | // Created by Krunoslav Zaher on 6/27/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | #if !RX_NO_MODULE 12 | import RxSwift 13 | import RxCocoa 14 | #endif 15 | 16 | open class RxTableViewSectionedAnimatedDataSource 17 | : TableViewSectionedDataSource 18 | , RxTableViewDataSourceType { 19 | 20 | public typealias Element = [S] 21 | public var animationConfiguration = AnimationConfiguration() 22 | 23 | var dataSet = false 24 | 25 | public override init() { 26 | super.init() 27 | } 28 | 29 | open func tableView(_ tableView: UITableView, observedEvent: Event) { 30 | UIBindingObserver(UIElement: self) { dataSource, newSections in 31 | #if DEBUG 32 | self._dataSourceBound = true 33 | #endif 34 | if !self.dataSet { 35 | self.dataSet = true 36 | dataSource.setSections(newSections) 37 | tableView.reloadData() 38 | } 39 | else { 40 | DispatchQueue.main.async { 41 | let oldSections = dataSource.sectionModels 42 | do { 43 | let differences = try differencesForSectionedView(oldSections, finalSections: newSections) 44 | 45 | for difference in differences { 46 | dataSource.setSections(difference.finalSections) 47 | 48 | tableView.performBatchUpdates(difference, animationConfiguration: self.animationConfiguration) 49 | } 50 | } 51 | catch let e { 52 | rxDebugFatalError(e) 53 | self.setSections(newSections) 54 | tableView.reloadData() 55 | } 56 | } 57 | } 58 | }.on(observedEvent) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources+Rx/RxTableViewSectionedReloadDataSource.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxTableViewSectionedReloadDataSource.swift 3 | // RxExample 4 | // 5 | // Created by Krunoslav Zaher on 6/27/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | #if !RX_NO_MODULE 12 | import RxSwift 13 | import RxCocoa 14 | #endif 15 | 16 | open class RxTableViewSectionedReloadDataSource 17 | : TableViewSectionedDataSource 18 | , RxTableViewDataSourceType { 19 | public typealias Element = [S] 20 | 21 | public override init() { 22 | super.init() 23 | } 24 | 25 | open func tableView(_ tableView: UITableView, observedEvent: Event) { 26 | UIBindingObserver(UIElement: self) { dataSource, element in 27 | #if DEBUG 28 | self._dataSourceBound = true 29 | #endif 30 | dataSource.setSections(element) 31 | tableView.reloadData() 32 | }.on(observedEvent) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/AnimatableSectionModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatableSectionModel.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/10/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct AnimatableSectionModel { 12 | public var model: Section 13 | public var items: [Item] 14 | 15 | public init(model: Section, items: [ItemType]) { 16 | self.model = model 17 | self.items = items 18 | } 19 | 20 | } 21 | 22 | extension AnimatableSectionModel 23 | : AnimatableSectionModelType { 24 | public typealias Item = ItemType 25 | public typealias Identity = Section.Identity 26 | 27 | public var identity: Section.Identity { 28 | return model.identity 29 | } 30 | 31 | public init(original: AnimatableSectionModel, items: [Item]) { 32 | self.model = original.model 33 | self.items = items 34 | } 35 | 36 | public var hashValue: Int { 37 | return self.model.identity.hashValue 38 | } 39 | } 40 | 41 | 42 | extension AnimatableSectionModel 43 | : CustomStringConvertible { 44 | 45 | public var description: String { 46 | return "HashableSectionModel(model: \"\(self.model)\", items: \(items))" 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/AnimatableSectionModelType+ItemPath.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatableSectionModelType+ItemPath.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/9/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Array where Element: AnimatableSectionModelType { 12 | subscript(index: ItemPath) -> Element.Item { 13 | return self[index.sectionIndex].items[index.itemIndex] 14 | } 15 | } -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/AnimatableSectionModelType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatableSectionModelType.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/6/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol AnimatableSectionModelType 12 | : SectionModelType 13 | , IdentifiableType { 14 | associatedtype Item : IdentifiableType, Equatable 15 | } -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/AnimationConfiguration.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimationConfiguration.swift 3 | // RxDataSources 4 | // 5 | // Created by Esteban Torres on 5/2/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | /** 13 | Exposes custom animation styles for insertion, deletion and reloading behavior. 14 | */ 15 | public struct AnimationConfiguration { 16 | let insertAnimation: UITableViewRowAnimation 17 | let reloadAnimation: UITableViewRowAnimation 18 | let deleteAnimation: UITableViewRowAnimation 19 | 20 | public init(insertAnimation: UITableViewRowAnimation = .automatic, 21 | reloadAnimation: UITableViewRowAnimation = .automatic, 22 | deleteAnimation: UITableViewRowAnimation = .automatic) { 23 | self.insertAnimation = insertAnimation 24 | self.reloadAnimation = reloadAnimation 25 | self.deleteAnimation = deleteAnimation 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/Array+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Array+Extensions.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 4/26/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | import Foundation 12 | 13 | extension Array where Element: SectionModelType { 14 | mutating func moveFromSourceIndexPath(_ sourceIndexPath: IndexPath, destinationIndexPath: IndexPath) { 15 | let sourceSection = self[sourceIndexPath.section] 16 | var sourceItems = sourceSection.items 17 | 18 | let sourceItem = sourceItems.remove(at: sourceIndexPath.item) 19 | 20 | let sourceSectionNew = Element(original: sourceSection, items: sourceItems) 21 | self[sourceIndexPath.section] = sourceSectionNew 22 | 23 | let destinationSection = self[destinationIndexPath.section] 24 | var destinationItems = destinationSection.items 25 | destinationItems.insert(sourceItem, at: destinationIndexPath.item) 26 | 27 | self[destinationIndexPath.section] = Element(original: destinationSection, items: destinationItems) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/DataSources.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataSources.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/8/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum RxDataSourceError : Error { 12 | case unwrappingOptional 13 | case preconditionFailed(message: String) 14 | } 15 | 16 | func rxPrecondition(_ condition: Bool, _ message: @autoclosure() -> String) throws -> () { 17 | if condition { 18 | return 19 | } 20 | rxDebugFatalError("Precondition failed") 21 | 22 | throw RxDataSourceError.preconditionFailed(message: message()) 23 | } 24 | 25 | func rxDebugFatalError(_ error: Error) { 26 | rxDebugFatalError("\(error)") 27 | } 28 | 29 | func rxDebugFatalError(_ message: String) { 30 | #if DEBUG 31 | fatalError(message) 32 | #else 33 | print(message) 34 | #endif 35 | } 36 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/FloatingPointType+IdentifiableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FloatingPointType+IdentifiableType.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 7/4/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension FloatingPoint { 12 | typealias identity = Self 13 | 14 | public var identity: Self { 15 | return self 16 | } 17 | } 18 | 19 | extension Float : IdentifiableType { 20 | 21 | } 22 | 23 | extension Double : IdentifiableType { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/IdentifiableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IdentifiableType.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/6/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol IdentifiableType { 12 | associatedtype Identity: Hashable 13 | 14 | var identity : Identity { get } 15 | } -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/IdentifiableValue.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IdentifiableValue.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/7/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct IdentifiableValue { 12 | public let value: Value 13 | } 14 | 15 | extension IdentifiableValue 16 | : IdentifiableType { 17 | 18 | public typealias Identity = Value 19 | 20 | public var identity : Identity { 21 | return value 22 | } 23 | } 24 | 25 | extension IdentifiableValue 26 | : Equatable 27 | , CustomStringConvertible 28 | , CustomDebugStringConvertible { 29 | 30 | public var description: String { 31 | return "\(value)" 32 | } 33 | 34 | public var debugDescription: String { 35 | return "\(value)" 36 | } 37 | } 38 | 39 | public func == (lhs: IdentifiableValue, rhs: IdentifiableValue) -> Bool { 40 | return lhs.value == rhs.value 41 | } 42 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/IntegerType+IdentifiableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IntegerType+IdentifiableType.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 7/4/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Integer { 12 | typealias identity = Self 13 | 14 | public var identity: Self { 15 | return self 16 | } 17 | } 18 | 19 | extension Int : IdentifiableType { 20 | 21 | } 22 | 23 | extension Int8 : IdentifiableType { 24 | 25 | } 26 | 27 | extension Int16 : IdentifiableType { 28 | 29 | } 30 | 31 | extension Int32 : IdentifiableType { 32 | 33 | } 34 | 35 | extension Int64 : IdentifiableType { 36 | 37 | } 38 | 39 | 40 | extension UInt : IdentifiableType { 41 | 42 | } 43 | 44 | extension UInt8 : IdentifiableType { 45 | 46 | } 47 | 48 | extension UInt16 : IdentifiableType { 49 | 50 | } 51 | 52 | extension UInt32 : IdentifiableType { 53 | 54 | } 55 | 56 | extension UInt64 : IdentifiableType { 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/ItemPath.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemPath.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/9/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct ItemPath { 12 | public let sectionIndex: Int 13 | public let itemIndex: Int 14 | } 15 | 16 | extension ItemPath : Equatable { 17 | 18 | } 19 | 20 | public func == (lhs: ItemPath, rhs: ItemPath) -> Bool { 21 | return lhs.sectionIndex == rhs.sectionIndex && lhs.itemIndex == rhs.itemIndex 22 | } -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/Optional+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Optional+Extensions.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 1/8/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Optional { 12 | func unwrap() throws -> Wrapped { 13 | if let unwrapped = self { 14 | return unwrapped 15 | } 16 | else { 17 | rxDebugFatalError("Error during unwrapping optional") 18 | throw RxDataSourceError.unwrappingOptional 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/SectionModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SectionModel.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 6/16/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct SectionModel { 12 | public var model: Section 13 | public var items: [Item] 14 | 15 | public init(model: Section, items: [Item]) { 16 | self.model = model 17 | self.items = items 18 | } 19 | } 20 | 21 | extension SectionModel 22 | : SectionModelType { 23 | public typealias Identity = Section 24 | public typealias Item = ItemType 25 | 26 | public var identity: Section { 27 | return model 28 | } 29 | } 30 | 31 | extension SectionModel 32 | : CustomStringConvertible { 33 | 34 | public var description: String { 35 | return "\(self.model) > \(items)" 36 | } 37 | } 38 | 39 | extension SectionModel { 40 | public init(original: SectionModel, items: [Item]) { 41 | self.model = original.model 42 | self.items = items 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/SectionModelType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SectionModelType.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 6/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol SectionModelType { 12 | associatedtype Item 13 | 14 | var items: [Item] { get } 15 | 16 | init(original: Self, items: [Item]) 17 | } -------------------------------------------------------------------------------- /Pods/RxDataSources/Sources/DataSources/String+IdentifiableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+IdentifiableType.swift 3 | // RxDataSources 4 | // 5 | // Created by Krunoslav Zaher on 7/4/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension String : IdentifiableType { 12 | public typealias Identity = String 13 | 14 | public var identity: String { 15 | return self 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Pods/RxSwift/LICENSE.md: -------------------------------------------------------------------------------- 1 | **The MIT License** 2 | **Copyright © 2015 Krunoslav Zaher** 3 | **All rights reserved.** 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InfiniteSequence.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 6/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Sequence that repeats `repeatedValue` infinite number of times. 12 | struct InfiniteSequence : Sequence { 13 | typealias Element = E 14 | typealias Iterator = AnyIterator 15 | 16 | private let _repeatedValue: E 17 | 18 | init(repeatedValue: E) { 19 | _repeatedValue = repeatedValue 20 | } 21 | 22 | func makeIterator() -> Iterator { 23 | let repeatedValue = _repeatedValue 24 | return AnyIterator { 25 | return repeatedValue 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/DispatchQueue+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DispatchQueue+Extensions.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 10/22/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Dispatch 11 | 12 | extension DispatchQueue { 13 | private static var token: DispatchSpecificKey<()> = { 14 | let key = DispatchSpecificKey<()>() 15 | DispatchQueue.main.setSpecific(key: key, value: ()) 16 | return key 17 | }() 18 | 19 | static var isMain: Bool { 20 | return DispatchQueue.getSpecific(key: token) != nil 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/Platform.Darwin.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Platform.Darwin.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 12/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 10 | 11 | import Darwin 12 | import Foundation 13 | 14 | typealias AtomicInt = Int32 15 | 16 | let AtomicCompareAndSwap = OSAtomicCompareAndSwap32Barrier 17 | let AtomicIncrement = OSAtomicIncrement32Barrier 18 | let AtomicDecrement = OSAtomicDecrement32Barrier 19 | 20 | extension Thread { 21 | 22 | static func setThreadLocalStorageValue(_ value: T?, forKey key: String 23 | ) { 24 | let currentThread = Thread.current 25 | let threadDictionary = currentThread.threadDictionary 26 | 27 | if let newValue = value { 28 | threadDictionary[key] = newValue 29 | } 30 | else { 31 | threadDictionary[key] = nil 32 | } 33 | 34 | } 35 | static func getThreadLocalStorageValueForKey(_ key: String) -> T? { 36 | let currentThread = Thread.current 37 | let threadDictionary = currentThread.threadDictionary 38 | 39 | return threadDictionary[key] as? T 40 | } 41 | } 42 | 43 | extension AtomicInt { 44 | func valueSnapshot() -> Int32 { 45 | return self 46 | } 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Cancelable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Cancelable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents disposable resource with state tracking. 12 | public protocol Cancelable : Disposable { 13 | /// Was resource disposed. 14 | var isDisposed: Bool { get } 15 | } 16 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/Lock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Lock.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/31/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol Lock { 12 | func lock() 13 | func unlock() 14 | } 15 | 16 | // https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000321.html 17 | typealias SpinLock = NSRecursiveLock 18 | 19 | extension NSRecursiveLock : Lock { 20 | func performLocked(_ action: () -> Void) { 21 | lock(); defer { unlock() } 22 | action() 23 | } 24 | 25 | func calculateLocked(_ action: () -> T) -> T { 26 | lock(); defer { unlock() } 27 | return action() 28 | } 29 | 30 | func calculateLockedOrFail(_ action: () throws -> T) throws -> T { 31 | lock(); defer { unlock() } 32 | let result = try action() 33 | return result 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LockOwnerType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol LockOwnerType : class, Lock { 12 | var _lock: NSRecursiveLock { get } 13 | } 14 | 15 | extension LockOwnerType { 16 | func lock() { 17 | _lock.lock() 18 | } 19 | 20 | func unlock() { 21 | _lock.unlock() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SynchronizedDisposeType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol SynchronizedDisposeType : class, Disposable, Lock { 12 | func _synchronized_dispose() 13 | } 14 | 15 | extension SynchronizedDisposeType { 16 | func synchronizedDispose() { 17 | lock(); defer { unlock() } 18 | _synchronized_dispose() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SynchronizedOnType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol SynchronizedOnType : class, ObserverType, Lock { 12 | func _synchronized_on(_ event: Event) 13 | } 14 | 15 | extension SynchronizedOnType { 16 | func synchronizedOn(_ event: Event) { 17 | lock(); defer { unlock() } 18 | _synchronized_on(event) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SynchronizedSubscribeType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol SynchronizedSubscribeType : class, ObservableType, Lock { 12 | func _synchronized_subscribe(_ observer: O) -> Disposable where O.E == E 13 | } 14 | 15 | extension SynchronizedSubscribeType { 16 | func synchronizedSubscribe(_ observer: O) -> Disposable where O.E == E { 17 | lock(); defer { unlock() } 18 | return _synchronized_subscribe(observer) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SynchronizedUnsubscribeType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol SynchronizedUnsubscribeType : class { 12 | associatedtype DisposeKey 13 | 14 | func synchronizedUnsubscribe(_ disposeKey: DisposeKey) 15 | } 16 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ConnectableObservableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectableObservableType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/1/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /** 12 | Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence. 13 | */ 14 | public protocol ConnectableObservableType : ObservableType { 15 | /** 16 | 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. 17 | 18 | - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. 19 | */ 20 | func connect() -> Disposable 21 | } 22 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Disposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Respresents a disposable resource. 12 | public protocol Disposable { 13 | /// Dispose resource. 14 | func dispose() 15 | } 16 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnonymousDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents an Action-based disposable. 12 | /// 13 | /// When dispose method is called, disposal action will be dereferenced. 14 | fileprivate final class AnonymousDisposable : DisposeBase, Cancelable { 15 | public typealias DisposeAction = () -> Void 16 | 17 | private var _isDisposed: AtomicInt = 0 18 | private var _disposeAction: DisposeAction? 19 | 20 | /// - returns: Was resource disposed. 21 | public var isDisposed: Bool { 22 | return _isDisposed == 1 23 | } 24 | 25 | /// Constructs a new disposable with the given action used for disposal. 26 | /// 27 | /// - parameter disposeAction: Disposal action which will be run upon calling `dispose`. 28 | fileprivate init(_ disposeAction: @escaping DisposeAction) { 29 | _disposeAction = disposeAction 30 | super.init() 31 | } 32 | 33 | // Non-deprecated version of the constructor, used by `Disposables.create(with:)` 34 | fileprivate init(disposeAction: @escaping DisposeAction) { 35 | _disposeAction = disposeAction 36 | super.init() 37 | } 38 | 39 | /// Calls the disposal action if and only if the current instance hasn't been disposed yet. 40 | /// 41 | /// After invoking disposal action, disposal action will be dereferenced. 42 | fileprivate func dispose() { 43 | if AtomicCompareAndSwap(0, 1, &_isDisposed) { 44 | assert(_isDisposed == 1) 45 | 46 | if let action = _disposeAction { 47 | _disposeAction = nil 48 | action() 49 | } 50 | } 51 | } 52 | } 53 | 54 | extension Disposables { 55 | 56 | /// Constructs a new disposable with the given action used for disposal. 57 | /// 58 | /// - parameter dispose: Disposal action which will be run upon calling `dispose`. 59 | public static func create(with dispose: @escaping () -> ()) -> Cancelable { 60 | return AnonymousDisposable(disposeAction: dispose) 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BinaryDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 6/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents two disposable resources that are disposed together. 12 | private final class BinaryDisposable : DisposeBase, Cancelable { 13 | 14 | private var _isDisposed: AtomicInt = 0 15 | 16 | // state 17 | private var _disposable1: Disposable? 18 | private var _disposable2: Disposable? 19 | 20 | /// - returns: Was resource disposed. 21 | var isDisposed: Bool { 22 | return _isDisposed > 0 23 | } 24 | 25 | /// Constructs new binary disposable from two disposables. 26 | /// 27 | /// - parameter disposable1: First disposable 28 | /// - parameter disposable2: Second disposable 29 | init(_ disposable1: Disposable, _ disposable2: Disposable) { 30 | _disposable1 = disposable1 31 | _disposable2 = disposable2 32 | super.init() 33 | } 34 | 35 | /// Calls the disposal action if and only if the current instance hasn't been disposed yet. 36 | /// 37 | /// After invoking disposal action, disposal action will be dereferenced. 38 | func dispose() { 39 | if AtomicCompareAndSwap(0, 1, &_isDisposed) { 40 | _disposable1?.dispose() 41 | _disposable2?.dispose() 42 | _disposable1 = nil 43 | _disposable2 = nil 44 | } 45 | } 46 | } 47 | 48 | extension Disposables { 49 | 50 | /// Creates a disposable with the given disposables. 51 | public static func create(_ disposable1: Disposable, _ disposable2: Disposable) -> Cancelable { 52 | return BinaryDisposable(disposable1, disposable2) 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BooleanDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Junior B. on 10/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents a disposable resource that can be checked for disposal status. 12 | public final class BooleanDisposable : Disposable, Cancelable { 13 | 14 | internal static let BooleanDisposableTrue = BooleanDisposable(isDisposed: true) 15 | private var _isDisposed = false 16 | 17 | /// Initializes a new instance of the `BooleanDisposable` class 18 | public init() { 19 | } 20 | 21 | /// Initializes a new instance of the `BooleanDisposable` class with given value 22 | public init(isDisposed: Bool) { 23 | self._isDisposed = isDisposed 24 | } 25 | 26 | /// - returns: Was resource disposed. 27 | public var isDisposed: Bool { 28 | return _isDisposed 29 | } 30 | 31 | /// Sets the status to disposed, which can be observer through the `isDisposed` property. 32 | public func dispose() { 33 | _isDisposed = true 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/Disposables.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Disposables.swift 3 | // RxSwift 4 | // 5 | // Created by Mohsen Ramezanpoor on 01/08/2016. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// A collection of utility methods for common disposable operations. 12 | public struct Disposables { 13 | private init() {} 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DisposeBase.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/4/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Base class for all disposables. 12 | public class DisposeBase { 13 | init() { 14 | #if TRACE_RESOURCES 15 | let _ = Resources.incrementTotal() 16 | #endif 17 | } 18 | 19 | deinit { 20 | #if TRACE_RESOURCES 21 | let _ = Resources.decrementTotal() 22 | #endif 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NopDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents a disposable that does nothing on disposal. 12 | /// 13 | /// Nop = No Operation 14 | fileprivate struct NopDisposable : Disposable { 15 | 16 | fileprivate static let noOp: Disposable = NopDisposable() 17 | 18 | fileprivate init() { 19 | 20 | } 21 | 22 | /// Does nothing. 23 | public func dispose() { 24 | } 25 | } 26 | 27 | extension Disposables { 28 | /** 29 | Creates a disposable that does nothing on disposal. 30 | */ 31 | static public func create() -> Disposable { 32 | return NopDisposable.noOp 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScheduledDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 6/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | private let disposeScheduledDisposable: (ScheduledDisposable) -> Disposable = { sd in 12 | sd.disposeInner() 13 | return Disposables.create() 14 | } 15 | 16 | /// Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler. 17 | public final class ScheduledDisposable : Cancelable { 18 | public let scheduler: ImmediateSchedulerType 19 | 20 | private var _isDisposed: AtomicInt = 0 21 | 22 | // state 23 | private var _disposable: Disposable? 24 | 25 | /// - returns: Was resource disposed. 26 | public var isDisposed: Bool { 27 | return _isDisposed == 1 28 | } 29 | 30 | /** 31 | Initializes a new instance of the `ScheduledDisposable` that uses a `scheduler` on which to dispose the `disposable`. 32 | 33 | - parameter scheduler: Scheduler where the disposable resource will be disposed on. 34 | - parameter disposable: Disposable resource to dispose on the given scheduler. 35 | */ 36 | public init(scheduler: ImmediateSchedulerType, disposable: Disposable) { 37 | self.scheduler = scheduler 38 | _disposable = disposable 39 | } 40 | 41 | /// Disposes the wrapped disposable on the provided scheduler. 42 | public func dispose() { 43 | let _ = scheduler.schedule(self, action: disposeScheduledDisposable) 44 | } 45 | 46 | func disposeInner() { 47 | if AtomicCompareAndSwap(0, 1, &_isDisposed) { 48 | _disposable!.dispose() 49 | _disposable = nil 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SubscriptionDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct SubscriptionDisposable : Disposable { 12 | private let _key: T.DisposeKey 13 | private weak var _owner: T? 14 | 15 | init(owner: T, key: T.DisposeKey) { 16 | _owner = owner 17 | _key = key 18 | } 19 | 20 | func dispose() { 21 | _owner?.synchronizedUnsubscribe(_key) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Errors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Errors.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | let RxErrorDomain = "RxErrorDomain" 12 | let RxCompositeFailures = "RxCompositeFailures" 13 | 14 | /// Generic Rx error codes. 15 | public enum RxError 16 | : Swift.Error 17 | , CustomDebugStringConvertible { 18 | /// Unknown error occured. 19 | case unknown 20 | /// Performing an action on disposed object. 21 | case disposed(object: AnyObject) 22 | /// Aritmetic overflow error. 23 | case overflow 24 | /// Argument out of range error. 25 | case argumentOutOfRange 26 | /// Sequence doesn't contain any elements. 27 | case noElements 28 | /// Sequence contains more than one element. 29 | case moreThanOneElement 30 | /// Timeout error. 31 | case timeout 32 | } 33 | 34 | extension RxError { 35 | /// A textual representation of `self`, suitable for debugging. 36 | public var debugDescription: String { 37 | switch self { 38 | case .unknown: 39 | return "Unknown error occured." 40 | case .disposed(let object): 41 | return "Object `\(object)` was already disposed." 42 | case .overflow: 43 | return "Arithmetic overflow occured." 44 | case .argumentOutOfRange: 45 | return "Argument out of range." 46 | case .noElements: 47 | return "Sequence doesn't contain any elements." 48 | case .moreThanOneElement: 49 | return "Sequence contains more than one element." 50 | case .timeout: 51 | return "Sequence timeout." 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Event.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Event.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents a sequence event. 12 | /// 13 | /// Sequence grammar: 14 | /// **next\* (error | completed)** 15 | public enum Event { 16 | /// Next element is produced. 17 | case next(Element) 18 | 19 | /// Sequence terminated with an error. 20 | case error(Swift.Error) 21 | 22 | /// Sequence completed successfully. 23 | case completed 24 | } 25 | 26 | extension Event : CustomDebugStringConvertible { 27 | /// - returns: Description of event. 28 | public var debugDescription: String { 29 | switch self { 30 | case .next(let value): 31 | return "next(\(value))" 32 | case .error(let error): 33 | return "error(\(error))" 34 | case .completed: 35 | return "completed" 36 | } 37 | } 38 | } 39 | 40 | extension Event { 41 | /// Is `Completed` or `Error` event. 42 | public var isStopEvent: Bool { 43 | switch self { 44 | case .next: return false 45 | case .error, .completed: return true 46 | } 47 | } 48 | 49 | /// If `Next` event, returns element value. 50 | public var element: Element? { 51 | if case .next(let value) = self { 52 | return value 53 | } 54 | return nil 55 | } 56 | 57 | /// If `Error` event, returns error. 58 | public var error: Swift.Error? { 59 | if case .error(let error) = self { 60 | return error 61 | } 62 | return nil 63 | } 64 | } 65 | 66 | extension Event { 67 | /// Maps sequence elements using transform. If error happens during the transform .error 68 | /// will be returned as value 69 | public func map(_ transform: (Element) throws -> Result) -> Event { 70 | do { 71 | switch self { 72 | case let .next(element): 73 | return .next(try transform(element)) 74 | case let .error(error): 75 | return .error(error) 76 | case .completed: 77 | return .completed 78 | } 79 | } 80 | catch let e { 81 | return .error(e) 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bag+Rx.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/19/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | // MARK: forEach 13 | 14 | extension Bag where T: ObserverType { 15 | /// Dispatches `event` to app observers contained inside bag. 16 | /// 17 | /// - parameter action: Enumeration closure. 18 | func on(_ event: Event) { 19 | if _onlyFastPath { 20 | _value0?.on(event) 21 | return 22 | } 23 | 24 | let value0 = _value0 25 | let dictionary = _dictionary 26 | 27 | if let value0 = value0 { 28 | value0.on(event) 29 | } 30 | 31 | if let dictionary = dictionary { 32 | for element in dictionary.values { 33 | element.on(event) 34 | } 35 | } 36 | } 37 | } 38 | 39 | /// Dispatches `dispose` to all disposables contained inside bag. 40 | func disposeAll(in bag: Bag) { 41 | if bag._onlyFastPath { 42 | bag._value0?.dispose() 43 | return 44 | } 45 | 46 | let value0 = bag._value0 47 | let dictionary = bag._dictionary 48 | 49 | if let value0 = value0 { 50 | value0.dispose() 51 | } 52 | 53 | if let dictionary = dictionary { 54 | for element in dictionary.values { 55 | element.dispose() 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Extensions/String+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Rx.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 12/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension String { 12 | /// This is needed because on Linux Swift doesn't have `rangeOfString(..., options: .BackwardsSearch)` 13 | func lastIndexOf(_ character: Character) -> Index? { 14 | var index = endIndex 15 | while index > startIndex { 16 | index = self.index(before: index) 17 | if self[index] == character { 18 | return index 19 | } 20 | } 21 | 22 | return nil 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImmediateSchedulerType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 5/31/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents an object that immediately schedules units of work. 12 | public protocol ImmediateSchedulerType { 13 | /** 14 | Schedules an action to be executed immediatelly. 15 | 16 | - parameter state: State passed to the action to be executed. 17 | - parameter action: Action to be executed. 18 | - returns: The disposable object used to cancel the scheduled action (best effort). 19 | */ 20 | func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable 21 | } 22 | 23 | extension ImmediateSchedulerType { 24 | /** 25 | Schedules an action to be executed recursively. 26 | 27 | - parameter state: State passed to the action to be executed. 28 | - 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. 29 | - returns: The disposable object used to cancel the scheduled action (best effort). 30 | */ 31 | public func scheduleRecursive(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> ()) -> ()) -> Disposable { 32 | let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self) 33 | 34 | recursiveScheduler.schedule(state) 35 | 36 | return Disposables.create(with: recursiveScheduler.dispose) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Observable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// A type-erased `ObservableType`. 12 | /// 13 | /// It represents a push style sequence. 14 | public class Observable : ObservableType { 15 | /// Type of elements in sequence. 16 | public typealias E = Element 17 | 18 | init() { 19 | #if TRACE_RESOURCES 20 | let _ = Resources.incrementTotal() 21 | #endif 22 | } 23 | 24 | public func subscribe(_ observer: O) -> Disposable where O.E == E { 25 | abstractMethod() 26 | } 27 | 28 | public func asObservable() -> Observable { 29 | return self 30 | } 31 | 32 | deinit { 33 | #if TRACE_RESOURCES 34 | let _ = Resources.decrementTotal() 35 | #endif 36 | } 37 | 38 | // this is kind of ugly I know :( 39 | // Swift compiler reports "Not supported yet" when trying to override protocol extensions, so ¯\_(ツ)_/¯ 40 | 41 | /// Optimizations for map operator 42 | internal func composeMap(_ selector: @escaping (Element) throws -> R) -> Observable { 43 | return Map(source: self, transform: selector) 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ObservableConvertibleType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObservableConvertibleType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/17/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Type that can be converted to observable sequence (`Observer`). 12 | public protocol ObservableConvertibleType { 13 | /// Type of elements in sequence. 14 | associatedtype E 15 | 16 | /// Converts `self` to `Observable` sequence. 17 | /// 18 | /// - returns: Observable sequence that represents `self`. 19 | func asObservable() -> Observable 20 | } 21 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ObservableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObservableType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents a push style sequence. 12 | public protocol ObservableType : ObservableConvertibleType { 13 | /// Type of elements in sequence. 14 | associatedtype E 15 | 16 | /** 17 | Subscribes `observer` to receive events for this sequence. 18 | 19 | ### Grammar 20 | 21 | **Next\* (Error | Completed)?** 22 | 23 | * sequences can produce zero or more elements so zero or more `Next` events can be sent to `observer` 24 | * once an `Error` or `Completed` event is sent, the sequence terminates and can't produce any other elements 25 | 26 | It is possible that events are sent from different threads, but no two events can be sent concurrently to 27 | `observer`. 28 | 29 | ### Resource Management 30 | 31 | When sequence sends `Complete` or `Error` event all internal resources that compute sequence elements 32 | will be freed. 33 | 34 | To cancel production of sequence elements and free resources immediatelly, call `dispose` on returned 35 | subscription. 36 | 37 | - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources. 38 | */ 39 | func subscribe(_ observer: O) -> Disposable where O.E == E 40 | } 41 | 42 | extension ObservableType { 43 | 44 | /// Default implementation of converting `ObservableType` to `Observable`. 45 | public func asObservable() -> Observable { 46 | // temporary workaround 47 | //return Observable.create(subscribe: self.subscribe) 48 | return Observable.create { o in 49 | return self.subscribe(o) 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/AddRef.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AddRef.swift 3 | // RxSwift 4 | // 5 | // Created by Junior B. on 30/10/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AddRefSink : Sink, ObserverType { 12 | typealias Element = O.E 13 | 14 | override init(observer: O, cancel: Cancelable) { 15 | super.init(observer: observer, cancel: cancel) 16 | } 17 | 18 | func on(_ event: Event) { 19 | switch event { 20 | case .next(_): 21 | forwardOn(event) 22 | case .completed, .error(_): 23 | forwardOn(event) 24 | dispose() 25 | } 26 | } 27 | } 28 | 29 | class AddRef : Producer { 30 | typealias EventHandler = (Event) throws -> Void 31 | 32 | private let _source: Observable 33 | private let _refCount: RefCountDisposable 34 | 35 | init(source: Observable, refCount: RefCountDisposable) { 36 | _source = source 37 | _refCount = refCount 38 | } 39 | 40 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 41 | let releaseDisposable = _refCount.retain() 42 | let sink = AddRefSink(observer: observer, cancel: cancel) 43 | let subscription = Disposables.create(releaseDisposable, _source.subscribeSafe(sink)) 44 | 45 | return (sink: sink, subscription: subscription) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnonymousObservable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AnonymousObservableSink : Sink, ObserverType { 12 | typealias E = O.E 13 | typealias Parent = AnonymousObservable 14 | 15 | // state 16 | private var _isStopped: AtomicInt = 0 17 | 18 | override init(observer: O, cancel: Cancelable) { 19 | super.init(observer: observer, cancel: cancel) 20 | } 21 | 22 | func on(_ event: Event) { 23 | switch event { 24 | case .next: 25 | if _isStopped == 1 { 26 | return 27 | } 28 | forwardOn(event) 29 | case .error, .completed: 30 | if AtomicCompareAndSwap(0, 1, &_isStopped) { 31 | forwardOn(event) 32 | dispose() 33 | } 34 | } 35 | } 36 | 37 | func run(_ parent: Parent) -> Disposable { 38 | return parent._subscribeHandler(AnyObserver(self)) 39 | } 40 | } 41 | 42 | class AnonymousObservable : Producer { 43 | typealias SubscribeHandler = (AnyObserver) -> Disposable 44 | 45 | let _subscribeHandler: SubscribeHandler 46 | 47 | init(_ subscribeHandler: @escaping SubscribeHandler) { 48 | _subscribeHandler = subscribeHandler 49 | } 50 | 51 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 52 | let sink = AnonymousObservableSink(observer: observer, cancel: cancel) 53 | let subscription = sink.run(self) 54 | return (sink: sink, subscription: subscription) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Concat.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Concat.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/21/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | class ConcatSink 13 | : TailRecursiveSink 14 | , ObserverType where S.Iterator.Element : ObservableConvertibleType, S.Iterator.Element.E == O.E { 15 | typealias Element = O.E 16 | 17 | override init(observer: O, cancel: Cancelable) { 18 | super.init(observer: observer, cancel: cancel) 19 | } 20 | 21 | func on(_ event: Event){ 22 | switch event { 23 | case .next: 24 | forwardOn(event) 25 | case .error: 26 | forwardOn(event) 27 | dispose() 28 | case .completed: 29 | schedule(.moveNext) 30 | } 31 | } 32 | 33 | override func subscribeToNext(_ source: Observable) -> Disposable { 34 | return source.subscribe(self) 35 | } 36 | 37 | override func extract(_ observable: Observable) -> SequenceGenerator? { 38 | if let source = observable as? Concat { 39 | return (source._sources.makeIterator(), source._count) 40 | } 41 | else { 42 | return nil 43 | } 44 | } 45 | } 46 | 47 | class Concat : Producer where S.Iterator.Element : ObservableConvertibleType { 48 | typealias Element = S.Iterator.Element.E 49 | 50 | fileprivate let _sources: S 51 | fileprivate let _count: IntMax? 52 | 53 | init(sources: S, count: IntMax?) { 54 | _sources = sources 55 | _count = count 56 | } 57 | 58 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 59 | let sink = ConcatSink(observer: observer, cancel: cancel) 60 | let subscription = sink.run((_sources.makeIterator(), _count)) 61 | return (sink: sink, subscription: subscription) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Deferred.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Deferred.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/19/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class DeferredSink : Sink, ObserverType where S.E == O.E { 12 | typealias E = O.E 13 | 14 | private let _observableFactory: () throws -> S 15 | 16 | init(observableFactory: @escaping () throws -> S, observer: O, cancel: Cancelable) { 17 | _observableFactory = observableFactory 18 | super.init(observer: observer, cancel: cancel) 19 | } 20 | 21 | func run() -> Disposable { 22 | do { 23 | let result = try _observableFactory() 24 | return result.subscribe(self) 25 | } 26 | catch let e { 27 | forwardOn(.error(e)) 28 | dispose() 29 | return Disposables.create() 30 | } 31 | } 32 | 33 | func on(_ event: Event) { 34 | forwardOn(event) 35 | 36 | switch event { 37 | case .next: 38 | break 39 | case .error: 40 | dispose() 41 | case .completed: 42 | dispose() 43 | } 44 | } 45 | } 46 | 47 | class Deferred : Producer { 48 | typealias Factory = () throws -> S 49 | 50 | private let _observableFactory : Factory 51 | 52 | init(observableFactory: @escaping Factory) { 53 | _observableFactory = observableFactory 54 | } 55 | 56 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == S.E { 57 | let sink = DeferredSink(observableFactory: _observableFactory, observer: observer, cancel: cancel) 58 | let subscription = sink.run() 59 | return (sink: sink, subscription: subscription) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/DelaySubscription.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DelaySubscription.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 6/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class DelaySubscriptionSink 12 | : Sink 13 | , ObserverType where O.E == ElementType { 14 | typealias Parent = DelaySubscription 15 | typealias E = O.E 16 | 17 | private let _parent: Parent 18 | 19 | init(parent: Parent, observer: O, cancel: Cancelable) { 20 | _parent = parent 21 | super.init(observer: observer, cancel: cancel) 22 | } 23 | 24 | func on(_ event: Event) { 25 | forwardOn(event) 26 | if event.isStopEvent { 27 | dispose() 28 | } 29 | } 30 | 31 | } 32 | 33 | class DelaySubscription: Producer { 34 | private let _source: Observable 35 | private let _dueTime: RxTimeInterval 36 | private let _scheduler: SchedulerType 37 | 38 | init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { 39 | _source = source 40 | _dueTime = dueTime 41 | _scheduler = scheduler 42 | } 43 | 44 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 45 | let sink = DelaySubscriptionSink(parent: self, observer: observer, cancel: cancel) 46 | let subscription = _scheduler.scheduleRelative((), dueTime: _dueTime) { _ in 47 | return self._source.subscribe(sink) 48 | } 49 | 50 | return (sink: sink, subscription: subscription) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Do.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Do.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/21/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class DoSink : Sink, ObserverType { 12 | typealias Element = O.E 13 | typealias Parent = Do 14 | 15 | private let _parent: Parent 16 | 17 | init(parent: Parent, observer: O, cancel: Cancelable) { 18 | _parent = parent 19 | super.init(observer: observer, cancel: cancel) 20 | } 21 | 22 | func on(_ event: Event) { 23 | do { 24 | try _parent._eventHandler(event) 25 | forwardOn(event) 26 | if event.isStopEvent { 27 | dispose() 28 | } 29 | } 30 | catch let error { 31 | forwardOn(.error(error)) 32 | dispose() 33 | } 34 | } 35 | } 36 | 37 | class Do : Producer { 38 | typealias EventHandler = (Event) throws -> Void 39 | 40 | fileprivate let _source: Observable 41 | fileprivate let _eventHandler: EventHandler 42 | fileprivate let _onSubscribe: (() -> ())? 43 | fileprivate let _onDispose: (() -> ())? 44 | 45 | init(source: Observable, eventHandler: @escaping EventHandler, onSubscribe: (() -> ())?, onDispose: (() -> ())?) { 46 | _source = source 47 | _eventHandler = eventHandler 48 | _onSubscribe = onSubscribe 49 | _onDispose = onDispose 50 | } 51 | 52 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 53 | _onSubscribe?() 54 | let sink = DoSink(parent: self, observer: observer, cancel: cancel) 55 | let subscription = _source.subscribe(sink) 56 | let onDispose = _onDispose 57 | let allSubscriptions = Disposables.create { 58 | subscription.dispose() 59 | onDispose?() 60 | } 61 | return (sink: sink, subscription: allSubscriptions) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Empty.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Empty.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Empty : Producer { 12 | override func subscribe(_ observer: O) -> Disposable where O.E == Element { 13 | observer.on(.completed) 14 | return Disposables.create() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Error.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Error.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Error : Producer { 12 | private let _error: Swift.Error 13 | 14 | init(error: Swift.Error) { 15 | _error = error 16 | } 17 | 18 | override func subscribe(_ observer: O) -> Disposable where O.E == Element { 19 | observer.on(.error(_error)) 20 | return Disposables.create() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Filter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Filter.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/17/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class FilterSink: Sink, ObserverType { 12 | typealias Predicate = (Element) throws -> Bool 13 | typealias Element = O.E 14 | 15 | private let _predicate: Predicate 16 | 17 | init(predicate: @escaping Predicate, observer: O, cancel: Cancelable) { 18 | _predicate = predicate 19 | super.init(observer: observer, cancel: cancel) 20 | } 21 | 22 | func on(_ event: Event) { 23 | switch event { 24 | case .next(let value): 25 | do { 26 | let satisfies = try _predicate(value) 27 | if satisfies { 28 | forwardOn(.next(value)) 29 | } 30 | } 31 | catch let e { 32 | forwardOn(.error(e)) 33 | dispose() 34 | } 35 | case .completed, .error: 36 | forwardOn(event) 37 | dispose() 38 | } 39 | } 40 | } 41 | 42 | class Filter : Producer { 43 | typealias Predicate = (Element) throws -> Bool 44 | 45 | private let _source: Observable 46 | private let _predicate: Predicate 47 | 48 | init(source: Observable, predicate: @escaping Predicate) { 49 | _source = source 50 | _predicate = predicate 51 | } 52 | 53 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 54 | let sink = FilterSink(predicate: _predicate, observer: observer, cancel: cancel) 55 | let subscription = _source.subscribe(sink) 56 | return (sink: sink, subscription: subscription) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Just.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Just.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class JustScheduledSink : Sink { 12 | typealias Parent = JustScheduled 13 | 14 | private let _parent: Parent 15 | 16 | init(parent: Parent, observer: O, cancel: Cancelable) { 17 | _parent = parent 18 | super.init(observer: observer, cancel: cancel) 19 | } 20 | 21 | func run() -> Disposable { 22 | let scheduler = _parent._scheduler 23 | return scheduler.schedule(_parent._element) { element in 24 | self.forwardOn(.next(element)) 25 | return scheduler.schedule(()) { _ in 26 | self.forwardOn(.completed) 27 | return Disposables.create() 28 | } 29 | } 30 | } 31 | } 32 | 33 | class JustScheduled : Producer { 34 | fileprivate let _scheduler: ImmediateSchedulerType 35 | fileprivate let _element: Element 36 | 37 | init(element: Element, scheduler: ImmediateSchedulerType) { 38 | _scheduler = scheduler 39 | _element = element 40 | } 41 | 42 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { 43 | let sink = JustScheduledSink(parent: self, observer: observer, cancel: cancel) 44 | let subscription = sink.run() 45 | return (sink: sink, subscription: subscription) 46 | } 47 | } 48 | 49 | class Just : Producer { 50 | private let _element: Element 51 | 52 | init(element: Element) { 53 | _element = element 54 | } 55 | 56 | override func subscribe(_ observer: O) -> Disposable where O.E == Element { 57 | observer.on(.next(_element)) 58 | observer.on(.completed) 59 | return Disposables.create() 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Never.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Never.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Never : Producer { 12 | override func subscribe(_ observer: O) -> Disposable where O.E == Element { 13 | return Disposables.create() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Range.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Range.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class RangeProducer : Producer { 12 | fileprivate let _start: E 13 | fileprivate let _count: E 14 | fileprivate let _scheduler: ImmediateSchedulerType 15 | 16 | init(start: E, count: E, scheduler: ImmediateSchedulerType) { 17 | if count < 0 { 18 | rxFatalError("count can't be negative") 19 | } 20 | 21 | if start &+ (count - 1) < start { 22 | rxFatalError("overflow of count") 23 | } 24 | 25 | _start = start 26 | _count = count 27 | _scheduler = scheduler 28 | } 29 | 30 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { 31 | let sink = RangeSink(parent: self, observer: observer, cancel: cancel) 32 | let subscription = sink.run() 33 | return (sink: sink, subscription: subscription) 34 | } 35 | } 36 | 37 | class RangeSink : Sink where O.E: SignedInteger { 38 | typealias Parent = RangeProducer 39 | 40 | private let _parent: Parent 41 | 42 | init(parent: Parent, observer: O, cancel: Cancelable) { 43 | _parent = parent 44 | super.init(observer: observer, cancel: cancel) 45 | } 46 | 47 | func run() -> Disposable { 48 | return _parent._scheduler.scheduleRecursive(0 as O.E) { i, recurse in 49 | if i < self._parent._count { 50 | self.forwardOn(.next(self._parent._start + i)) 51 | recurse(i + 1) 52 | } 53 | else { 54 | self.forwardOn(.completed) 55 | self.dispose() 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Repeat.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Repeat.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class RepeatElement : Producer { 12 | fileprivate let _element: Element 13 | fileprivate let _scheduler: ImmediateSchedulerType 14 | 15 | init(element: Element, scheduler: ImmediateSchedulerType) { 16 | _element = element 17 | _scheduler = scheduler 18 | } 19 | 20 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 21 | let sink = RepeatElementSink(parent: self, observer: observer, cancel: cancel) 22 | let subscription = sink.run() 23 | 24 | return (sink: sink, subscription: subscription) 25 | } 26 | } 27 | 28 | class RepeatElementSink : Sink { 29 | typealias Parent = RepeatElement 30 | 31 | private let _parent: Parent 32 | 33 | init(parent: Parent, observer: O, cancel: Cancelable) { 34 | _parent = parent 35 | super.init(observer: observer, cancel: cancel) 36 | } 37 | 38 | func run() -> Disposable { 39 | return _parent._scheduler.scheduleRecursive(_parent._element) { e, recurse in 40 | self.forwardOn(.next(e)) 41 | recurse(e) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Scan.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Scan.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 6/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class ScanSink : Sink, ObserverType where O.E == Accumulate { 12 | typealias Parent = Scan 13 | typealias E = ElementType 14 | 15 | fileprivate let _parent: Parent 16 | fileprivate var _accumulate: Accumulate 17 | 18 | init(parent: Parent, observer: O, cancel: Cancelable) { 19 | _parent = parent 20 | _accumulate = parent._seed 21 | super.init(observer: observer, cancel: cancel) 22 | } 23 | 24 | func on(_ event: Event) { 25 | switch event { 26 | case .next(let element): 27 | do { 28 | _accumulate = try _parent._accumulator(_accumulate, element) 29 | forwardOn(.next(_accumulate)) 30 | } 31 | catch let error { 32 | forwardOn(.error(error)) 33 | dispose() 34 | } 35 | case .error(let error): 36 | forwardOn(.error(error)) 37 | dispose() 38 | case .completed: 39 | forwardOn(.completed) 40 | dispose() 41 | } 42 | } 43 | 44 | } 45 | 46 | class Scan: Producer { 47 | typealias Accumulator = (Accumulate, Element) throws -> Accumulate 48 | 49 | fileprivate let _source: Observable 50 | fileprivate let _seed: Accumulate 51 | fileprivate let _accumulator: Accumulator 52 | 53 | init(source: Observable, seed: Accumulate, accumulator: @escaping Accumulator) { 54 | _source = source 55 | _seed = seed 56 | _accumulator = accumulator 57 | } 58 | 59 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Accumulate { 60 | let sink = ScanSink(parent: self, observer: observer, cancel: cancel) 61 | let subscription = _source.subscribe(sink) 62 | return (sink: sink, subscription: subscription) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Sequence.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Sequence.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class ObservableSequenceSink : Sink where S.Iterator.Element == O.E { 12 | typealias Parent = ObservableSequence 13 | 14 | private let _parent: Parent 15 | 16 | init(parent: Parent, observer: O, cancel: Cancelable) { 17 | _parent = parent 18 | super.init(observer: observer, cancel: cancel) 19 | } 20 | 21 | func run() -> Disposable { 22 | return _parent._scheduler.scheduleRecursive((_parent._elements.makeIterator(), _parent._elements)) { (iterator, recurse) in 23 | var mutableIterator = iterator 24 | if let next = mutableIterator.0.next() { 25 | self.forwardOn(.next(next)) 26 | recurse(mutableIterator) 27 | } 28 | else { 29 | self.forwardOn(.completed) 30 | } 31 | } 32 | } 33 | } 34 | 35 | class ObservableSequence : Producer { 36 | fileprivate let _elements: S 37 | fileprivate let _scheduler: ImmediateSchedulerType 38 | 39 | init(elements: S, scheduler: ImmediateSchedulerType) { 40 | _elements = elements 41 | _scheduler = scheduler 42 | } 43 | 44 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { 45 | let sink = ObservableSequenceSink(parent: self, observer: observer, cancel: cancel) 46 | let subscription = sink.run() 47 | return (sink: sink, subscription: subscription) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Sink.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/19/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Sink : Disposable { 12 | fileprivate let _observer: O 13 | fileprivate let _cancel: Cancelable 14 | fileprivate var _disposed: Bool 15 | 16 | init(observer: O, cancel: Cancelable) { 17 | #if TRACE_RESOURCES 18 | let _ = Resources.incrementTotal() 19 | #endif 20 | _observer = observer 21 | _cancel = cancel 22 | _disposed = false 23 | } 24 | 25 | final func forwardOn(_ event: Event) { 26 | if _disposed { 27 | return 28 | } 29 | _observer.on(event) 30 | } 31 | 32 | final func forwarder() -> SinkForward { 33 | return SinkForward(forward: self) 34 | } 35 | 36 | var disposed: Bool { 37 | return _disposed 38 | } 39 | 40 | func dispose() { 41 | _disposed = true 42 | _cancel.dispose() 43 | } 44 | 45 | deinit { 46 | #if TRACE_RESOURCES 47 | let _ = Resources.decrementTotal() 48 | #endif 49 | } 50 | } 51 | 52 | class SinkForward: ObserverType { 53 | typealias E = O.E 54 | 55 | private let _forward: Sink 56 | 57 | init(forward: Sink) { 58 | _forward = forward 59 | } 60 | 61 | func on(_ event: Event) { 62 | switch event { 63 | case .next: 64 | _forward._observer.on(event) 65 | case .error, .completed: 66 | _forward._observer.on(event) 67 | _forward._cancel.dispose() 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/StartWith.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StartWith.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/6/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class StartWith: Producer { 12 | let elements: [Element] 13 | let source: Observable 14 | 15 | init(source: Observable, elements: [Element]) { 16 | self.source = source 17 | self.elements = elements 18 | super.init() 19 | } 20 | 21 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 22 | for e in elements { 23 | observer.on(.next(e)) 24 | } 25 | 26 | return (sink: Disposables.create(), subscription: source.subscribe(observer)) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/SubscribeOn.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SubscribeOn.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 6/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class SubscribeOnSink : Sink, ObserverType where Ob.E == O.E { 12 | typealias Element = O.E 13 | typealias Parent = SubscribeOn 14 | 15 | let parent: Parent 16 | 17 | init(parent: Parent, observer: O, cancel: Cancelable) { 18 | self.parent = parent 19 | super.init(observer: observer, cancel: cancel) 20 | } 21 | 22 | func on(_ event: Event) { 23 | forwardOn(event) 24 | 25 | if event.isStopEvent { 26 | self.dispose() 27 | } 28 | } 29 | 30 | func run() -> Disposable { 31 | let disposeEverything = SerialDisposable() 32 | let cancelSchedule = SingleAssignmentDisposable() 33 | 34 | disposeEverything.disposable = cancelSchedule 35 | 36 | let disposeSchedule = parent.scheduler.schedule(()) { (_) -> Disposable in 37 | let subscription = self.parent.source.subscribe(self) 38 | disposeEverything.disposable = ScheduledDisposable(scheduler: self.parent.scheduler, disposable: subscription) 39 | return Disposables.create() 40 | } 41 | 42 | cancelSchedule.setDisposable(disposeSchedule) 43 | 44 | return disposeEverything 45 | } 46 | } 47 | 48 | class SubscribeOn : Producer { 49 | let source: Ob 50 | let scheduler: ImmediateSchedulerType 51 | 52 | init(source: Ob, scheduler: ImmediateSchedulerType) { 53 | self.source = source 54 | self.scheduler = scheduler 55 | } 56 | 57 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Ob.E { 58 | let sink = SubscribeOnSink(parent: self, observer: observer, cancel: cancel) 59 | let subscription = sink.run() 60 | return (sink: sink, subscription: subscription) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/TakeLast.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TakeLast.swift 3 | // RxSwift 4 | // 5 | // Created by Tomi Koskinen on 25/10/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | class TakeLastSink : Sink, ObserverType where O.E == ElementType { 13 | typealias Parent = TakeLast 14 | typealias E = ElementType 15 | 16 | private let _parent: Parent 17 | 18 | private var _elements: Queue 19 | 20 | init(parent: Parent, observer: O, cancel: Cancelable) { 21 | _parent = parent 22 | _elements = Queue(capacity: parent._count + 1) 23 | super.init(observer: observer, cancel: cancel) 24 | } 25 | 26 | func on(_ event: Event) { 27 | switch event { 28 | case .next(let value): 29 | _elements.enqueue(value) 30 | if _elements.count > self._parent._count { 31 | let _ = _elements.dequeue() 32 | } 33 | case .error: 34 | forwardOn(event) 35 | dispose() 36 | case .completed: 37 | for e in _elements { 38 | forwardOn(.next(e)) 39 | } 40 | forwardOn(.completed) 41 | dispose() 42 | } 43 | } 44 | } 45 | 46 | class TakeLast: Producer { 47 | fileprivate let _source: Observable 48 | fileprivate let _count: Int 49 | 50 | init(source: Observable, count: Int) { 51 | if count < 0 { 52 | rxFatalError("count can't be negative") 53 | } 54 | _source = source 55 | _count = count 56 | } 57 | 58 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 59 | let sink = TakeLastSink(parent: self, observer: observer, cancel: cancel) 60 | let subscription = _source.subscribe(sink) 61 | return (sink: sink, subscription: subscription) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Implementations/ToArray.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToArray.swift 3 | // RxSwift 4 | // 5 | // Created by Junior B. on 20/10/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class ToArraySink : Sink, ObserverType where O.E == [SourceType] { 12 | typealias Parent = ToArray 13 | 14 | let _parent: Parent 15 | var _list = Array() 16 | 17 | init(parent: Parent, observer: O, cancel: Cancelable) { 18 | _parent = parent 19 | 20 | super.init(observer: observer, cancel: cancel) 21 | } 22 | 23 | func on(_ event: Event) { 24 | switch event { 25 | case .next(let value): 26 | self._list.append(value) 27 | case .error(let e): 28 | forwardOn(.error(e)) 29 | self.dispose() 30 | case .completed: 31 | forwardOn(.next(_list)) 32 | forwardOn(.completed) 33 | self.dispose() 34 | } 35 | } 36 | } 37 | 38 | class ToArray : Producer<[SourceType]> { 39 | let _source: Observable 40 | 41 | init(source: Observable) { 42 | _source = source 43 | } 44 | 45 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == [SourceType] { 46 | let sink = ToArraySink(parent: self, observer: observer, cancel: cancel) 47 | let subscription = _source.subscribe(sink) 48 | return (sink: sink, subscription: subscription) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Observable+Concurrency.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Observable+Concurrency.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // MARK: observeOn 12 | 13 | extension ObservableType { 14 | 15 | /** 16 | Wraps the source sequence in order to run its observer callbacks on the specified scheduler. 17 | 18 | This only invokes observer callbacks on a `scheduler`. In case the subscription and/or unsubscription 19 | actions have side-effects that require to be run on a scheduler, use `subscribeOn`. 20 | 21 | - seealso: [observeOn operator on reactivex.io](http://reactivex.io/documentation/operators/observeon.html) 22 | 23 | - parameter scheduler: Scheduler to notify observers on. 24 | - returns: The source sequence whose observations happen on the specified scheduler. 25 | */ 26 | public func observeOn(_ scheduler: ImmediateSchedulerType) 27 | -> Observable { 28 | if let scheduler = scheduler as? SerialDispatchQueueScheduler { 29 | return ObserveOnSerialDispatchQueue(source: self.asObservable(), scheduler: scheduler) 30 | } 31 | else { 32 | return ObserveOn(source: self.asObservable(), scheduler: scheduler) 33 | } 34 | } 35 | } 36 | 37 | // MARK: subscribeOn 38 | 39 | extension ObservableType { 40 | 41 | /** 42 | Wraps the source sequence in order to run its subscription and unsubscription logic on the specified 43 | scheduler. 44 | 45 | This operation is not commonly used. 46 | 47 | This only performs the side-effects of subscription and unsubscription on the specified scheduler. 48 | 49 | In order to invoke observer callbacks on a `scheduler`, use `observeOn`. 50 | 51 | - seealso: [subscribeOn operator on reactivex.io](http://reactivex.io/documentation/operators/subscribeon.html) 52 | 53 | - parameter scheduler: Scheduler to perform subscription and unsubscription actions on. 54 | - returns: The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. 55 | */ 56 | public func subscribeOn(_ scheduler: ImmediateSchedulerType) 57 | -> Observable { 58 | return SubscribeOn(source: self, scheduler: scheduler) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Observable+Debug.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Observable+Debug.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 5/2/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // MARK: debug 12 | 13 | extension ObservableType { 14 | 15 | /** 16 | Prints received events for all observers on standard output. 17 | 18 | - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html) 19 | 20 | - parameter identifier: Identifier that is printed together with event description to standard output. 21 | - parameter trimOutput: Should output be trimmed to max 40 characters. 22 | - returns: An observable sequence whose events are printed to standard output. 23 | */ 24 | public func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function) 25 | -> Observable { 26 | return Debug(source: self, identifier: identifier, trimOutput: trimOutput, file: file, line: line, function: function) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ObserverType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObserverType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Supports push-style iteration over an observable sequence. 12 | public protocol ObserverType { 13 | /// The type of elements in sequence that observer can observe. 14 | associatedtype E 15 | 16 | /// Notify observer about sequence event. 17 | /// 18 | /// - parameter event: Event that occured. 19 | func on(_ event: Event) 20 | } 21 | 22 | /// Convenience API extensions to provide alternate next, error, completed events 23 | extension ObserverType { 24 | 25 | /// Convenience method equivalent to `on(.next(element: E))` 26 | /// 27 | /// - parameter element: Next element to send to observer(s) 28 | public final func onNext(_ element: E) { 29 | on(.next(element)) 30 | } 31 | 32 | /// Convenience method equivalent to `on(.completed)` 33 | public final func onCompleted() { 34 | on(.completed) 35 | } 36 | 37 | /// Convenience method equivalent to `on(.error(Swift.Error))` 38 | /// - parameter error: Swift.Error to send to observer(s) 39 | public final func onError(_ error: Swift.Error) { 40 | on(.error(error)) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnonymousObserver.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class AnonymousObserver : ObserverBase { 12 | typealias Element = ElementType 13 | 14 | typealias EventHandler = (Event) -> Void 15 | 16 | private let _eventHandler : EventHandler 17 | 18 | init(_ eventHandler: @escaping EventHandler) { 19 | #if TRACE_RESOURCES 20 | let _ = Resources.incrementTotal() 21 | #endif 22 | _eventHandler = eventHandler 23 | } 24 | 25 | override func onCore(_ event: Event) { 26 | return _eventHandler(event) 27 | } 28 | 29 | #if TRACE_RESOURCES 30 | deinit { 31 | let _ = Resources.decrementTotal() 32 | } 33 | #endif 34 | } 35 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observers/ObserverBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObserverBase.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class ObserverBase : Disposable, ObserverType { 12 | typealias E = ElementType 13 | 14 | private var _isStopped: AtomicInt = 0 15 | 16 | func on(_ event: Event) { 17 | switch event { 18 | case .next: 19 | if _isStopped == 0 { 20 | onCore(event) 21 | } 22 | case .error, .completed: 23 | 24 | if !AtomicCompareAndSwap(0, 1, &_isStopped) { 25 | return 26 | } 27 | 28 | onCore(event) 29 | } 30 | } 31 | 32 | func onCore(_ event: Event) { 33 | abstractMethod() 34 | } 35 | 36 | func dispose() { 37 | _ = AtomicCompareAndSwap(0, 1, &_isStopped) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Reactive.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Reactive.swift 3 | // RxSwift 4 | // 5 | // Created by Yury Korolev on 5/2/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /** 10 | Use `Reactive` proxy as customization point for constrained protocol extensions. 11 | 12 | General pattern would be: 13 | 14 | // 1. Extend Reactive protocol with constrain on Base 15 | // Read as: Reactive Extension where Base is a SomeType 16 | extension Reactive where Base: SomeType { 17 | // 2. Put any specific reactive extension for SomeType here 18 | } 19 | 20 | With this approach we can have more specialized methods and properties using 21 | `Base` and not just specialized on common base type. 22 | 23 | */ 24 | 25 | public struct Reactive { 26 | /// Base object to extend. 27 | public let base: Base 28 | 29 | /// Creates extensions with base object. 30 | /// 31 | /// - parameter base: Base object. 32 | public init(_ base: Base) { 33 | self.base = base 34 | } 35 | } 36 | 37 | /// A type that has reactive extensions. 38 | public protocol ReactiveCompatible { 39 | /// Extended type 40 | associatedtype CompatibleType 41 | 42 | /// Reactive extensions. 43 | static var rx: Reactive.Type { get set } 44 | 45 | /// Reactive extensions. 46 | var rx: Reactive { get set } 47 | } 48 | 49 | extension ReactiveCompatible { 50 | /// Reactive extensions. 51 | public static var rx: Reactive.Type { 52 | get { 53 | return Reactive.self 54 | } 55 | set { 56 | // this enables using Reactive to "mutate" base type 57 | } 58 | } 59 | 60 | /// Reactive extensions. 61 | public var rx: Reactive { 62 | get { 63 | return Reactive(self) 64 | } 65 | set { 66 | // this enables using Reactive to "mutate" base object 67 | } 68 | } 69 | } 70 | 71 | import Foundation 72 | 73 | /// Extend NSObject with `rx` proxy. 74 | extension NSObject: ReactiveCompatible { } 75 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Rx.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/14/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if TRACE_RESOURCES 12 | fileprivate var resourceCount: AtomicInt = 0 13 | 14 | /// Resource utilization information 15 | public struct Resources { 16 | /// Counts internal Rx resource allocations (Observables, Observers, Disposables, etc.). This provides a simple way to detect leaks during development. 17 | public static var total: Int32 { 18 | return resourceCount.valueSnapshot() 19 | } 20 | 21 | /// Increments `Resources.total` resource count. 22 | /// 23 | /// - returns: New resource count 24 | public static func incrementTotal() -> Int32 { 25 | return AtomicIncrement(&resourceCount) 26 | } 27 | 28 | /// Decrements `Resources.total` resource count 29 | /// 30 | /// - returns: New resource count 31 | public static func decrementTotal() -> Int32 { 32 | return AtomicDecrement(&resourceCount) 33 | } 34 | } 35 | #endif 36 | 37 | /// Swift does not implement abstract methods. This method is used as a runtime check to ensure that methods which intended to be abstract (i.e., they should be implemented in subclasses) are not called directly on the superclass. 38 | func abstractMethod() -> Swift.Never { 39 | rxFatalError("Abstract method") 40 | } 41 | 42 | func rxFatalError(_ lastMessage: String) -> Swift.Never { 43 | // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours. 44 | fatalError(lastMessage) 45 | } 46 | 47 | func incrementChecked(_ i: inout Int) throws -> Int { 48 | if i == Int.max { 49 | throw RxError.overflow 50 | } 51 | defer { i += 1 } 52 | return i 53 | } 54 | 55 | func decrementChecked(_ i: inout Int) throws -> Int { 56 | if i == Int.min { 57 | throw RxError.overflow 58 | } 59 | defer { i -= 1 } 60 | return i 61 | } 62 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/RxMutableBox.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxMutableBox.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 5/22/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Creates mutable reference wrapper for any type. 12 | class RxMutableBox : CustomDebugStringConvertible { 13 | /// Wrapped value 14 | var value : T 15 | 16 | /// Creates reference wrapper for `value`. 17 | /// 18 | /// - parameter value: Value to wrap. 19 | init (_ value: T) { 20 | self.value = value 21 | } 22 | } 23 | 24 | extension RxMutableBox { 25 | /// - returns: Box description. 26 | var debugDescription: String { 27 | return "MutatingBox(\(self.value))" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HistoricalScheduler.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 12/27/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Provides a virtual time scheduler that uses `Date` for absolute time and `NSTimeInterval` for relative time. 12 | public class HistoricalScheduler : VirtualTimeScheduler { 13 | 14 | /** 15 | Creates a new historical scheduler with initial clock value. 16 | 17 | - parameter initialClock: Initial value for virtual clock. 18 | */ 19 | public init(initialClock: RxTime = Date(timeIntervalSince1970: 0)) { 20 | super.init(initialClock: initialClock, converter: HistoricalSchedulerTimeConverter()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/ImmediateScheduler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImmediateScheduler.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/17/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents an object that schedules units of work to run immediately on the current thread. 12 | private class ImmediateScheduler : ImmediateSchedulerType { 13 | 14 | private let _asyncLock = AsyncLock() 15 | 16 | /** 17 | Schedules an action to be executed immediatelly. 18 | 19 | In case `schedule` is called recursively from inside of `action` callback, scheduled `action` will be enqueued 20 | and executed after current `action`. (`AsyncLock` behavior) 21 | 22 | - parameter state: State passed to the action to be executed. 23 | - parameter action: Action to be executed. 24 | - returns: The disposable object used to cancel the scheduled action (best effort). 25 | */ 26 | func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { 27 | let disposable = SingleAssignmentDisposable() 28 | _asyncLock.invoke(AnonymousInvocable { 29 | if disposable.isDisposed { 30 | return 31 | } 32 | disposable.setDisposable(action(state)) 33 | }) 34 | 35 | return disposable 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/AnonymousInvocable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnonymousInvocable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct AnonymousInvocable : InvocableType { 12 | private let _action: () -> () 13 | 14 | init(_ action: @escaping () -> ()) { 15 | _action = action 16 | } 17 | 18 | func invoke() { 19 | _action() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InvocableScheduledItem.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct InvocableScheduledItem : InvocableType { 12 | 13 | let _invocable: I 14 | let _state: I.Value 15 | 16 | init(invocable: I, state: I.Value) { 17 | _invocable = invocable 18 | _state = state 19 | } 20 | 21 | func invoke() { 22 | _invocable.invoke(_state) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InvocableType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol InvocableType { 12 | func invoke() 13 | } 14 | 15 | protocol InvocableWithValueType { 16 | associatedtype Value 17 | 18 | func invoke(_ value: Value) 19 | } 20 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScheduledItem.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/2/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct ScheduledItem 12 | : ScheduledItemType 13 | , InvocableType { 14 | typealias Action = (T) -> Disposable 15 | 16 | private let _action: Action 17 | private let _state: T 18 | 19 | private let _disposable = SingleAssignmentDisposable() 20 | 21 | var isDisposed: Bool { 22 | return _disposable.isDisposed 23 | } 24 | 25 | init(action: @escaping Action, state: T) { 26 | _action = action 27 | _state = state 28 | } 29 | 30 | func invoke() { 31 | _disposable.setDisposable(_action(_state)) 32 | } 33 | 34 | func dispose() { 35 | _disposable.dispose() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScheduledItemType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol ScheduledItemType 12 | : Cancelable 13 | , InvocableType { 14 | func invoke() 15 | } 16 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OperationQueueScheduler.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/4/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Abstracts the work that needs to be performed on a specific `NSOperationQueue`. 12 | /// 13 | /// 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`. 14 | public class OperationQueueScheduler: ImmediateSchedulerType { 15 | public let operationQueue: OperationQueue 16 | 17 | /// Constructs new instance of `OperationQueueScheduler` that performs work on `operationQueue`. 18 | /// 19 | /// - parameter operationQueue: Operation queue targeted to perform work on. 20 | public init(operationQueue: OperationQueue) { 21 | self.operationQueue = operationQueue 22 | } 23 | 24 | /** 25 | Schedules an action to be executed recursively. 26 | 27 | - parameter state: State passed to the action to be executed. 28 | - 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. 29 | - returns: The disposable object used to cancel the scheduled action (best effort). 30 | */ 31 | public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { 32 | let cancel = SingleAssignmentDisposable() 33 | 34 | let operation = BlockOperation { 35 | if cancel.isDisposed { 36 | return 37 | } 38 | 39 | 40 | cancel.setDisposable(action(state)) 41 | } 42 | 43 | self.operationQueue.addOperation(operation) 44 | 45 | return cancel 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Subjects/SubjectType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SubjectType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/1/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Represents an object that is both an observable sequence as well as an observer. 12 | public protocol SubjectType : ObservableType { 13 | /// The type of the observer that represents this subject. 14 | /// 15 | /// Usually this type is type of subject itself, but it doesn't have to be. 16 | associatedtype SubjectObserverType : ObserverType 17 | 18 | /// Returns observer interface for subject. 19 | /// 20 | /// - returns: Observer interface for subject. 21 | func asObserver() -> SubjectObserverType 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Subjects/Variable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Variable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Variable is a wrapper for `BehaviorSubject`. 12 | /// 13 | /// Unlike `BehaviorSubject` it can't terminate with error, and when variable is deallocated 14 | /// it will complete it's observable sequence (`asObservable`). 15 | public class Variable { 16 | 17 | public typealias E = Element 18 | 19 | private let _subject: BehaviorSubject 20 | 21 | private var _lock = SpinLock() 22 | 23 | // state 24 | private var _value: E 25 | 26 | /// Gets or sets current value of variable. 27 | /// 28 | /// Whenever a new value is set, all the observers are notified of the change. 29 | /// 30 | /// Even if the newly set value is same as the old value, observers are still notified for change. 31 | public var value: E { 32 | get { 33 | _lock.lock(); defer { _lock.unlock() } 34 | return _value 35 | } 36 | set(newValue) { 37 | _lock.lock() 38 | _value = newValue 39 | _lock.unlock() 40 | 41 | _subject.on(.next(newValue)) 42 | } 43 | } 44 | 45 | /// Initializes variable with initial value. 46 | /// 47 | /// - parameter value: Initial variable value. 48 | public init(_ value: Element) { 49 | _value = value 50 | _subject = BehaviorSubject(value: value) 51 | } 52 | 53 | /// - returns: Canonical interface for push style sequence 54 | public func asObservable() -> Observable { 55 | return _subject 56 | } 57 | 58 | deinit { 59 | _subject.on(.completed) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RxSwiftPlayer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RxSwiftPlayer/Pods-RxSwiftPlayer-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RxSwiftPlayer : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RxSwiftPlayer 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RxSwiftPlayer/Pods-RxSwiftPlayer-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | 6 | FOUNDATION_EXPORT double Pods_RxSwiftPlayerVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char Pods_RxSwiftPlayerVersionString[]; 8 | 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RxSwiftPlayer/Pods-RxSwiftPlayer.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/RxCocoa" "$PODS_CONFIGURATION_BUILD_DIR/RxDataSources" "$PODS_CONFIGURATION_BUILD_DIR/RxSwift" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/RxCocoa/RxCocoa.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/RxDataSources/RxDataSources.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/RxSwift/RxSwift.framework/Headers" 7 | OTHER_LDFLAGS = $(inherited) -framework "RxCocoa" -framework "RxDataSources" -framework "RxSwift" 8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 9 | PODS_BUILD_DIR = $BUILD_DIR 10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RxSwiftPlayer/Pods-RxSwiftPlayer.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_RxSwiftPlayer { 2 | umbrella header "Pods-RxSwiftPlayer-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RxSwiftPlayer/Pods-RxSwiftPlayer.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/RxCocoa" "$PODS_CONFIGURATION_BUILD_DIR/RxDataSources" "$PODS_CONFIGURATION_BUILD_DIR/RxSwift" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/RxCocoa/RxCocoa.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/RxDataSources/RxDataSources.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/RxSwift/RxSwift.framework/Headers" 7 | OTHER_LDFLAGS = $(inherited) -framework "RxCocoa" -framework "RxDataSources" -framework "RxSwift" 8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 9 | PODS_BUILD_DIR = $BUILD_DIR 10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxCocoa/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxCocoa/RxCocoa-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxCocoa : NSObject 3 | @end 4 | @implementation PodsDummy_RxCocoa 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxCocoa/RxCocoa-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxCocoa/RxCocoa-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "RxCocoa.h" 6 | #import "RxCocoaRuntime.h" 7 | #import "_RX.h" 8 | #import "_RXDelegateProxy.h" 9 | #import "_RXKVOObserver.h" 10 | #import "_RXObjCRuntime.h" 11 | 12 | FOUNDATION_EXPORT double RxCocoaVersionNumber; 13 | FOUNDATION_EXPORT const unsigned char RxCocoaVersionString[]; 14 | 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxCocoa/RxCocoa.modulemap: -------------------------------------------------------------------------------- 1 | framework module RxCocoa { 2 | umbrella header "RxCocoa-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxCocoa/RxCocoa.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/RxCocoa 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxDataSources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxDataSources/RxDataSources-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxDataSources : NSObject 3 | @end 4 | @implementation PodsDummy_RxDataSources 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxDataSources/RxDataSources-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxDataSources/RxDataSources-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | 6 | FOUNDATION_EXPORT double RxDataSourcesVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char RxDataSourcesVersionString[]; 8 | 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxDataSources/RxDataSources.modulemap: -------------------------------------------------------------------------------- 1 | framework module RxDataSources { 2 | umbrella header "RxDataSources-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxDataSources/RxDataSources.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/RxDataSources 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/RxCocoa" "$PODS_CONFIGURATION_BUILD_DIR/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxSwift : NSObject 3 | @end 4 | @implementation PodsDummy_RxSwift 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | 6 | FOUNDATION_EXPORT double RxSwiftVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char RxSwiftVersionString[]; 8 | 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift.modulemap: -------------------------------------------------------------------------------- 1 | framework module RxSwift { 2 | umbrella header "RxSwift-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/RxSwift 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RxSwift Player 2 | 3 | Explores RxSwift and RxCocoa. Work in progress... 4 | 5 | ![ScreenShot](/Assets/RxSwiftPlayer.png) 6 | -------------------------------------------------------------------------------- /RxSwiftPlayer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RxSwiftPlayer.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-Small@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-Small@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-40@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-40@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-60@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-60@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "29x29", 41 | "idiom" : "ipad", 42 | "filename" : "Icon-Small.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "29x29", 47 | "idiom" : "ipad", 48 | "filename" : "Icon-Small@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "40x40", 53 | "idiom" : "ipad", 54 | "filename" : "Icon-40.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "40x40", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-40@2x.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "76x76", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-76.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "76x76", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-76@2x.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "83.5x83.5", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-83.5@2x.png", 79 | "scale" : "2x" 80 | } 81 | ], 82 | "info" : { 83 | "version" : 1, 84 | "author" : "xcode" 85 | } 86 | } -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-40.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-Small.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /RxSwiftPlayer/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /RxSwiftPlayer/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RxSwiftPlayer/Button.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Button.swift 3 | // RxSwiftPlayer 4 | // 5 | // Created by Scott Gardner on 3/12/16. 6 | // Copyright © 2016 Scott Gardner. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class Button: UIButton { 12 | 13 | override init(frame: CGRect) { 14 | super.init(frame: frame) 15 | configure() 16 | } 17 | 18 | required init?(coder aDecoder: NSCoder) { 19 | super.init(coder: aDecoder) 20 | configure() 21 | } 22 | 23 | func configure() { 24 | layer.cornerRadius = 5.0 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /RxSwiftPlayer/ContainedTextViewViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContainedTextViewViewController.swift 3 | // RxSwiftPlayer 4 | // 5 | // Created by Scott Gardner on 3/21/16. 6 | // Copyright © 2016 Scott Gardner. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RxSwift 11 | 12 | class ContainedTextViewViewController: UIViewController, HasTwoWayBindingViewControllerViewModel { 13 | 14 | // MARK: - Outlets 15 | 16 | @IBOutlet weak var expandBarButtonItem: UIBarButtonItem! 17 | @IBOutlet weak var textView: UITextView! 18 | 19 | // MARK: - Properties 20 | 21 | // HasTwoWayBindingViewControllerViewModel 22 | var viewModel: TwoWayBindingViewControllerViewModel! 23 | 24 | let disposeBag = DisposeBag() 25 | 26 | // MARK: - View life cycle 27 | 28 | override func didMove(toParentViewController parent: UIViewController?) { 29 | guard let controller = parent?.parent as? TwoWayBindingViewController else { return } 30 | 31 | expandBarButtonItem.rx.tap.asDriver() 32 | .drive(onNext: { [weak self] _ in 33 | controller.performSegue(withIdentifier: "PresentedTextViewViewController", sender: self?.expandBarButtonItem) 34 | }).addDisposableTo(disposeBag) 35 | } 36 | 37 | override func viewDidLoad() { 38 | super.viewDidLoad() 39 | bindViewModel() 40 | } 41 | 42 | func bindViewModel() { 43 | textView.rx.text <-> viewModel.textViewText 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /RxSwiftPlayer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIAppFonts 26 | 27 | RxSwiftPlayer.ttf 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UIStatusBarStyle 38 | UIStatusBarStyleLightContent 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | UIInterfaceOrientationPortraitUpsideDown 45 | 46 | UISupportedInterfaceOrientations~ipad 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationPortraitUpsideDown 50 | UIInterfaceOrientationLandscapeLeft 51 | UIInterfaceOrientationLandscapeRight 52 | 53 | UIViewControllerBasedStatusBarAppearance 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /RxSwiftPlayer/PresentedTextViewViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PresentedTextViewViewController.swift 3 | // RxSwiftPlayer 4 | // 5 | // Created by Scott Gardner on 3/21/16. 6 | // Copyright © 2016 Scott Gardner. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RxSwift 11 | 12 | class PresentedTextViewViewController: UIViewController, HasTwoWayBindingViewControllerViewModel { 13 | 14 | // MARK: - Outlets 15 | 16 | @IBOutlet weak var textView: UITextView! 17 | 18 | // MARK: - Properties 19 | 20 | // HasTwoWayBindingViewControllerViewModel 21 | var viewModel: TwoWayBindingViewControllerViewModel! 22 | 23 | let disposeBag = DisposeBag() 24 | 25 | // MARK: - View life cycle 26 | 27 | override func viewDidLoad() { 28 | super.viewDidLoad() 29 | 30 | textView.becomeFirstResponder() 31 | bindViewModel() 32 | } 33 | 34 | func bindViewModel() { 35 | (textView.rx.text <-> viewModel.textViewText).addDisposableTo(disposeBag) 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /RxSwiftPlayer/RxSwiftPlayer.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scotteg/RxSwiftPlayer/52b432707f4c8b29b564acdc008b90084ce99489/RxSwiftPlayer/RxSwiftPlayer.ttf -------------------------------------------------------------------------------- /RxSwiftPlayer/SectionedTableViewReloadViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SectionedTableViewReloadViewController.swift 3 | // RxSwiftPlayer 4 | // 5 | // Created by Scott Gardner on 3/13/16. 6 | // Copyright © 2016 Scott Gardner. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RxSwift 11 | import RxDataSources 12 | 13 | enum ReloadDataSource: String { 14 | 15 | case SampleData1 = "Sample Data 1" 16 | case SampleData2 = "Sample Data 2" 17 | 18 | static let allValues: [ReloadDataSource] = [.SampleData1, .SampleData2] 19 | 20 | } 21 | 22 | extension ReloadDataSource: IdentifiableType { 23 | 24 | var identity: String { return rawValue } 25 | 26 | } 27 | 28 | class SectionedTableViewReloadViewController: UIViewController { 29 | 30 | // MARK: - Outlets 31 | 32 | @IBOutlet weak var tableView: UITableView! 33 | @IBOutlet weak var addBarButtonItem: UIBarButtonItem! 34 | 35 | // MARK: - Properties 36 | 37 | let dataSource = RxTableViewSectionedReloadDataSource>() 38 | 39 | let data = Variable([ 40 | SectionModel(model: "Section 1", items: ReloadDataSource.allValues) 41 | ]) 42 | 43 | let disposeBag = DisposeBag() 44 | 45 | // MARK: - View life cycle 46 | 47 | override func viewDidLoad() { 48 | super.viewDidLoad() 49 | 50 | dataSource.configureCell = { _, tableView, indexPath, dataSourceItem in 51 | let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) 52 | cell.textLabel!.text = dataSourceItem.rawValue 53 | return cell 54 | } 55 | 56 | data.asDriver() 57 | .drive(tableView.rx.items(dataSource: dataSource)) 58 | .addDisposableTo(disposeBag) 59 | 60 | dataSource.titleForHeaderInSection = { 61 | $0[$1].model 62 | } 63 | 64 | addBarButtonItem.rx.tap.asDriver() 65 | .drive(onNext: { [weak self] _ in 66 | guard let strongSelf = self else { return } 67 | strongSelf.data.value += [SectionModel(model: "Section \(strongSelf.data.value.count + 1)", items: ReloadDataSource.allValues)] 68 | }).addDisposableTo(disposeBag) 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /RxSwiftPlayer/TextView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextView.swift 3 | // RxSwiftPlayer 4 | // 5 | // Created by Scott Gardner on 3/21/16. 6 | // Copyright © 2016 Scott Gardner. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TextView: UITextView { 12 | 13 | override init(frame: CGRect, textContainer: NSTextContainer?) { 14 | super.init(frame: frame, textContainer: textContainer) 15 | configure() 16 | } 17 | 18 | required init?(coder aDecoder: NSCoder) { 19 | super.init(coder: aDecoder) 20 | configure() 21 | } 22 | 23 | func configure() { 24 | layer.cornerRadius = 5.0 25 | layer.borderWidth = 0.5 26 | layer.borderColor = UIColor(red: 204/255.0, green: 204/255.0, blue: 204/255.0, alpha: 1.0).cgColor 27 | } 28 | 29 | } 30 | --------------------------------------------------------------------------------