├── Podfile ├── Podfile.lock ├── Pods ├── Anchorage │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── AnchorGroupProvider.swift │ │ ├── Anchorage.swift │ │ ├── Compatability.swift │ │ ├── Internal.swift │ │ ├── NSLayoutAnchor+MultiplierConstraints.swift │ │ └── Priority.swift ├── Local Podspecs │ └── RIBs.podspec.json ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── stanislavostrovskiy.xcuserdatad │ │ └── xcschemes │ │ ├── Anchorage.xcscheme │ │ ├── Pods-RIBsTutorial.xcscheme │ │ ├── Pods-RIBsTutorialTests.xcscheme │ │ ├── RIBs.xcscheme │ │ ├── RxRelay.xcscheme │ │ ├── RxSwift.xcscheme │ │ └── xcschememanagement.plist ├── RIBs │ ├── LICENSE.txt │ ├── README.md │ └── ios │ │ └── RIBs │ │ └── Classes │ │ ├── Builder.swift │ │ ├── ComponentizedBuilder.swift │ │ ├── DI │ │ ├── Component.swift │ │ └── Dependency.swift │ │ ├── Extensions │ │ └── Foundation+Extensions.swift │ │ ├── Interactor.swift │ │ ├── LaunchRouter.swift │ │ ├── LeakDetector │ │ ├── Executor.swift │ │ └── LeakDetector.swift │ │ ├── MultiStageComponentizedBuilder.swift │ │ ├── PresentableInteractor.swift │ │ ├── Presenter.swift │ │ ├── Router.swift │ │ ├── ViewControllable.swift │ │ ├── ViewableRouter.swift │ │ ├── Worker │ │ └── Worker.swift │ │ └── Workflow │ │ └── Workflow.swift ├── RxRelay │ ├── LICENSE.md │ ├── README.md │ └── RxRelay │ │ ├── BehaviorRelay.swift │ │ ├── Observable+Bind.swift │ │ ├── PublishRelay.swift │ │ └── Utils.swift ├── RxSwift │ ├── LICENSE.md │ ├── Platform │ │ ├── AtomicInt.swift │ │ ├── DataStructures │ │ │ ├── Bag.swift │ │ │ ├── InfiniteSequence.swift │ │ │ ├── PriorityQueue.swift │ │ │ └── Queue.swift │ │ ├── DispatchQueue+Extensions.swift │ │ ├── Platform.Darwin.swift │ │ ├── Platform.Linux.swift │ │ └── RecursiveLock.swift │ ├── README.md │ └── RxSwift │ │ ├── AnyObserver.swift │ │ ├── Cancelable.swift │ │ ├── Concurrency │ │ ├── AsyncLock.swift │ │ ├── Lock.swift │ │ ├── LockOwnerType.swift │ │ ├── SynchronizedDisposeType.swift │ │ ├── SynchronizedOnType.swift │ │ └── SynchronizedUnsubscribeType.swift │ │ ├── ConnectableObservableType.swift │ │ ├── Date+Dispatch.swift │ │ ├── Deprecated.swift │ │ ├── Disposable.swift │ │ ├── Disposables │ │ ├── AnonymousDisposable.swift │ │ ├── BinaryDisposable.swift │ │ ├── BooleanDisposable.swift │ │ ├── CompositeDisposable.swift │ │ ├── Disposables.swift │ │ ├── DisposeBag.swift │ │ ├── DisposeBase.swift │ │ ├── NopDisposable.swift │ │ ├── RefCountDisposable.swift │ │ ├── ScheduledDisposable.swift │ │ ├── SerialDisposable.swift │ │ ├── SingleAssignmentDisposable.swift │ │ └── SubscriptionDisposable.swift │ │ ├── Errors.swift │ │ ├── Event.swift │ │ ├── Extensions │ │ └── Bag+Rx.swift │ │ ├── GroupedObservable.swift │ │ ├── ImmediateSchedulerType.swift │ │ ├── Observable.swift │ │ ├── ObservableConvertibleType.swift │ │ ├── ObservableType+Extensions.swift │ │ ├── ObservableType.swift │ │ ├── Observables │ │ ├── AddRef.swift │ │ ├── Amb.swift │ │ ├── AsMaybe.swift │ │ ├── AsSingle.swift │ │ ├── Buffer.swift │ │ ├── Catch.swift │ │ ├── CombineLatest+Collection.swift │ │ ├── CombineLatest+arity.swift │ │ ├── CombineLatest.swift │ │ ├── CompactMap.swift │ │ ├── Concat.swift │ │ ├── Create.swift │ │ ├── Debounce.swift │ │ ├── Debug.swift │ │ ├── DefaultIfEmpty.swift │ │ ├── Deferred.swift │ │ ├── Delay.swift │ │ ├── DelaySubscription.swift │ │ ├── Dematerialize.swift │ │ ├── DistinctUntilChanged.swift │ │ ├── Do.swift │ │ ├── ElementAt.swift │ │ ├── Empty.swift │ │ ├── Enumerated.swift │ │ ├── Error.swift │ │ ├── Filter.swift │ │ ├── First.swift │ │ ├── Generate.swift │ │ ├── GroupBy.swift │ │ ├── Just.swift │ │ ├── Map.swift │ │ ├── Materialize.swift │ │ ├── Merge.swift │ │ ├── Multicast.swift │ │ ├── Never.swift │ │ ├── ObserveOn.swift │ │ ├── Optional.swift │ │ ├── Producer.swift │ │ ├── Range.swift │ │ ├── Reduce.swift │ │ ├── Repeat.swift │ │ ├── RetryWhen.swift │ │ ├── Sample.swift │ │ ├── Scan.swift │ │ ├── Sequence.swift │ │ ├── ShareReplayScope.swift │ │ ├── SingleAsync.swift │ │ ├── Sink.swift │ │ ├── Skip.swift │ │ ├── SkipUntil.swift │ │ ├── SkipWhile.swift │ │ ├── StartWith.swift │ │ ├── SubscribeOn.swift │ │ ├── Switch.swift │ │ ├── SwitchIfEmpty.swift │ │ ├── Take.swift │ │ ├── TakeLast.swift │ │ ├── TakeUntil.swift │ │ ├── TakeWhile.swift │ │ ├── Throttle.swift │ │ ├── Timeout.swift │ │ ├── Timer.swift │ │ ├── ToArray.swift │ │ ├── Using.swift │ │ ├── Window.swift │ │ ├── WithLatestFrom.swift │ │ ├── Zip+Collection.swift │ │ ├── Zip+arity.swift │ │ └── Zip.swift │ │ ├── ObserverType.swift │ │ ├── Observers │ │ ├── AnonymousObserver.swift │ │ ├── ObserverBase.swift │ │ └── TailRecursiveSink.swift │ │ ├── Reactive.swift │ │ ├── Rx.swift │ │ ├── RxMutableBox.swift │ │ ├── SchedulerType.swift │ │ ├── Schedulers │ │ ├── ConcurrentDispatchQueueScheduler.swift │ │ ├── ConcurrentMainScheduler.swift │ │ ├── CurrentThreadScheduler.swift │ │ ├── HistoricalScheduler.swift │ │ ├── HistoricalSchedulerTimeConverter.swift │ │ ├── Internal │ │ │ ├── DispatchQueueConfiguration.swift │ │ │ ├── InvocableScheduledItem.swift │ │ │ ├── InvocableType.swift │ │ │ ├── ScheduledItem.swift │ │ │ └── ScheduledItemType.swift │ │ ├── MainScheduler.swift │ │ ├── OperationQueueScheduler.swift │ │ ├── RecursiveScheduler.swift │ │ ├── SchedulerServices+Emulation.swift │ │ ├── SerialDispatchQueueScheduler.swift │ │ ├── VirtualTimeConverterType.swift │ │ └── VirtualTimeScheduler.swift │ │ ├── Subjects │ │ ├── AsyncSubject.swift │ │ ├── BehaviorSubject.swift │ │ ├── PublishSubject.swift │ │ ├── ReplaySubject.swift │ │ └── SubjectType.swift │ │ ├── SwiftSupport │ │ └── SwiftSupport.swift │ │ └── Traits │ │ ├── Completable+AndThen.swift │ │ ├── Completable.swift │ │ ├── Maybe.swift │ │ ├── ObservableType+PrimitiveSequence.swift │ │ ├── PrimitiveSequence+Zip+arity.swift │ │ ├── PrimitiveSequence.swift │ │ └── Single.swift └── Target Support Files │ ├── Anchorage │ ├── Anchorage-Info.plist │ ├── Anchorage-dummy.m │ ├── Anchorage-prefix.pch │ ├── Anchorage-umbrella.h │ ├── Anchorage.debug.xcconfig │ ├── Anchorage.modulemap │ └── Anchorage.release.xcconfig │ ├── Pods-RIBsTutorial │ ├── Pods-RIBsTutorial-Info.plist │ ├── Pods-RIBsTutorial-acknowledgements.markdown │ ├── Pods-RIBsTutorial-acknowledgements.plist │ ├── Pods-RIBsTutorial-dummy.m │ ├── Pods-RIBsTutorial-frameworks-Debug-input-files.xcfilelist │ ├── Pods-RIBsTutorial-frameworks-Debug-output-files.xcfilelist │ ├── Pods-RIBsTutorial-frameworks-Release-input-files.xcfilelist │ ├── Pods-RIBsTutorial-frameworks-Release-output-files.xcfilelist │ ├── Pods-RIBsTutorial-frameworks.sh │ ├── Pods-RIBsTutorial-umbrella.h │ ├── Pods-RIBsTutorial.debug.xcconfig │ ├── Pods-RIBsTutorial.modulemap │ └── Pods-RIBsTutorial.release.xcconfig │ ├── Pods-RIBsTutorialTests │ ├── Pods-RIBsTutorialTests-Info.plist │ ├── Pods-RIBsTutorialTests-acknowledgements.markdown │ ├── Pods-RIBsTutorialTests-acknowledgements.plist │ ├── Pods-RIBsTutorialTests-dummy.m │ ├── Pods-RIBsTutorialTests-umbrella.h │ ├── Pods-RIBsTutorialTests.debug.xcconfig │ ├── Pods-RIBsTutorialTests.modulemap │ └── Pods-RIBsTutorialTests.release.xcconfig │ ├── RIBs │ ├── RIBs-Info.plist │ ├── RIBs-dummy.m │ ├── RIBs-prefix.pch │ ├── RIBs-umbrella.h │ ├── RIBs.debug.xcconfig │ ├── RIBs.modulemap │ └── RIBs.release.xcconfig │ ├── RxRelay │ ├── RxRelay-Info.plist │ ├── RxRelay-dummy.m │ ├── RxRelay-prefix.pch │ ├── RxRelay-umbrella.h │ ├── RxRelay.debug.xcconfig │ ├── RxRelay.modulemap │ └── RxRelay.release.xcconfig │ └── RxSwift │ ├── RxSwift-Info.plist │ ├── RxSwift-dummy.m │ ├── RxSwift-prefix.pch │ ├── RxSwift-umbrella.h │ ├── RxSwift.debug.xcconfig │ ├── RxSwift.modulemap │ └── RxSwift.release.xcconfig ├── RIBsTutorial.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── stanislavostrovskiy.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── RIBsTutorial.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── stanislavostrovskiy.xcuserdatad │ ├── IDEFindNavigatorScopes.plist │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist ├── RIBsTutorial ├── AppStart │ ├── AppComponent.swift │ └── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── CreateAccount │ ├── CreateAccountBuilder.swift │ ├── CreateAccountInteractor.swift │ ├── CreateAccountRouter.swift │ └── CreateAccountViewController.swift ├── Home │ ├── HomeBuilder.swift │ ├── HomeInteractor.swift │ ├── HomeRouter.swift │ └── HomeViewController.swift ├── Info.plist ├── Login │ ├── LoginBuilder.swift │ ├── LoginInteractor.swift │ ├── LoginRouter.swift │ └── LoginViewController.swift ├── Root │ ├── RootBuilder.swift │ ├── RootInteractor.swift │ ├── RootRouter.swift │ └── RootViewController.swift └── WebService.swift └── RIBsTutorialTests └── Info.plist /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '11.0' 2 | 3 | target 'RIBsTutorial' do 4 | use_frameworks! 5 | 6 | # Pods for RIBsTutorial 7 | 8 | pod 'Anchorage' 9 | pod 'RIBs', git: 'https://github.com/Stan-Ost/RIBs', branch: 'master', submodules: true 10 | 11 | 12 | target 'RIBsTutorialTests' do 13 | inherit! :search_paths 14 | # Pods for testing 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Anchorage (4.4.0) 3 | - RIBs (0.9.3): 4 | - RxRelay (~> 5.0) 5 | - RxSwift (~> 5.0) 6 | - RxRelay (5.1.1): 7 | - RxSwift (~> 5) 8 | - RxSwift (5.1.1) 9 | 10 | DEPENDENCIES: 11 | - Anchorage 12 | - RIBs (from `https://github.com/Stan-Ost/RIBs`, branch `master`) 13 | 14 | SPEC REPOS: 15 | trunk: 16 | - Anchorage 17 | - RxRelay 18 | - RxSwift 19 | 20 | EXTERNAL SOURCES: 21 | RIBs: 22 | :branch: master 23 | :git: https://github.com/Stan-Ost/RIBs 24 | :submodules: true 25 | 26 | CHECKOUT OPTIONS: 27 | RIBs: 28 | :commit: 6ab41722da34f61a61a898d7cb0dc3035b4606db 29 | :git: https://github.com/Stan-Ost/RIBs 30 | :submodules: true 31 | 32 | SPEC CHECKSUMS: 33 | Anchorage: d7f02c4f9425b537053237aab11ae97e59b55f36 34 | RIBs: efceda5df20c1a1e05139232a4638a6242caa92a 35 | RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9 36 | RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178 37 | 38 | PODFILE CHECKSUM: 64266cad7f45b06ead0ed02f5cfbd6829e35a5dd 39 | 40 | COCOAPODS: 1.9.1 41 | -------------------------------------------------------------------------------- /Pods/Anchorage/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Rightpoint 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 | -------------------------------------------------------------------------------- /Pods/Local Podspecs/RIBs.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RIBs", 3 | "version": "0.9.3", 4 | "summary": "Uber's cross-platform mobile architecture.", 5 | "description": "RIBs is the cross-platform architecture behind many mobile apps at Uber. This architecture framework is designed for mobile apps with a large number of engineers and nested states.", 6 | "homepage": "https://github.com/uber/RIBs", 7 | "license": { 8 | "type": "Apache License, Version 2.0", 9 | "file": "LICENSE.txt" 10 | }, 11 | "authors": { 12 | "uber": "mobile-open-source@uber.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/uber/RIBs.git", 16 | "tag": "v0.9.3" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "ios/RIBs/Classes/**/*", 22 | "dependencies": { 23 | "RxSwift": [ 24 | "~> 5.0" 25 | ], 26 | "RxRelay": [ 27 | "~> 5.0" 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Anchorage (4.4.0) 3 | - RIBs (0.9.3): 4 | - RxRelay (~> 5.0) 5 | - RxSwift (~> 5.0) 6 | - RxRelay (5.1.1): 7 | - RxSwift (~> 5) 8 | - RxSwift (5.1.1) 9 | 10 | DEPENDENCIES: 11 | - Anchorage 12 | - RIBs (from `https://github.com/Stan-Ost/RIBs`, branch `master`) 13 | 14 | SPEC REPOS: 15 | trunk: 16 | - Anchorage 17 | - RxRelay 18 | - RxSwift 19 | 20 | EXTERNAL SOURCES: 21 | RIBs: 22 | :branch: master 23 | :git: https://github.com/Stan-Ost/RIBs 24 | :submodules: true 25 | 26 | CHECKOUT OPTIONS: 27 | RIBs: 28 | :commit: 6ab41722da34f61a61a898d7cb0dc3035b4606db 29 | :git: https://github.com/Stan-Ost/RIBs 30 | :submodules: true 31 | 32 | SPEC CHECKSUMS: 33 | Anchorage: d7f02c4f9425b537053237aab11ae97e59b55f36 34 | RIBs: efceda5df20c1a1e05139232a4638a6242caa92a 35 | RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9 36 | RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178 37 | 38 | PODFILE CHECKSUM: 64266cad7f45b06ead0ed02f5cfbd6829e35a5dd 39 | 40 | COCOAPODS: 1.9.1 41 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/Anchorage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/Pods-RIBsTutorial.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/Pods-RIBsTutorialTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/RIBs.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/RxRelay.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/RxSwift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Anchorage.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | Pods-RIBsTutorial.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | Pods-RIBsTutorialTests.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 2 27 | 28 | RIBs.xcscheme 29 | 30 | isShown 31 | 32 | orderHint 33 | 3 34 | 35 | RxRelay.xcscheme 36 | 37 | isShown 38 | 39 | orderHint 40 | 4 41 | 42 | RxSwift.xcscheme 43 | 44 | isShown 45 | 46 | orderHint 47 | 5 48 | 49 | 50 | SuppressBuildableAutocreation 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/Builder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | /// The base builder protocol that all builders should conform to. 20 | public protocol Buildable: class {} 21 | 22 | /// Utility that instantiates a RIB and sets up its internal wirings. 23 | open class Builder: Buildable { 24 | 25 | /// The dependency used for this builder to build the RIB. 26 | public let dependency: DependencyType 27 | 28 | /// Initializer. 29 | /// 30 | /// - parameter dependency: The dependency used for this builder to build the RIB. 31 | public init(dependency: DependencyType) { 32 | self.dependency = dependency 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/DI/Component.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | /// The base class for all components. 18 | /// 19 | /// A component defines private properties a RIB provides to its internal `Router`, `Interactor`, `Presenter` and 20 | /// view units, as well as public properties to its child RIBs. 21 | /// 22 | /// A component subclass implementation should conform to child 'Dependency' protocols, defined by all of its immediate 23 | /// children. 24 | open class Component: Dependency { 25 | 26 | /// The dependency of this `Component`. 27 | public let dependency: DependencyType 28 | 29 | /// Initializer. 30 | /// 31 | /// - parameter dependency: The dependency of this `Component`, usually provided by the parent `Component`. 32 | public init(dependency: DependencyType) { 33 | self.dependency = dependency 34 | } 35 | 36 | /// Used to create a shared dependency in your `Component` sub-class. Shared dependencies are retained and reused 37 | /// by the component. Each dependent asking for this dependency will receive the same instance while the component 38 | /// is alive. 39 | /// 40 | /// - note: Any shared dependency's constructor may not switch threads as this might cause a deadlock. 41 | /// 42 | /// - parameter factory: The closure to construct the dependency. 43 | /// - returns: The instance. 44 | public final func shared(__function: String = #function, _ factory: () -> T) -> T { 45 | lock.lock() 46 | defer { 47 | lock.unlock() 48 | } 49 | 50 | // Additional nil coalescing is needed to mitigate a Swift bug appearing in Xcode 10. 51 | // see https://bugs.swift.org/browse/SR-8704. 52 | // Without this measure, calling `shared` from a function that returns an optional type 53 | // will always pass the check below and return nil if the instance is not initialized. 54 | if let instance = (sharedInstances[__function] as? T?) ?? nil { 55 | return instance 56 | } 57 | 58 | let instance = factory() 59 | sharedInstances[__function] = instance 60 | 61 | return instance 62 | } 63 | 64 | // MARK: - Private 65 | 66 | private var sharedInstances = [String: Any]() 67 | private let lock = NSRecursiveLock() 68 | } 69 | 70 | /// The special empty component. 71 | open class EmptyComponent: EmptyDependency { 72 | 73 | /// Initializer. 74 | public init() {} 75 | } 76 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/DI/Dependency.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | /// The base dependency protocol. 20 | /// 21 | /// Subclasses should define a set of properties that are required by the module from the DI graph. A dependency is 22 | /// typically provided and satisfied by its immediate parent module. 23 | public protocol Dependency: class {} 24 | 25 | /// The special empty dependency. 26 | public protocol EmptyDependency: Dependency {} 27 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/Extensions/Foundation+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | /// Array extensions. 20 | public extension Array { 21 | 22 | /// Remove the given element from this array, by comparing pointer references. 23 | /// 24 | /// - parameter element: The element to remove. 25 | mutating func removeElementByReference(_ element: Element) { 26 | guard let objIndex = firstIndex(where: { $0 as AnyObject === element as AnyObject }) else { 27 | return 28 | } 29 | remove(at: objIndex) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/LaunchRouter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import UIKit 18 | 19 | /// The root `Router` of an application. 20 | public protocol LaunchRouting: ViewableRouting { 21 | 22 | /// Launches the router tree. 23 | /// 24 | /// - parameter window: The application window to launch from. 25 | func launch(from window: UIWindow) 26 | } 27 | 28 | /// The application root router base class, that acts as the root of the router tree. 29 | open class LaunchRouter: ViewableRouter, LaunchRouting { 30 | 31 | /// Initializer. 32 | /// 33 | /// - parameter interactor: The corresponding `Interactor` of this `Router`. 34 | /// - parameter viewController: The corresponding `ViewController` of this `Router`. 35 | public override init(interactor: InteractorType, viewController: ViewControllerType) { 36 | super.init(interactor: interactor, viewController: viewController) 37 | } 38 | 39 | /// Launches the router tree. 40 | /// 41 | /// - parameter window: The window to launch the router tree in. 42 | public final func launch(from window: UIWindow) { 43 | window.rootViewController = viewControllable.uiviewController 44 | window.makeKeyAndVisible() 45 | 46 | interactable.activate() 47 | load() 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import RxSwift 18 | 19 | public class Executor { 20 | 21 | /// Execute the given logic after the given delay assuming the given maximum frame duration. 22 | /// 23 | /// This allows excluding the time elapsed due to breakpoint pauses. 24 | /// 25 | /// - note: The logic closure is not guaranteed to be performed exactly after the given delay. It may be performed 26 | /// later if the actual frame duration exceeds the given maximum frame duration. 27 | /// 28 | /// - parameter delay: The delay to perform the logic, excluding any potential elapsed time due to breakpoint 29 | /// pauses. 30 | /// - parameter maxFrameDuration: The maximum duration a single frame should take. Defaults to 33ms. 31 | /// - parameter logic: The closure logic to perform. 32 | public static func execute(withDelay delay: TimeInterval, maxFrameDuration: Int = 33, logic: @escaping () -> ()) { 33 | let period = DispatchTimeInterval.milliseconds(maxFrameDuration / 3) 34 | var lastRunLoopTime = Date().timeIntervalSinceReferenceDate 35 | var properFrameTime = 0.0 36 | var didExecute = false 37 | _ = Observable 38 | .timer(DispatchTimeInterval.milliseconds(0), period: period, scheduler: MainScheduler.instance) 39 | .takeWhile { _ in 40 | !didExecute 41 | } 42 | .subscribe(onNext: { _ in 43 | let currentTime = Date().timeIntervalSinceReferenceDate 44 | let trueElapsedTime = currentTime - lastRunLoopTime 45 | lastRunLoopTime = currentTime 46 | 47 | // If we did drop frame, we under-count the frame duration, which is fine. It 48 | // just means the logic is performed slightly later. 49 | let boundedElapsedTime = min(trueElapsedTime, Double(maxFrameDuration) / 1000) 50 | properFrameTime += boundedElapsedTime 51 | if properFrameTime > delay { 52 | didExecute = true 53 | 54 | logic() 55 | } 56 | }) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/PresentableInteractor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | /// Base class of an `Interactor` that actually has an associated `Presenter` and `View`. 20 | open class PresentableInteractor: Interactor { 21 | 22 | /// The `Presenter` associated with this `Interactor`. 23 | public let presenter: PresenterType 24 | 25 | /// Initializer. 26 | /// 27 | /// - note: This holds a strong reference to the given `Presenter`. 28 | /// 29 | /// - parameter presenter: The presenter associated with this `Interactor`. 30 | public init(presenter: PresenterType) { 31 | self.presenter = presenter 32 | } 33 | 34 | // MARK: - Private 35 | 36 | deinit { 37 | LeakDetector.instance.expectDeallocate(object: presenter as AnyObject) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/Presenter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import Foundation 18 | 19 | /// The base protocol for all `Presenter`s. 20 | public protocol Presentable: class {} 21 | 22 | /// The base class of all `Presenter`s. A `Presenter` translates business models into values the corresponding 23 | /// `ViewController` can consume and display. It also maps UI events to business logic method, invoked to 24 | /// its listener. 25 | open class Presenter: Presentable { 26 | 27 | /// The view controller of this presenter. 28 | public let viewController: ViewControllerType 29 | 30 | /// Initializer. 31 | /// 32 | /// - parameter viewController: The `ViewController` of this `Pesenters`. 33 | public init(viewController: ViewControllerType) { 34 | self.viewController = viewController 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Pods/RIBs/ios/RIBs/Classes/ViewControllable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017. Uber Technologies 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | import UIKit 18 | 19 | /// Basic interface between a `Router` and the UIKit `UIViewController`. 20 | 21 | /// @mockable 22 | public protocol ViewControllable: class { 23 | 24 | var uiviewController: UIViewController { get } 25 | } 26 | 27 | /// Default implementation on `UIViewController` to conform to `ViewControllable` protocol 28 | public extension ViewControllable where Self: UIViewController { 29 | 30 | var uiviewController: UIViewController { 31 | return self 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Pods/RxRelay/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/RxRelay/RxRelay/BehaviorRelay.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BehaviorRelay.swift 3 | // RxRelay 4 | // 5 | // Created by Krunoslav Zaher on 10/7/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import RxSwift 10 | 11 | /// BehaviorRelay is a wrapper for `BehaviorSubject`. 12 | /// 13 | /// Unlike `BehaviorSubject` it can't terminate with error or completed. 14 | public final class BehaviorRelay: ObservableType { 15 | private let _subject: BehaviorSubject 16 | 17 | /// Accepts `event` and emits it to subscribers 18 | public func accept(_ event: Element) { 19 | self._subject.onNext(event) 20 | } 21 | 22 | /// Current value of behavior subject 23 | public var value: Element { 24 | // this try! is ok because subject can't error out or be disposed 25 | return try! self._subject.value() 26 | } 27 | 28 | /// Initializes behavior relay with initial value. 29 | public init(value: Element) { 30 | self._subject = BehaviorSubject(value: value) 31 | } 32 | 33 | /// Subscribes observer 34 | public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { 35 | return self._subject.subscribe(observer) 36 | } 37 | 38 | /// - returns: Canonical interface for push style sequence 39 | public func asObservable() -> Observable { 40 | return self._subject.asObservable() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Pods/RxRelay/RxRelay/PublishRelay.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PublishRelay.swift 3 | // RxRelay 4 | // 5 | // Created by Krunoslav Zaher on 3/28/15. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import RxSwift 10 | 11 | /// PublishRelay is a wrapper for `PublishSubject`. 12 | /// 13 | /// Unlike `PublishSubject` it can't terminate with error or completed. 14 | public final class PublishRelay: ObservableType { 15 | private let _subject: PublishSubject 16 | 17 | // Accepts `event` and emits it to subscribers 18 | public func accept(_ event: Element) { 19 | self._subject.onNext(event) 20 | } 21 | 22 | /// Initializes with internal empty subject. 23 | public init() { 24 | self._subject = PublishSubject() 25 | } 26 | 27 | /// Subscribes observer 28 | public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { 29 | return self._subject.subscribe(observer) 30 | } 31 | 32 | /// - returns: Canonical interface for push style sequence 33 | public func asObservable() -> Observable { 34 | return self._subject.asObservable() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Pods/RxRelay/RxRelay/Utils.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Utils.swift 3 | // RxRelay 4 | // 5 | // Created by Shai Mishali on 09/04/2019. 6 | // Copyright © 2019 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | func rxFatalErrorInDebug(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) { 12 | #if DEBUG 13 | fatalError(lastMessage(), file: file, line: line) 14 | #else 15 | print("\(file):\(line): \(lastMessage())") 16 | #endif 17 | } 18 | -------------------------------------------------------------------------------- /Pods/RxSwift/LICENSE.md: -------------------------------------------------------------------------------- 1 | **The MIT License** 2 | **Copyright © 2015 Krunoslav Zaher** 3 | **All rights reserved.** 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/AtomicInt.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AtomicInt.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 10/28/18. 6 | // Copyright © 2018 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import class Foundation.NSLock 10 | 11 | final class AtomicInt: NSLock { 12 | fileprivate var value: Int32 13 | public init(_ value: Int32 = 0) { 14 | self.value = value 15 | } 16 | } 17 | 18 | @discardableResult 19 | @inline(__always) 20 | func add(_ this: AtomicInt, _ value: Int32) -> Int32 { 21 | this.lock() 22 | let oldValue = this.value 23 | this.value += value 24 | this.unlock() 25 | return oldValue 26 | } 27 | 28 | @discardableResult 29 | @inline(__always) 30 | func sub(_ this: AtomicInt, _ value: Int32) -> Int32 { 31 | this.lock() 32 | let oldValue = this.value 33 | this.value -= value 34 | this.unlock() 35 | return oldValue 36 | } 37 | 38 | @discardableResult 39 | @inline(__always) 40 | func fetchOr(_ this: AtomicInt, _ mask: Int32) -> Int32 { 41 | this.lock() 42 | let oldValue = this.value 43 | this.value |= mask 44 | this.unlock() 45 | return oldValue 46 | } 47 | 48 | @inline(__always) 49 | func load(_ this: AtomicInt) -> Int32 { 50 | this.lock() 51 | let oldValue = this.value 52 | this.unlock() 53 | return oldValue 54 | } 55 | 56 | @discardableResult 57 | @inline(__always) 58 | func increment(_ this: AtomicInt) -> Int32 { 59 | return add(this, 1) 60 | } 61 | 62 | @discardableResult 63 | @inline(__always) 64 | func decrement(_ this: AtomicInt) -> Int32 { 65 | return sub(this, 1) 66 | } 67 | 68 | @inline(__always) 69 | func isFlagSet(_ this: AtomicInt, _ mask: Int32) -> Bool { 70 | return (load(this) & mask) != 0 71 | } 72 | -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InfiniteSequence.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 6/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Sequence that repeats `repeatedValue` infinite number of times. 10 | struct InfiniteSequence : Sequence { 11 | typealias Iterator = AnyIterator 12 | 13 | private let _repeatedValue: Element 14 | 15 | init(repeatedValue: Element) { 16 | _repeatedValue = repeatedValue 17 | } 18 | 19 | func makeIterator() -> Iterator { 20 | let repeatedValue = _repeatedValue 21 | return AnyIterator { 22 | return repeatedValue 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/DispatchQueue+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DispatchQueue+Extensions.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 10/22/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Dispatch 10 | 11 | extension DispatchQueue { 12 | private static var token: DispatchSpecificKey<()> = { 13 | let key = DispatchSpecificKey<()>() 14 | DispatchQueue.main.setSpecific(key: key, value: ()) 15 | return key 16 | }() 17 | 18 | static var isMain: Bool { 19 | return DispatchQueue.getSpecific(key: token) != nil 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/Platform.Darwin.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Platform.Darwin.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 12/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 10 | 11 | import Darwin 12 | import class Foundation.Thread 13 | import protocol Foundation.NSCopying 14 | 15 | extension Thread { 16 | static func setThreadLocalStorageValue(_ value: T?, forKey key: NSCopying) { 17 | let currentThread = Thread.current 18 | let threadDictionary = currentThread.threadDictionary 19 | 20 | if let newValue = value { 21 | threadDictionary[key] = newValue 22 | } 23 | else { 24 | threadDictionary[key] = nil 25 | } 26 | } 27 | 28 | static func getThreadLocalStorageValueForKey(_ key: NSCopying) -> T? { 29 | let currentThread = Thread.current 30 | let threadDictionary = currentThread.threadDictionary 31 | 32 | return threadDictionary[key] as? T 33 | } 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/Platform.Linux.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Platform.Linux.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 12/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(Linux) 10 | 11 | import class Foundation.Thread 12 | 13 | extension Thread { 14 | 15 | static func setThreadLocalStorageValue(_ value: T?, forKey key: String) { 16 | if let newValue = value { 17 | Thread.current.threadDictionary[key] = newValue 18 | } 19 | else { 20 | Thread.current.threadDictionary[key] = nil 21 | } 22 | } 23 | 24 | static func getThreadLocalStorageValueForKey(_ key: String) -> T? { 25 | let currentThread = Thread.current 26 | let threadDictionary = currentThread.threadDictionary 27 | 28 | return threadDictionary[key] as? T 29 | } 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /Pods/RxSwift/Platform/RecursiveLock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RecursiveLock.swift 3 | // Platform 4 | // 5 | // Created by Krunoslav Zaher on 12/18/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import class Foundation.NSRecursiveLock 10 | 11 | #if TRACE_RESOURCES 12 | class RecursiveLock: NSRecursiveLock { 13 | override init() { 14 | _ = Resources.incrementTotal() 15 | super.init() 16 | } 17 | 18 | override func lock() { 19 | super.lock() 20 | _ = Resources.incrementTotal() 21 | } 22 | 23 | override func unlock() { 24 | super.unlock() 25 | _ = Resources.decrementTotal() 26 | } 27 | 28 | deinit { 29 | _ = Resources.decrementTotal() 30 | } 31 | } 32 | #else 33 | typealias RecursiveLock = NSRecursiveLock 34 | #endif 35 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/AnyObserver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnyObserver.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// A type-erased `ObserverType`. 10 | /// 11 | /// Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type. 12 | public struct AnyObserver : ObserverType { 13 | /// Anonymous event handler type. 14 | public typealias EventHandler = (Event) -> Void 15 | 16 | private let observer: EventHandler 17 | 18 | /// Construct an instance whose `on(event)` calls `eventHandler(event)` 19 | /// 20 | /// - parameter eventHandler: Event handler that observes sequences events. 21 | public init(eventHandler: @escaping EventHandler) { 22 | self.observer = eventHandler 23 | } 24 | 25 | /// Construct an instance whose `on(event)` calls `observer.on(event)` 26 | /// 27 | /// - parameter observer: Observer that receives sequence events. 28 | public init(_ observer: Observer) where Observer.Element == Element { 29 | self.observer = observer.on 30 | } 31 | 32 | /// Send `event` to this observer. 33 | /// 34 | /// - parameter event: Event instance. 35 | public func on(_ event: Event) { 36 | return self.observer(event) 37 | } 38 | 39 | /// Erases type of observer and returns canonical observer. 40 | /// 41 | /// - returns: type erased observer. 42 | public func asObserver() -> AnyObserver { 43 | return self 44 | } 45 | } 46 | 47 | extension AnyObserver { 48 | /// Collection of `AnyObserver`s 49 | typealias s = Bag<(Event) -> Void> 50 | } 51 | 52 | extension ObserverType { 53 | /// Erases type of observer and returns canonical observer. 54 | /// 55 | /// - returns: type erased observer. 56 | public func asObserver() -> AnyObserver { 57 | return AnyObserver(self) 58 | } 59 | 60 | /// Transforms observer of type R to type E using custom transform method. 61 | /// Each event sent to result observer is transformed and sent to `self`. 62 | /// 63 | /// - returns: observer that transforms events. 64 | public func mapObserver(_ transform: @escaping (Result) throws -> Element) -> AnyObserver { 65 | return AnyObserver { e in 66 | self.on(e.map(transform)) 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Cancelable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Cancelable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents disposable resource with state tracking. 10 | public protocol Cancelable : Disposable { 11 | /// Was resource disposed. 12 | var isDisposed: Bool { get } 13 | } 14 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AsyncLock.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/21/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /** 10 | In case nobody holds this lock, the work will be queued and executed immediately 11 | on thread that is requesting lock. 12 | 13 | In case there is somebody currently holding that lock, action will be enqueued. 14 | When owned of the lock finishes with it's processing, it will also execute 15 | and pending work. 16 | 17 | That means that enqueued work could possibly be executed later on a different thread. 18 | */ 19 | final class AsyncLock 20 | : Disposable 21 | , Lock 22 | , SynchronizedDisposeType { 23 | typealias Action = () -> Void 24 | 25 | var _lock = SpinLock() 26 | 27 | private var _queue: Queue = Queue(capacity: 0) 28 | 29 | private var _isExecuting: Bool = false 30 | private var _hasFaulted: Bool = false 31 | 32 | // lock { 33 | func lock() { 34 | self._lock.lock() 35 | } 36 | 37 | func unlock() { 38 | self._lock.unlock() 39 | } 40 | // } 41 | 42 | private func enqueue(_ action: I) -> I? { 43 | self._lock.lock(); defer { self._lock.unlock() } // { 44 | if self._hasFaulted { 45 | return nil 46 | } 47 | 48 | if self._isExecuting { 49 | self._queue.enqueue(action) 50 | return nil 51 | } 52 | 53 | self._isExecuting = true 54 | 55 | return action 56 | // } 57 | } 58 | 59 | private func dequeue() -> I? { 60 | self._lock.lock(); defer { self._lock.unlock() } // { 61 | if !self._queue.isEmpty { 62 | return self._queue.dequeue() 63 | } 64 | else { 65 | self._isExecuting = false 66 | return nil 67 | } 68 | // } 69 | } 70 | 71 | func invoke(_ action: I) { 72 | let firstEnqueuedAction = self.enqueue(action) 73 | 74 | if let firstEnqueuedAction = firstEnqueuedAction { 75 | firstEnqueuedAction.invoke() 76 | } 77 | else { 78 | // action is enqueued, it's somebody else's concern now 79 | return 80 | } 81 | 82 | while true { 83 | let nextAction = self.dequeue() 84 | 85 | if let nextAction = nextAction { 86 | nextAction.invoke() 87 | } 88 | else { 89 | return 90 | } 91 | } 92 | } 93 | 94 | func dispose() { 95 | self.synchronizedDispose() 96 | } 97 | 98 | func _synchronized_dispose() { 99 | self._queue = Queue(capacity: 0) 100 | self._hasFaulted = true 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/Lock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Lock.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/31/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | protocol Lock { 10 | func lock() 11 | func unlock() 12 | } 13 | 14 | // https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000321.html 15 | typealias SpinLock = RecursiveLock 16 | 17 | extension RecursiveLock : Lock { 18 | @inline(__always) 19 | final func performLocked(_ action: () -> Void) { 20 | self.lock(); defer { self.unlock() } 21 | action() 22 | } 23 | 24 | @inline(__always) 25 | final func calculateLocked(_ action: () -> T) -> T { 26 | self.lock(); defer { self.unlock() } 27 | return action() 28 | } 29 | 30 | @inline(__always) 31 | final func calculateLockedOrFail(_ action: () throws -> T) throws -> T { 32 | self.lock(); defer { self.unlock() } 33 | let result = try action() 34 | return result 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LockOwnerType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | protocol LockOwnerType : class, Lock { 10 | var _lock: RecursiveLock { get } 11 | } 12 | 13 | extension LockOwnerType { 14 | func lock() { 15 | self._lock.lock() 16 | } 17 | 18 | func unlock() { 19 | self._lock.unlock() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SynchronizedDisposeType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | protocol SynchronizedDisposeType : class, Disposable, Lock { 10 | func _synchronized_dispose() 11 | } 12 | 13 | extension SynchronizedDisposeType { 14 | func synchronizedDispose() { 15 | self.lock(); defer { self.unlock() } 16 | self._synchronized_dispose() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SynchronizedOnType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | protocol SynchronizedOnType : class, ObserverType, Lock { 10 | func _synchronized_on(_ event: Event) 11 | } 12 | 13 | extension SynchronizedOnType { 14 | func synchronizedOn(_ event: Event) { 15 | self.lock(); defer { self.unlock() } 16 | self._synchronized_on(event) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SynchronizedUnsubscribeType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | protocol SynchronizedUnsubscribeType : class { 10 | associatedtype DisposeKey 11 | 12 | func synchronizedUnsubscribe(_ disposeKey: DisposeKey) 13 | } 14 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ConnectableObservableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectableObservableType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/1/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /** 10 | Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence. 11 | */ 12 | public protocol ConnectableObservableType : ObservableType { 13 | /** 14 | 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. 15 | 16 | - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. 17 | */ 18 | func connect() -> Disposable 19 | } 20 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Date+Dispatch.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Date+Dispatch.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/14/19. 6 | // Copyright © 2019 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import struct Foundation.Date 10 | import struct Foundation.TimeInterval 11 | import enum Dispatch.DispatchTimeInterval 12 | 13 | extension DispatchTimeInterval { 14 | var convertToSecondsFactor: Double { 15 | switch self { 16 | case .nanoseconds: return 1_000_000_000.0 17 | case .microseconds: return 1_000_000.0 18 | case .milliseconds: return 1_000.0 19 | case .seconds: return 1.0 20 | case .never: fatalError() 21 | @unknown default: fatalError() 22 | } 23 | } 24 | 25 | func map(_ transform: (Int, Double) -> Int) -> DispatchTimeInterval { 26 | switch self { 27 | case .nanoseconds(let value): return .nanoseconds(transform(value, 1_000_000_000.0)) 28 | case .microseconds(let value): return .microseconds(transform(value, 1_000_000.0)) 29 | case .milliseconds(let value): return .milliseconds(transform(value, 1_000.0)) 30 | case .seconds(let value): return .seconds(transform(value, 1.0)) 31 | case .never: return .never 32 | @unknown default: fatalError() 33 | } 34 | } 35 | 36 | var isNow: Bool { 37 | switch self { 38 | case .nanoseconds(let value), .microseconds(let value), .milliseconds(let value), .seconds(let value): return value == 0 39 | case .never: return false 40 | @unknown default: fatalError() 41 | } 42 | } 43 | 44 | internal func reduceWithSpanBetween(earlierDate: Date, laterDate: Date) -> DispatchTimeInterval { 45 | return self.map { value, factor in 46 | let interval = laterDate.timeIntervalSince(earlierDate) 47 | let remainder = Double(value) - interval * factor 48 | guard remainder > 0 else { return 0 } 49 | return Int(remainder.rounded(.toNearestOrAwayFromZero)) 50 | } 51 | } 52 | } 53 | 54 | extension Date { 55 | 56 | internal func addingDispatchInterval(_ dispatchInterval: DispatchTimeInterval) -> Date { 57 | switch dispatchInterval { 58 | case .nanoseconds(let value), .microseconds(let value), .milliseconds(let value), .seconds(let value): 59 | return self.addingTimeInterval(TimeInterval(value) / dispatchInterval.convertToSecondsFactor) 60 | case .never: return Date.distantFuture 61 | @unknown default: fatalError() 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Disposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents a disposable resource. 10 | public protocol Disposable { 11 | /// Dispose resource. 12 | func dispose() 13 | } 14 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnonymousDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents an Action-based disposable. 10 | /// 11 | /// When dispose method is called, disposal action will be dereferenced. 12 | private final class AnonymousDisposable : DisposeBase, Cancelable { 13 | public typealias DisposeAction = () -> Void 14 | 15 | private let _isDisposed = AtomicInt(0) 16 | private var _disposeAction: DisposeAction? 17 | 18 | /// - returns: Was resource disposed. 19 | public var isDisposed: Bool { 20 | return isFlagSet(self._isDisposed, 1) 21 | } 22 | 23 | /// Constructs a new disposable with the given action used for disposal. 24 | /// 25 | /// - parameter disposeAction: Disposal action which will be run upon calling `dispose`. 26 | private init(_ disposeAction: @escaping DisposeAction) { 27 | self._disposeAction = disposeAction 28 | super.init() 29 | } 30 | 31 | // Non-deprecated version of the constructor, used by `Disposables.create(with:)` 32 | fileprivate init(disposeAction: @escaping DisposeAction) { 33 | self._disposeAction = disposeAction 34 | super.init() 35 | } 36 | 37 | /// Calls the disposal action if and only if the current instance hasn't been disposed yet. 38 | /// 39 | /// After invoking disposal action, disposal action will be dereferenced. 40 | fileprivate func dispose() { 41 | if fetchOr(self._isDisposed, 1) == 0 { 42 | if let action = self._disposeAction { 43 | self._disposeAction = nil 44 | action() 45 | } 46 | } 47 | } 48 | } 49 | 50 | extension Disposables { 51 | 52 | /// Constructs a new disposable with the given action used for disposal. 53 | /// 54 | /// - parameter dispose: Disposal action which will be run upon calling `dispose`. 55 | public static func create(with dispose: @escaping () -> Void) -> Cancelable { 56 | return AnonymousDisposable(disposeAction: dispose) 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /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 | /// Represents two disposable resources that are disposed together. 10 | private final class BinaryDisposable : DisposeBase, Cancelable { 11 | 12 | private let _isDisposed = AtomicInt(0) 13 | 14 | // state 15 | private var _disposable1: Disposable? 16 | private var _disposable2: Disposable? 17 | 18 | /// - returns: Was resource disposed. 19 | var isDisposed: Bool { 20 | return isFlagSet(self._isDisposed, 1) 21 | } 22 | 23 | /// Constructs new binary disposable from two disposables. 24 | /// 25 | /// - parameter disposable1: First disposable 26 | /// - parameter disposable2: Second disposable 27 | init(_ disposable1: Disposable, _ disposable2: Disposable) { 28 | self._disposable1 = disposable1 29 | self._disposable2 = disposable2 30 | super.init() 31 | } 32 | 33 | /// Calls the disposal action if and only if the current instance hasn't been disposed yet. 34 | /// 35 | /// After invoking disposal action, disposal action will be dereferenced. 36 | func dispose() { 37 | if fetchOr(self._isDisposed, 1) == 0 { 38 | self._disposable1?.dispose() 39 | self._disposable2?.dispose() 40 | self._disposable1 = nil 41 | self._disposable2 = nil 42 | } 43 | } 44 | } 45 | 46 | extension Disposables { 47 | 48 | /// Creates a disposable with the given disposables. 49 | public static func create(_ disposable1: Disposable, _ disposable2: Disposable) -> Cancelable { 50 | return BinaryDisposable(disposable1, disposable2) 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BooleanDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Junior B. on 10/29/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents a disposable resource that can be checked for disposal status. 10 | public final class BooleanDisposable : Cancelable { 11 | 12 | internal static let BooleanDisposableTrue = BooleanDisposable(isDisposed: true) 13 | private var _isDisposed = false 14 | 15 | /// Initializes a new instance of the `BooleanDisposable` class 16 | public init() { 17 | } 18 | 19 | /// Initializes a new instance of the `BooleanDisposable` class with given value 20 | public init(isDisposed: Bool) { 21 | self._isDisposed = isDisposed 22 | } 23 | 24 | /// - returns: Was resource disposed. 25 | public var isDisposed: Bool { 26 | return self._isDisposed 27 | } 28 | 29 | /// Sets the status to disposed, which can be observer through the `isDisposed` property. 30 | public func dispose() { 31 | self._isDisposed = true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/Disposables.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Disposables.swift 3 | // RxSwift 4 | // 5 | // Created by Mohsen Ramezanpoor on 01/08/2016. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// A collection of utility methods for common disposable operations. 10 | public struct Disposables { 11 | private init() {} 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DisposeBase.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/4/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Base class for all disposables. 10 | public class DisposeBase { 11 | init() { 12 | #if TRACE_RESOURCES 13 | _ = Resources.incrementTotal() 14 | #endif 15 | } 16 | 17 | deinit { 18 | #if TRACE_RESOURCES 19 | _ = Resources.decrementTotal() 20 | #endif 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NopDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents a disposable that does nothing on disposal. 10 | /// 11 | /// Nop = No Operation 12 | private struct NopDisposable : Disposable { 13 | 14 | fileprivate static let noOp: Disposable = NopDisposable() 15 | 16 | private init() { 17 | 18 | } 19 | 20 | /// Does nothing. 21 | public func dispose() { 22 | } 23 | } 24 | 25 | extension Disposables { 26 | /** 27 | Creates a disposable that does nothing on disposal. 28 | */ 29 | static public func create() -> Disposable { 30 | return NopDisposable.noOp 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /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 | private let disposeScheduledDisposable: (ScheduledDisposable) -> Disposable = { sd in 10 | sd.disposeInner() 11 | return Disposables.create() 12 | } 13 | 14 | /// Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler. 15 | public final class ScheduledDisposable : Cancelable { 16 | public let scheduler: ImmediateSchedulerType 17 | 18 | private let _isDisposed = AtomicInt(0) 19 | 20 | // state 21 | private var _disposable: Disposable? 22 | 23 | /// - returns: Was resource disposed. 24 | public var isDisposed: Bool { 25 | return isFlagSet(self._isDisposed, 1) 26 | } 27 | 28 | /** 29 | Initializes a new instance of the `ScheduledDisposable` that uses a `scheduler` on which to dispose the `disposable`. 30 | 31 | - parameter scheduler: Scheduler where the disposable resource will be disposed on. 32 | - parameter disposable: Disposable resource to dispose on the given scheduler. 33 | */ 34 | public init(scheduler: ImmediateSchedulerType, disposable: Disposable) { 35 | self.scheduler = scheduler 36 | self._disposable = disposable 37 | } 38 | 39 | /// Disposes the wrapped disposable on the provided scheduler. 40 | public func dispose() { 41 | _ = self.scheduler.schedule(self, action: disposeScheduledDisposable) 42 | } 43 | 44 | func disposeInner() { 45 | if fetchOr(self._isDisposed, 1) == 0 { 46 | self._disposable!.dispose() 47 | self._disposable = nil 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SerialDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource. 10 | public final class SerialDisposable : DisposeBase, Cancelable { 11 | private var _lock = SpinLock() 12 | 13 | // state 14 | private var _current = nil as Disposable? 15 | private var _isDisposed = false 16 | 17 | /// - returns: Was resource disposed. 18 | public var isDisposed: Bool { 19 | return self._isDisposed 20 | } 21 | 22 | /// Initializes a new instance of the `SerialDisposable`. 23 | override public init() { 24 | super.init() 25 | } 26 | 27 | /** 28 | Gets or sets the underlying disposable. 29 | 30 | Assigning this property disposes the previous disposable object. 31 | 32 | If the `SerialDisposable` has already been disposed, assignment to this property causes immediate disposal of the given disposable object. 33 | */ 34 | public var disposable: Disposable { 35 | get { 36 | return self._lock.calculateLocked { 37 | return self._current ?? Disposables.create() 38 | } 39 | } 40 | set (newDisposable) { 41 | let disposable: Disposable? = self._lock.calculateLocked { 42 | if self._isDisposed { 43 | return newDisposable 44 | } 45 | else { 46 | let toDispose = self._current 47 | self._current = newDisposable 48 | return toDispose 49 | } 50 | } 51 | 52 | if let disposable = disposable { 53 | disposable.dispose() 54 | } 55 | } 56 | } 57 | 58 | /// Disposes the underlying disposable as well as all future replacements. 59 | public func dispose() { 60 | self._dispose()?.dispose() 61 | } 62 | 63 | private func _dispose() -> Disposable? { 64 | self._lock.lock(); defer { self._lock.unlock() } 65 | if self._isDisposed { 66 | return nil 67 | } 68 | else { 69 | self._isDisposed = true 70 | let current = self._current 71 | self._current = nil 72 | return current 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SingleAssignmentDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /** 10 | Represents a disposable resource which only allows a single assignment of its underlying disposable resource. 11 | 12 | If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an exception. 13 | */ 14 | public final class SingleAssignmentDisposable : DisposeBase, Cancelable { 15 | 16 | private enum DisposeState: Int32 { 17 | case disposed = 1 18 | case disposableSet = 2 19 | } 20 | 21 | // state 22 | private let _state = AtomicInt(0) 23 | private var _disposable = nil as Disposable? 24 | 25 | /// - returns: A value that indicates whether the object is disposed. 26 | public var isDisposed: Bool { 27 | return isFlagSet(self._state, DisposeState.disposed.rawValue) 28 | } 29 | 30 | /// Initializes a new instance of the `SingleAssignmentDisposable`. 31 | public override init() { 32 | super.init() 33 | } 34 | 35 | /// Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined. 36 | /// 37 | /// **Throws exception if the `SingleAssignmentDisposable` has already been assigned to.** 38 | public func setDisposable(_ disposable: Disposable) { 39 | self._disposable = disposable 40 | 41 | let previousState = fetchOr(self._state, DisposeState.disposableSet.rawValue) 42 | 43 | if (previousState & DisposeState.disposableSet.rawValue) != 0 { 44 | rxFatalError("oldState.disposable != nil") 45 | } 46 | 47 | if (previousState & DisposeState.disposed.rawValue) != 0 { 48 | disposable.dispose() 49 | self._disposable = nil 50 | } 51 | } 52 | 53 | /// Disposes the underlying disposable. 54 | public func dispose() { 55 | let previousState = fetchOr(self._state, DisposeState.disposed.rawValue) 56 | 57 | if (previousState & DisposeState.disposed.rawValue) != 0 { 58 | return 59 | } 60 | 61 | if (previousState & DisposeState.disposableSet.rawValue) != 0 { 62 | guard let disposable = self._disposable else { 63 | rxFatalError("Disposable not set") 64 | } 65 | disposable.dispose() 66 | self._disposable = nil 67 | } 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SubscriptionDisposable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | struct SubscriptionDisposable : Disposable { 10 | private let _key: T.DisposeKey 11 | private weak var _owner: T? 12 | 13 | init(owner: T, key: T.DisposeKey) { 14 | self._owner = owner 15 | self._key = key 16 | } 17 | 18 | func dispose() { 19 | self._owner?.synchronizedUnsubscribe(self._key) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Errors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Errors.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/28/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | let RxErrorDomain = "RxErrorDomain" 10 | let RxCompositeFailures = "RxCompositeFailures" 11 | 12 | /// Generic Rx error codes. 13 | public enum RxError 14 | : Swift.Error 15 | , CustomDebugStringConvertible { 16 | /// Unknown error occurred. 17 | case unknown 18 | /// Performing an action on disposed object. 19 | case disposed(object: AnyObject) 20 | /// Arithmetic overflow error. 21 | case overflow 22 | /// Argument out of range error. 23 | case argumentOutOfRange 24 | /// Sequence doesn't contain any elements. 25 | case noElements 26 | /// Sequence contains more than one element. 27 | case moreThanOneElement 28 | /// Timeout error. 29 | case timeout 30 | } 31 | 32 | extension RxError { 33 | /// A textual representation of `self`, suitable for debugging. 34 | public var debugDescription: String { 35 | switch self { 36 | case .unknown: 37 | return "Unknown error occurred." 38 | case .disposed(let object): 39 | return "Object `\(object)` was already disposed." 40 | case .overflow: 41 | return "Arithmetic overflow occurred." 42 | case .argumentOutOfRange: 43 | return "Argument out of range." 44 | case .noElements: 45 | return "Sequence doesn't contain any elements." 46 | case .moreThanOneElement: 47 | return "Sequence contains more than one element." 48 | case .timeout: 49 | return "Sequence timeout." 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bag+Rx.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 10/19/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | 10 | // MARK: forEach 11 | 12 | @inline(__always) 13 | func dispatch(_ bag: Bag<(Event) -> Void>, _ event: Event) { 14 | bag._value0?(event) 15 | 16 | if bag._onlyFastPath { 17 | return 18 | } 19 | 20 | let pairs = bag._pairs 21 | for i in 0 ..< pairs.count { 22 | pairs[i].value(event) 23 | } 24 | 25 | if let dictionary = bag._dictionary { 26 | for element in dictionary.values { 27 | element(event) 28 | } 29 | } 30 | } 31 | 32 | /// Dispatches `dispose` to all disposables contained inside bag. 33 | func disposeAll(in bag: Bag) { 34 | bag._value0?.dispose() 35 | 36 | if bag._onlyFastPath { 37 | return 38 | } 39 | 40 | let pairs = bag._pairs 41 | for i in 0 ..< pairs.count { 42 | pairs[i].value.dispose() 43 | } 44 | 45 | if let dictionary = bag._dictionary { 46 | for element in dictionary.values { 47 | element.dispose() 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/GroupedObservable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GroupedObservable.swift 3 | // RxSwift 4 | // 5 | // Created by Tomi Koskinen on 01/12/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents an observable sequence of elements that have a common key. 10 | public struct GroupedObservable : ObservableType { 11 | /// Gets the common key. 12 | public let key: Key 13 | 14 | private let source: Observable 15 | 16 | /// Initializes grouped observable sequence with key and source observable sequence. 17 | /// 18 | /// - parameter key: Grouped observable sequence key 19 | /// - parameter source: Observable sequence that represents sequence of elements for the key 20 | /// - returns: Grouped observable sequence of elements for the specific key 21 | public init(key: Key, source: Observable) { 22 | self.key = key 23 | self.source = source 24 | } 25 | 26 | /// Subscribes `observer` to receive events for this sequence. 27 | public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { 28 | return self.source.subscribe(observer) 29 | } 30 | 31 | /// Converts `self` to `Observable` sequence. 32 | public func asObservable() -> Observable { 33 | return self.source 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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 | /// Represents an object that immediately schedules units of work. 10 | public protocol ImmediateSchedulerType { 11 | /** 12 | Schedules an action to be executed immediately. 13 | 14 | - parameter state: State passed to the action to be executed. 15 | - parameter action: Action to be executed. 16 | - returns: The disposable object used to cancel the scheduled action (best effort). 17 | */ 18 | func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable 19 | } 20 | 21 | extension ImmediateSchedulerType { 22 | /** 23 | Schedules an action to be executed recursively. 24 | 25 | - parameter state: State passed to the action to be executed. 26 | - 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. 27 | - returns: The disposable object used to cancel the scheduled action (best effort). 28 | */ 29 | public func scheduleRecursive(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> Void) -> Void) -> Disposable { 30 | let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self) 31 | 32 | recursiveScheduler.schedule(state) 33 | 34 | return Disposables.create(with: recursiveScheduler.dispose) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Observable.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// A type-erased `ObservableType`. 10 | /// 11 | /// It represents a push style sequence. 12 | public class Observable : ObservableType { 13 | init() { 14 | #if TRACE_RESOURCES 15 | _ = Resources.incrementTotal() 16 | #endif 17 | } 18 | 19 | public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { 20 | rxAbstractMethod() 21 | } 22 | 23 | public func asObservable() -> Observable { 24 | return self 25 | } 26 | 27 | deinit { 28 | #if TRACE_RESOURCES 29 | _ = Resources.decrementTotal() 30 | #endif 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ObservableConvertibleType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObservableConvertibleType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/17/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Type that can be converted to observable sequence (`Observable`). 10 | public protocol ObservableConvertibleType { 11 | /// Type of elements in sequence. 12 | associatedtype Element 13 | 14 | @available(*, deprecated, renamed: "Element") 15 | typealias E = Element 16 | 17 | /// Converts `self` to `Observable` sequence. 18 | /// 19 | /// - returns: Observable sequence that represents `self`. 20 | func asObservable() -> Observable 21 | } 22 | -------------------------------------------------------------------------------- /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 | /// Represents a push style sequence. 10 | public protocol ObservableType: ObservableConvertibleType { 11 | /** 12 | Subscribes `observer` to receive events for this sequence. 13 | 14 | ### Grammar 15 | 16 | **Next\* (Error | Completed)?** 17 | 18 | * sequences can produce zero or more elements so zero or more `Next` events can be sent to `observer` 19 | * once an `Error` or `Completed` event is sent, the sequence terminates and can't produce any other elements 20 | 21 | It is possible that events are sent from different threads, but no two events can be sent concurrently to 22 | `observer`. 23 | 24 | ### Resource Management 25 | 26 | When sequence sends `Complete` or `Error` event all internal resources that compute sequence elements 27 | will be freed. 28 | 29 | To cancel production of sequence elements and free resources immediately, call `dispose` on returned 30 | subscription. 31 | 32 | - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources. 33 | */ 34 | func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element 35 | } 36 | 37 | extension ObservableType { 38 | 39 | /// Default implementation of converting `ObservableType` to `Observable`. 40 | public func asObservable() -> Observable { 41 | // temporary workaround 42 | //return Observable.create(subscribe: self.subscribe) 43 | return Observable.create { o in 44 | return self.subscribe(o) 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/AddRef.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AddRef.swift 3 | // RxSwift 4 | // 5 | // Created by Junior B. on 30/10/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | final class AddRefSink : Sink, ObserverType { 10 | typealias Element = Observer.Element 11 | 12 | override init(observer: Observer, cancel: Cancelable) { 13 | super.init(observer: observer, cancel: cancel) 14 | } 15 | 16 | func on(_ event: Event) { 17 | switch event { 18 | case .next: 19 | self.forwardOn(event) 20 | case .completed, .error: 21 | self.forwardOn(event) 22 | self.dispose() 23 | } 24 | } 25 | } 26 | 27 | final class AddRef : Producer { 28 | 29 | private let _source: Observable 30 | private let _refCount: RefCountDisposable 31 | 32 | init(source: Observable, refCount: RefCountDisposable) { 33 | self._source = source 34 | self._refCount = refCount 35 | } 36 | 37 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 38 | let releaseDisposable = self._refCount.retain() 39 | let sink = AddRefSink(observer: observer, cancel: cancel) 40 | let subscription = Disposables.create(releaseDisposable, self._source.subscribe(sink)) 41 | 42 | return (sink: sink, subscription: subscription) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/AsMaybe.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AsMaybe.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/12/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | private final class AsMaybeSink : Sink, ObserverType { 10 | typealias Element = Observer.Element 11 | 12 | private var _element: Event? 13 | 14 | func on(_ event: Event) { 15 | switch event { 16 | case .next: 17 | if self._element != nil { 18 | self.forwardOn(.error(RxError.moreThanOneElement)) 19 | self.dispose() 20 | } 21 | 22 | self._element = event 23 | case .error: 24 | self.forwardOn(event) 25 | self.dispose() 26 | case .completed: 27 | if let element = self._element { 28 | self.forwardOn(element) 29 | } 30 | self.forwardOn(.completed) 31 | self.dispose() 32 | } 33 | } 34 | } 35 | 36 | final class AsMaybe: Producer { 37 | private let _source: Observable 38 | 39 | init(source: Observable) { 40 | self._source = source 41 | } 42 | 43 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 44 | let sink = AsMaybeSink(observer: observer, cancel: cancel) 45 | let subscription = self._source.subscribe(sink) 46 | return (sink: sink, subscription: subscription) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/AsSingle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AsSingle.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/12/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | private final class AsSingleSink : Sink, ObserverType { 10 | typealias Element = Observer.Element 11 | 12 | private var _element: Event? 13 | 14 | func on(_ event: Event) { 15 | switch event { 16 | case .next: 17 | if self._element != nil { 18 | self.forwardOn(.error(RxError.moreThanOneElement)) 19 | self.dispose() 20 | } 21 | 22 | self._element = event 23 | case .error: 24 | self.forwardOn(event) 25 | self.dispose() 26 | case .completed: 27 | if let element = self._element { 28 | self.forwardOn(element) 29 | self.forwardOn(.completed) 30 | } 31 | else { 32 | self.forwardOn(.error(RxError.noElements)) 33 | } 34 | self.dispose() 35 | } 36 | } 37 | } 38 | 39 | final class AsSingle: Producer { 40 | private let _source: Observable 41 | 42 | init(source: Observable) { 43 | self._source = source 44 | } 45 | 46 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 47 | let sink = AsSingleSink(observer: observer, cancel: cancel) 48 | let subscription = self._source.subscribe(sink) 49 | return (sink: sink, subscription: subscription) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Create.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Create.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | // MARK: create 11 | 12 | /** 13 | Creates an observable sequence from a specified subscribe method implementation. 14 | 15 | - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html) 16 | 17 | - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method. 18 | - returns: The observable sequence with the specified implementation for the `subscribe` method. 19 | */ 20 | public static func create(_ subscribe: @escaping (AnyObserver) -> Disposable) -> Observable { 21 | return AnonymousObservable(subscribe) 22 | } 23 | } 24 | 25 | final private class AnonymousObservableSink: Sink, ObserverType { 26 | typealias Element = Observer.Element 27 | typealias Parent = AnonymousObservable 28 | 29 | // state 30 | private let _isStopped = AtomicInt(0) 31 | 32 | #if DEBUG 33 | private let _synchronizationTracker = SynchronizationTracker() 34 | #endif 35 | 36 | override init(observer: Observer, cancel: Cancelable) { 37 | super.init(observer: observer, cancel: cancel) 38 | } 39 | 40 | func on(_ event: Event) { 41 | #if DEBUG 42 | self._synchronizationTracker.register(synchronizationErrorMessage: .default) 43 | defer { self._synchronizationTracker.unregister() } 44 | #endif 45 | switch event { 46 | case .next: 47 | if load(self._isStopped) == 1 { 48 | return 49 | } 50 | self.forwardOn(event) 51 | case .error, .completed: 52 | if fetchOr(self._isStopped, 1) == 0 { 53 | self.forwardOn(event) 54 | self.dispose() 55 | } 56 | } 57 | } 58 | 59 | func run(_ parent: Parent) -> Disposable { 60 | return parent._subscribeHandler(AnyObserver(self)) 61 | } 62 | } 63 | 64 | final private class AnonymousObservable: Producer { 65 | typealias SubscribeHandler = (AnyObserver) -> Disposable 66 | 67 | let _subscribeHandler: SubscribeHandler 68 | 69 | init(_ subscribeHandler: @escaping SubscribeHandler) { 70 | self._subscribeHandler = subscribeHandler 71 | } 72 | 73 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 74 | let sink = AnonymousObservableSink(observer: observer, cancel: cancel) 75 | let subscription = sink.run(self) 76 | return (sink: sink, subscription: subscription) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultIfEmpty.swift 3 | // RxSwift 4 | // 5 | // Created by sergdort on 23/12/2016. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Emits elements from the source observable sequence, or a default element if the source observable sequence is empty. 13 | 14 | - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html) 15 | 16 | - parameter default: Default element to be sent if the source does not emit any elements 17 | - returns: An observable sequence which emits default element end completes in case the original sequence is empty 18 | */ 19 | public func ifEmpty(default: Element) -> Observable { 20 | return DefaultIfEmpty(source: self.asObservable(), default: `default`) 21 | } 22 | } 23 | 24 | final private class DefaultIfEmptySink: Sink, ObserverType { 25 | typealias Element = Observer.Element 26 | private let _default: Element 27 | private var _isEmpty = true 28 | 29 | init(default: Element, observer: Observer, cancel: Cancelable) { 30 | self._default = `default` 31 | super.init(observer: observer, cancel: cancel) 32 | } 33 | 34 | func on(_ event: Event) { 35 | switch event { 36 | case .next: 37 | self._isEmpty = false 38 | self.forwardOn(event) 39 | case .error: 40 | self.forwardOn(event) 41 | self.dispose() 42 | case .completed: 43 | if self._isEmpty { 44 | self.forwardOn(.next(self._default)) 45 | } 46 | self.forwardOn(.completed) 47 | self.dispose() 48 | } 49 | } 50 | } 51 | 52 | final private class DefaultIfEmpty: Producer { 53 | private let _source: Observable 54 | private let _default: SourceType 55 | 56 | init(source: Observable, `default`: SourceType) { 57 | self._source = source 58 | self._default = `default` 59 | } 60 | 61 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceType { 62 | let sink = DefaultIfEmptySink(default: self._default, observer: observer, cancel: cancel) 63 | let subscription = self._source.subscribe(sink) 64 | return (sink: sink, subscription: subscription) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/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 | extension ObservableType { 10 | /** 11 | Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. 12 | 13 | - seealso: [defer operator on reactivex.io](http://reactivex.io/documentation/operators/defer.html) 14 | 15 | - parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence. 16 | - returns: An observable sequence whose observers trigger an invocation of the given observable factory function. 17 | */ 18 | public static func deferred(_ observableFactory: @escaping () throws -> Observable) 19 | -> Observable { 20 | return Deferred(observableFactory: observableFactory) 21 | } 22 | } 23 | 24 | final private class DeferredSink: Sink, ObserverType where Source.Element == Observer.Element { 25 | typealias Element = Observer.Element 26 | 27 | private let _observableFactory: () throws -> Source 28 | 29 | init(observableFactory: @escaping () throws -> Source, observer: Observer, cancel: Cancelable) { 30 | self._observableFactory = observableFactory 31 | super.init(observer: observer, cancel: cancel) 32 | } 33 | 34 | func run() -> Disposable { 35 | do { 36 | let result = try self._observableFactory() 37 | return result.subscribe(self) 38 | } 39 | catch let e { 40 | self.forwardOn(.error(e)) 41 | self.dispose() 42 | return Disposables.create() 43 | } 44 | } 45 | 46 | func on(_ event: Event) { 47 | self.forwardOn(event) 48 | 49 | switch event { 50 | case .next: 51 | break 52 | case .error: 53 | self.dispose() 54 | case .completed: 55 | self.dispose() 56 | } 57 | } 58 | } 59 | 60 | final private class Deferred: Producer { 61 | typealias Factory = () throws -> Source 62 | 63 | private let _observableFactory : Factory 64 | 65 | init(observableFactory: @escaping Factory) { 66 | self._observableFactory = observableFactory 67 | } 68 | 69 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) 70 | where Observer.Element == Source.Element { 71 | let sink = DeferredSink(observableFactory: self._observableFactory, observer: observer, cancel: cancel) 72 | let subscription = sink.run() 73 | return (sink: sink, subscription: subscription) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/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 | extension ObservableType { 10 | 11 | /** 12 | Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers. 13 | 14 | - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html) 15 | 16 | - parameter dueTime: Relative time shift of the subscription. 17 | - parameter scheduler: Scheduler to run the subscription delay timer on. 18 | - returns: Time-shifted sequence. 19 | */ 20 | public func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType) 21 | -> Observable { 22 | return DelaySubscription(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler) 23 | } 24 | } 25 | 26 | final private class DelaySubscriptionSink 27 | : Sink, ObserverType { 28 | typealias Element = Observer.Element 29 | 30 | func on(_ event: Event) { 31 | self.forwardOn(event) 32 | if event.isStopEvent { 33 | self.dispose() 34 | } 35 | } 36 | 37 | } 38 | 39 | final private class DelaySubscription: Producer { 40 | private let _source: Observable 41 | private let _dueTime: RxTimeInterval 42 | private let _scheduler: SchedulerType 43 | 44 | init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { 45 | self._source = source 46 | self._dueTime = dueTime 47 | self._scheduler = scheduler 48 | } 49 | 50 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 51 | let sink = DelaySubscriptionSink(observer: observer, cancel: cancel) 52 | let subscription = self._scheduler.scheduleRelative((), dueTime: self._dueTime) { _ in 53 | return self._source.subscribe(sink) 54 | } 55 | 56 | return (sink: sink, subscription: subscription) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Dematerialize.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Dematerialize.swift 3 | // RxSwift 4 | // 5 | // Created by Jamie Pinkham on 3/13/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType where Element: EventConvertible { 10 | /** 11 | Convert any previously materialized Observable into it's original form. 12 | - seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html) 13 | - returns: The dematerialized observable sequence. 14 | */ 15 | public func dematerialize() -> Observable { 16 | return Dematerialize(source: self.asObservable()) 17 | } 18 | 19 | } 20 | 21 | private final class DematerializeSink: Sink, ObserverType where Observer.Element == T.Element { 22 | fileprivate func on(_ event: Event) { 23 | switch event { 24 | case .next(let element): 25 | self.forwardOn(element.event) 26 | if element.event.isStopEvent { 27 | self.dispose() 28 | } 29 | case .completed: 30 | self.forwardOn(.completed) 31 | self.dispose() 32 | case .error(let error): 33 | self.forwardOn(.error(error)) 34 | self.dispose() 35 | } 36 | } 37 | } 38 | 39 | final private class Dematerialize: Producer { 40 | private let _source: Observable 41 | 42 | init(source: Observable) { 43 | self._source = source 44 | } 45 | 46 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == T.Element { 47 | let sink = DematerializeSink(observer: observer, cancel: cancel) 48 | let subscription = self._source.subscribe(sink) 49 | return (sink: sink, subscription: subscription) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Empty.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Empty.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | /** 11 | Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message. 12 | 13 | - seealso: [empty operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) 14 | 15 | - returns: An observable sequence with no elements. 16 | */ 17 | public static func empty() -> Observable { 18 | return EmptyProducer() 19 | } 20 | } 21 | 22 | final private class EmptyProducer: Producer { 23 | override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { 24 | observer.on(.completed) 25 | return Disposables.create() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Enumerated.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Enumerated.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/6/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Enumerates the elements of an observable sequence. 13 | 14 | - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html) 15 | 16 | - returns: An observable sequence that contains tuples of source sequence elements and their indexes. 17 | */ 18 | public func enumerated() 19 | -> Observable<(index: Int, element: Element)> { 20 | return Enumerated(source: self.asObservable()) 21 | } 22 | } 23 | 24 | final private class EnumeratedSink: Sink, ObserverType where Observer.Element == (index: Int, element: Element) { 25 | var index = 0 26 | 27 | func on(_ event: Event) { 28 | switch event { 29 | case .next(let value): 30 | do { 31 | let nextIndex = try incrementChecked(&self.index) 32 | let next = (index: nextIndex, element: value) 33 | self.forwardOn(.next(next)) 34 | } 35 | catch let e { 36 | self.forwardOn(.error(e)) 37 | self.dispose() 38 | } 39 | case .completed: 40 | self.forwardOn(.completed) 41 | self.dispose() 42 | case .error(let error): 43 | self.forwardOn(.error(error)) 44 | self.dispose() 45 | } 46 | } 47 | } 48 | 49 | final private class Enumerated: Producer<(index: Int, element: Element)> { 50 | private let _source: Observable 51 | 52 | init(source: Observable) { 53 | self._source = source 54 | } 55 | 56 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == (index: Int, element: Element) { 57 | let sink = EnumeratedSink(observer: observer, cancel: cancel) 58 | let subscription = self._source.subscribe(sink) 59 | return (sink: sink, subscription: subscription) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Error.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Error.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | /** 11 | Returns an observable sequence that terminates with an `error`. 12 | 13 | - seealso: [throw operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) 14 | 15 | - returns: The observable sequence that terminates with specified error. 16 | */ 17 | public static func error(_ error: Swift.Error) -> Observable { 18 | return ErrorProducer(error: error) 19 | } 20 | } 21 | 22 | final private class ErrorProducer: Producer { 23 | private let _error: Swift.Error 24 | 25 | init(error: Swift.Error) { 26 | self._error = error 27 | } 28 | 29 | override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { 30 | observer.on(.error(self._error)) 31 | return Disposables.create() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/First.swift: -------------------------------------------------------------------------------- 1 | // 2 | // First.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 7/31/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | private final class FirstSink : Sink, ObserverType where Observer.Element == Element? { 10 | typealias Parent = First 11 | 12 | func on(_ event: Event) { 13 | switch event { 14 | case .next(let value): 15 | self.forwardOn(.next(value)) 16 | self.forwardOn(.completed) 17 | self.dispose() 18 | case .error(let error): 19 | self.forwardOn(.error(error)) 20 | self.dispose() 21 | case .completed: 22 | self.forwardOn(.next(nil)) 23 | self.forwardOn(.completed) 24 | self.dispose() 25 | } 26 | } 27 | } 28 | 29 | final class First: Producer { 30 | private let _source: Observable 31 | 32 | init(source: Observable) { 33 | self._source = source 34 | } 35 | 36 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element? { 37 | let sink = FirstSink(observer: observer, cancel: cancel) 38 | let subscription = self._source.subscribe(sink) 39 | return (sink: sink, subscription: subscription) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Map.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Map.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Projects each element of an observable sequence into a new form. 13 | 14 | - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html) 15 | 16 | - parameter transform: A transform function to apply to each source element. 17 | - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source. 18 | 19 | */ 20 | public func map(_ transform: @escaping (Element) throws -> Result) 21 | -> Observable { 22 | return Map(source: self.asObservable(), transform: transform) 23 | } 24 | } 25 | 26 | final private class MapSink: Sink, ObserverType { 27 | typealias Transform = (SourceType) throws -> ResultType 28 | 29 | typealias ResultType = Observer.Element 30 | typealias Element = SourceType 31 | 32 | private let _transform: Transform 33 | 34 | init(transform: @escaping Transform, observer: Observer, cancel: Cancelable) { 35 | self._transform = transform 36 | super.init(observer: observer, cancel: cancel) 37 | } 38 | 39 | func on(_ event: Event) { 40 | switch event { 41 | case .next(let element): 42 | do { 43 | let mappedElement = try self._transform(element) 44 | self.forwardOn(.next(mappedElement)) 45 | } 46 | catch let e { 47 | self.forwardOn(.error(e)) 48 | self.dispose() 49 | } 50 | case .error(let error): 51 | self.forwardOn(.error(error)) 52 | self.dispose() 53 | case .completed: 54 | self.forwardOn(.completed) 55 | self.dispose() 56 | } 57 | } 58 | } 59 | 60 | final private class Map: Producer { 61 | typealias Transform = (SourceType) throws -> ResultType 62 | 63 | private let _source: Observable 64 | 65 | private let _transform: Transform 66 | 67 | init(source: Observable, transform: @escaping Transform) { 68 | self._source = source 69 | self._transform = transform 70 | } 71 | 72 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType { 73 | let sink = MapSink(transform: self._transform, observer: observer, cancel: cancel) 74 | let subscription = self._source.subscribe(sink) 75 | return (sink: sink, subscription: subscription) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Materialize.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Materialize.swift 3 | // RxSwift 4 | // 5 | // Created by sergdort on 08/03/2017. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | /** 11 | Convert any Observable into an Observable of its events. 12 | - seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html) 13 | - returns: An observable sequence that wraps events in an Event. The returned Observable never errors, but it does complete after observing all of the events of the underlying Observable. 14 | */ 15 | public func materialize() -> Observable> { 16 | return Materialize(source: self.asObservable()) 17 | } 18 | } 19 | 20 | private final class MaterializeSink: Sink, ObserverType where Observer.Element == Event { 21 | 22 | func on(_ event: Event) { 23 | self.forwardOn(.next(event)) 24 | if event.isStopEvent { 25 | self.forwardOn(.completed) 26 | self.dispose() 27 | } 28 | } 29 | } 30 | 31 | final private class Materialize: Producer> { 32 | private let _source: Observable 33 | 34 | init(source: Observable) { 35 | self._source = source 36 | } 37 | 38 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 39 | let sink = MaterializeSink(observer: observer, cancel: cancel) 40 | let subscription = self._source.subscribe(sink) 41 | 42 | return (sink: sink, subscription: subscription) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Never.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Never.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 8/30/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Returns a non-terminating observable sequence, which can be used to denote an infinite duration. 13 | 14 | - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) 15 | 16 | - returns: An observable sequence whose observers will never get called. 17 | */ 18 | public static func never() -> Observable { 19 | return NeverProducer() 20 | } 21 | } 22 | 23 | final private class NeverProducer: Producer { 24 | override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { 25 | return Disposables.create() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Range.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Range.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType where Element : RxAbstractInteger { 10 | /** 11 | Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to generate and send out observer messages. 12 | 13 | - seealso: [range operator on reactivex.io](http://reactivex.io/documentation/operators/range.html) 14 | 15 | - parameter start: The value of the first integer in the sequence. 16 | - parameter count: The number of sequential integers to generate. 17 | - parameter scheduler: Scheduler to run the generator loop on. 18 | - returns: An observable sequence that contains a range of sequential integral numbers. 19 | */ 20 | public static func range(start: Element, count: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { 21 | return RangeProducer(start: start, count: count, scheduler: scheduler) 22 | } 23 | } 24 | 25 | final private class RangeProducer: Producer { 26 | fileprivate let _start: Element 27 | fileprivate let _count: Element 28 | fileprivate let _scheduler: ImmediateSchedulerType 29 | 30 | init(start: Element, count: Element, scheduler: ImmediateSchedulerType) { 31 | guard count >= 0 else { 32 | rxFatalError("count can't be negative") 33 | } 34 | 35 | guard start &+ (count - 1) >= start || count == 0 else { 36 | rxFatalError("overflow of count") 37 | } 38 | 39 | self._start = start 40 | self._count = count 41 | self._scheduler = scheduler 42 | } 43 | 44 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 45 | let sink = RangeSink(parent: self, observer: observer, cancel: cancel) 46 | let subscription = sink.run() 47 | return (sink: sink, subscription: subscription) 48 | } 49 | } 50 | 51 | final private class RangeSink: Sink where Observer.Element: RxAbstractInteger { 52 | typealias Parent = RangeProducer 53 | 54 | private let _parent: Parent 55 | 56 | init(parent: Parent, observer: Observer, cancel: Cancelable) { 57 | self._parent = parent 58 | super.init(observer: observer, cancel: cancel) 59 | } 60 | 61 | func run() -> Disposable { 62 | return self._parent._scheduler.scheduleRecursive(0 as Observer.Element) { i, recurse in 63 | if i < self._parent._count { 64 | self.forwardOn(.next(self._parent._start + i)) 65 | recurse(i + 1) 66 | } 67 | else { 68 | self.forwardOn(.completed) 69 | self.dispose() 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Repeat.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Repeat.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/13/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | /** 11 | Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages. 12 | 13 | - seealso: [repeat operator on reactivex.io](http://reactivex.io/documentation/operators/repeat.html) 14 | 15 | - parameter element: Element to repeat. 16 | - parameter scheduler: Scheduler to run the producer loop on. 17 | - returns: An observable sequence that repeats the given element infinitely. 18 | */ 19 | public static func repeatElement(_ element: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { 20 | return RepeatElement(element: element, scheduler: scheduler) 21 | } 22 | } 23 | 24 | final private class RepeatElement: Producer { 25 | fileprivate let _element: Element 26 | fileprivate let _scheduler: ImmediateSchedulerType 27 | 28 | init(element: Element, scheduler: ImmediateSchedulerType) { 29 | self._element = element 30 | self._scheduler = scheduler 31 | } 32 | 33 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 34 | let sink = RepeatElementSink(parent: self, observer: observer, cancel: cancel) 35 | let subscription = sink.run() 36 | 37 | return (sink: sink, subscription: subscription) 38 | } 39 | } 40 | 41 | final private class RepeatElementSink: Sink { 42 | typealias Parent = RepeatElement 43 | 44 | private let _parent: Parent 45 | 46 | init(parent: Parent, observer: Observer, cancel: Cancelable) { 47 | self._parent = parent 48 | super.init(observer: observer, cancel: cancel) 49 | } 50 | 51 | func run() -> Disposable { 52 | return self._parent._scheduler.scheduleRecursive(self._parent._element) { e, recurse in 53 | self.forwardOn(.next(e)) 54 | recurse(e) 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/Sink.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Sink.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/19/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | class Sink : Disposable { 10 | fileprivate let _observer: Observer 11 | fileprivate let _cancel: Cancelable 12 | private let _disposed = AtomicInt(0) 13 | 14 | #if DEBUG 15 | private let _synchronizationTracker = SynchronizationTracker() 16 | #endif 17 | 18 | init(observer: Observer, cancel: Cancelable) { 19 | #if TRACE_RESOURCES 20 | _ = Resources.incrementTotal() 21 | #endif 22 | self._observer = observer 23 | self._cancel = cancel 24 | } 25 | 26 | final func forwardOn(_ event: Event) { 27 | #if DEBUG 28 | self._synchronizationTracker.register(synchronizationErrorMessage: .default) 29 | defer { self._synchronizationTracker.unregister() } 30 | #endif 31 | if isFlagSet(self._disposed, 1) { 32 | return 33 | } 34 | self._observer.on(event) 35 | } 36 | 37 | final func forwarder() -> SinkForward { 38 | return SinkForward(forward: self) 39 | } 40 | 41 | final var disposed: Bool { 42 | return isFlagSet(self._disposed, 1) 43 | } 44 | 45 | func dispose() { 46 | fetchOr(self._disposed, 1) 47 | self._cancel.dispose() 48 | } 49 | 50 | deinit { 51 | #if TRACE_RESOURCES 52 | _ = Resources.decrementTotal() 53 | #endif 54 | } 55 | } 56 | 57 | final class SinkForward: ObserverType { 58 | typealias Element = Observer.Element 59 | 60 | private let _forward: Sink 61 | 62 | init(forward: Sink) { 63 | self._forward = forward 64 | } 65 | 66 | final func on(_ event: Event) { 67 | switch event { 68 | case .next: 69 | self._forward._observer.on(event) 70 | case .error, .completed: 71 | self._forward._observer.on(event) 72 | self._forward._cancel.dispose() 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/SkipWhile.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SkipWhile.swift 3 | // RxSwift 4 | // 5 | // Created by Yury Korolev on 10/9/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. 13 | 14 | - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html) 15 | 16 | - parameter predicate: A function to test each element for a condition. 17 | - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. 18 | */ 19 | public func skipWhile(_ predicate: @escaping (Element) throws -> Bool) -> Observable { 20 | return SkipWhile(source: self.asObservable(), predicate: predicate) 21 | } 22 | } 23 | 24 | final private class SkipWhileSink: Sink, ObserverType { 25 | typealias Element = Observer.Element 26 | typealias Parent = SkipWhile 27 | 28 | private let _parent: Parent 29 | private var _running = false 30 | 31 | init(parent: Parent, observer: Observer, cancel: Cancelable) { 32 | self._parent = parent 33 | super.init(observer: observer, cancel: cancel) 34 | } 35 | 36 | func on(_ event: Event) { 37 | switch event { 38 | case .next(let value): 39 | if !self._running { 40 | do { 41 | self._running = try !self._parent._predicate(value) 42 | } catch let e { 43 | self.forwardOn(.error(e)) 44 | self.dispose() 45 | return 46 | } 47 | } 48 | 49 | if self._running { 50 | self.forwardOn(.next(value)) 51 | } 52 | case .error, .completed: 53 | self.forwardOn(event) 54 | self.dispose() 55 | } 56 | } 57 | } 58 | 59 | final private class SkipWhile: Producer { 60 | typealias Predicate = (Element) throws -> Bool 61 | 62 | private let _source: Observable 63 | fileprivate let _predicate: Predicate 64 | 65 | init(source: Observable, predicate: @escaping Predicate) { 66 | self._source = source 67 | self._predicate = predicate 68 | } 69 | 70 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 71 | let sink = SkipWhileSink(parent: self, observer: observer, cancel: cancel) 72 | let subscription = self._source.subscribe(sink) 73 | return (sink: sink, subscription: subscription) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/StartWith.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StartWith.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/6/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Prepends a sequence of values to an observable sequence. 13 | 14 | - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html) 15 | 16 | - parameter elements: Elements to prepend to the specified sequence. 17 | - returns: The source sequence prepended with the specified values. 18 | */ 19 | public func startWith(_ elements: Element ...) 20 | -> Observable { 21 | return StartWith(source: self.asObservable(), elements: elements) 22 | } 23 | } 24 | 25 | final private class StartWith: Producer { 26 | let elements: [Element] 27 | let source: Observable 28 | 29 | init(source: Observable, elements: [Element]) { 30 | self.source = source 31 | self.elements = elements 32 | super.init() 33 | } 34 | 35 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 36 | for e in self.elements { 37 | observer.on(.next(e)) 38 | } 39 | 40 | return (sink: Disposables.create(), subscription: self.source.subscribe(observer)) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/TakeLast.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TakeLast.swift 3 | // RxSwift 4 | // 5 | // Created by Tomi Koskinen on 25/10/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Returns a specified number of contiguous elements from the end of an observable sequence. 13 | 14 | This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. 15 | 16 | - seealso: [takeLast operator on reactivex.io](http://reactivex.io/documentation/operators/takelast.html) 17 | 18 | - parameter count: Number of elements to take from the end of the source sequence. 19 | - returns: An observable sequence containing the specified number of elements from the end of the source sequence. 20 | */ 21 | public func takeLast(_ count: Int) 22 | -> Observable { 23 | return TakeLast(source: self.asObservable(), count: count) 24 | } 25 | } 26 | 27 | final private class TakeLastSink: Sink, ObserverType { 28 | typealias Element = Observer.Element 29 | typealias Parent = TakeLast 30 | 31 | private let _parent: Parent 32 | 33 | private var _elements: Queue 34 | 35 | init(parent: Parent, observer: Observer, cancel: Cancelable) { 36 | self._parent = parent 37 | self._elements = Queue(capacity: parent._count + 1) 38 | super.init(observer: observer, cancel: cancel) 39 | } 40 | 41 | func on(_ event: Event) { 42 | switch event { 43 | case .next(let value): 44 | self._elements.enqueue(value) 45 | if self._elements.count > self._parent._count { 46 | _ = self._elements.dequeue() 47 | } 48 | case .error: 49 | self.forwardOn(event) 50 | self.dispose() 51 | case .completed: 52 | for e in self._elements { 53 | self.forwardOn(.next(e)) 54 | } 55 | self.forwardOn(.completed) 56 | self.dispose() 57 | } 58 | } 59 | } 60 | 61 | final private class TakeLast: Producer { 62 | private let _source: Observable 63 | fileprivate let _count: Int 64 | 65 | init(source: Observable, count: Int) { 66 | if count < 0 { 67 | rxFatalError("count can't be negative") 68 | } 69 | self._source = source 70 | self._count = count 71 | } 72 | 73 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 74 | let sink = TakeLastSink(parent: self, observer: observer, cancel: cancel) 75 | let subscription = self._source.subscribe(sink) 76 | return (sink: sink, subscription: subscription) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/TakeWhile.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TakeWhile.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 6/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | 11 | /** 12 | Returns elements from an observable sequence as long as a specified condition is true. 13 | 14 | - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html) 15 | 16 | - parameter predicate: A function to test each element for a condition. 17 | - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. 18 | */ 19 | public func takeWhile(_ predicate: @escaping (Element) throws -> Bool) 20 | -> Observable { 21 | return TakeWhile(source: self.asObservable(), predicate: predicate) 22 | } 23 | } 24 | 25 | final private class TakeWhileSink 26 | : Sink 27 | , ObserverType { 28 | typealias Element = Observer.Element 29 | typealias Parent = TakeWhile 30 | 31 | private let _parent: Parent 32 | 33 | private var _running = true 34 | 35 | init(parent: Parent, observer: Observer, cancel: Cancelable) { 36 | self._parent = parent 37 | super.init(observer: observer, cancel: cancel) 38 | } 39 | 40 | func on(_ event: Event) { 41 | switch event { 42 | case .next(let value): 43 | if !self._running { 44 | return 45 | } 46 | 47 | do { 48 | self._running = try self._parent._predicate(value) 49 | } catch let e { 50 | self.forwardOn(.error(e)) 51 | self.dispose() 52 | return 53 | } 54 | 55 | if self._running { 56 | self.forwardOn(.next(value)) 57 | } else { 58 | self.forwardOn(.completed) 59 | self.dispose() 60 | } 61 | case .error, .completed: 62 | self.forwardOn(event) 63 | self.dispose() 64 | } 65 | } 66 | 67 | } 68 | 69 | final private class TakeWhile: Producer { 70 | typealias Predicate = (Element) throws -> Bool 71 | 72 | private let _source: Observable 73 | fileprivate let _predicate: Predicate 74 | 75 | init(source: Observable, predicate: @escaping Predicate) { 76 | self._source = source 77 | self._predicate = predicate 78 | } 79 | 80 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { 81 | let sink = TakeWhileSink(parent: self, observer: observer, cancel: cancel) 82 | let subscription = self._source.subscribe(sink) 83 | return (sink: sink, subscription: subscription) 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observables/ToArray.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToArray.swift 3 | // RxSwift 4 | // 5 | // Created by Junior B. on 20/10/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | 10 | extension ObservableType { 11 | 12 | /** 13 | Converts an Observable into a Single that emits the whole sequence as a single array and then terminates. 14 | 15 | For aggregation behavior see `reduce`. 16 | 17 | - seealso: [toArray operator on reactivex.io](http://reactivex.io/documentation/operators/to.html) 18 | 19 | - returns: A Single sequence containing all the emitted elements as array. 20 | */ 21 | public func toArray() 22 | -> Single<[Element]> { 23 | return PrimitiveSequence(raw: ToArray(source: self.asObservable())) 24 | } 25 | } 26 | 27 | final private class ToArraySink: Sink, ObserverType where Observer.Element == [SourceType] { 28 | typealias Parent = ToArray 29 | 30 | let _parent: Parent 31 | var _list = [SourceType]() 32 | 33 | init(parent: Parent, observer: Observer, cancel: Cancelable) { 34 | self._parent = parent 35 | 36 | super.init(observer: observer, cancel: cancel) 37 | } 38 | 39 | func on(_ event: Event) { 40 | switch event { 41 | case .next(let value): 42 | self._list.append(value) 43 | case .error(let e): 44 | self.forwardOn(.error(e)) 45 | self.dispose() 46 | case .completed: 47 | self.forwardOn(.next(self._list)) 48 | self.forwardOn(.completed) 49 | self.dispose() 50 | } 51 | } 52 | } 53 | 54 | final private class ToArray: Producer<[SourceType]> { 55 | let _source: Observable 56 | 57 | init(source: Observable) { 58 | self._source = source 59 | } 60 | 61 | override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == [SourceType] { 62 | let sink = ToArraySink(parent: self, observer: observer, cancel: cancel) 63 | let subscription = self._source.subscribe(sink) 64 | return (sink: sink, subscription: subscription) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/ObserverType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObserverType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Supports push-style iteration over an observable sequence. 10 | public protocol ObserverType { 11 | /// The type of elements in sequence that observer can observe. 12 | associatedtype Element 13 | 14 | @available(*, deprecated, renamed: "Element") 15 | typealias E = Element 16 | 17 | /// Notify observer about sequence event. 18 | /// 19 | /// - parameter event: Event that occurred. 20 | func on(_ event: Event) 21 | } 22 | 23 | /// Convenience API extensions to provide alternate next, error, completed events 24 | extension ObserverType { 25 | 26 | /// Convenience method equivalent to `on(.next(element: Element))` 27 | /// 28 | /// - parameter element: Next element to send to observer(s) 29 | public func onNext(_ element: Element) { 30 | self.on(.next(element)) 31 | } 32 | 33 | /// Convenience method equivalent to `on(.completed)` 34 | public func onCompleted() { 35 | self.on(.completed) 36 | } 37 | 38 | /// Convenience method equivalent to `on(.error(Swift.Error))` 39 | /// - parameter error: Swift.Error to send to observer(s) 40 | public func onError(_ error: Swift.Error) { 41 | self.on(.error(error)) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnonymousObserver.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | final class AnonymousObserver: ObserverBase { 10 | typealias EventHandler = (Event) -> Void 11 | 12 | private let _eventHandler : EventHandler 13 | 14 | init(_ eventHandler: @escaping EventHandler) { 15 | #if TRACE_RESOURCES 16 | _ = Resources.incrementTotal() 17 | #endif 18 | self._eventHandler = eventHandler 19 | } 20 | 21 | override func onCore(_ event: Event) { 22 | return self._eventHandler(event) 23 | } 24 | 25 | #if TRACE_RESOURCES 26 | deinit { 27 | _ = Resources.decrementTotal() 28 | } 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Observers/ObserverBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObserverBase.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/15/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | class ObserverBase : Disposable, ObserverType { 10 | private let _isStopped = AtomicInt(0) 11 | 12 | func on(_ event: Event) { 13 | switch event { 14 | case .next: 15 | if load(self._isStopped) == 0 { 16 | self.onCore(event) 17 | } 18 | case .error, .completed: 19 | if fetchOr(self._isStopped, 1) == 0 { 20 | self.onCore(event) 21 | } 22 | } 23 | } 24 | 25 | func onCore(_ event: Event) { 26 | rxAbstractMethod() 27 | } 28 | 29 | func dispose() { 30 | fetchOr(self._isStopped, 1) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Reactive.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Reactive.swift 3 | // RxSwift 4 | // 5 | // Created by Yury Korolev on 5/2/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /** 10 | Use `Reactive` proxy as customization point for constrained protocol extensions. 11 | 12 | General pattern would be: 13 | 14 | // 1. Extend Reactive protocol with constrain on Base 15 | // Read as: Reactive Extension where Base is a SomeType 16 | extension Reactive where Base: SomeType { 17 | // 2. Put any specific reactive extension for SomeType here 18 | } 19 | 20 | With this approach we can have more specialized methods and properties using 21 | `Base` and not just specialized on common base type. 22 | 23 | */ 24 | 25 | public struct Reactive { 26 | /// Base object to extend. 27 | public let base: Base 28 | 29 | /// Creates extensions with base object. 30 | /// 31 | /// - parameter base: Base object. 32 | public init(_ base: Base) { 33 | self.base = base 34 | } 35 | } 36 | 37 | /// A type that has reactive extensions. 38 | public protocol ReactiveCompatible { 39 | /// Extended type 40 | associatedtype ReactiveBase 41 | 42 | @available(*, deprecated, renamed: "ReactiveBase") 43 | typealias CompatibleType = ReactiveBase 44 | 45 | /// Reactive extensions. 46 | static var rx: Reactive.Type { get set } 47 | 48 | /// Reactive extensions. 49 | var rx: Reactive { get set } 50 | } 51 | 52 | extension ReactiveCompatible { 53 | /// Reactive extensions. 54 | public static var rx: Reactive.Type { 55 | get { 56 | return Reactive.self 57 | } 58 | // swiftlint:disable:next unused_setter_value 59 | set { 60 | // this enables using Reactive to "mutate" base type 61 | } 62 | } 63 | 64 | /// Reactive extensions. 65 | public var rx: Reactive { 66 | get { 67 | return Reactive(self) 68 | } 69 | // swiftlint:disable:next unused_setter_value 70 | set { 71 | // this enables using Reactive to "mutate" base object 72 | } 73 | } 74 | } 75 | 76 | import class Foundation.NSObject 77 | 78 | /// Extend NSObject with `rx` proxy. 79 | extension NSObject: ReactiveCompatible { } 80 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/RxMutableBox.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RxMutableBox.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 5/22/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | #if os(Linux) 10 | /// As Swift 5 was released, A patch to `Thread` for Linux 11 | /// changed `threadDictionary` to a `NSMutableDictionary` instead of 12 | /// a `Dictionary`: https://github.com/apple/swift-corelibs-foundation/pull/1762/files 13 | /// 14 | /// This means that on Linux specifically, `RxMutableBox` must be a `NSObject` 15 | /// or it won't be possible to store it in `Thread.threadDictionary`. 16 | /// 17 | /// For more information, read the discussion at: 18 | /// https://github.com/ReactiveX/RxSwift/issues/1911#issuecomment-479723298 19 | import class Foundation.NSObject 20 | 21 | /// Creates mutable reference wrapper for any type. 22 | final class RxMutableBox: NSObject { 23 | /// Wrapped value 24 | var value: T 25 | 26 | /// Creates reference wrapper for `value`. 27 | /// 28 | /// - parameter value: Value to wrap. 29 | init (_ value: T) { 30 | self.value = value 31 | } 32 | } 33 | #else 34 | /// Creates mutable reference wrapper for any type. 35 | final class RxMutableBox: CustomDebugStringConvertible { 36 | /// Wrapped value 37 | var value: T 38 | 39 | /// Creates reference wrapper for `value`. 40 | /// 41 | /// - parameter value: Value to wrap. 42 | init (_ value: T) { 43 | self.value = value 44 | } 45 | } 46 | 47 | extension RxMutableBox { 48 | /// - returns: Box description. 49 | var debugDescription: String { 50 | return "MutatingBox(\(self.value))" 51 | } 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HistoricalScheduler.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 12/27/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import struct Foundation.Date 10 | 11 | /// Provides a virtual time scheduler that uses `Date` for absolute time and `NSTimeInterval` for relative time. 12 | public class HistoricalScheduler : VirtualTimeScheduler { 13 | 14 | /** 15 | Creates a new historical scheduler with initial clock value. 16 | 17 | - parameter initialClock: Initial value for virtual clock. 18 | */ 19 | public init(initialClock: RxTime = Date(timeIntervalSince1970: 0)) { 20 | super.init(initialClock: initialClock, converter: HistoricalSchedulerTimeConverter()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HistoricalSchedulerTimeConverter.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 12/27/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Converts historical virtual time into real time. 12 | /// 13 | /// Since historical virtual time is also measured in `Date`, this converter is identity function. 14 | public struct HistoricalSchedulerTimeConverter : VirtualTimeConverterType { 15 | /// Virtual time unit used that represents ticks of virtual clock. 16 | public typealias VirtualTimeUnit = RxTime 17 | 18 | /// Virtual time unit used to represent differences of virtual times. 19 | public typealias VirtualTimeIntervalUnit = TimeInterval 20 | 21 | /// Returns identical value of argument passed because historical virtual time is equal to real time, just 22 | /// decoupled from local machine clock. 23 | public func convertFromVirtualTime(_ virtualTime: VirtualTimeUnit) -> RxTime { 24 | return virtualTime 25 | } 26 | 27 | /// Returns identical value of argument passed because historical virtual time is equal to real time, just 28 | /// decoupled from local machine clock. 29 | public func convertToVirtualTime(_ time: RxTime) -> VirtualTimeUnit { 30 | return time 31 | } 32 | 33 | /// Returns identical value of argument passed because historical virtual time is equal to real time, just 34 | /// decoupled from local machine clock. 35 | public func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> TimeInterval { 36 | return virtualTimeInterval 37 | } 38 | 39 | /// Returns identical value of argument passed because historical virtual time is equal to real time, just 40 | /// decoupled from local machine clock. 41 | public func convertToVirtualTimeInterval(_ timeInterval: TimeInterval) -> VirtualTimeIntervalUnit { 42 | return timeInterval 43 | } 44 | 45 | /** 46 | Offsets `Date` by time interval. 47 | 48 | - parameter time: Time. 49 | - parameter timeInterval: Time interval offset. 50 | - returns: Time offsetted by time interval. 51 | */ 52 | public func offsetVirtualTime(_ time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit { 53 | return time.addingTimeInterval(offset) 54 | } 55 | 56 | /// Compares two `Date`s. 57 | public func compareVirtualTime(_ lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison { 58 | switch lhs.compare(rhs as Date) { 59 | case .orderedAscending: 60 | return .lessThan 61 | case .orderedSame: 62 | return .equal 63 | case .orderedDescending: 64 | return .greaterThan 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InvocableScheduledItem.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | struct InvocableScheduledItem : InvocableType { 10 | 11 | let _invocable: I 12 | let _state: I.Value 13 | 14 | init(invocable: I, state: I.Value) { 15 | self._invocable = invocable 16 | self._state = state 17 | } 18 | 19 | func invoke() { 20 | self._invocable.invoke(self._state) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InvocableType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | protocol InvocableType { 10 | func invoke() 11 | } 12 | 13 | protocol InvocableWithValueType { 14 | associatedtype Value 15 | 16 | func invoke(_ value: Value) 17 | } 18 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScheduledItem.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/2/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | struct ScheduledItem 10 | : ScheduledItemType 11 | , InvocableType { 12 | typealias Action = (T) -> Disposable 13 | 14 | private let _action: Action 15 | private let _state: T 16 | 17 | private let _disposable = SingleAssignmentDisposable() 18 | 19 | var isDisposed: Bool { 20 | return self._disposable.isDisposed 21 | } 22 | 23 | init(action: @escaping Action, state: T) { 24 | self._action = action 25 | self._state = state 26 | } 27 | 28 | func invoke() { 29 | self._disposable.setDisposable(self._action(self._state)) 30 | } 31 | 32 | func dispose() { 33 | self._disposable.dispose() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScheduledItemType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 11/7/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | protocol ScheduledItemType 10 | : Cancelable 11 | , InvocableType { 12 | func invoke() 13 | } 14 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OperationQueueScheduler.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 4/4/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import class Foundation.Operation 10 | import class Foundation.OperationQueue 11 | import class Foundation.BlockOperation 12 | import Dispatch 13 | 14 | /// Abstracts the work that needs to be performed on a specific `NSOperationQueue`. 15 | /// 16 | /// This scheduler is suitable for cases when there is some bigger chunk of work that needs to be performed in background and you want to fine tune concurrent processing using `maxConcurrentOperationCount`. 17 | public class OperationQueueScheduler: ImmediateSchedulerType { 18 | public let operationQueue: OperationQueue 19 | public let queuePriority: Operation.QueuePriority 20 | 21 | /// Constructs new instance of `OperationQueueScheduler` that performs work on `operationQueue`. 22 | /// 23 | /// - parameter operationQueue: Operation queue targeted to perform work on. 24 | /// - parameter queuePriority: Queue priority which will be assigned to new operations. 25 | public init(operationQueue: OperationQueue, queuePriority: Operation.QueuePriority = .normal) { 26 | self.operationQueue = operationQueue 27 | self.queuePriority = queuePriority 28 | } 29 | 30 | /** 31 | Schedules an action to be executed recursively. 32 | 33 | - parameter state: State passed to the action to be executed. 34 | - 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. 35 | - returns: The disposable object used to cancel the scheduled action (best effort). 36 | */ 37 | public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { 38 | let cancel = SingleAssignmentDisposable() 39 | 40 | let operation = BlockOperation { 41 | if cancel.isDisposed { 42 | return 43 | } 44 | 45 | 46 | cancel.setDisposable(action(state)) 47 | } 48 | 49 | operation.queuePriority = self.queuePriority 50 | 51 | self.operationQueue.addOperation(operation) 52 | 53 | return cancel 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SchedulerServices+Emulation.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 6/6/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | enum SchedulePeriodicRecursiveCommand { 10 | case tick 11 | case dispatchStart 12 | } 13 | 14 | final class SchedulePeriodicRecursive { 15 | typealias RecursiveAction = (State) -> State 16 | typealias RecursiveScheduler = AnyRecursiveScheduler 17 | 18 | private let _scheduler: SchedulerType 19 | private let _startAfter: RxTimeInterval 20 | private let _period: RxTimeInterval 21 | private let _action: RecursiveAction 22 | 23 | private var _state: State 24 | private let _pendingTickCount = AtomicInt(0) 25 | 26 | init(scheduler: SchedulerType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping RecursiveAction, state: State) { 27 | self._scheduler = scheduler 28 | self._startAfter = startAfter 29 | self._period = period 30 | self._action = action 31 | self._state = state 32 | } 33 | 34 | func start() -> Disposable { 35 | return self._scheduler.scheduleRecursive(SchedulePeriodicRecursiveCommand.tick, dueTime: self._startAfter, action: self.tick) 36 | } 37 | 38 | func tick(_ command: SchedulePeriodicRecursiveCommand, scheduler: RecursiveScheduler) { 39 | // Tries to emulate periodic scheduling as best as possible. 40 | // The problem that could arise is if handling periodic ticks take too long, or 41 | // tick interval is short. 42 | switch command { 43 | case .tick: 44 | scheduler.schedule(.tick, dueTime: self._period) 45 | 46 | // The idea is that if on tick there wasn't any item enqueued, schedule to perform work immediately. 47 | // Else work will be scheduled after previous enqueued work completes. 48 | if increment(self._pendingTickCount) == 0 { 49 | self.tick(.dispatchStart, scheduler: scheduler) 50 | } 51 | 52 | case .dispatchStart: 53 | self._state = self._action(self._state) 54 | // Start work and schedule check is this last batch of work 55 | if decrement(self._pendingTickCount) > 1 { 56 | // This gives priority to scheduler emulation, it's not perfect, but helps 57 | scheduler.schedule(SchedulePeriodicRecursiveCommand.dispatchStart) 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Subjects/SubjectType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SubjectType.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 3/1/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /// Represents an object that is both an observable sequence as well as an observer. 10 | public protocol SubjectType : ObservableType { 11 | /// The type of the observer that represents this subject. 12 | /// 13 | /// Usually this type is type of subject itself, but it doesn't have to be. 14 | associatedtype Observer: ObserverType 15 | 16 | @available(*, deprecated, renamed: "Observer") 17 | typealias SubjectObserverType = Observer 18 | 19 | /// Returns observer interface for subject. 20 | /// 21 | /// - returns: Observer interface for subject. 22 | func asObserver() -> Observer 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/SwiftSupport/SwiftSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftSupport.swift 3 | // RxSwift 4 | // 5 | // Created by Volodymyr Gorbenko on 3/6/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | typealias IntMax = Int64 12 | public typealias RxAbstractInteger = FixedWidthInteger 13 | 14 | extension SignedInteger { 15 | func toIntMax() -> IntMax { 16 | return IntMax(self) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Pods/RxSwift/RxSwift/Traits/ObservableType+PrimitiveSequence.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObservableType+PrimitiveSequence.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 9/17/17. 6 | // Copyright © 2017 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension ObservableType { 10 | /** 11 | The `asSingle` operator throws a `RxError.noElements` or `RxError.moreThanOneElement` 12 | if the source Observable does not emit exactly one element before successfully completing. 13 | 14 | - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html) 15 | 16 | - returns: An observable sequence that emits a single element when the source Observable has completed, or throws an exception if more (or none) of them are emitted. 17 | */ 18 | public func asSingle() -> Single { 19 | return PrimitiveSequence(raw: AsSingle(source: self.asObservable())) 20 | } 21 | 22 | /** 23 | The `first` operator emits only the very first item emitted by this Observable, 24 | or nil if this Observable completes without emitting anything. 25 | 26 | - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html) 27 | 28 | - returns: An observable sequence that emits a single element or nil if the source observable sequence completes without emitting any items. 29 | */ 30 | public func first() -> Single { 31 | return PrimitiveSequence(raw: First(source: self.asObservable())) 32 | } 33 | 34 | /** 35 | The `asMaybe` operator throws a `RxError.moreThanOneElement` 36 | if the source Observable does not emit at most one element before successfully completing. 37 | 38 | - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html) 39 | 40 | - returns: An observable sequence that emits a single element, completes when the source Observable has completed, or throws an exception if more of them are emitted. 41 | */ 42 | public func asMaybe() -> Maybe { 43 | return PrimitiveSequence(raw: AsMaybe(source: self.asObservable())) 44 | } 45 | } 46 | 47 | extension ObservableType where Element == Never { 48 | /** 49 | - returns: An observable sequence that completes. 50 | */ 51 | public func asCompletable() 52 | -> Completable { 53 | return PrimitiveSequence(raw: self.asObservable()) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Anchorage/Anchorage-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.4.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Anchorage/Anchorage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Anchorage : NSObject 3 | @end 4 | @implementation PodsDummy_Anchorage 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Anchorage/Anchorage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Anchorage/Anchorage-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double AnchorageVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char AnchorageVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Anchorage/Anchorage.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Anchorage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Anchorage 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Anchorage/Anchorage.modulemap: -------------------------------------------------------------------------------- 1 | framework module Anchorage { 2 | umbrella header "Anchorage-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Anchorage/Anchorage.release.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Anchorage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Anchorage 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RIBsTutorial : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RIBsTutorial 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/Anchorage/Anchorage.framework 3 | ${BUILT_PRODUCTS_DIR}/RIBs/RIBs.framework 4 | ${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework 5 | ${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Anchorage.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RIBs.framework 3 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework 4 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/Anchorage/Anchorage.framework 3 | ${BUILT_PRODUCTS_DIR}/RIBs/RIBs.framework 4 | ${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework 5 | ${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Anchorage.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RIBs.framework 3 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework 4 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_RIBsTutorialVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_RIBsTutorialVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage/Anchorage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs/RIBs.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay/RxRelay.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Anchorage" -framework "RIBs" -framework "RxRelay" -framework "RxSwift" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_RIBsTutorial { 2 | umbrella header "Pods-RIBsTutorial-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorial/Pods-RIBsTutorial.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage/Anchorage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs/RIBs.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay/RxRelay.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Anchorage" -framework "RIBs" -framework "RxRelay" -framework "RxSwift" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RIBsTutorialTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RIBsTutorialTests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_RIBsTutorialTestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_RIBsTutorialTestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage/Anchorage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs/RIBs.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay/RxRelay.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "Anchorage" -framework "RIBs" -framework "RxRelay" -framework "RxSwift" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_RIBsTutorialTests { 2 | umbrella header "Pods-RIBsTutorialTests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RIBsTutorialTests/Pods-RIBsTutorialTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Anchorage/Anchorage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RIBs/RIBs.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay/RxRelay.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "Anchorage" -framework "RIBs" -framework "RxRelay" -framework "RxSwift" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RIBs/RIBs-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.9.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RIBs/RIBs-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RIBs : NSObject 3 | @end 4 | @implementation PodsDummy_RIBs 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RIBs/RIBs-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RIBs/RIBs-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double RIBsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char RIBsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RIBs/RIBs.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RIBs 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/RIBs 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RIBs/RIBs.modulemap: -------------------------------------------------------------------------------- 1 | framework module RIBs { 2 | umbrella header "RIBs-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RIBs/RIBs.release.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RIBs 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxRelay" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/RIBs 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxRelay/RxRelay-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 5.1.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxRelay/RxRelay-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxRelay : NSObject 3 | @end 4 | @implementation PodsDummy_RxRelay 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxRelay/RxRelay-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxRelay/RxRelay-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double RxRelayVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char RxRelayVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxRelay/RxRelay.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxRelay 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/RxRelay 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxRelay/RxRelay.modulemap: -------------------------------------------------------------------------------- 1 | framework module RxRelay { 2 | umbrella header "RxRelay-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxRelay/RxRelay.release.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxRelay 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/RxRelay 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 5.1.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxSwift : NSObject 3 | @end 4 | @implementation PodsDummy_RxSwift 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double RxSwiftVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char RxSwiftVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/RxSwift 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift.modulemap: -------------------------------------------------------------------------------- 1 | framework module RxSwift { 2 | umbrella header "RxSwift-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/RxSwift/RxSwift.release.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/RxSwift 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /RIBsTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RIBsTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RIBsTutorial.xcodeproj/xcuserdata/stanislavostrovskiy.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RIBsTutorial.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 6 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /RIBsTutorial.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RIBsTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RIBsTutorial.xcworkspace/xcuserdata/stanislavostrovskiy.xcuserdatad/IDEFindNavigatorScopes.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RIBsTutorial.xcworkspace/xcuserdata/stanislavostrovskiy.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /RIBsTutorial/AppStart/AppComponent.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | final class AppComponent: Component, RootDependency { 4 | var webService: WebServicing 5 | 6 | init() { 7 | webService = WebService() 8 | super.init(dependency: EmptyComponent()) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /RIBsTutorial/AppStart/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | import UIKit 3 | 4 | @UIApplicationMain 5 | class AppDelegate: UIResponder, UIApplicationDelegate { 6 | 7 | var window: UIWindow? 8 | private var launchRouter: LaunchRouting? 9 | 10 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 11 | 12 | let window = UIWindow(frame: UIScreen.main.bounds) 13 | 14 | let launchRouter = RootBuilder(dependency: AppComponent()).build() 15 | self.launchRouter = launchRouter 16 | launchRouter.launch(from: window) 17 | 18 | self.window = window 19 | 20 | return true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RIBsTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /RIBsTutorial/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /RIBsTutorial/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RIBsTutorial/CreateAccount/CreateAccountBuilder.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | ///@mockable 4 | protocol CreateAccountDependency: Dependency { 5 | // TODO: Declare the set of dependencies required by this RIB, but cannot be 6 | // created by this RIB. 7 | } 8 | 9 | final class CreateAccountComponent: Component { 10 | } 11 | 12 | // MARK: - Builder 13 | 14 | ///@mockable 15 | protocol CreateAccountBuildable: Buildable { 16 | func build(withListener listener: CreateAccountListener) -> CreateAccountRouting 17 | } 18 | 19 | final class CreateAccountBuilder: Builder, CreateAccountBuildable { 20 | 21 | override init(dependency: CreateAccountDependency) { 22 | super.init(dependency: dependency) 23 | } 24 | 25 | func build(withListener listener: CreateAccountListener) -> CreateAccountRouting { 26 | _ = CreateAccountComponent(dependency: dependency) 27 | let viewController = CreateAccountViewController() 28 | let interactor = CreateAccountInteractor(presenter: viewController) 29 | interactor.listener = listener 30 | return CreateAccountRouter(interactor: interactor, viewController: viewController) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /RIBsTutorial/CreateAccount/CreateAccountInteractor.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | import RxSwift 3 | 4 | ///@mockable 5 | protocol CreateAccountRouting: ViewableRouting { 6 | // TODO: Declare methods the interactor can invoke to manage sub-tree via the router. 7 | } 8 | 9 | ///@mockable 10 | protocol CreateAccountPresentable: Presentable { 11 | var listener: CreateAccountPresentableListener? { get set } 12 | // TODO: Declare methods the interactor can invoke the presenter to present data. 13 | } 14 | 15 | ///@mockable 16 | protocol CreateAccountListener: class { 17 | func closeCreateAccountFlow() 18 | } 19 | 20 | final class CreateAccountInteractor: PresentableInteractor, CreateAccountInteractable, CreateAccountPresentableListener { 21 | 22 | weak var router: CreateAccountRouting? 23 | weak var listener: CreateAccountListener? 24 | 25 | // TODO: Add additional dependencies to constructor. Do not perform any logic 26 | // in constructor. 27 | override init(presenter: CreateAccountPresentable) { 28 | super.init(presenter: presenter) 29 | presenter.listener = self 30 | } 31 | 32 | override func didBecomeActive() { 33 | super.didBecomeActive() 34 | // TODO: Implement business logic here. 35 | } 36 | 37 | override func willResignActive() { 38 | super.willResignActive() 39 | // TODO: Pause any business logic. 40 | } 41 | 42 | // MARK: - CreateAccountPresentableListener 43 | 44 | func didTapClose() { 45 | listener?.closeCreateAccountFlow() 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RIBsTutorial/CreateAccount/CreateAccountRouter.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | ///@mockable 4 | protocol CreateAccountInteractable: Interactable { 5 | var router: CreateAccountRouting? { get set } 6 | var listener: CreateAccountListener? { get set } 7 | } 8 | 9 | ///@mockable 10 | protocol CreateAccountViewControllable: ViewControllable { 11 | // TODO: Declare methods the router invokes to manipulate the view hierarchy. 12 | } 13 | 14 | final class CreateAccountRouter: ViewableRouter, CreateAccountRouting { 15 | 16 | // TODO: Constructor inject child builder protocols to allow building children. 17 | override init(interactor: CreateAccountInteractable, viewController: CreateAccountViewControllable) { 18 | super.init(interactor: interactor, viewController: viewController) 19 | interactor.router = self 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RIBsTutorial/CreateAccount/CreateAccountViewController.swift: -------------------------------------------------------------------------------- 1 | import Anchorage 2 | import RIBs 3 | import RxSwift 4 | import UIKit 5 | 6 | ///@mockable 7 | protocol CreateAccountPresentableListener: class { 8 | func didTapClose() 9 | } 10 | 11 | final class CreateAccountViewController: UIViewController, CreateAccountPresentable, CreateAccountViewControllable { 12 | 13 | weak var listener: CreateAccountPresentableListener? 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | view.backgroundColor = .white 19 | 20 | let closeButton = UIButton() 21 | closeButton.setTitle("Close create account", for: .normal) 22 | closeButton.backgroundColor = .blue 23 | closeButton.addTarget(self, action: #selector(close), for: .touchUpInside) 24 | 25 | view.addSubview(closeButton) 26 | closeButton.centerYAnchor == view.centerYAnchor 27 | closeButton.horizontalAnchors == view.horizontalAnchors + 16 28 | closeButton.heightAnchor == 40 29 | } 30 | 31 | @objc private func close() { 32 | listener?.didTapClose() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RIBsTutorial/Home/HomeBuilder.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | ///@mockable 4 | protocol HomeDependency: Dependency { 5 | // TODO: Declare the set of dependencies required by this RIB, but cannot be 6 | // created by this RIB. 7 | } 8 | 9 | final class HomeComponent: Component { 10 | 11 | // TODO: Declare 'fileprivate' dependencies that are only used by this RIB. 12 | } 13 | 14 | // MARK: - Builder 15 | 16 | ///@mockable 17 | protocol HomeBuildable: Buildable { 18 | func build(withListener listener: HomeListener) -> HomeRouting 19 | } 20 | 21 | final class HomeBuilder: Builder, HomeBuildable { 22 | 23 | override init(dependency: HomeDependency) { 24 | super.init(dependency: dependency) 25 | } 26 | 27 | func build(withListener listener: HomeListener) -> HomeRouting { 28 | let component = HomeComponent(dependency: dependency) 29 | let viewController = HomeViewController() 30 | let interactor = HomeInteractor(presenter: viewController) 31 | interactor.listener = listener 32 | return HomeRouter(interactor: interactor, viewController: viewController) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RIBsTutorial/Home/HomeInteractor.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | import RxSwift 3 | 4 | ///@mockable 5 | protocol HomeRouting: ViewableRouting { 6 | } 7 | 8 | ///@mockable 9 | protocol HomePresentable: Presentable { 10 | var listener: HomePresentableListener? { get set } 11 | } 12 | 13 | ///@mockable 14 | protocol HomeListener: class { 15 | func logout() 16 | } 17 | 18 | final class HomeInteractor: PresentableInteractor, HomeInteractable, HomePresentableListener { 19 | 20 | weak var router: HomeRouting? 21 | weak var listener: HomeListener? 22 | 23 | override init(presenter: HomePresentable) { 24 | super.init(presenter: presenter) 25 | presenter.listener = self 26 | } 27 | 28 | // MARK: - HomePresentableListener 29 | 30 | func didTapLogout() { 31 | listener?.logout() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RIBsTutorial/Home/HomeRouter.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | ///@mockable 4 | protocol HomeInteractable: Interactable { 5 | var router: HomeRouting? { get set } 6 | var listener: HomeListener? { get set } 7 | } 8 | 9 | ///@mockable 10 | protocol HomeViewControllable: ViewControllable { 11 | // TODO: Declare methods the router invokes to manipulate the view hierarchy. 12 | } 13 | 14 | final class HomeRouter: ViewableRouter, HomeRouting { 15 | 16 | // TODO: Constructor inject child builder protocols to allow building children. 17 | override init(interactor: HomeInteractable, viewController: HomeViewControllable) { 18 | super.init(interactor: interactor, viewController: viewController) 19 | interactor.router = self 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RIBsTutorial/Home/HomeViewController.swift: -------------------------------------------------------------------------------- 1 | import Anchorage 2 | import RIBs 3 | import RxSwift 4 | import UIKit 5 | 6 | ///@mockable 7 | protocol HomePresentableListener: class { 8 | func didTapLogout() 9 | } 10 | 11 | final class HomeViewController: UIViewController, HomePresentable, HomeViewControllable { 12 | 13 | weak var listener: HomePresentableListener? 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | view.backgroundColor = .white 19 | 20 | let closeButton = UIButton() 21 | closeButton.setTitle("Log out", for: .normal) 22 | closeButton.backgroundColor = .blue 23 | closeButton.addTarget(self, action: #selector(close), for: .touchUpInside) 24 | 25 | view.addSubview(closeButton) 26 | closeButton.centerYAnchor == view.centerYAnchor 27 | closeButton.horizontalAnchors == view.horizontalAnchors + 16 28 | closeButton.heightAnchor == 40 29 | } 30 | 31 | @objc private func close() { 32 | listener?.didTapLogout() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RIBsTutorial/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIBsTutorial/Login/LoginBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LoginBuilder.swift 3 | // RIBsTutorial 4 | // 5 | // Created by Stanislav Ostrovskiy on 5/21/20. 6 | // Copyright © 2020 Stanislav Ostrovskiy. All rights reserved. 7 | // 8 | 9 | import RIBs 10 | 11 | ///@mockable 12 | protocol LoginDependency: CreateAccountDependency { 13 | var webService: WebServicing { get } 14 | } 15 | 16 | final class LoginComponent: Component { 17 | } 18 | 19 | // MARK: - Builder 20 | 21 | ///@mockable 22 | protocol LoginBuildable: Buildable { 23 | func build(withListener listener: LoginListener) -> LoginRouting 24 | } 25 | 26 | final class LoginBuilder: Builder, LoginBuildable { 27 | 28 | override init(dependency: LoginDependency) { 29 | super.init(dependency: dependency) 30 | } 31 | 32 | func build(withListener listener: LoginListener) -> LoginRouting { 33 | let component = LoginComponent(dependency: dependency) 34 | let viewController = LoginViewController() 35 | let interactor = LoginInteractor(presenter: viewController, webService: component.dependency.webService) 36 | interactor.listener = listener 37 | 38 | let createAccountBuilder = CreateAccountBuilder(dependency: component.dependency) 39 | 40 | return LoginRouter( 41 | interactor: interactor, 42 | viewController: viewController, 43 | createAccountBuilder: createAccountBuilder 44 | ) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RIBsTutorial/Login/LoginInteractor.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | import RxSwift 3 | 4 | ///@mockable 5 | protocol LoginRouting: ViewableRouting { 6 | func routeToCreateAccount() 7 | func detachCreateAccount() 8 | } 9 | 10 | ///@mockable 11 | protocol LoginPresentable: Presentable { 12 | var listener: LoginPresentableListener? { get set } 13 | func showActivityIndicator(_ isLoading: Bool) 14 | func showErrorAlert() 15 | } 16 | 17 | ///@mockable 18 | protocol LoginListener: class { 19 | func dismissLoginFlow() 20 | } 21 | 22 | final class LoginInteractor: PresentableInteractor, LoginInteractable, LoginPresentableListener { 23 | 24 | weak var router: LoginRouting? 25 | weak var listener: LoginListener? 26 | 27 | private let webService: WebServicing 28 | 29 | init(presenter: LoginPresentable, webService: WebServicing) { 30 | self.webService = webService 31 | super.init(presenter: presenter) 32 | presenter.listener = self 33 | } 34 | 35 | // MARK: - LoginPresentableListener 36 | 37 | func didTapLogin(username: String, password: String) { 38 | presenter.showActivityIndicator(true) 39 | webService.login( 40 | username: username, 41 | password: password) { [weak self] result in 42 | self?.presenter.showActivityIndicator(false) 43 | switch result { 44 | case .success: 45 | self?.listener?.dismissLoginFlow() 46 | case .failure: 47 | self?.presenter.showErrorAlert() 48 | } 49 | } 50 | } 51 | 52 | func didTapCreateAccount() { 53 | router?.routeToCreateAccount() 54 | } 55 | 56 | // MARK: - CreateAccountListener 57 | 58 | func closeCreateAccountFlow() { 59 | router?.detachCreateAccount() 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /RIBsTutorial/Login/LoginRouter.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | ///@mockable 4 | protocol LoginInteractable: Interactable, CreateAccountListener { 5 | var router: LoginRouting? { get set } 6 | var listener: LoginListener? { get set } 7 | } 8 | 9 | ///@mockable 10 | protocol LoginViewControllable: ViewControllable { 11 | func present(_ viewController: ViewControllable) 12 | } 13 | 14 | final class LoginRouter: ViewableRouter, LoginRouting { 15 | 16 | private let createAccountBuilder: CreateAccountBuildable 17 | private var createAccountRouter: CreateAccountRouting? 18 | 19 | init( 20 | interactor: LoginInteractable, 21 | viewController: LoginViewControllable, 22 | createAccountBuilder: CreateAccountBuildable 23 | ) { 24 | self.createAccountBuilder = createAccountBuilder 25 | super.init(interactor: interactor, viewController: viewController) 26 | interactor.router = self 27 | } 28 | 29 | func routeToCreateAccount() { 30 | guard createAccountRouter == nil else { return } 31 | let router = createAccountBuilder.build(withListener: interactor) 32 | attachChild(router) 33 | createAccountRouter = router 34 | router.viewControllable.uiviewController.modalPresentationStyle = .fullScreen 35 | viewController.present(router.viewControllable) 36 | } 37 | 38 | func detachCreateAccount() { 39 | guard let createAccountRouter = createAccountRouter else { return } 40 | detachChild(createAccountRouter) 41 | createAccountRouter.viewControllable.uiviewController.dismiss(animated: true, completion: nil) 42 | self.createAccountRouter = nil 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /RIBsTutorial/Root/RootBuilder.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | ///@mockable 4 | protocol RootDependency: LoginDependency, HomeDependency { 5 | var webService: WebServicing { get } 6 | } 7 | 8 | final class RootComponent: Component { 9 | 10 | private let rootViewController: RootViewController 11 | 12 | init(dependency: RootDependency, 13 | rootViewController: RootViewController) { 14 | self.rootViewController = rootViewController 15 | super.init(dependency: dependency) 16 | } 17 | } 18 | 19 | // MARK: - Builder 20 | 21 | ///@mockable 22 | protocol RootBuildable: Buildable { 23 | func build() -> LaunchRouting 24 | } 25 | 26 | final class RootBuilder: Builder, RootBuildable { 27 | 28 | override init(dependency: RootDependency) { 29 | super.init(dependency: dependency) 30 | } 31 | 32 | func build() -> LaunchRouting { 33 | let viewController = RootViewController() 34 | let component = RootComponent( 35 | dependency: dependency, 36 | rootViewController: viewController 37 | ) 38 | 39 | let loginBuilder = LoginBuilder(dependency: component.dependency) 40 | let homeBuilder = HomeBuilder(dependency: component.dependency) 41 | 42 | let interactor = RootInteractor(presenter: viewController) 43 | return RootRouter( 44 | interactor: interactor, 45 | viewController: viewController, 46 | loginBuilder: loginBuilder, 47 | homeBuilder: homeBuilder 48 | ) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /RIBsTutorial/Root/RootInteractor.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | import RxSwift 3 | 4 | ///@mockable 5 | protocol RootRouting: ViewableRouting { 6 | func attachLogin() 7 | func attachHome() 8 | } 9 | 10 | ///@mockable 11 | protocol RootPresentable: Presentable { 12 | var listener: RootPresentableListener? { get set } 13 | } 14 | 15 | ///@mockable 16 | protocol RootListener: class { 17 | } 18 | 19 | final class RootInteractor: PresentableInteractor, RootInteractable, RootPresentableListener { 20 | 21 | weak var router: RootRouting? 22 | weak var listener: RootListener? 23 | 24 | override init(presenter: RootPresentable) { 25 | super.init(presenter: presenter) 26 | presenter.listener = self 27 | } 28 | 29 | override func didBecomeActive() { 30 | super.didBecomeActive() 31 | 32 | router?.attachLogin() 33 | } 34 | 35 | // MARK: - LoginListener 36 | 37 | func dismissLoginFlow() { 38 | router?.attachHome() 39 | } 40 | 41 | // MARK: - HomeListener 42 | 43 | func logout() { 44 | router?.attachLogin() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RIBsTutorial/Root/RootRouter.swift: -------------------------------------------------------------------------------- 1 | import RIBs 2 | 3 | ///@mockable 4 | protocol RootInteractable: Interactable, LoginListener, HomeListener { 5 | var router: RootRouting? { get set } 6 | var listener: RootListener? { get set } 7 | } 8 | 9 | ///@mockable 10 | protocol RootViewControllable: ViewControllable { 11 | func replaceScreen(viewController: ViewControllable) 12 | } 13 | 14 | final class RootRouter: LaunchRouter, RootRouting { 15 | 16 | private let loginBuilder: LoginBuildable 17 | private var loginRouter: LoginRouting? 18 | private let homeBuilder: HomeBuildable 19 | private var homeRouter: HomeRouting? 20 | 21 | init( 22 | interactor: RootInteractable, 23 | viewController: RootViewControllable, 24 | loginBuilder: LoginBuildable, 25 | homeBuilder: HomeBuildable 26 | ) { 27 | self.loginBuilder = loginBuilder 28 | self.homeBuilder = homeBuilder 29 | super.init(interactor: interactor, viewController: viewController) 30 | interactor.router = self 31 | } 32 | 33 | func attachLogin() { 34 | if let homeRouter = homeRouter { 35 | detachChild(homeRouter) 36 | self.homeRouter = nil 37 | } 38 | 39 | guard loginRouter == nil else { return } 40 | let router = loginBuilder.build(withListener: interactor) 41 | attachChild(router) 42 | loginRouter = router 43 | viewController.replaceScreen(viewController: router.viewControllable) 44 | } 45 | 46 | func attachHome() { 47 | if let loginRouter = loginRouter { 48 | detachChild(loginRouter) 49 | self.loginRouter = nil 50 | } 51 | 52 | guard homeRouter == nil else { return } 53 | let router = homeBuilder.build(withListener: interactor) 54 | attachChild(router) 55 | homeRouter = router 56 | viewController.replaceScreen(viewController: router.viewControllable) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /RIBsTutorial/Root/RootViewController.swift: -------------------------------------------------------------------------------- 1 | import Anchorage 2 | import RIBs 3 | import RxSwift 4 | import UIKit 5 | 6 | ///@mockable 7 | protocol RootPresentableListener: class { 8 | } 9 | 10 | final class RootViewController: UIViewController, RootPresentable, RootViewControllable { 11 | 12 | weak var listener: RootPresentableListener? 13 | 14 | private var currentViewController: ViewControllable? 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | view.backgroundColor = .white 20 | } 21 | 22 | // MARK: - RootViewControllable 23 | 24 | func replaceScreen(viewController: ViewControllable) { 25 | viewController.uiviewController.willMove(toParent: self) 26 | addChild(viewController.uiviewController) 27 | view.addSubview(viewController.uiviewController.view) 28 | viewController.uiviewController.view.edgeAnchors == view.edgeAnchors 29 | currentViewController?.uiviewController.willMove(toParent: nil) 30 | currentViewController?.uiviewController.view.removeFromSuperview() 31 | currentViewController?.uiviewController.removeFromParent() 32 | viewController.uiviewController.didMove(toParent: self) 33 | currentViewController = viewController 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /RIBsTutorial/WebService.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | ///@mockable 4 | protocol WebServicing: class { 5 | func login(username: String, password: String, handler: @escaping (Result) -> Void) 6 | } 7 | 8 | final class WebService: WebServicing { 9 | func login(username: String, password: String, handler: @escaping (Result) -> Void) { 10 | DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) { 11 | if password == "" { 12 | handler(.success("userID")) 13 | } else { 14 | handler(.failure(WebServiceError.generic)) 15 | } 16 | } 17 | } 18 | } 19 | 20 | enum WebServiceError: Error { 21 | case generic 22 | } 23 | -------------------------------------------------------------------------------- /RIBsTutorialTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | --------------------------------------------------------------------------------