├── LICENSE
├── Podfile
├── Podfile.lock
├── Pods
├── Alamofire
│ ├── LICENSE
│ ├── README.md
│ └── Source
│ │ ├── Alamofire.swift
│ │ ├── Download.swift
│ │ ├── Error.swift
│ │ ├── Manager.swift
│ │ ├── MultipartFormData.swift
│ │ ├── NetworkReachabilityManager.swift
│ │ ├── Notifications.swift
│ │ ├── ParameterEncoding.swift
│ │ ├── Request.swift
│ │ ├── Response.swift
│ │ ├── ResponseSerialization.swift
│ │ ├── Result.swift
│ │ ├── ServerTrustPolicy.swift
│ │ ├── Stream.swift
│ │ ├── Timeline.swift
│ │ ├── Upload.swift
│ │ └── Validation.swift
├── Headers
│ └── Private
│ │ └── RxCocoa
│ │ ├── RxCocoa.h
│ │ ├── _RX.h
│ │ ├── _RXDelegateProxy.h
│ │ ├── _RXKVOObserver.h
│ │ └── _RXObjCRuntime.h
├── Local Podspecs
│ └── SwiftyJSON.podspec.json
├── Manifest.lock
├── Pods.xcodeproj
│ ├── project.pbxproj
│ └── xcuserdata
│ │ ├── cobe.xcuserdatad
│ │ └── xcschemes
│ │ │ ├── Alamofire.xcscheme
│ │ │ ├── Pods-WhatsTheWeatherIn.xcscheme
│ │ │ ├── RxAlamofire.xcscheme
│ │ │ ├── RxBlocking.xcscheme
│ │ │ ├── RxCocoa.xcscheme
│ │ │ ├── RxSwift.xcscheme
│ │ │ ├── SwiftyJSON.xcscheme
│ │ │ └── xcschememanagement.plist
│ │ ├── marin.xcuserdatad
│ │ └── xcschemes
│ │ │ ├── Alamofire.xcscheme
│ │ │ ├── Pods-WhatsTheWeatherIn.xcscheme
│ │ │ ├── RxBlocking.xcscheme
│ │ │ ├── RxCocoa.xcscheme
│ │ │ ├── RxSwift.xcscheme
│ │ │ ├── SwiftyJSON.xcscheme
│ │ │ └── xcschememanagement.plist
│ │ └── mohammedalwaili.xcuserdatad
│ │ └── xcschemes
│ │ ├── Alamofire.xcscheme
│ │ ├── Pods-WhatsTheWeatherIn.xcscheme
│ │ ├── RxAlamofire.xcscheme
│ │ ├── RxBlocking.xcscheme
│ │ ├── RxCocoa.xcscheme
│ │ ├── RxSwift.xcscheme
│ │ ├── SwiftyJSON.xcscheme
│ │ └── xcschememanagement.plist
├── RxAlamofire
│ ├── LICENSE.md
│ ├── README.md
│ └── RxAlamofire
│ │ └── Source
│ │ └── RxAlamofire.swift
├── RxBlocking
│ ├── LICENSE.md
│ ├── README.md
│ └── RxBlocking
│ │ ├── BlockingObservable+Operators.swift
│ │ ├── BlockingObservable.swift
│ │ ├── ObservableConvertibleType+Blocking.swift
│ │ └── RunLoopLock.swift
├── RxCocoa
│ ├── LICENSE.md
│ ├── README.md
│ └── RxCocoa
│ │ ├── Common
│ │ ├── CLLocationManager+Rx.swift
│ │ ├── CocoaUnits
│ │ │ ├── ControlEvent.swift
│ │ │ ├── ControlProperty.swift
│ │ │ └── Driver
│ │ │ │ ├── ControlEvent+Driver.swift
│ │ │ │ ├── ControlProperty+Driver.swift
│ │ │ │ ├── Driver+Operators+arity.swift
│ │ │ │ ├── Driver+Operators.swift
│ │ │ │ ├── Driver+Subscription.swift
│ │ │ │ ├── Driver.swift
│ │ │ │ ├── ObservableConvertibleType+Driver.swift
│ │ │ │ └── Variable+Driver.swift
│ │ ├── DelegateProxy.swift
│ │ ├── DelegateProxyType.swift
│ │ ├── KVORepresentable+CoreGraphics.swift
│ │ ├── KVORepresentable+Swift.swift
│ │ ├── KVORepresentable.swift
│ │ ├── Logging.swift
│ │ ├── NSLayoutConstraint+Rx.swift
│ │ ├── Observable+Bind.swift
│ │ ├── Observables
│ │ │ ├── Implementations
│ │ │ │ ├── ControlTarget.swift
│ │ │ │ ├── DeallocObservable.swift
│ │ │ │ ├── KVOObservable.swift
│ │ │ │ ├── KVOObserver.swift
│ │ │ │ └── MessageSentObserver.swift
│ │ │ ├── NSNotificationCenter+Rx.swift
│ │ │ ├── NSObject+Rx+KVORepresentable.swift
│ │ │ ├── NSObject+Rx+RawRepresentable.swift
│ │ │ ├── NSObject+Rx.swift
│ │ │ └── NSURLSession+Rx.swift
│ │ ├── Proxies
│ │ │ └── RxCLLocationManagerDelegateProxy.swift
│ │ ├── RxCocoa.swift
│ │ ├── RxTarget.swift
│ │ ├── _RX.h
│ │ ├── _RX.m
│ │ ├── _RXDelegateProxy.h
│ │ ├── _RXDelegateProxy.m
│ │ ├── _RXKVOObserver.h
│ │ ├── _RXKVOObserver.m
│ │ ├── _RXObjCRuntime.h
│ │ └── _RXObjCRuntime.m
│ │ ├── RxCocoa.h
│ │ └── iOS
│ │ ├── DataSources
│ │ ├── RxCollectionViewReactiveArrayDataSource.swift
│ │ └── RxTableViewReactiveArrayDataSource.swift
│ │ ├── Events
│ │ └── ItemEvents.swift
│ │ ├── NSTextStorage+Rx.swift
│ │ ├── Protocols
│ │ ├── RxCollectionViewDataSourceType.swift
│ │ └── RxTableViewDataSourceType.swift
│ │ ├── Proxies
│ │ ├── RxCollectionViewDataSourceProxy.swift
│ │ ├── RxCollectionViewDelegateProxy.swift
│ │ ├── RxScrollViewDelegateProxy.swift
│ │ ├── RxSearchBarDelegateProxy.swift
│ │ ├── RxTableViewDataSourceProxy.swift
│ │ ├── RxTableViewDelegateProxy.swift
│ │ ├── RxTextStorageDelegateProxy.swift
│ │ └── RxTextViewDelegateProxy.swift
│ │ ├── UIActivityIndicatorView+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
│ │ ├── UIScrollView+Rx.swift
│ │ ├── UISearchBar+Rx.swift
│ │ ├── UISegmentedControl+Rx.swift
│ │ ├── UISlider+Rx.swift
│ │ ├── UIStepper+Rx.swift
│ │ ├── UISwitch+Rx.swift
│ │ ├── UITableView+Rx.swift
│ │ ├── UITextField+Rx.swift
│ │ ├── UITextView+Rx.swift
│ │ └── UIView+Rx.swift
├── RxSwift
│ ├── LICENSE.md
│ ├── README.md
│ └── RxSwift
│ │ ├── AnyObserver.swift
│ │ ├── Cancelable.swift
│ │ ├── Concurrency
│ │ ├── AsyncLock.swift
│ │ ├── Lock.swift
│ │ ├── LockOwnerType.swift
│ │ ├── SynchronizedDisposeType.swift
│ │ ├── SynchronizedOnType.swift
│ │ ├── SynchronizedSubscribeType.swift
│ │ └── SynchronizedUnsubscribeType.swift
│ │ ├── ConnectableObservableType.swift
│ │ ├── DataStructures
│ │ ├── Bag.swift
│ │ ├── InfiniteSequence.swift
│ │ ├── PriorityQueue.swift
│ │ └── Queue.swift
│ │ ├── Disposable.swift
│ │ ├── Disposables
│ │ ├── AnonymousDisposable.swift
│ │ ├── BinaryDisposable.swift
│ │ ├── BooleanDisposable.swift
│ │ ├── CompositeDisposable.swift
│ │ ├── DisposeBag.swift
│ │ ├── DisposeBase.swift
│ │ ├── NAryDisposable.swift
│ │ ├── NopDisposable.swift
│ │ ├── RefCountDisposable.swift
│ │ ├── ScheduledDisposable.swift
│ │ ├── SerialDisposable.swift
│ │ ├── SingleAssignmentDisposable.swift
│ │ ├── StableCompositeDisposable.swift
│ │ └── SubscriptionDisposable.swift
│ │ ├── Errors.swift
│ │ ├── Event.swift
│ │ ├── Extensions
│ │ └── String+Rx.swift
│ │ ├── ImmediateSchedulerType.swift
│ │ ├── Observable+Extensions.swift
│ │ ├── Observable.swift
│ │ ├── ObservableConvertibleType.swift
│ │ ├── ObservableType.swift
│ │ ├── Observables
│ │ ├── Implementations
│ │ │ ├── AddRef.swift
│ │ │ ├── Amb.swift
│ │ │ ├── AnonymousObservable.swift
│ │ │ ├── Buffer.swift
│ │ │ ├── Catch.swift
│ │ │ ├── CombineLatest+CollectionType.swift
│ │ │ ├── CombineLatest+arity.swift
│ │ │ ├── CombineLatest.swift
│ │ │ ├── Concat.swift
│ │ │ ├── ConnectableObservable.swift
│ │ │ ├── Debug.swift
│ │ │ ├── Deferred.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+CollectionType.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
│ │ ├── Platform
│ │ ├── Platform.Darwin.swift
│ │ └── Platform.Linux.swift
│ │ ├── Rx.swift
│ │ ├── RxMutableBox.swift
│ │ ├── SchedulerType.swift
│ │ ├── Schedulers
│ │ ├── ConcurrentDispatchQueueScheduler.swift
│ │ ├── ConcurrentMainScheduler.swift
│ │ ├── CurrentThreadScheduler.swift
│ │ ├── DispatchQueueSchedulerQOS.swift
│ │ ├── HistoricalScheduler.swift
│ │ ├── HistoricalSchedulerTimeConverter.swift
│ │ ├── ImmediateScheduler.swift
│ │ ├── Internal
│ │ │ ├── AnonymousInvocable.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
├── SwiftyJSON
│ ├── LICENSE
│ ├── README.md
│ └── Source
│ │ └── SwiftyJSON.swift
└── Target Support Files
│ ├── Alamofire
│ ├── Alamofire-dummy.m
│ ├── Alamofire-prefix.pch
│ ├── Alamofire-umbrella.h
│ ├── Alamofire.modulemap
│ ├── Alamofire.xcconfig
│ └── Info.plist
│ ├── Pods-WhatsTheWeatherIn
│ ├── Info.plist
│ ├── Pods-WhatsTheWeatherIn-acknowledgements.markdown
│ ├── Pods-WhatsTheWeatherIn-acknowledgements.plist
│ ├── Pods-WhatsTheWeatherIn-dummy.m
│ ├── Pods-WhatsTheWeatherIn-frameworks.sh
│ ├── Pods-WhatsTheWeatherIn-resources.sh
│ ├── Pods-WhatsTheWeatherIn-umbrella.h
│ ├── Pods-WhatsTheWeatherIn.debug.xcconfig
│ ├── Pods-WhatsTheWeatherIn.modulemap
│ └── Pods-WhatsTheWeatherIn.release.xcconfig
│ ├── RxAlamofire
│ ├── Info.plist
│ ├── RxAlamofire-dummy.m
│ ├── RxAlamofire-prefix.pch
│ ├── RxAlamofire-umbrella.h
│ ├── RxAlamofire.modulemap
│ └── RxAlamofire.xcconfig
│ ├── RxBlocking
│ ├── Info.plist
│ ├── RxBlocking-dummy.m
│ ├── RxBlocking-prefix.pch
│ ├── RxBlocking-umbrella.h
│ ├── RxBlocking.modulemap
│ └── RxBlocking.xcconfig
│ ├── RxCocoa
│ ├── Info.plist
│ ├── RxCocoa-dummy.m
│ ├── RxCocoa-prefix.pch
│ ├── RxCocoa-umbrella.h
│ ├── RxCocoa.modulemap
│ └── RxCocoa.xcconfig
│ ├── RxSwift
│ ├── Info.plist
│ ├── RxSwift-dummy.m
│ ├── RxSwift-prefix.pch
│ ├── RxSwift-umbrella.h
│ ├── RxSwift.modulemap
│ └── RxSwift.xcconfig
│ └── SwiftyJSON
│ ├── Info.plist
│ ├── SwiftyJSON-dummy.m
│ ├── SwiftyJSON-prefix.pch
│ ├── SwiftyJSON-umbrella.h
│ ├── SwiftyJSON.modulemap
│ └── SwiftyJSON.xcconfig
├── README.md
├── WhatsTheWeatherIn.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcuserdata
│ ├── cobe.xcuserdatad
│ └── xcschemes
│ │ ├── WhatsTheWeatherIn.xcscheme
│ │ └── xcschememanagement.plist
│ ├── marin.xcuserdatad
│ └── xcschemes
│ │ ├── WhatsTheWeatherIn.xcscheme
│ │ └── xcschememanagement.plist
│ └── mohammedalwaili.xcuserdatad
│ └── xcschemes
│ ├── WhatsTheWeatherIn.xcscheme
│ └── xcschememanagement.plist
├── WhatsTheWeatherIn.xcworkspace
├── contents.xcworkspacedata
├── xcshareddata
│ └── WhatsTheWeatherIn.xcscmblueprint
└── xcuserdata
│ ├── cobe.xcuserdatad
│ ├── UserInterfaceState.xcuserstate
│ └── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ ├── marin.xcuserdatad
│ └── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ └── mohammedalwaili.xcuserdatad
│ └── UserInterfaceState.xcuserstate
├── WhatsTheWeatherIn
├── AppDelegate.swift
├── Array+uniqueElements.swift
├── Assets.xcassets
│ ├── 5975465375_9c089b6085_b.jpg
│ ├── 5975465375_9c089b6085_b@2x.jpg
│ ├── 5975465375_9c089b6085_b@3x.jpg
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── Raining-piyal-E2-9D-A5-34558502-2560-1600.jpg
│ ├── Raining-piyal-E2-9D-A5-34558502-2560-1600@2x.jpg
│ ├── Raining-piyal-E2-9D-A5-34558502-2560-1600@3x.jpg
│ ├── cloudy.imageset
│ │ ├── Contents.json
│ │ └── cloudy.jpg
│ ├── sunny sky.jpg
│ ├── sunny sky@2x.jpg
│ ├── sunny sky@3x.jpg
│ └── sunny.imageset
│ │ ├── Contents.json
│ │ └── sunny.jpg
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── ForecastTableViewCell.swift
├── Info.plist
├── NSDate+Extensions.swift
├── String+percentEncoding.swift
├── Texts.swift
├── UIViewController+presentError.swift
├── Weather.swift
├── WeatherAPIService.swift
├── WeatherBackgroundImage.swift
├── WeatherOverviewViewController.swift
└── WeatherViewModel.swift
├── WhatsTheWeatherInTests
├── Info.plist
└── WhatsTheWeatherInTests.swift
└── WhatsTheWeatherInUITests
├── Info.plist
└── WhatsTheWeatherInUITests.swift
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 marinbenc
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, "8.0"
2 | use_frameworks!
3 |
4 | target 'WhatsTheWeatherIn' do
5 | pod 'RxSwift', '~> 2.0.0-beta'
6 | pod 'RxCocoa', '~> 2.0.0-beta'
7 | pod 'RxBlocking', '~> 2.0.0-beta'
8 | pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
9 | pod 'Alamofire', '~> 3.0'
10 | pod 'RxAlamofire'
11 | end
12 |
13 | target 'WhatsTheWeatherInTests' do
14 |
15 | end
16 |
17 | target 'WhatsTheWeatherInUITests' do
18 |
19 | end
20 |
21 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Alamofire (3.4.0)
3 | - RxAlamofire (1.1.1):
4 | - RxAlamofire/Core (= 1.1.1)
5 | - RxAlamofire/Core (1.1.1):
6 | - Alamofire (~> 3.0)
7 | - RxSwift (~> 2.0)
8 | - RxBlocking (2.0.0):
9 | - RxSwift (~> 2.0)
10 | - RxCocoa (2.0.0):
11 | - RxSwift (~> 2.0)
12 | - RxSwift (2.0.0)
13 | - SwiftyJSON (2.3.2)
14 |
15 | DEPENDENCIES:
16 | - Alamofire (~> 3.0)
17 | - RxAlamofire
18 | - RxBlocking (~> 2.0.0-beta)
19 | - RxCocoa (~> 2.0.0-beta)
20 | - RxSwift (~> 2.0.0-beta)
21 | - SwiftyJSON (from `https://github.com/SwiftyJSON/SwiftyJSON.git`)
22 |
23 | EXTERNAL SOURCES:
24 | SwiftyJSON:
25 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
26 |
27 | CHECKOUT OPTIONS:
28 | SwiftyJSON:
29 | :commit: 2a5b70f06001316d4fb54501edc70b4084705da0
30 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
31 |
32 | SPEC CHECKSUMS:
33 | Alamofire: c19a627cefd6a95f840401c49ab1f124e07f54ee
34 | RxAlamofire: 5900f3842dd7bad9ca620bfb5917b9c984db5cca
35 | RxBlocking: a95a10ed54eb5d116f6c9a87047ff671e181d07b
36 | RxCocoa: b0ebd70b4f7450bdb3c8987b122f8fd568dc1e2f
37 | RxSwift: d83246efa6f16c50c143bec134649d045498f601
38 | SwiftyJSON: 04ccea08915aa0109039157c7974cf0298da292a
39 |
40 | COCOAPODS: 0.39.0
41 |
--------------------------------------------------------------------------------
/Pods/Alamofire/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Pods/Headers/Private/RxCocoa/RxCocoa.h:
--------------------------------------------------------------------------------
1 | ../../../RxCocoa/RxCocoa/RxCocoa.h
--------------------------------------------------------------------------------
/Pods/Headers/Private/RxCocoa/_RX.h:
--------------------------------------------------------------------------------
1 | ../../../RxCocoa/RxCocoa/Common/_RX.h
--------------------------------------------------------------------------------
/Pods/Headers/Private/RxCocoa/_RXDelegateProxy.h:
--------------------------------------------------------------------------------
1 | ../../../RxCocoa/RxCocoa/Common/_RXDelegateProxy.h
--------------------------------------------------------------------------------
/Pods/Headers/Private/RxCocoa/_RXKVOObserver.h:
--------------------------------------------------------------------------------
1 | ../../../RxCocoa/RxCocoa/Common/_RXKVOObserver.h
--------------------------------------------------------------------------------
/Pods/Headers/Private/RxCocoa/_RXObjCRuntime.h:
--------------------------------------------------------------------------------
1 | ../../../RxCocoa/RxCocoa/Common/_RXObjCRuntime.h
--------------------------------------------------------------------------------
/Pods/Local Podspecs/SwiftyJSON.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SwiftyJSON",
3 | "version": "2.3.2",
4 | "summary": "SwiftyJSON makes it easy to deal with JSON data in Swift",
5 | "homepage": "https://github.com/SwiftyJSON/SwiftyJSON",
6 | "license": {
7 | "type": "MIT"
8 | },
9 | "authors": {
10 | "lingoer": "lingoerer@gmail.com",
11 | "tangplin": "tangplin@gmail.com"
12 | },
13 | "requires_arc": true,
14 | "platforms": {
15 | "osx": "10.9",
16 | "ios": "8.0",
17 | "watchos": "2.0",
18 | "tvos": "9.0"
19 | },
20 | "source": {
21 | "git": "https://github.com/SwiftyJSON/SwiftyJSON.git",
22 | "tag": "2.3.2"
23 | },
24 | "source_files": "Source/*.swift"
25 | }
26 |
--------------------------------------------------------------------------------
/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Alamofire (3.4.0)
3 | - RxAlamofire (1.1.1):
4 | - RxAlamofire/Core (= 1.1.1)
5 | - RxAlamofire/Core (1.1.1):
6 | - Alamofire (~> 3.0)
7 | - RxSwift (~> 2.0)
8 | - RxBlocking (2.0.0):
9 | - RxSwift (~> 2.0)
10 | - RxCocoa (2.0.0):
11 | - RxSwift (~> 2.0)
12 | - RxSwift (2.0.0)
13 | - SwiftyJSON (2.3.2)
14 |
15 | DEPENDENCIES:
16 | - Alamofire (~> 3.0)
17 | - RxAlamofire
18 | - RxBlocking (~> 2.0.0-beta)
19 | - RxCocoa (~> 2.0.0-beta)
20 | - RxSwift (~> 2.0.0-beta)
21 | - SwiftyJSON (from `https://github.com/SwiftyJSON/SwiftyJSON.git`)
22 |
23 | EXTERNAL SOURCES:
24 | SwiftyJSON:
25 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
26 |
27 | CHECKOUT OPTIONS:
28 | SwiftyJSON:
29 | :commit: 2a5b70f06001316d4fb54501edc70b4084705da0
30 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
31 |
32 | SPEC CHECKSUMS:
33 | Alamofire: c19a627cefd6a95f840401c49ab1f124e07f54ee
34 | RxAlamofire: 5900f3842dd7bad9ca620bfb5917b9c984db5cca
35 | RxBlocking: a95a10ed54eb5d116f6c9a87047ff671e181d07b
36 | RxCocoa: b0ebd70b4f7450bdb3c8987b122f8fd568dc1e2f
37 | RxSwift: d83246efa6f16c50c143bec134649d045498f601
38 | SwiftyJSON: 04ccea08915aa0109039157c7974cf0298da292a
39 |
40 | COCOAPODS: 0.39.0
41 |
--------------------------------------------------------------------------------
/Pods/Pods.xcodeproj/xcuserdata/cobe.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Alamofire.xcscheme
8 |
9 | isShown
10 |
11 |
12 | Pods-WhatsTheWeatherIn.xcscheme
13 |
14 | isShown
15 |
16 |
17 | RxAlamofire.xcscheme
18 |
19 | isShown
20 |
21 |
22 | RxBlocking.xcscheme
23 |
24 | isShown
25 |
26 |
27 | RxCocoa.xcscheme
28 |
29 | isShown
30 |
31 |
32 | RxSwift.xcscheme
33 |
34 | isShown
35 |
36 |
37 | SwiftyJSON.xcscheme
38 |
39 | isShown
40 |
41 |
42 |
43 | SuppressBuildableAutocreation
44 |
45 | 599BBF5513E538A63464C00964043A04
46 |
47 | primary
48 |
49 |
50 | 781AE1CB218361A44AD2F0515A89E25D
51 |
52 | primary
53 |
54 |
55 | 79C040AFDDCE1BCBF6D8B5EB0B85887F
56 |
57 | primary
58 |
59 |
60 | 8946CA2E3570209ABCFC423CEE5BDE38
61 |
62 | primary
63 |
64 |
65 | CC9A6272DDD5C0ECFF56FF2AC6EF9E69
66 |
67 | primary
68 |
69 |
70 | D8A4FCEBB5B518BA9D0EB5CE758D238E
71 |
72 | primary
73 |
74 |
75 | DB5F663D53BB47C5D1FB396D237171A6
76 |
77 | primary
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Pods/Pods.xcodeproj/xcuserdata/mohammedalwaili.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Alamofire.xcscheme
8 |
9 | isShown
10 |
11 |
12 | Pods-WhatsTheWeatherIn.xcscheme
13 |
14 | isShown
15 |
16 |
17 | RxAlamofire.xcscheme
18 |
19 | isShown
20 |
21 |
22 | RxBlocking.xcscheme
23 |
24 | isShown
25 |
26 |
27 | RxCocoa.xcscheme
28 |
29 | isShown
30 |
31 |
32 | RxSwift.xcscheme
33 |
34 | isShown
35 |
36 |
37 | SwiftyJSON.xcscheme
38 |
39 | isShown
40 |
41 |
42 |
43 | SuppressBuildableAutocreation
44 |
45 | 432ECC54282C84882B482CCB4CF227FC
46 |
47 | primary
48 |
49 |
50 | 599BBF5513E538A63464C00964043A04
51 |
52 | primary
53 |
54 |
55 | 781AE1CB218361A44AD2F0515A89E25D
56 |
57 | primary
58 |
59 |
60 | 8946CA2E3570209ABCFC423CEE5BDE38
61 |
62 | primary
63 |
64 |
65 | CC9A6272DDD5C0ECFF56FF2AC6EF9E69
66 |
67 | primary
68 |
69 |
70 | D8A4FCEBB5B518BA9D0EB5CE758D238E
71 |
72 | primary
73 |
74 |
75 | DB5F663D53BB47C5D1FB396D237171A6
76 |
77 | primary
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Pods/RxAlamofire/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Junior B.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/Pods/RxBlocking/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/RxBlocking/RxBlocking/BlockingObservable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BlockingObservable.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 10/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 | /**
15 | `BlockingObservable` is a variety of `Observable` that provides blocking operators.
16 |
17 | It can be useful for testing and demo purposes, but is generally inappropriate for production applications.
18 |
19 | If you think you need to use a `BlockingObservable` this is usually a sign that you should rethink your
20 | design.
21 | */
22 | public struct BlockingObservable {
23 | let source: Observable
24 | }
--------------------------------------------------------------------------------
/Pods/RxBlocking/RxBlocking/ObservableConvertibleType+Blocking.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ObservableConvertibleType+Blocking.swift
3 | // RxBlocking
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 | extension ObservableConvertibleType {
15 | /**
16 | Converts an Observable into a `BlockingObservable` (an Observable with blocking operators).
17 |
18 | - returns: `BlockingObservable` version of `self`
19 | */
20 | @warn_unused_result(message="http://git.io/rxs.uo")
21 | public func toBlocking() -> BlockingObservable {
22 | return BlockingObservable(source: self.asObservable())
23 | }
24 | }
--------------------------------------------------------------------------------
/Pods/RxBlocking/RxBlocking/RunLoopLock.swift:
--------------------------------------------------------------------------------
1 | //
2 | // RunLoopLock.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 11/5/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 RunLoopLock {
15 | let currentRunLoop: CFRunLoopRef
16 |
17 | init() {
18 | currentRunLoop = CFRunLoopGetCurrent()
19 | }
20 |
21 | func dispatch(action: () -> ()) {
22 | CFRunLoopPerformBlock(currentRunLoop, kCFRunLoopDefaultMode) {
23 | if CurrentThreadScheduler.isScheduleRequired {
24 | CurrentThreadScheduler.instance.schedule(()) { _ in
25 | action()
26 | return NopDisposable.instance
27 | }
28 | }
29 | else {
30 | action()
31 | }
32 | }
33 | CFRunLoopWakeUp(currentRunLoop)
34 | }
35 |
36 | func stop() {
37 | CFRunLoopPerformBlock(currentRunLoop, kCFRunLoopDefaultMode) {
38 | CFRunLoopStop(self.currentRunLoop)
39 | }
40 | CFRunLoopWakeUp(currentRunLoop)
41 | }
42 |
43 | func run() {
44 | CFRunLoopRun()
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/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/RxCocoa/Common/CocoaUnits/Driver/ControlEvent+Driver.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ControlEvent+Driver.swift
3 | // Rx
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 | /**
16 | Converts `ControlEvent` to `Driver` unit.
17 |
18 | `ControlEvent` already can't fail, so no special case needs to be handled.
19 | */
20 | @warn_unused_result(message="http://git.io/rxs.uo")
21 | public func asDriver() -> Driver {
22 | return self.asDriver { (error) -> Driver in
23 | #if DEBUG
24 | rxFatalError("Somehow driver received error from a source that shouldn't fail.")
25 | #else
26 | return Driver.empty()
27 | #endif
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/ControlProperty+Driver.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ControlProperty+Driver.swift
3 | // Rx
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 | /**
16 | Converts `ControlProperty` to `Driver` unit.
17 |
18 | `ControlProperty` already can't fail, so no special case needs to be handled.
19 | */
20 | @warn_unused_result(message="http://git.io/rxs.uo")
21 | public func asDriver() -> Driver {
22 | return self.asDriver { (error) -> Driver in
23 | #if DEBUG
24 | rxFatalError("Somehow driver received error from a source that shouldn't fail.")
25 | #else
26 | return Driver.empty()
27 | #endif
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/CocoaUnits/Driver/Variable+Driver.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Variable+Driver.swift
3 | // Rx
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 | /**
16 | Converts `Variable` to `Driver` unit.
17 |
18 | - returns: Driving observable sequence.
19 | */
20 | @warn_unused_result(message="http://git.io/rxs.uo")
21 | public func asDriver() -> Driver {
22 | let source = self.asObservable()
23 | .observeOn(driverObserveOnScheduler)
24 | return Driver(source)
25 | }
26 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+CoreGraphics.swift:
--------------------------------------------------------------------------------
1 | //
2 | // KVORepresentable+CoreGraphics.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 11/14/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 | import CoreGraphics
14 |
15 | #if arch(x86_64) || arch(arm64)
16 | let CGRectType = "{CGRect={CGPoint=dd}{CGSize=dd}}"
17 | let CGSizeType = "{CGSize=dd}"
18 | let CGPointType = "{CGPoint=dd}"
19 | #elseif arch(i386) || arch(arm)
20 | let CGRectType = "{CGRect={CGPoint=ff}{CGSize=ff}}"
21 | let CGSizeType = "{CGSize=ff}"
22 | let CGPointType = "{CGPoint=ff}"
23 | #endif
24 |
25 | extension CGRect : KVORepresentable {
26 | public typealias KVOType = NSValue
27 |
28 | /**
29 | Constructs self from `NSValue`.
30 | */
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 | /**
45 | Constructs self from `NSValue`.
46 | */
47 | public init?(KVOValue: KVOType) {
48 | if strcmp(KVOValue.objCType, CGPointType) != 0 {
49 | return nil
50 | }
51 | var typedValue = CGPoint(x: 0, y: 0)
52 | KVOValue.getValue(&typedValue)
53 | self = typedValue
54 | }
55 | }
56 |
57 | extension CGSize : KVORepresentable {
58 | public typealias KVOType = NSValue
59 |
60 | /**
61 | Constructs self from `NSValue`.
62 | */
63 | public init?(KVOValue: KVOType) {
64 | if strcmp(KVOValue.objCType, CGSizeType) != 0 {
65 | return nil
66 | }
67 | var typedValue = CGSize(width: 0, height: 0)
68 | KVOValue.getValue(&typedValue)
69 | self = typedValue
70 | }
71 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/KVORepresentable+Swift.swift:
--------------------------------------------------------------------------------
1 | //
2 | // KVORepresentable+Swift.swift
3 | // Rx
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 | /**
15 | Constructs `Self` using KVO value.
16 | */
17 | public init?(KVOValue: KVOType) {
18 | self.init(KVOValue.integerValue)
19 | }
20 | }
21 |
22 | extension Int32 : KVORepresentable {
23 | public typealias KVOType = NSNumber
24 |
25 | /**
26 | Constructs `Self` using KVO value.
27 | */
28 | public init?(KVOValue: KVOType) {
29 | self.init(KVOValue.intValue)
30 | }
31 | }
32 |
33 | extension Int64 : KVORepresentable {
34 | public typealias KVOType = NSNumber
35 |
36 | /**
37 | Constructs `Self` using KVO value.
38 | */
39 | public init?(KVOValue: KVOType) {
40 | self.init(KVOValue.longLongValue)
41 | }
42 | }
43 |
44 | extension UInt : KVORepresentable {
45 | public typealias KVOType = NSNumber
46 |
47 | /**
48 | Constructs `Self` using KVO value.
49 | */
50 | public init?(KVOValue: KVOType) {
51 | self.init(KVOValue.unsignedLongValue)
52 | }
53 | }
54 |
55 | extension UInt32 : KVORepresentable {
56 | public typealias KVOType = NSNumber
57 |
58 | /**
59 | Constructs `Self` using KVO value.
60 | */
61 | public init?(KVOValue: KVOType) {
62 | self.init(KVOValue.unsignedIntValue)
63 | }
64 | }
65 |
66 | extension UInt64 : KVORepresentable {
67 | public typealias KVOType = NSNumber
68 |
69 | /**
70 | Constructs `Self` using KVO value.
71 | */
72 | public init?(KVOValue: KVOType) {
73 | self.init(KVOValue.unsignedLongLongValue)
74 | }
75 | }
76 |
77 |
78 | extension RawRepresentable where RawValue: KVORepresentable {
79 | /**
80 | Constructs `Self` using optional KVO value.
81 | */
82 | init?(KVOValue: RawValue.KVOType?) {
83 | guard let KVOValue = KVOValue else {
84 | return nil
85 | }
86 |
87 | guard let rawValue = RawValue(KVOValue: KVOValue) else {
88 | return nil
89 | }
90 |
91 | self.init(rawValue: rawValue)
92 | }
93 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/KVORepresentable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // KVORepresentable.swift
3 | // Rx
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 | /**
12 | Type that is KVO representable (KVO mechanism can be used to observe it).
13 | */
14 | public protocol KVORepresentable {
15 | /**
16 | Associated KVO type.
17 | */
18 | typealias KVOType
19 |
20 | /**
21 | Constructs `Self` using KVO value.
22 | */
23 | init?(KVOValue: KVOType)
24 | }
25 |
26 | extension KVORepresentable {
27 | /**
28 | Initializes `KVORepresentable` with optional value.
29 | */
30 | init?(KVOValue: KVOType?) {
31 | guard let KVOValue = KVOValue else {
32 | return nil
33 | }
34 |
35 | self.init(KVOValue: KVOValue)
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/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 | /**
12 | Simple logging settings for RxCocoa library.
13 | */
14 | public struct Logging {
15 | public typealias LogURLRequest = (NSURLRequest) -> Bool
16 |
17 | /**
18 | Log URL requests to standard output in curl format.
19 | */
20 | public static var URLRequests: LogURLRequest = { _ in
21 | #if DEBUG
22 | return true
23 | #else
24 | return false
25 | #endif
26 | }
27 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSLayoutConstraint+Rx.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 12/6/15.
6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | #if os(OSX)
12 | import Cocoa
13 | #else
14 | import UIKit
15 | #endif
16 |
17 | #if !RX_NO_MODULE
18 | import RxSwift
19 | #endif
20 |
21 | #if os(iOS) || os(OSX) || os(tvOS)
22 | extension NSLayoutConstraint {
23 | /**
24 | Bindable sink for `constant` property.
25 | */
26 | public var rx_constant: AnyObserver {
27 | return AnyObserver { [weak self] event in
28 | MainScheduler.ensureExecutingOnScheduler()
29 |
30 | switch event {
31 | case .Next(let value):
32 | self?.constant = value
33 | case .Error(let error):
34 | bindingErrorToInterface(error)
35 | break
36 | case .Completed:
37 | break
38 | }
39 | }
40 | }
41 | }
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/DeallocObservable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DeallocObservable.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 12/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 | class DeallocObservable {
15 | let _subject = ReplaySubject.create(bufferSize: 1)
16 |
17 | init() {
18 | }
19 |
20 | deinit {
21 | _subject.on(.Next(()))
22 | _subject.on(.Completed)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/KVOObserver.swift:
--------------------------------------------------------------------------------
1 | //
2 | // KVOObserver.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 | protocol KVOObservableProtocol {
15 | var target: AnyObject { get }
16 | var keyPath: String { get }
17 | var retainTarget: Bool { get }
18 | var options: NSKeyValueObservingOptions { get }
19 | }
20 |
21 | class KVOObserver : _RXKVOObserver
22 | , Disposable {
23 | typealias Callback = (AnyObject?) -> Void
24 |
25 | var retainSelf: KVOObserver? = nil
26 |
27 | init(parent: KVOObservableProtocol, callback: Callback) {
28 | #if TRACE_RESOURCES
29 | OSAtomicIncrement32(&resourceCount)
30 | #endif
31 |
32 | super.init(target: parent.target, retainTarget: parent.retainTarget, keyPath: parent.keyPath, options: parent.options, callback: callback)
33 | self.retainSelf = self
34 | }
35 |
36 | override func dispose() {
37 | super.dispose()
38 | self.retainSelf = nil
39 | }
40 |
41 | deinit {
42 | #if TRACE_RESOURCES
43 | OSAtomicDecrement32(&resourceCount)
44 | #endif
45 | }
46 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/Observables/Implementations/MessageSentObserver.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MessageSentObserver.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 | #if !DISABLE_SWIZZLING
15 |
16 | class DeallocatingObservable
17 | : ObservableConvertibleType
18 | , RXMessageSentObserver {
19 | typealias E = ()
20 |
21 | private let _subject = ReplaySubject<()>.create(bufferSize: 1)
22 |
23 | @objc var targetImplementation: IMP = RX_default_target_implementation()
24 |
25 | var isActive: Bool {
26 | return targetImplementation != RX_default_target_implementation()
27 | }
28 |
29 | init() {
30 | }
31 |
32 | @objc func messageSentWithParameters(parameters: [AnyObject]) -> Void {
33 | _subject.on(.Next())
34 | }
35 |
36 | func asObservable() -> Observable<()> {
37 | return _subject
38 | }
39 |
40 | deinit {
41 | _subject.on(.Completed)
42 | }
43 | }
44 |
45 | class MessageSentObservable
46 | : ObservableConvertibleType
47 | , RXMessageSentObserver {
48 | typealias E = [AnyObject]
49 |
50 | private let _subject = PublishSubject<[AnyObject]>()
51 |
52 | @objc var targetImplementation: IMP = RX_default_target_implementation()
53 |
54 | var isActive: Bool {
55 | return targetImplementation != RX_default_target_implementation()
56 | }
57 |
58 | init() {
59 | }
60 |
61 | @objc func messageSentWithParameters(parameters: [AnyObject]) -> Void {
62 | _subject.on(.Next(parameters))
63 | }
64 |
65 | func asObservable() -> Observable<[AnyObject]> {
66 | return _subject
67 | }
68 |
69 | deinit {
70 | _subject.on(.Completed)
71 | }
72 | }
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/Observables/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 NSNotificationCenter {
15 | /**
16 | Transforms notifications posted to notification center to observable sequence of notifications.
17 |
18 | - parameter name: Filter notifications by name.
19 | - parameter object: Optional object used to filter notifications.
20 | - returns: Observable sequence of posted notifications.
21 | */
22 | @warn_unused_result(message="http://git.io/rxs.uo")
23 | public func rx_notification(name: String, object: AnyObject? = nil) -> Observable {
24 | return Observable.create { [weak object] observer in
25 | let nsObserver = self.addObserverForName(name, object: object, queue: nil) { notification in
26 | observer.on(.Next(notification))
27 | }
28 |
29 | return AnonymousDisposable {
30 | self.removeObserver(nsObserver)
31 | }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+KVORepresentable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+Rx+KVORepresentable.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 11/14/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 NSObject {
15 |
16 | /**
17 | Specialization of generic `rx_observe` method.
18 |
19 | This is a special overload because to observe values of some type (for example `Int`), first values of KVO type
20 | need to be observed (`NSNumber`), and then converted to result type.
21 |
22 | For more information take a look at `rx_observe` method.
23 | */
24 | @warn_unused_result(message="http://git.io/rxs.uo")
25 | public func rx_observe(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable {
26 | return rx_observe(E.KVOType.self, keyPath, options: options, retainSelf: retainSelf)
27 | .map(E.init)
28 | }
29 | }
30 |
31 | #if !DISABLE_SWIZZLING
32 | // KVO
33 | extension NSObject {
34 | /**
35 | Specialization of generic `rx_observeWeakly` method.
36 |
37 | For more information take a look at `rx_observeWeakly` method.
38 | */
39 | @warn_unused_result(message="http://git.io/rxs.uo")
40 | public func rx_observeWeakly(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable {
41 | return rx_observeWeakly(E.KVOType.self, keyPath, options: options)
42 | .map(E.init)
43 | }
44 | }
45 | #endif
46 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/Observables/NSObject+Rx+RawRepresentable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+Rx+RawRepresentable.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 11/9/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 NSObject {
15 | /**
16 | Specialization of generic `rx_observe` method.
17 |
18 | This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value.
19 |
20 | It is useful for observing bridged ObjC enum values.
21 |
22 | For more information take a look at `rx_observe` method.
23 | */
24 | @warn_unused_result(message="http://git.io/rxs.uo")
25 | public func rx_observe(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial], retainSelf: Bool = true) -> Observable {
26 | return rx_observe(E.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf)
27 | .map(E.init)
28 | }
29 | }
30 |
31 | #if !DISABLE_SWIZZLING
32 |
33 | // rx_observeWeakly + RawRepresentable
34 | extension NSObject {
35 |
36 | /**
37 | Specialization of generic `rx_observeWeakly` method.
38 |
39 | This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value.
40 |
41 | It is useful for observing bridged ObjC enum values.
42 |
43 | For more information take a look at `rx_observeWeakly` method.
44 | */
45 | @warn_unused_result(message="http://git.io/rxs.uo")
46 | public func rx_observeWeakly(type: E.Type, _ keyPath: String, options: NSKeyValueObservingOptions = [.New, .Initial]) -> Observable {
47 | return rx_observeWeakly(E.RawValue.KVOType.self, keyPath, options: options)
48 | .map(E.init)
49 | }
50 | }
51 | #endif
52 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/Proxies/RxCLLocationManagerDelegateProxy.swift:
--------------------------------------------------------------------------------
1 | //
2 | // RxCLLocationManagerDelegateProxy.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 | import CoreLocation
10 | #if !RX_NO_MODULE
11 | import RxSwift
12 | #endif
13 |
14 | class RxCLLocationManagerDelegateProxy : DelegateProxy
15 | , CLLocationManagerDelegate
16 | , DelegateProxyType {
17 |
18 | class func currentDelegateFor(object: AnyObject) -> AnyObject? {
19 | let locationManager: CLLocationManager = castOrFatalError(object)
20 | return locationManager.delegate
21 | }
22 |
23 | class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
24 | let locationManager: CLLocationManager = castOrFatalError(object)
25 | locationManager.delegate = castOptionalOrFatalError(delegate)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/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 | OSAtomicIncrement32(&resourceCount)
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 | OSAtomicDecrement32(&resourceCount)
42 | }
43 | #endif
44 | }
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/_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 "_RX.h"
10 |
11 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/_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 | @interface _RXDelegateProxy : NSObject
12 |
13 | @property (nonatomic, assign, readonly) id _forwardToDelegate;
14 |
15 | -(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate;
16 |
17 | -(BOOL)hasWiredImplementationForSelector:(SEL)selector;
18 |
19 | -(void)interceptedSelector:(SEL)selector withArguments:(NSArray*)arguments;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/_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 | typedef void (^KVOCallback)(id);
18 |
19 | // Exists because if written in Swift, reading unowned is disabled during dealloc process
20 | @interface _RXKVOObserver : NSObject
21 |
22 | -(instancetype)initWithTarget:(id)target
23 | retainTarget:(BOOL)retainTarget
24 | keyPath:(NSString*)keyPath
25 | options:(NSKeyValueObservingOptions)options
26 | callback:(KVOCallback)callback;
27 |
28 | -(void)dispose;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/Common/_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 "_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 ) KVOCallback callback;
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 | self.callback(change[NSKeyValueChangeNewKey]);
44 | }
45 |
46 | -(void)dispose {
47 | [self.target removeObserver:self forKeyPath:self.keyPath context:nil];
48 | self.target = nil;
49 | self.retainedTarget = nil;
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/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 | import UIKit
11 |
12 | public typealias ItemMovedEvent = (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath)
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSTextStorage+Rx.swift
3 | // Rx
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 NSTextStorage {
18 |
19 | /**
20 | Reactive wrapper for `delegate`.
21 |
22 | For more information take a look at `DelegateProxyType` protocol documentation.
23 | */
24 | public var rx_delegate:DelegateProxy {
25 | return proxyForObject(RxTextStorageDelegateProxy.self, self)
26 | }
27 |
28 | /**
29 | Reactive wrapper for `delegate` message.
30 | */
31 | public var rx_didProcessEditingRangeChangeInLength: Observable<(editedMask:NSTextStorageEditActions, editedRange:NSRange, delta:Int)> {
32 | return rx_delegate
33 | .observe("textStorage:didProcessEditing:range:changeInLength:")
34 | .map { a in
35 | let editedMask = NSTextStorageEditActions(rawValue: try castOrThrow(UInt.self, a[1]) )
36 | let editedRange = try castOrThrow(NSValue.self, a[2]).rangeValue
37 | let delta = try castOrThrow(Int.self, a[3])
38 |
39 | return (editedMask, editedRange, delta)
40 | }
41 | }
42 | }
43 | #endif
44 |
--------------------------------------------------------------------------------
/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 | /**
18 | Marks data source as `UICollectionView` reactive data source enabling it to be used with one of the `bindTo` methods.
19 | */
20 | public protocol RxCollectionViewDataSourceType /*: UICollectionViewDataSource*/ {
21 |
22 | /**
23 | Type of elements that can be bound to collection view.
24 | */
25 | typealias Element
26 |
27 | /**
28 | New observable sequence event observed.
29 |
30 | - parameter collectionView: Bound collection view.
31 | - parameter observedEvent: Event
32 | */
33 | func collectionView(collectionView: UICollectionView, observedEvent: Event) -> Void
34 | }
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/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 | /**
18 | Marks data source as `UITableView` reactive data source enabling it to be used with one of the `bindTo` methods.
19 | */
20 | public protocol RxTableViewDataSourceType /*: UITableViewDataSource*/ {
21 |
22 | /**
23 | Type of elements that can be bound to table view.
24 | */
25 | typealias Element
26 |
27 | /**
28 | New observable sequence event observed.
29 |
30 | - parameter tableView: Bound table view.
31 | - parameter observedEvent: Event
32 | */
33 | func tableView(tableView: UITableView, observedEvent: Event) -> Void
34 | }
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/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 | /**
18 | For more information take a look at `DelegateProxyType`.
19 | */
20 | public class RxCollectionViewDelegateProxy
21 | : RxScrollViewDelegateProxy
22 | , UICollectionViewDelegate
23 | , UICollectionViewDelegateFlowLayout {
24 |
25 | /**
26 | Typed parent object.
27 | */
28 | public weak private(set) var collectionView: UICollectionView?
29 |
30 | /**
31 | Initializes `RxCollectionViewDelegateProxy`
32 |
33 | - parameter parentObject: Parent object for delegate proxy.
34 | */
35 | public required init(parentObject: AnyObject) {
36 | self.collectionView = (parentObject as! UICollectionView)
37 | super.init(parentObject: parentObject)
38 | }
39 | }
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/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 | class RxSearchBarDelegateProxy : DelegateProxy
18 | , UISearchBarDelegate
19 | , DelegateProxyType {
20 |
21 | class func currentDelegateFor(object: AnyObject) -> AnyObject? {
22 | let searchBar: UISearchBar = castOrFatalError(object)
23 | return searchBar.delegate
24 | }
25 |
26 | class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
27 | let searchBar: UISearchBar = castOrFatalError(object)
28 | searchBar.delegate = castOptionalOrFatalError(delegate)
29 | }
30 | }
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/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 | /**
18 | For more information take a look at `DelegateProxyType`.
19 | */
20 | public class RxTableViewDelegateProxy
21 | : RxScrollViewDelegateProxy
22 | , UITableViewDelegate {
23 |
24 |
25 | /**
26 | Typed parent object.
27 | */
28 | public weak private(set) var tableView: UITableView?
29 |
30 | /**
31 | Initializes `RxTableViewDelegateProxy`
32 |
33 | - parameter parentObject: Parent object for delegate proxy.
34 | */
35 | public required init(parentObject: AnyObject) {
36 | self.tableView = (parentObject as! UITableView)
37 | super.init(parentObject: parentObject)
38 | }
39 | }
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift:
--------------------------------------------------------------------------------
1 | //
2 | // RxTextStorageDelegateProxy.swift
3 | // Rx
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 | /**
24 | For more information take a look at `DelegateProxyType`.
25 | */
26 | public class func setCurrentDelegate(delegate: AnyObject?, toObject object: AnyObject) {
27 | let textStorage: NSTextStorage = castOrFatalError(object)
28 | textStorage.delegate = castOptionalOrFatalError(delegate)
29 | }
30 |
31 | /**
32 | For more information take a look at `DelegateProxyType`.
33 | */
34 | public class func currentDelegateFor(object: AnyObject) -> AnyObject? {
35 | let textStorage: NSTextStorage = castOrFatalError(object)
36 | return textStorage.delegate
37 | }
38 |
39 |
40 | }
41 | #endif
42 |
--------------------------------------------------------------------------------
/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 | /**
18 | For more information take a look at `DelegateProxyType`.
19 | */
20 | public class RxTextViewDelegateProxy
21 | : RxScrollViewDelegateProxy
22 | , UITextViewDelegate {
23 |
24 | /**
25 | Typed parent object.
26 | */
27 | public weak private(set) var textView: UITextView?
28 |
29 | /**
30 | Initializes `RxTextViewDelegateProxy`
31 |
32 | - parameter parentObject: Parent object for delegate proxy.
33 | */
34 | public required init(parentObject: AnyObject) {
35 | self.textView = (parentObject as! UITextView)
36 | super.init(parentObject: parentObject)
37 | }
38 |
39 | // MARK: delegate methods
40 |
41 | /**
42 | For more information take a look at `DelegateProxyType`.
43 | */
44 | @objc public func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool {
45 | /**
46 | We've had some issues with observing text changes. This is here just in case we need the same hack in future and that
47 | we wouldn't need to change the public interface.
48 | */
49 | let forwardToDelegate = self.forwardToDelegate() as? UITextViewDelegate
50 | return forwardToDelegate?.textView?(textView,
51 | shouldChangeTextInRange: range,
52 | replacementText: text) ?? true
53 | }
54 | }
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIActivityIndicatorView+Rx.swift
3 | // Rx
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 UIActivityIndicatorView {
17 |
18 | /**
19 | Bindable sink for `startAnimating()`, `stopAnimating()` methods.
20 | */
21 | public var rx_animating: AnyObserver {
22 | return AnyObserver {event in
23 | MainScheduler.ensureExecutingOnScheduler()
24 |
25 | switch (event) {
26 | case .Next(let value):
27 | if value {
28 | self.startAnimating()
29 | } else {
30 | self.stopAnimating()
31 | }
32 | case .Error(let error):
33 | bindingErrorToInterface(error)
34 | case .Completed:
35 | break
36 | }
37 | }
38 | }
39 |
40 | }
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/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 UIButton {
18 |
19 | /**
20 | Reactive wrapper for `TouchUpInside` control event.
21 | */
22 | public var rx_tap: ControlEvent {
23 | return rx_controlEvent(.TouchUpInside)
24 | }
25 |
26 | }
27 |
28 | #endif
29 |
30 | #if os(tvOS)
31 |
32 | import Foundation
33 | #if !RX_NO_MODULE
34 | import RxSwift
35 | #endif
36 | import UIKit
37 |
38 | extension UIButton {
39 |
40 | /**
41 | Reactive wrapper for `PrimaryActionTriggered` control event.
42 | */
43 | public var rx_primaryAction: ControlEvent {
44 | return rx_controlEvent(.PrimaryActionTriggered)
45 | }
46 | }
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/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 UIDatePicker {
18 |
19 | /**
20 | Reactive wrapper for `date` property.
21 | */
22 | public var rx_date: ControlProperty {
23 | return rx_value(getter: { [weak self] in
24 | self?.date ?? NSDate()
25 | }, setter: { [weak self] value in
26 | self?.date = value
27 | })
28 | }
29 |
30 | }
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/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 UIImageView {
18 |
19 | /**
20 | Bindable sink for `image` property.
21 | */
22 | public var rx_image: AnyObserver {
23 | return self.rx_imageAnimated(nil)
24 | }
25 |
26 | /**
27 | Bindable sink for `image` property.
28 |
29 | - parameter transitionType: Optional transition type while setting the image (kCATransitionFade, kCATransitionMoveIn, ...)
30 | */
31 | public func rx_imageAnimated(transitionType: String?) -> AnyObserver {
32 | return AnyObserver { [weak self] event in
33 | MainScheduler.ensureExecutingOnScheduler()
34 |
35 | switch event {
36 | case .Next(let value):
37 | if let transitionType = transitionType {
38 | if value != nil {
39 | let transition = CATransition()
40 | transition.duration = 0.25
41 | transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
42 | transition.type = transitionType
43 | self?.layer.addAnimation(transition, forKey: kCATransition)
44 | }
45 | }
46 | else {
47 | self?.layer.removeAllAnimations()
48 | }
49 | self?.image = value
50 | case .Error(let error):
51 | bindingErrorToInterface(error)
52 | break
53 | case .Completed:
54 | break
55 | }
56 | }
57 | }
58 |
59 | }
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/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 UILabel {
18 |
19 | /**
20 | Bindable sink for `text` property.
21 | */
22 | public var rx_text: AnyObserver {
23 | return AnyObserver { [weak self] event in
24 | MainScheduler.ensureExecutingOnScheduler()
25 |
26 | switch event {
27 | case .Next(let value):
28 | self?.text = value
29 | case .Error(let error):
30 | bindingErrorToInterface(error)
31 | break
32 | case .Completed:
33 | break
34 | }
35 | }
36 | }
37 |
38 | /**
39 | Bindable sink for `attributedText` property.
40 | */
41 | public var rx_attributedText: AnyObserver {
42 | return AnyObserver { [weak self] event in
43 | MainScheduler.ensureExecutingOnScheduler()
44 |
45 | switch event {
46 | case .Next(let value):
47 | self?.attributedText = value
48 | case .Error(let error):
49 | bindingErrorToInterface(error)
50 | break
51 | case .Completed:
52 | break
53 | }
54 | }
55 | }
56 |
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/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 | /**
20 | Factory method that enables subclasses to implement their own `rx_delegate`.
21 |
22 | - returns: Instance of delegate proxy that wraps `delegate`.
23 | */
24 | public func rx_createDelegateProxy() -> RxScrollViewDelegateProxy {
25 | return RxScrollViewDelegateProxy(parentObject: self)
26 | }
27 |
28 | /**
29 | Reactive wrapper for `delegate`.
30 |
31 | For more information take a look at `DelegateProxyType` protocol documentation.
32 | */
33 | public var rx_delegate: DelegateProxy {
34 | return proxyForObject(RxScrollViewDelegateProxy.self, self)
35 | }
36 |
37 | /**
38 | Reactive wrapper for `contentOffset`.
39 | */
40 | public var rx_contentOffset: ControlProperty {
41 | let proxy = proxyForObject(RxScrollViewDelegateProxy.self, self)
42 |
43 | return ControlProperty(values: proxy.contentOffsetSubject, valueSink: AnyObserver { [weak self] event in
44 | switch event {
45 | case .Next(let value):
46 | self?.contentOffset = value
47 | case .Error(let error):
48 | bindingErrorToInterface(error)
49 | case .Completed:
50 | break
51 | }
52 | })
53 | }
54 |
55 | /**
56 | Installs delegate as forwarding delegate on `rx_delegate`.
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 | */
63 | public func rx_setDelegate(delegate: UIScrollViewDelegate)
64 | -> Disposable {
65 | let proxy = proxyForObject(RxScrollViewDelegateProxy.self, self)
66 | return installDelegate(proxy, delegate: delegate, retainDelegate: false, onProxyForObject: self)
67 | }
68 | }
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UISearchBar+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) || os(tvOS)
10 |
11 | import Foundation
12 | #if !RX_NO_MODULE
13 | import RxSwift
14 | #endif
15 | import UIKit
16 |
17 |
18 |
19 | extension UISearchBar {
20 |
21 | /**
22 | Reactive wrapper for `delegate`.
23 |
24 | For more information take a look at `DelegateProxyType` protocol documentation.
25 | */
26 | public var rx_delegate: DelegateProxy {
27 | return proxyForObject(RxSearchBarDelegateProxy.self, self)
28 | }
29 |
30 | /**
31 | Reactive wrapper for `text` property.
32 | */
33 | public var rx_text: ControlProperty {
34 | let source: Observable = Observable.deferred { [weak self] () -> Observable in
35 | let text = self?.text ?? ""
36 |
37 | return (self?.rx_delegate.observe("searchBar:textDidChange:") ?? Observable.empty())
38 | .map { a in
39 | return a[1] as? String ?? ""
40 | }
41 | .startWith(text)
42 | }
43 |
44 | return ControlProperty(values: source, valueSink: AnyObserver { [weak self] event in
45 | switch event {
46 | case .Next(let value):
47 | self?.text = value
48 | case .Error(let error):
49 | bindingErrorToInterface(error)
50 | case .Completed:
51 | break
52 | }
53 | })
54 | }
55 | }
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/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 UISegmentedControl {
18 |
19 | /**
20 | Reactive wrapper for `selectedSegmentIndex` property.
21 | */
22 | public var rx_value: ControlProperty {
23 | return rx_value(getter: { [weak self] in
24 | self?.selectedSegmentIndex ?? 0
25 | }, setter: { [weak self] value in
26 | self?.selectedSegmentIndex = value
27 | })
28 | }
29 |
30 | }
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/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 UISlider {
18 |
19 | /**
20 | Reactive wrapper for `value` property.
21 | */
22 | public var rx_value: ControlProperty {
23 | return rx_value(getter: { [weak self] in
24 | self?.value ?? 0.0
25 | }, setter: { [weak self] value in
26 | self?.value = value
27 | })
28 | }
29 |
30 | }
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/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 UIStepper {
18 |
19 | /**
20 | Reactive wrapper for `value` property.
21 | */
22 | public var rx_value: ControlProperty {
23 | return rx_value(getter: { [weak self] in
24 | self?.value ?? 0
25 | }, setter: { [weak self] value in
26 | self?.value = value
27 | })
28 | }
29 |
30 | }
31 |
32 | #endif
33 |
34 |
--------------------------------------------------------------------------------
/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 UISwitch {
18 |
19 | /**
20 | Reactive wrapper for `on` property.
21 | */
22 | public var rx_value: ControlProperty {
23 | return rx_value(getter: { [weak self] in
24 | self?.on ?? false
25 | }, setter: { [weak self] value in
26 | self?.on = value
27 | })
28 | }
29 |
30 | }
31 |
32 | #endif
33 |
34 |
--------------------------------------------------------------------------------
/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 UITextField {
18 |
19 | /**
20 | Reactive wrapper for `text` property.
21 | */
22 | public var rx_text: ControlProperty {
23 | return rx_value(getter: { [weak self] in
24 | self?.text ?? ""
25 | }, setter: { [weak self] value in
26 | self?.text = value
27 | })
28 | }
29 |
30 | }
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UITextView+Rx.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 |
18 |
19 | extension UITextView {
20 |
21 | /**
22 | Factory method that enables subclasses to implement their own `rx_delegate`.
23 |
24 | - returns: Instance of delegate proxy that wraps `delegate`.
25 | */
26 | public override func rx_createDelegateProxy() -> RxScrollViewDelegateProxy {
27 | return RxTextViewDelegateProxy(parentObject: self)
28 | }
29 |
30 | /**
31 | Reactive wrapper for `text` property.
32 | */
33 | public var rx_text: ControlProperty {
34 | let source: Observable = Observable.deferred { [weak self] in
35 | let text = self?.text ?? ""
36 |
37 | let textChanged = self?.textStorage
38 | .rx_didProcessEditingRangeChangeInLength
39 | .map { _ in
40 | return self?.textStorage.string ?? ""
41 | }
42 | ?? Observable.empty()
43 |
44 | return textChanged
45 | .startWith(text)
46 | .distinctUntilChanged()
47 | }
48 |
49 | return ControlProperty(values: source, valueSink: AnyObserver { [weak self] event in
50 | switch event {
51 | case .Next(let value):
52 | self?.text = value
53 | case .Error(let error):
54 | bindingErrorToInterface(error)
55 | case .Completed:
56 | break
57 | }
58 | })
59 | }
60 |
61 | }
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Rx.swift
3 | // Rx
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 UIView {
18 | /**
19 | Bindable sink for `hidden` property.
20 | */
21 | public var rx_hidden: AnyObserver {
22 | return AnyObserver { [weak self] event in
23 | MainScheduler.ensureExecutingOnScheduler()
24 |
25 | switch event {
26 | case .Next(let value):
27 | self?.hidden = value
28 | case .Error(let error):
29 | bindingErrorToInterface(error)
30 | break
31 | case .Completed:
32 | break
33 | }
34 | }
35 | }
36 |
37 | /**
38 | Bindable sink for `alpha` property.
39 | */
40 | public var rx_alpha: AnyObserver {
41 | return AnyObserver { [weak self] event in
42 | MainScheduler.ensureExecutingOnScheduler()
43 |
44 | switch event {
45 | case .Next(let value):
46 | self?.alpha = value
47 | case .Error(let error):
48 | bindingErrorToInterface(error)
49 | break
50 | case .Completed:
51 | break
52 | }
53 | }
54 | }
55 | }
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/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/RxSwift/AnyObserver.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AnyObserver.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 2/28/15.
6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | /**
12 | A type-erased `ObserverType`.
13 |
14 | Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type.
15 | */
16 | public struct AnyObserver : ObserverType {
17 | /**
18 | The type of elements in sequence that observer can observe.
19 | */
20 | public typealias E = Element
21 |
22 | /**
23 | Anonymous event handler type.
24 | */
25 | public typealias EventHandler = (Event) -> Void
26 |
27 | public let observer: EventHandler
28 |
29 | /**
30 | Construct an instance whose `on(event)` calls `eventHandler(event)`
31 |
32 | - parameter eventHandler: Event handler that observes sequences events.
33 | */
34 | public init(eventHandler: EventHandler) {
35 | self.observer = eventHandler
36 | }
37 |
38 | /**
39 | Construct an instance whose `on(event)` calls `observer.on(event)`
40 |
41 | - parameter observer: Observer that receives sequence events.
42 | */
43 | public init(_ observer: O) {
44 | self.observer = observer.on
45 | }
46 |
47 | /**
48 | Send `event` to this observer.
49 |
50 | - parameter event: Event instance.
51 | */
52 | public func on(event: Event) {
53 | return self.observer(event)
54 | }
55 |
56 | /**
57 | Erases type of observer and returns canonical observer.
58 |
59 | - returns: type erased observer.
60 | */
61 | public func asObserver() -> AnyObserver {
62 | return self
63 | }
64 | }
65 |
66 | extension ObserverType {
67 | /**
68 | Erases type of observer and returns canonical observer.
69 |
70 | - returns: type erased observer.
71 | */
72 | public func asObserver() -> AnyObserver {
73 | return AnyObserver(self)
74 | }
75 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Cancelable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Cancelable.swift
3 | // Rx
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 | /**
12 | Represents disposable resource with state tracking.
13 | */
14 | public protocol Cancelable : Disposable {
15 | /**
16 | - returns: Was resource disposed.
17 | */
18 | var disposed: Bool { get }
19 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LockOwnerType.swift
3 | // Rx
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 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SynchronizedDisposeType.swift
3 | // Rx
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 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SynchronizedOnType.swift
3 | // Rx
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 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Concurrency/SynchronizedSubscribeType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SynchronizedSubscribeType.swift
3 | // Rx
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
13 | }
14 |
15 | extension SynchronizedSubscribeType {
16 | func synchronizedSubscribe(observer: O) -> Disposable {
17 | lock(); defer { unlock() }
18 | return _synchronized_subscribe(observer)
19 | }
20 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SynchronizedUnsubscribeType.swift
3 | // Rx
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 | typealias DisposeKey
13 |
14 | func synchronizedUnsubscribe(disposeKey: DisposeKey)
15 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/ConnectableObservableType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ConnectableObservableType.swift
3 | // Rx
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 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/DataStructures/InfiniteSequence.swift:
--------------------------------------------------------------------------------
1 | //
2 | // InfiniteSequence.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 | /**
12 | Sequence that repeats `repeatedValue` infinite number of times.
13 | */
14 | struct InfiniteSequence : SequenceType {
15 | typealias Element = E
16 | typealias Generator = AnyGenerator
17 |
18 | private let _repeatedValue: E
19 |
20 | init(repeatedValue: E) {
21 | _repeatedValue = repeatedValue
22 | }
23 |
24 | func generate() -> Generator {
25 | let repeatedValue = _repeatedValue
26 | return anyGenerator {
27 | return repeatedValue
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Disposable.swift
3 | // Rx
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 | /**
12 | Respresents disposable resource.
13 | */
14 | public protocol Disposable {
15 | /**
16 | Dispose resource.
17 | */
18 | func dispose()
19 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AnonymousDisposable.swift
3 | // Rx
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 | /**
12 | Represents an Action-based disposable.
13 |
14 | When dispose method is called, disposal action will be dereferenced.
15 | */
16 | public final class AnonymousDisposable : DisposeBase, Cancelable {
17 | public typealias DisposeAction = () -> Void
18 |
19 | private var _disposed: AtomicInt = 0
20 | private var _disposeAction: DisposeAction?
21 |
22 | /**
23 | - returns: Was resource disposed.
24 | */
25 | public var disposed: Bool {
26 | get {
27 | return _disposed == 1
28 | }
29 | }
30 |
31 | /**
32 | Constructs a new disposable with the given action used for disposal.
33 |
34 | - parameter disposeAction: Disposal action which will be run upon calling `dispose`.
35 | */
36 | public init(_ disposeAction: DisposeAction) {
37 | _disposeAction = disposeAction
38 | super.init()
39 | }
40 |
41 | /**
42 | Calls the disposal action if and only if the current instance hasn't been disposed yet.
43 |
44 | After invoking disposal action, disposal action will be dereferenced.
45 | */
46 | public func dispose() {
47 | if AtomicCompareAndSwap(0, 1, &_disposed) {
48 | assert(_disposed == 1)
49 |
50 | if let action = _disposeAction {
51 | _disposeAction = nil
52 | action()
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/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 | /**
12 | Represents two disposable resources that are disposed together.
13 | */
14 | public final class BinaryDisposable : DisposeBase, Cancelable {
15 |
16 | private var _disposed: AtomicInt = 0
17 |
18 | // state
19 | private var _disposable1: Disposable?
20 | private var _disposable2: Disposable?
21 |
22 | /**
23 | - returns: Was resource disposed.
24 | */
25 | public var disposed: Bool {
26 | get {
27 | return _disposed > 0
28 | }
29 | }
30 |
31 | /**
32 | Constructs new binary disposable from two disposables.
33 |
34 | - parameter disposable1: First disposable
35 | - parameter disposable2: Second disposable
36 | */
37 | init(_ disposable1: Disposable, _ disposable2: Disposable) {
38 | _disposable1 = disposable1
39 | _disposable2 = disposable2
40 | super.init()
41 | }
42 |
43 | /**
44 | Calls the disposal action if and only if the current instance hasn't been disposed yet.
45 |
46 | After invoking disposal action, disposal action will be dereferenced.
47 | */
48 | public func dispose() {
49 | if AtomicCompareAndSwap(0, 1, &_disposed) {
50 | _disposable1?.dispose()
51 | _disposable2?.dispose()
52 | _disposable1 = nil
53 | _disposable2 = nil
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BooleanDisposable.swift
3 | // Rx
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 | /**
12 | Represents a disposable resource that can be checked for disposal status.
13 | */
14 | public class BooleanDisposable : Disposable, Cancelable {
15 |
16 | internal static let BooleanDisposableTrue = BooleanDisposable(disposed: true)
17 | private var _disposed = false
18 |
19 | /**
20 | Initializes a new instance of the `BooleanDisposable` class
21 | */
22 | public init() {
23 | }
24 |
25 | /**
26 | Initializes a new instance of the `BooleanDisposable` class with given value
27 | */
28 | public init(disposed: Bool) {
29 | self._disposed = disposed
30 | }
31 |
32 | /**
33 | - returns: Was resource disposed.
34 | */
35 | public var disposed: Bool {
36 | get {
37 | return _disposed
38 | }
39 | }
40 |
41 | /**
42 | Sets the status to disposed, which can be observer through the `disposed` property.
43 | */
44 | public func dispose() {
45 | _disposed = true
46 | }
47 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DisposeBase.swift
3 | // Rx
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 | /**
12 | Base class for all disposables.
13 | */
14 | public class DisposeBase {
15 | init() {
16 | #if TRACE_RESOURCES
17 | AtomicIncrement(&resourceCount)
18 | #endif
19 | }
20 |
21 | deinit {
22 | #if TRACE_RESOURCES
23 | AtomicDecrement(&resourceCount)
24 | #endif
25 | }
26 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposables/NAryDisposable.swift:
--------------------------------------------------------------------------------
1 | // This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project
2 | //
3 | // NAryDisposable.swift
4 | // RxSwift
5 | //
6 | // Created by Krunoslav Zaher on 8/20/15.
7 | // Copyright © 2015 Krunoslav Zaher. All rights reserved.
8 | //
9 |
10 | import Foundation
11 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NopDisposable.swift
3 | // Rx
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 | /**
12 | Represents a disposable that does nothing on disposal.
13 |
14 | Nop = No Operation
15 | */
16 | public struct NopDisposable : Disposable {
17 |
18 | /**
19 | Singleton instance of `NopDisposable`.
20 | */
21 | public static let instance: Disposable = NopDisposable()
22 |
23 | init() {
24 |
25 | }
26 |
27 | /**
28 | Does nothing.
29 | */
30 | public func dispose() {
31 | }
32 | }
--------------------------------------------------------------------------------
/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 NopDisposable.instance
14 | }
15 |
16 | /**
17 | Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler.
18 | */
19 | public class ScheduledDisposable : Cancelable {
20 | public let scheduler: ImmediateSchedulerType
21 |
22 | private var _disposed: AtomicInt = 0
23 |
24 | // state
25 | private var _disposable: Disposable?
26 |
27 | /**
28 | - returns: Was resource disposed.
29 | */
30 | public var disposed: Bool {
31 | get {
32 | return _disposed == 1
33 | }
34 | }
35 |
36 | /**
37 | Initializes a new instance of the `ScheduledDisposable` that uses a `scheduler` on which to dispose the `disposable`.
38 |
39 | - parameter scheduler: Scheduler where the disposable resource will be disposed on.
40 | - parameter disposable: Disposable resource to dispose on the given scheduler.
41 | */
42 | init(scheduler: ImmediateSchedulerType, disposable: Disposable) {
43 | self.scheduler = scheduler
44 | _disposable = disposable
45 | }
46 |
47 | /**
48 | Disposes the wrapped disposable on the provided scheduler.
49 | */
50 | public func dispose() {
51 | scheduler.schedule(self, action: disposeScheduledDisposable)
52 | }
53 |
54 | func disposeInner() {
55 | if AtomicCompareAndSwap(0, 1, &_disposed) {
56 | _disposable!.dispose()
57 | _disposable = nil
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposables/StableCompositeDisposable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // StableCompositeDisposable.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 | public final class StableCompositeDisposable {
12 | public static func create(disposable1: Disposable, _ disposable2: Disposable) -> Disposable {
13 | return BinaryDisposable(disposable1, disposable2)
14 | }
15 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SubscriptionDisposable.swift
3 | // Rx
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 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Errors.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Errors.swift
3 | // Rx
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 | /**
15 | Generic Rx error codes.
16 | */
17 | public enum RxError
18 | : ErrorType
19 | , CustomDebugStringConvertible {
20 | /**
21 | Unknown error occured.
22 | */
23 | case Unknown
24 | /**
25 | Performing an action on disposed object.
26 | */
27 | case Disposed(object: AnyObject)
28 | /**
29 | Aritmetic overflow error.
30 | */
31 | case Overflow
32 | /**
33 | Argument out of range error.
34 | */
35 | case ArgumentOutOfRange
36 | /**
37 | Sequence doesn't contain any element.
38 | */
39 | case NoElements
40 | /**
41 | Sequence contains more then one element.
42 | */
43 | case MoreThanOneElement
44 | /**
45 | Timeout error.
46 | */
47 | case Timeout
48 | }
49 |
50 | public extension RxError {
51 | /**
52 | A textual representation of `self`, suitable for debugging.
53 | */
54 | public var debugDescription: String {
55 | switch self {
56 | case .Unknown:
57 | return "Unknown error occured."
58 | case .Disposed(let object):
59 | return "Object `\(object)` was already disposed."
60 | case .Overflow:
61 | return "Arithmetic overflow occured."
62 | case .ArgumentOutOfRange:
63 | return "Argument out of range."
64 | case .NoElements:
65 | return "Sequence doesn't contain any element."
66 | case .MoreThanOneElement:
67 | return "Sequence contains more then one element."
68 | case .Timeout:
69 | return "Sequence timeout"
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Event.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Event.swift
3 | // Rx
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 |
12 | /**
13 | Represents sequence event
14 |
15 | Sequence grammar:
16 | Next\* (Error | Completed)
17 | */
18 | public enum Event : CustomDebugStringConvertible {
19 | /**
20 | Next element is produced
21 | */
22 | case Next(Element)
23 |
24 | /**
25 | Sequence terminates with error
26 | */
27 | case Error(ErrorType)
28 |
29 | /**
30 | Sequence completes sucessfully
31 | */
32 | case Completed
33 | }
34 |
35 | extension Event {
36 | /**
37 | - returns: Description of event
38 | */
39 | public var debugDescription: String {
40 | get {
41 | switch self {
42 | case .Next(let value):
43 | return "Next(\(value))"
44 | case .Error(let error):
45 | return "Error(\(error))"
46 | case .Completed:
47 | return "Completed"
48 | }
49 | }
50 | }
51 | }
52 |
53 | extension Event {
54 | /**
55 | - returns: Is `Completed` or `Error` event
56 | */
57 | public var isStopEvent: Bool {
58 | get {
59 | switch self {
60 | case .Next: return false
61 | case .Error, .Completed: return true
62 | }
63 | }
64 | }
65 |
66 | /**
67 | - returns: If `Next` event, returns element value.
68 | */
69 | public var element: Element? {
70 | get {
71 | if case .Next(let value) = self {
72 | return value
73 | }
74 | return nil
75 | }
76 | }
77 |
78 | /**
79 | - returns: If `Error` event, returns error.
80 | */
81 | public var error: ErrorType? {
82 | get {
83 | if case .Error(let error) = self {
84 | return error
85 | }
86 | return nil
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // String+Rx.swift
3 | // Rx
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 | /**
13 | This is needed because on Linux Swift doesn't have `rangeOfString(..., options: .BackwardsSearch)`
14 | */
15 | func lastIndexOf(character: Character) -> Index? {
16 | var last: Index?
17 | for i in startIndex ..< endIndex {
18 | if self[i] == character {
19 | last = i
20 | }
21 | }
22 |
23 | return last
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 | /**
12 | Represents an object that immediately schedules units of work.
13 | */
14 | public protocol ImmediateSchedulerType {
15 | /**
16 | Schedules an action to be executed immediatelly.
17 |
18 | - parameter state: State passed to the action to be executed.
19 | - parameter action: Action to be executed.
20 | - returns: The disposable object used to cancel the scheduled action (best effort).
21 | */
22 | func schedule(state: StateType, action: (StateType) -> Disposable) -> Disposable
23 | }
24 |
25 | extension ImmediateSchedulerType {
26 | /**
27 | Schedules an action to be executed recursively.
28 |
29 | - parameter state: State passed to the action to be executed.
30 | - 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.
31 | - returns: The disposable object used to cancel the scheduled action (best effort).
32 | */
33 | public func scheduleRecursive(state: State, action: (state: State, recurse: (State) -> ()) -> ()) -> Disposable {
34 | let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self)
35 |
36 | recursiveScheduler.schedule(state)
37 |
38 | return AnonymousDisposable {
39 | recursiveScheduler.dispose()
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Observable.swift
3 | // Rx
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 | /**
12 | A type-erased `ObservableType`.
13 |
14 | It represents a push style sequence.
15 | */
16 | public class Observable : ObservableType {
17 | /**
18 | Type of elements in sequence.
19 | */
20 | public typealias E = Element
21 |
22 | init() {
23 | #if TRACE_RESOURCES
24 | OSAtomicIncrement32(&resourceCount)
25 | #endif
26 | }
27 |
28 | public func subscribe(observer: O) -> Disposable {
29 | abstractMethod()
30 | }
31 |
32 | public func asObservable() -> Observable {
33 | return self
34 | }
35 |
36 | deinit {
37 | #if TRACE_RESOURCES
38 | AtomicDecrement(&resourceCount)
39 | #endif
40 | }
41 |
42 | // this is kind of ugly I know :(
43 | // Swift compiler reports "Not supported yet" when trying to override protocol extensions, so ¯\_(ツ)_/¯
44 |
45 | /**
46 | Optimizations for map operator
47 | */
48 | internal func composeMap(selector: Element throws -> R) -> Observable {
49 | return Map(source: self, selector: selector)
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ObservableConvertibleType.swift
3 | // Rx
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 | /**
12 | Type that can be converted to observable sequence (`Observer`).
13 | */
14 | public protocol ObservableConvertibleType {
15 | /**
16 | Type of elements in sequence.
17 | */
18 | typealias E
19 |
20 | /**
21 | Converts `self` to `Observable` sequence.
22 |
23 | - returns: Observable sequence that represents `self`.
24 | */
25 | func asObservable() -> Observable
26 | }
27 |
--------------------------------------------------------------------------------
/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 | /**
12 | Represents a push style sequence.
13 | */
14 | public protocol ObservableType : ObservableConvertibleType {
15 | /**
16 | Type of elements in sequence.
17 | */
18 | typealias E
19 |
20 | /**
21 | Subscribes `observer` to receive events for this sequence.
22 |
23 | ### Grammar
24 |
25 | **Next\* (Error | Completed)?**
26 |
27 | * sequences can produce zero or more elements so zero or more `Next` events can be sent to `observer`
28 | * once an `Error` or `Completed` event is sent, the sequence terminates and can't produce any other element
29 |
30 | It is possible that events are sent from different threads, but no two events can be sent concurrently to
31 | `observer`.
32 |
33 | ### Resource Management
34 |
35 | When sequence sends `Complete` or `Error` event all internal resources that compute sequence elements
36 | will be freed.
37 |
38 | To cancel production of sequence elements and free resources immediatelly, call `dispose` on returned
39 | subscription.
40 |
41 | - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources.
42 | */
43 | @warn_unused_result(message="http://git.io/rxs.ud")
44 | func subscribe(observer: O) -> Disposable
45 |
46 | }
47 |
48 | extension ObservableType {
49 |
50 | /**
51 | Default implementation of converting `ObservableType` to `Observable`.
52 | */
53 | @warn_unused_result(message="http://git.io/rxs.uo")
54 | public func asObservable() -> Observable {
55 | return Observable.create(self.subscribe)
56 | }
57 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/AddRef.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AddRef.swift
3 | // Rx
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) {
15 | super.init(observer: observer)
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) -> Disposable {
41 | let releaseDisposable = _refCount.retain()
42 | let sink = AddRefSink(observer: observer)
43 | sink.disposable = StableCompositeDisposable.create(releaseDisposable, _source.subscribeSafe(sink))
44 |
45 | return sink
46 | }
47 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AnonymousObservable.swift
3 | // Rx
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) {
19 | super.init(observer: observer)
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: SubscribeHandler) {
48 | _subscribeHandler = subscribeHandler
49 | }
50 |
51 | override func run(observer: O) -> Disposable {
52 | let sink = AnonymousObservableSink(observer: observer)
53 | sink.disposable = sink.run(self)
54 | return sink
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Concat.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Concat.swift
3 | // Rx
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 {
15 | typealias Element = O.E
16 |
17 | override init(observer: O) {
18 | super.init(observer: observer)
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.generate(), source._count)
40 | }
41 | else {
42 | return nil
43 | }
44 | }
45 | }
46 |
47 | class Concat : Producer {
48 | typealias Element = S.Generator.Element.E
49 |
50 | private let _sources: S
51 | private let _count: IntMax?
52 |
53 | init(sources: S, count: IntMax?) {
54 | _sources = sources
55 | _count = count
56 | }
57 |
58 | override func run(observer: O) -> Disposable {
59 | let sink = ConcatSink(observer: observer)
60 | sink.disposable = sink.run((_sources.generate(), _count))
61 | return sink
62 | }
63 | }
--------------------------------------------------------------------------------
/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 {
12 | typealias E = O.E
13 |
14 | private let _observableFactory: () throws -> S
15 |
16 | init(observableFactory: () throws -> S, observer: O) {
17 | _observableFactory = observableFactory
18 | super.init(observer: observer)
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 NopDisposable.instance
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: Factory) {
53 | _observableFactory = observableFactory
54 | }
55 |
56 | override func run(observer: O) -> Disposable {
57 | let sink = DeferredSink(observableFactory: _observableFactory, observer: observer)
58 | sink.disposable = sink.run()
59 | return sink
60 | }
61 | }
--------------------------------------------------------------------------------
/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 {
14 | typealias Parent = DelaySubscription
15 | typealias E = O.E
16 |
17 | private let _parent: Parent
18 |
19 | init(parent: Parent, observer: O) {
20 | _parent = parent
21 | super.init(observer: observer)
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) -> Disposable {
45 | let sink = DelaySubscriptionSink(parent: self, observer: observer)
46 | sink.disposable = _scheduler.scheduleRelative((), dueTime: _dueTime) { _ in
47 | return self._source.subscribe(sink)
48 | }
49 |
50 | return sink
51 | }
52 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/DistinctUntilChanged.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DistinctUntilChanged.swift
3 | // Rx
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 | class DistinctUntilChangedSink: Sink, ObserverType {
12 | typealias E = O.E
13 |
14 | private let _parent: DistinctUntilChanged
15 | private var _currentKey: Key? = nil
16 |
17 | init(parent: DistinctUntilChanged, observer: O) {
18 | _parent = parent
19 | super.init(observer: observer)
20 | }
21 |
22 | func on(event: Event) {
23 | switch event {
24 | case .Next(let value):
25 | do {
26 | let key = try _parent._selector(value)
27 | var areEqual = false
28 | if let currentKey = _currentKey {
29 | areEqual = try _parent._comparer(currentKey, key)
30 | }
31 |
32 | if areEqual {
33 | return
34 | }
35 |
36 | _currentKey = key
37 |
38 | forwardOn(event)
39 | }
40 | catch let error {
41 | forwardOn(.Error(error))
42 | dispose()
43 | }
44 | case .Error, .Completed:
45 | forwardOn(event)
46 | dispose()
47 | }
48 | }
49 | }
50 |
51 | class DistinctUntilChanged: Producer {
52 | typealias KeySelector = (Element) throws -> Key
53 | typealias EqualityComparer = (Key, Key) throws -> Bool
54 |
55 | private let _source: Observable
56 | private let _selector: KeySelector
57 | private let _comparer: EqualityComparer
58 |
59 | init(source: Observable, selector: KeySelector, comparer: EqualityComparer) {
60 | _source = source
61 | _selector = selector
62 | _comparer = comparer
63 | }
64 |
65 | override func run(observer: O) -> Disposable {
66 | let sink = DistinctUntilChangedSink(parent: self, observer: observer)
67 | sink.disposable = _source.subscribe(sink)
68 | return sink
69 | }
70 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Do.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Do.swift
3 | // Rx
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) {
18 | _parent = parent
19 | super.init(observer: observer)
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 | private let _source: Observable
41 | private let _eventHandler: EventHandler
42 |
43 | init(source: Observable, eventHandler: EventHandler) {
44 | _source = source
45 | _eventHandler = eventHandler
46 | }
47 |
48 | override func run(observer: O) -> Disposable {
49 | let sink = DoSink(parent: self, observer: observer)
50 | sink.disposable = _source.subscribe(sink)
51 | return sink
52 | }
53 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/ElementAt.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ElementAt.swift
3 | // Rx
4 | //
5 | // Created by Junior B. on 21/10/15.
6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 |
12 | class ElementAtSink : Sink, ObserverType {
13 | typealias Parent = ElementAt
14 |
15 | let _parent: Parent
16 | var _i: Int
17 |
18 | init(parent: Parent, observer: O) {
19 | _parent = parent
20 | _i = parent._index
21 |
22 | super.init(observer: observer)
23 | }
24 |
25 | func on(event: Event) {
26 | switch event {
27 | case .Next(_):
28 |
29 | if (_i == 0) {
30 | forwardOn(event)
31 | forwardOn(.Completed)
32 | self.dispose()
33 | }
34 |
35 | do {
36 | try decrementChecked(&_i)
37 | } catch(let e) {
38 | forwardOn(.Error(e))
39 | dispose()
40 | return
41 | }
42 |
43 | case .Error(let e):
44 | forwardOn(.Error(e))
45 | self.dispose()
46 | case .Completed:
47 | if (_parent._throwOnEmpty) {
48 | forwardOn(.Error(RxError.ArgumentOutOfRange))
49 | } else {
50 | forwardOn(.Completed)
51 | }
52 |
53 | self.dispose()
54 | }
55 | }
56 | }
57 |
58 | class ElementAt : Producer {
59 |
60 | let _source: Observable
61 | let _throwOnEmpty: Bool
62 | let _index: Int
63 |
64 | init(source: Observable, index: Int, throwOnEmpty: Bool) {
65 | if index < 0 {
66 | rxFatalError("index can't be negative")
67 | }
68 |
69 | self._source = source
70 | self._index = index
71 | self._throwOnEmpty = throwOnEmpty
72 | }
73 |
74 | override func run(observer: O) -> Disposable {
75 | let sink = ElementAtSink(parent: self, observer: observer)
76 | sink.disposable = _source.subscribeSafe(sink)
77 | return sink
78 | }
79 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Empty.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Empty.swift
3 | // Rx
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 {
13 | observer.on(.Completed)
14 | return NopDisposable.instance
15 | }
16 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Error.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Error.swift
3 | // Rx
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: ErrorType
13 |
14 | init(error: ErrorType) {
15 | _error = error
16 | }
17 |
18 | override func subscribe(observer: O) -> Disposable {
19 | observer.on(.Error(_error))
20 | return NopDisposable.instance
21 | }
22 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Filter.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Filter.swift
3 | // Rx
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 | typealias Parent = Filter
16 |
17 | private let _predicate: Predicate
18 |
19 | init(predicate: Predicate, observer: O) {
20 | _predicate = predicate
21 | super.init(observer: observer)
22 | }
23 |
24 | func on(event: Event) {
25 | switch event {
26 | case .Next(let value):
27 | do {
28 | let satisfies = try _predicate(value)
29 | if satisfies {
30 | forwardOn(.Next(value))
31 | }
32 | }
33 | catch let e {
34 | forwardOn(.Error(e))
35 | dispose()
36 | }
37 | case .Completed, .Error:
38 | forwardOn(event)
39 | dispose()
40 | }
41 | }
42 | }
43 |
44 | class Filter : Producer {
45 | typealias Predicate = (Element) throws -> Bool
46 |
47 | private let _source: Observable
48 | private let _predicate: Predicate
49 |
50 | init(source: Observable, predicate: Predicate) {
51 | _source = source
52 | _predicate = predicate
53 | }
54 |
55 | override func run(observer: O) -> Disposable {
56 | let sink = FilterSink(predicate: _predicate, observer: observer)
57 | sink.disposable = _source.subscribe(sink)
58 | return sink
59 | }
60 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Just.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Just.swift
3 | // Rx
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) {
17 | _parent = parent
18 | super.init(observer: observer)
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 NopDisposable.instance
28 | }
29 | }
30 | }
31 | }
32 |
33 | class JustScheduled : Producer {
34 | private let _scheduler: ImmediateSchedulerType
35 | private let _element: Element
36 |
37 | init(element: Element, scheduler: ImmediateSchedulerType) {
38 | _scheduler = scheduler
39 | _element = element
40 | }
41 |
42 | override func subscribe(observer: O) -> Disposable {
43 | let sink = JustScheduledSink(parent: self, observer: observer)
44 | sink.disposable = sink.run()
45 | return sink
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 {
57 | observer.on(.Next(_element))
58 | observer.on(.Completed)
59 | return NopDisposable.instance
60 | }
61 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Never.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Never.swift
3 | // Rx
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 {
13 | return NopDisposable.instance
14 | }
15 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Producer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Producer.swift
3 | // Rx
4 | //
5 | // Created by Krunoslav Zaher on 2/20/15.
6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | class Producer : Observable {
12 | override init() {
13 | super.init()
14 | }
15 |
16 | override func subscribe(observer: O) -> Disposable {
17 | if !CurrentThreadScheduler.isScheduleRequired {
18 | return run(observer)
19 | }
20 | else {
21 | return CurrentThreadScheduler.instance.schedule(()) { _ in
22 | return self.run(observer)
23 | }
24 | }
25 | }
26 |
27 | func run(observer: O) -> Disposable {
28 | abstractMethod()
29 | }
30 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Range.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Range.swift
3 | // Rx
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 | private let _start: E
13 | private let _count: E
14 | private 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) -> Disposable {
31 | let sink = RangeSink(parent: self, observer: observer)
32 | sink.disposable = sink.run()
33 | return sink
34 | }
35 | }
36 |
37 | class RangeSink : Sink {
38 | typealias Parent = RangeProducer
39 |
40 | private let _parent: Parent
41 |
42 | init(parent: Parent, observer: O) {
43 | _parent = parent
44 | super.init(observer: observer)
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 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Repeat.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Repeat.swift
3 | // RxExample
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 | private let _element: Element
13 | private let _scheduler: ImmediateSchedulerType
14 |
15 | init(element: Element, scheduler: ImmediateSchedulerType) {
16 | _element = element
17 | _scheduler = scheduler
18 | }
19 |
20 | override func run(observer: O) -> Disposable {
21 | let sink = RepeatElementSink(parent: self, observer: observer)
22 | sink.disposable = sink.run()
23 |
24 | return sink
25 | }
26 | }
27 |
28 | class RepeatElementSink : Sink {
29 | typealias Parent = RepeatElement
30 |
31 | private let _parent: Parent
32 |
33 | init(parent: Parent, observer: O) {
34 | _parent = parent
35 | super.init(observer: observer)
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 | }
--------------------------------------------------------------------------------
/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 {
12 | typealias Parent = Scan
13 | typealias E = ElementType
14 |
15 | private let _parent: Parent
16 | private var _accumulate: Accumulate
17 |
18 | init(parent: Parent, observer: O) {
19 | _parent = parent
20 | _accumulate = parent._seed
21 | super.init(observer: observer)
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 | private let _source: Observable
50 | private let _seed: Accumulate
51 | private let _accumulator: Accumulator
52 |
53 | init(source: Observable, seed: Accumulate, accumulator: Accumulator) {
54 | _source = source
55 | _seed = seed
56 | _accumulator = accumulator
57 | }
58 |
59 | override func run(observer: O) -> Disposable {
60 | let sink = ScanSink(parent: self, observer: observer)
61 | sink.disposable = _source.subscribe(sink)
62 | return sink
63 | }
64 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Sequence.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Sequence.swift
3 | // Rx
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 SequenceSink : Sink {
12 | typealias Parent = Sequence
13 |
14 | private let _parent: Parent
15 |
16 | init(parent: Parent, observer: O) {
17 | _parent = parent
18 | super.init(observer: observer)
19 | }
20 |
21 | func run() -> Disposable {
22 | return _parent._scheduler!.scheduleRecursive((0, _parent._elements)) { (state, recurse) in
23 | if state.0 < state.1.count {
24 | self.forwardOn(.Next(state.1[state.0]))
25 | recurse((state.0 + 1, state.1))
26 | }
27 | else {
28 | self.forwardOn(.Completed)
29 | }
30 | }
31 | }
32 | }
33 |
34 | class Sequence : Producer {
35 | private let _elements: [E]
36 | private let _scheduler: ImmediateSchedulerType?
37 |
38 | init(elements: [E], scheduler: ImmediateSchedulerType?) {
39 | _elements = elements
40 | _scheduler = scheduler
41 | }
42 |
43 | override func subscribe(observer: O) -> Disposable {
44 | // optimized version without scheduler
45 | guard _scheduler != nil else {
46 | for element in _elements {
47 | observer.on(.Next(element))
48 | }
49 |
50 | observer.on(.Completed)
51 | return NopDisposable.instance
52 | }
53 |
54 | let sink = SequenceSink(parent: self, observer: observer)
55 | sink.disposable = sink.run()
56 | return sink
57 | }
58 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Sink.swift
3 | // Rx
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 : SingleAssignmentDisposable {
12 | private let _observer: O
13 |
14 | init(observer: O) {
15 | #if TRACE_RESOURCES
16 | AtomicIncrement(&resourceCount)
17 | #endif
18 | _observer = observer
19 | }
20 |
21 | final func forwardOn(event: Event) {
22 | if disposed {
23 | return
24 | }
25 | _observer.on(event)
26 | }
27 |
28 | final func forwarder() -> SinkForward {
29 | return SinkForward(forward: self)
30 | }
31 |
32 | deinit {
33 | #if TRACE_RESOURCES
34 | AtomicDecrement(&resourceCount)
35 | #endif
36 | }
37 | }
38 |
39 | class SinkForward: ObserverType {
40 | typealias E = O.E
41 |
42 | private let _forward: Sink
43 |
44 | init(forward: Sink) {
45 | _forward = forward
46 | }
47 |
48 | func on(event: Event) {
49 | switch event {
50 | case .Next:
51 | _forward._observer.on(event)
52 | case .Error, .Completed:
53 | _forward._observer.on(event)
54 | _forward.dispose()
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/StartWith.swift:
--------------------------------------------------------------------------------
1 | //
2 | // StartWith.swift
3 | // RxCocoa
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) -> Disposable {
22 | for e in elements {
23 | observer.on(.Next(e))
24 | }
25 |
26 | return 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 {
12 | typealias Element = O.E
13 | typealias Parent = SubscribeOn
14 |
15 | let parent: Parent
16 |
17 | init(parent: Parent, observer: O) {
18 | self.parent = parent
19 | super.init(observer: observer)
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 | cancelSchedule.disposable = 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 NopDisposable.instance
40 | }
41 |
42 | return disposeEverything
43 | }
44 | }
45 |
46 | class SubscribeOn : Producer {
47 | let source: Ob
48 | let scheduler: ImmediateSchedulerType
49 |
50 | init(source: Ob, scheduler: ImmediateSchedulerType) {
51 | self.source = source
52 | self.scheduler = scheduler
53 | }
54 |
55 | override func run(observer: O) -> Disposable {
56 | let sink = SubscribeOnSink(parent: self, observer: observer)
57 | sink.disposable = sink.run()
58 | return sink
59 | }
60 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/TakeLast.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TakeLast.swift
3 | // Rx
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 {
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) {
21 | _parent = parent
22 | _elements = Queue(capacity: parent._count + 1)
23 | super.init(observer: observer)
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 | _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 | private let _source: Observable
48 | private 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) -> Disposable {
59 | let sink = TakeLastSink(parent: self, observer: observer)
60 | sink.disposable = _source.subscribe(sink)
61 | return sink
62 | }
63 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/Timer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Timer.swift
3 | // RxSwift
4 | //
5 | // Created by Krunoslav Zaher on 6/7/15.
6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | class TimerSink : Sink {
12 | typealias Parent = Timer
13 |
14 | private let _parent: Parent
15 |
16 | init(parent: Parent, observer: O) {
17 | _parent = parent
18 | super.init(observer: observer)
19 | }
20 |
21 | func run() -> Disposable {
22 | return _parent._scheduler.schedulePeriodic(0 as O.E, startAfter: _parent._dueTime, period: _parent._period!) { state in
23 | self.forwardOn(.Next(state))
24 | return state &+ 1
25 | }
26 | }
27 | }
28 |
29 | class TimerOneOffSink : Sink {
30 | typealias Parent = Timer
31 |
32 | private let _parent: Parent
33 |
34 | init(parent: Parent, observer: O) {
35 | _parent = parent
36 | super.init(observer: observer)
37 | }
38 |
39 | func run() -> Disposable {
40 | return _parent._scheduler.scheduleRelative((), dueTime: _parent._dueTime) { (_) -> Disposable in
41 | self.forwardOn(.Next(0))
42 | self.forwardOn(.Completed)
43 |
44 | return NopDisposable.instance
45 | }
46 | }
47 | }
48 |
49 | class Timer: Producer {
50 | private let _scheduler: SchedulerType
51 | private let _dueTime: RxTimeInterval
52 | private let _period: RxTimeInterval?
53 |
54 | init(dueTime: RxTimeInterval, period: RxTimeInterval?, scheduler: SchedulerType) {
55 | _scheduler = scheduler
56 | _dueTime = dueTime
57 | _period = period
58 | }
59 |
60 | override func run(observer: O) -> Disposable {
61 | if let _ = _period {
62 | let sink = TimerSink(parent: self, observer: observer)
63 | sink.disposable = sink.run()
64 | return sink
65 | }
66 | else {
67 | let sink = TimerOneOffSink(parent: self, observer: observer)
68 | sink.disposable = sink.run()
69 | return sink
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observables/Implementations/ToArray.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ToArray.swift
3 | // Rx
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 {
12 | typealias Parent = ToArray
13 |
14 | let _parent: Parent
15 | var _list = Array()
16 |
17 | init(parent: Parent, observer: O) {
18 | _parent = parent
19 |
20 | super.init(observer: observer)
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) -> Disposable {
46 | let sink = ToArraySink(parent: self, observer: observer)
47 | sink.disposable = _source.subscribe(sink)
48 | return sink
49 | }
50 | }
--------------------------------------------------------------------------------
/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 | - returns: An observable sequence whose events are printed to standard output.
22 | */
23 | @warn_unused_result(message="http://git.io/rxs.uo")
24 | public func debug(identifier: String? = nil, file: String = __FILE__, line: UInt = __LINE__, function: String = __FUNCTION__)
25 | -> Observable {
26 | return Debug(source: self.asObservable(), identifier: identifier, file: file, line: line, function: function)
27 | }
28 | }
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/ObserverType.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ObserverType.swift
3 | // Rx
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 | /**
12 | Supports push-style iteration over an observable sequence.
13 | */
14 | public protocol ObserverType {
15 | /**
16 | The type of elements in sequence that observer can observe.
17 | */
18 | typealias E
19 |
20 | /**
21 | Notify observer about sequence event.
22 |
23 | - parameter event: Event that occured.
24 | */
25 | func on(event: Event)
26 | }
27 |
28 | /**
29 | Convenience API extensions to provide alternate next, error, completed events
30 | */
31 | public extension ObserverType {
32 |
33 | /**
34 | Convenience method equivalent to `on(.Next(element: E))`
35 |
36 | - parameter element: Next element to send to observer(s)
37 | */
38 | final func onNext(element: E) {
39 | on(.Next(element))
40 | }
41 |
42 | /**
43 | Convenience method equivalent to `on(.Completed)`
44 | */
45 | final func onCompleted() {
46 | on(.Completed)
47 | }
48 |
49 | /**
50 | Convenience method equivalent to `on(.Error(error: ErrorType))`
51 | - parameter error: ErrorType to send to observer(s)
52 | */
53 | final func onError(error: ErrorType) {
54 | on(.Error(error))
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AnonymousObserver.swift
3 | // Rx
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: EventHandler) {
19 | #if TRACE_RESOURCES
20 | AtomicIncrement(&resourceCount)
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 | AtomicDecrement(&resourceCount)
32 | }
33 | #endif
34 | }
35 |
--------------------------------------------------------------------------------
/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ObserverBase.swift
3 | // Rx
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