├── .travis.yml ├── Example ├── Podfile ├── Podfile.lock ├── Pods │ ├── Alamofire │ │ ├── LICENSE │ │ ├── README.md │ │ └── Source │ │ │ ├── AFError.swift │ │ │ ├── Alamofire.swift │ │ │ ├── DispatchQueue+Alamofire.swift │ │ │ ├── MultipartFormData.swift │ │ │ ├── NetworkReachabilityManager.swift │ │ │ ├── Notifications.swift │ │ │ ├── ParameterEncoding.swift │ │ │ ├── Request.swift │ │ │ ├── Response.swift │ │ │ ├── ResponseSerialization.swift │ │ │ ├── Result.swift │ │ │ ├── ServerTrustPolicy.swift │ │ │ ├── SessionDelegate.swift │ │ │ ├── SessionManager.swift │ │ │ ├── TaskDelegate.swift │ │ │ ├── Timeline.swift │ │ │ └── Validation.swift │ ├── Cache │ │ ├── LICENSE.md │ │ ├── README.md │ │ └── Source │ │ │ ├── Shared │ │ │ ├── Configuration │ │ │ │ ├── DiskConfig.swift │ │ │ │ └── MemoryConfig.swift │ │ │ ├── Extensions │ │ │ │ ├── Date+Extensions.swift │ │ │ │ └── JSONDecoder+Extensions.swift │ │ │ ├── Library │ │ │ │ ├── DataSerializer.swift │ │ │ │ ├── Entry.swift │ │ │ │ ├── ExpirationMode.swift │ │ │ │ ├── Expiry.swift │ │ │ │ ├── ImageWrapper.swift │ │ │ │ ├── JSONArrayWrapper.swift │ │ │ │ ├── JSONDictionaryWrapper.swift │ │ │ │ ├── MD5.swift │ │ │ │ ├── MemoryCapsule.swift │ │ │ │ ├── ObservationToken.swift │ │ │ │ ├── Optional+Extension.swift │ │ │ │ ├── Result.swift │ │ │ │ ├── StorageError.swift │ │ │ │ ├── Transformer.swift │ │ │ │ ├── TransformerFactory.swift │ │ │ │ ├── TypeWrapper.swift │ │ │ │ └── Types.swift │ │ │ └── Storage │ │ │ │ ├── AsyncStorage.swift │ │ │ │ ├── DiskStorage.swift │ │ │ │ ├── HybridStorage.swift │ │ │ │ ├── KeyObservationRegistry.swift │ │ │ │ ├── MemoryStorage.swift │ │ │ │ ├── Storage+Transform.swift │ │ │ │ ├── Storage.swift │ │ │ │ ├── StorageAware.swift │ │ │ │ ├── StorageObservationRegistry.swift │ │ │ │ └── SyncStorage.swift │ │ │ └── iOS │ │ │ └── UIImage+Extensions.swift │ ├── Local Podspecs │ │ └── RxMoyaCache.podspec.json │ ├── Manifest.lock │ ├── Moya │ │ ├── License.md │ │ ├── Readme.md │ │ └── Sources │ │ │ ├── Moya │ │ │ ├── AnyEncodable.swift │ │ │ ├── Cancellable.swift │ │ │ ├── Endpoint.swift │ │ │ ├── Image.swift │ │ │ ├── Moya+Alamofire.swift │ │ │ ├── MoyaError.swift │ │ │ ├── MoyaProvider+Defaults.swift │ │ │ ├── MoyaProvider+Internal.swift │ │ │ ├── MoyaProvider.swift │ │ │ ├── MultiTarget.swift │ │ │ ├── MultipartFormData.swift │ │ │ ├── Plugin.swift │ │ │ ├── Plugins │ │ │ │ ├── AccessTokenPlugin.swift │ │ │ │ ├── CredentialsPlugin.swift │ │ │ │ ├── NetworkActivityPlugin.swift │ │ │ │ └── NetworkLoggerPlugin.swift │ │ │ ├── Response.swift │ │ │ ├── TargetType.swift │ │ │ ├── Task.swift │ │ │ ├── URL+Moya.swift │ │ │ ├── URLRequest+Encoding.swift │ │ │ └── ValidationType.swift │ │ │ └── RxMoya │ │ │ ├── MoyaProvider+Rx.swift │ │ │ ├── Observable+Response.swift │ │ │ └── Single+Response.swift │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── RxMoyaCache.xcscheme │ ├── Result │ │ ├── LICENSE │ │ ├── README.md │ │ └── Result │ │ │ ├── AnyError.swift │ │ │ ├── NoError.swift │ │ │ ├── Result.swift │ │ │ └── ResultProtocol.swift │ ├── RxAtomic │ │ ├── LICENSE.md │ │ └── RxAtomic │ │ │ ├── RxAtomic.c │ │ │ └── include │ │ │ └── RxAtomic.h │ ├── RxSwift │ │ ├── LICENSE.md │ │ ├── Platform │ │ │ ├── AtomicInt.swift │ │ │ ├── DataStructures │ │ │ │ ├── Bag.swift │ │ │ │ ├── InfiniteSequence.swift │ │ │ │ ├── PriorityQueue.swift │ │ │ │ └── Queue.swift │ │ │ ├── DeprecationWarner.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 │ │ │ ├── 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 │ │ │ └── String+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 │ │ │ ├── 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 │ │ ├── Alamofire │ │ ├── Alamofire-Info.plist │ │ ├── Alamofire-dummy.m │ │ ├── Alamofire-prefix.pch │ │ ├── Alamofire-umbrella.h │ │ ├── Alamofire.modulemap │ │ └── Alamofire.xcconfig │ │ ├── Cache │ │ ├── Cache-Info.plist │ │ ├── Cache-dummy.m │ │ ├── Cache-prefix.pch │ │ ├── Cache-umbrella.h │ │ ├── Cache.modulemap │ │ └── Cache.xcconfig │ │ ├── Moya │ │ ├── Moya-Info.plist │ │ ├── Moya-dummy.m │ │ ├── Moya-prefix.pch │ │ ├── Moya-umbrella.h │ │ ├── Moya.modulemap │ │ └── Moya.xcconfig │ │ ├── Pods-RxMoyaCache_Example │ │ ├── Pods-RxMoyaCache_Example-Info.plist │ │ ├── Pods-RxMoyaCache_Example-acknowledgements.markdown │ │ ├── Pods-RxMoyaCache_Example-acknowledgements.plist │ │ ├── Pods-RxMoyaCache_Example-dummy.m │ │ ├── Pods-RxMoyaCache_Example-frameworks.sh │ │ ├── Pods-RxMoyaCache_Example-umbrella.h │ │ ├── Pods-RxMoyaCache_Example.debug.xcconfig │ │ ├── Pods-RxMoyaCache_Example.modulemap │ │ └── Pods-RxMoyaCache_Example.release.xcconfig │ │ ├── Pods-RxMoyaCache_Tests │ │ ├── Pods-RxMoyaCache_Tests-Info.plist │ │ ├── Pods-RxMoyaCache_Tests-acknowledgements.markdown │ │ ├── Pods-RxMoyaCache_Tests-acknowledgements.plist │ │ ├── Pods-RxMoyaCache_Tests-dummy.m │ │ ├── Pods-RxMoyaCache_Tests-umbrella.h │ │ ├── Pods-RxMoyaCache_Tests.debug.xcconfig │ │ ├── Pods-RxMoyaCache_Tests.modulemap │ │ └── Pods-RxMoyaCache_Tests.release.xcconfig │ │ ├── Result │ │ ├── Result-Info.plist │ │ ├── Result-dummy.m │ │ ├── Result-prefix.pch │ │ ├── Result-umbrella.h │ │ ├── Result.modulemap │ │ └── Result.xcconfig │ │ ├── RxAtomic │ │ ├── RxAtomic-Info.plist │ │ ├── RxAtomic-dummy.m │ │ ├── RxAtomic-prefix.pch │ │ ├── RxAtomic-umbrella.h │ │ ├── RxAtomic.modulemap │ │ └── RxAtomic.xcconfig │ │ ├── RxMoyaCache │ │ ├── RxMoyaCache-Info.plist │ │ ├── RxMoyaCache-dummy.m │ │ ├── RxMoyaCache-prefix.pch │ │ ├── RxMoyaCache-umbrella.h │ │ ├── RxMoyaCache.modulemap │ │ └── RxMoyaCache.xcconfig │ │ └── RxSwift │ │ ├── RxSwift-Info.plist │ │ ├── RxSwift-dummy.m │ │ ├── RxSwift-prefix.pch │ │ ├── RxSwift-umbrella.h │ │ ├── RxSwift.modulemap │ │ └── RxSwift.xcconfig ├── RxMoyaCache.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── RxMoyaCache.xcworkspace │ └── contents.xcworkspacedata ├── RxMoyaCache │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── CleanJSON.swift │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── Network+Cache.swift │ └── ViewController.swift └── Tests │ ├── Info.plist │ └── Tests.swift ├── LICENSE ├── README.md ├── RxMoyaCache.podspec ├── RxMoyaCache ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── Cacheable.swift │ ├── CachingKey.swift │ ├── MoyaProviderType+Rx.swift │ ├── Provider.swift │ ├── Single+Cache.swift │ └── TargetType+Cache.swift ├── _Pods.xcodeproj └── fastlane ├── Appfile └── Fastfile /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/ 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode9 6 | language: swift 7 | cache: cocoapods 8 | podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods --pre # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - pod lib lint --no-clean 14 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'RxMoyaCache_Example' do 4 | pod 'RxMoyaCache', :path => '../' 5 | pod 'Cache' 6 | 7 | target 'RxMoyaCache_Tests' do 8 | inherit! :search_paths 9 | 10 | 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.8.1) 3 | - Cache (5.2.0) 4 | - Moya/Core (12.0.1): 5 | - Alamofire (~> 4.1) 6 | - Result (~> 4.0) 7 | - Moya/RxSwift (12.0.1): 8 | - Moya/Core 9 | - RxSwift (~> 4.0) 10 | - Result (4.1.0) 11 | - RxAtomic (4.4.1) 12 | - RxMoyaCache (0.1.0): 13 | - Moya/RxSwift 14 | - RxSwift (4.4.1): 15 | - RxAtomic (~> 4.4) 16 | 17 | DEPENDENCIES: 18 | - Cache 19 | - RxMoyaCache (from `../`) 20 | 21 | SPEC REPOS: 22 | https://github.com/cocoapods/specs.git: 23 | - Alamofire 24 | - Cache 25 | - Moya 26 | - Result 27 | - RxAtomic 28 | - RxSwift 29 | 30 | EXTERNAL SOURCES: 31 | RxMoyaCache: 32 | :path: "../" 33 | 34 | SPEC CHECKSUMS: 35 | Alamofire: 16ce2c353fb72865124ddae8a57c5942388f4f11 36 | Cache: 807c5d86d01a177f06ede9865add3aea269bbfd4 37 | Moya: cf730b3cd9e005401ef37a85143aa141a12fd38f 38 | Result: bd966fac789cc6c1563440b348ab2598cc24d5c7 39 | RxAtomic: f8d6adc1ccb87a767811269e4875887bc74dbf19 40 | RxMoyaCache: 717d45e69ccdf99690298792a991db5e8e28ed36 41 | RxSwift: 92fcf68dfef21f3e2ab1965363d9e7b3d787597e 42 | 43 | PODFILE CHECKSUM: 6c8eb1d6a106db6cd5209c8b5c9ff6efc2d05551 44 | 45 | COCOAPODS: 1.6.1 46 | -------------------------------------------------------------------------------- /Example/Pods/Alamofire/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DispatchQueue+Alamofire.swift 3 | // 4 | // Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | import Dispatch 26 | import Foundation 27 | 28 | extension DispatchQueue { 29 | static var userInteractive: DispatchQueue { return DispatchQueue.global(qos: .userInteractive) } 30 | static var userInitiated: DispatchQueue { return DispatchQueue.global(qos: .userInitiated) } 31 | static var utility: DispatchQueue { return DispatchQueue.global(qos: .utility) } 32 | static var background: DispatchQueue { return DispatchQueue.global(qos: .background) } 33 | 34 | func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) { 35 | asyncAfter(deadline: .now() + delay, execute: closure) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/Pods/Cache/LICENSE.md: -------------------------------------------------------------------------------- 1 | Licensed under the **MIT** license 2 | 3 | > Copyright (c) 2015 Hyper Interaktiv AS 4 | > 5 | > Permission is hereby granted, free of charge, to any person obtaining 6 | > a copy of this software and associated documentation files (the 7 | > "Software"), to deal in the Software without restriction, including 8 | > without limitation the rights to use, copy, modify, merge, publish, 9 | > distribute, sublicense, and/or sell copies of the Software, and to 10 | > permit persons to whom the Software is furnished to do so, subject to 11 | > the following conditions: 12 | > 13 | > The above copyright notice and this permission notice shall be 14 | > included in all copies or substantial portions of the Software. 15 | > 16 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | > IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | > CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | > TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Configuration/DiskConfig.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct DiskConfig { 4 | /// The name of disk storage, this will be used as folder name within directory 5 | public let name: String 6 | /// Expiry date that will be applied by default for every added object 7 | /// if it's not overridden in the add(key: object: expiry: completion:) method 8 | public let expiry: Expiry 9 | /// Maximum size of the disk cache storage (in bytes) 10 | public let maxSize: UInt 11 | /// A folder to store the disk cache contents. Defaults to a prefixed directory in Caches if nil 12 | public let directory: URL? 13 | #if os(iOS) || os(tvOS) 14 | /// Data protection is used to store files in an encrypted format on disk and to decrypt them on demand. 15 | /// Support only on iOS and tvOS. 16 | public let protectionType: FileProtectionType? 17 | 18 | public init(name: String, expiry: Expiry = .never, 19 | maxSize: UInt = 0, directory: URL? = nil, 20 | protectionType: FileProtectionType? = nil) { 21 | self.name = name 22 | self.expiry = expiry 23 | self.maxSize = maxSize 24 | self.directory = directory 25 | self.protectionType = protectionType 26 | } 27 | #else 28 | public init(name: String, expiry: Expiry = .never, 29 | maxSize: UInt = 0, directory: URL? = nil) { 30 | self.name = name 31 | self.expiry = expiry 32 | self.maxSize = maxSize 33 | self.directory = directory 34 | } 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Configuration/MemoryConfig.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct MemoryConfig { 4 | /// Expiry date that will be applied by default for every added object 5 | /// if it's not overridden in the add(key: object: expiry: completion:) method 6 | public let expiry: Expiry 7 | /// The maximum number of objects in memory the cache should hold. 8 | /// If 0, there is no count limit. The default value is 0. 9 | public let countLimit: UInt 10 | 11 | /// The maximum total cost that the cache can hold before it starts evicting objects. 12 | /// If 0, there is no total cost limit. The default value is 0 13 | public let totalCostLimit: UInt 14 | 15 | public init(expiry: Expiry = .never, countLimit: UInt = 0, totalCostLimit: UInt = 0) { 16 | self.expiry = expiry 17 | self.countLimit = countLimit 18 | self.totalCostLimit = totalCostLimit 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Extensions/Date+Extensions.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | Helper NSDate extension. 5 | */ 6 | extension Date { 7 | 8 | /// Checks if the date is in the past. 9 | var inThePast: Bool { 10 | return timeIntervalSinceNow < 0 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Extensions/JSONDecoder+Extensions.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Convert json string, dictionary, data to Codable objects 4 | public extension JSONDecoder { 5 | /// Convert json string to Codable object 6 | /// 7 | /// - Parameters: 8 | /// - string: Json string. 9 | /// - type: Type information. 10 | /// - Returns: Codable object. 11 | /// - Throws: Error if failed. 12 | static func decode(_ string: String, to type: T.Type) throws -> T { 13 | guard let data = string.data(using: .utf8) else { 14 | throw StorageError.decodingFailed 15 | } 16 | 17 | return try decode(data, to: type.self) 18 | } 19 | 20 | /// Convert json dictionary to Codable object 21 | /// 22 | /// - Parameters: 23 | /// - json: Json dictionary. 24 | /// - type: Type information. 25 | /// - Returns: Codable object 26 | /// - Throws: Error if failed 27 | static func decode(_ json: [String: Any], to type: T.Type) throws -> T { 28 | let data = try JSONSerialization.data(withJSONObject: json, options: []) 29 | return try decode(data, to: type) 30 | } 31 | 32 | /// Convert json data to Codable object 33 | /// 34 | /// - Parameters: 35 | /// - json: Json dictionary. 36 | /// - type: Type information. 37 | /// - Returns: Codable object 38 | /// - Throws: Error if failed 39 | static func decode(_ data: Data, to type: T.Type) throws -> T { 40 | return try JSONDecoder().decode(T.self, from: data) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/DataSerializer.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Convert to and from data 4 | class DataSerializer { 5 | 6 | /// Convert object to data 7 | /// 8 | /// - Parameter object: The object to convert 9 | /// - Returns: Data 10 | /// - Throws: Encoder error if any 11 | static func serialize(object: T) throws -> Data { 12 | let encoder = JSONEncoder() 13 | return try encoder.encode(object) 14 | } 15 | 16 | /// Convert data to object 17 | /// 18 | /// - Parameter data: The data to convert 19 | /// - Returns: The object 20 | /// - Throws: Decoder error if any 21 | static func deserialize(data: Data) throws -> T { 22 | let decoder = JSONDecoder() 23 | return try decoder.decode(T.self, from: data) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/Entry.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A wrapper around cached object and its expiry date. 4 | public struct Entry { 5 | /// Cached object 6 | public let object: T 7 | /// Expiry date 8 | public let expiry: Expiry 9 | /// File path to the cached object 10 | public let filePath: String? 11 | 12 | init(object: T, expiry: Expiry, filePath: String? = nil) { 13 | self.object = object 14 | self.expiry = expiry 15 | self.filePath = filePath 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/ExpirationMode.swift: -------------------------------------------------------------------------------- 1 | /// Sets the expiration mode for the `CacheManager`. The default value is `.auto` which means that `Cache` 2 | /// will handle expiration internally. It will trigger cache clean up tasks depending on the events its receives 3 | /// from the application. If expiration mode is set to manual, it means that you manually have to invoke the clear 4 | /// cache methods yourself. 5 | /// 6 | /// - auto: Automatic cleanup of expired objects (default). 7 | /// - manual: Manual means that you opt out from any automatic expiration handling. 8 | public enum ExpirationMode { 9 | case auto, manual 10 | } 11 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/Expiry.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | Helper enum to set the expiration date 5 | */ 6 | public enum Expiry { 7 | /// Object will be expired in the nearest future 8 | case never 9 | /// Object will be expired in the specified amount of seconds 10 | case seconds(TimeInterval) 11 | /// Object will be expired on the specified date 12 | case date(Date) 13 | 14 | /// Returns the appropriate date object 15 | public var date: Date { 16 | switch self { 17 | case .never: 18 | // Ref: http://lists.apple.com/archives/cocoa-dev/2005/Apr/msg01833.html 19 | return Date(timeIntervalSince1970: 60 * 60 * 24 * 365 * 68) 20 | case .seconds(let seconds): 21 | return Date().addingTimeInterval(seconds) 22 | case .date(let date): 23 | return date 24 | } 25 | } 26 | 27 | /// Checks if cached object is expired according to expiration date 28 | public var isExpired: Bool { 29 | return date.inThePast 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/ImageWrapper.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct ImageWrapper: Codable { 4 | public let image: Image 5 | 6 | public enum CodingKeys: String, CodingKey { 7 | case image 8 | } 9 | 10 | public init(image: Image) { 11 | self.image = image 12 | } 13 | 14 | public init(from decoder: Decoder) throws { 15 | let container = try decoder.container(keyedBy: CodingKeys.self) 16 | let data = try container.decode(Data.self, forKey: CodingKeys.image) 17 | guard let image = Image(data: data) else { 18 | throw StorageError.decodingFailed 19 | } 20 | 21 | self.image = image 22 | } 23 | 24 | public func encode(to encoder: Encoder) throws { 25 | var container = encoder.container(keyedBy: CodingKeys.self) 26 | guard let data = image.cache_toData() else { 27 | throw StorageError.encodingFailed 28 | } 29 | 30 | try container.encode(data, forKey: CodingKeys.image) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/JSONArrayWrapper.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public typealias JSONArray = [JSONDictionary] 4 | 5 | public struct JSONArrayWrapper: Codable { 6 | public let jsonArray: JSONArray 7 | 8 | public enum CodingKeys: String, CodingKey { 9 | case jsonArray 10 | } 11 | 12 | public init(jsonArray: JSONArray) { 13 | self.jsonArray = jsonArray 14 | } 15 | 16 | public init(from decoder: Decoder) throws { 17 | let container = try decoder.container(keyedBy: CodingKeys.self) 18 | let data = try container.decode(Data.self, forKey: CodingKeys.jsonArray) 19 | let object = try JSONSerialization.jsonObject( 20 | with: data, 21 | options: [] 22 | ) 23 | 24 | guard let jsonArray = object as? JSONArray else { 25 | throw StorageError.decodingFailed 26 | } 27 | 28 | self.jsonArray = jsonArray 29 | } 30 | 31 | public func encode(to encoder: Encoder) throws { 32 | var container = encoder.container(keyedBy: CodingKeys.self) 33 | let data = try JSONSerialization.data( 34 | withJSONObject: jsonArray, 35 | options: [] 36 | ) 37 | 38 | try container.encode(data, forKey: CodingKeys.jsonArray) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/JSONDictionaryWrapper.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public typealias JSONDictionary = [String: Any] 4 | 5 | public struct JSONDictionaryWrapper: Codable { 6 | public let jsonDictionary: JSONDictionary 7 | 8 | public enum CodingKeys: String, CodingKey { 9 | case jsonDictionary 10 | } 11 | 12 | public init(jsonDictionary: JSONDictionary) { 13 | self.jsonDictionary = jsonDictionary 14 | } 15 | 16 | public init(from decoder: Decoder) throws { 17 | let container = try decoder.container(keyedBy: CodingKeys.self) 18 | let data = try container.decode(Data.self, forKey: CodingKeys.jsonDictionary) 19 | let object = try JSONSerialization.jsonObject( 20 | with: data, 21 | options: [] 22 | ) 23 | 24 | guard let jsonDictionary = object as? JSONDictionary else { 25 | throw StorageError.decodingFailed 26 | } 27 | 28 | self.jsonDictionary = jsonDictionary 29 | } 30 | 31 | public func encode(to encoder: Encoder) throws { 32 | var container = encoder.container(keyedBy: CodingKeys.self) 33 | let data = try JSONSerialization.data( 34 | withJSONObject: jsonDictionary, 35 | options: [] 36 | ) 37 | 38 | try container.encode(data, forKey: CodingKeys.jsonDictionary) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/MemoryCapsule.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Helper class to hold cached instance and expiry date. 4 | /// Used in memory storage to work with NSCache. 5 | class MemoryCapsule: NSObject { 6 | /// Object to be cached 7 | let object: Any 8 | /// Expiration date 9 | let expiry: Expiry 10 | 11 | /** 12 | Creates a new instance of Capsule. 13 | - Parameter value: Object to be cached 14 | - Parameter expiry: Expiration date 15 | */ 16 | init(value: Any, expiry: Expiry) { 17 | self.object = value 18 | self.expiry = expiry 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/ObservationToken.swift: -------------------------------------------------------------------------------- 1 | public final class ObservationToken { 2 | private let cancellationClosure: () -> Void 3 | 4 | init(cancellationClosure: @escaping () -> Void) { 5 | self.cancellationClosure = cancellationClosure 6 | } 7 | 8 | public func cancel() { 9 | cancellationClosure() 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/Optional+Extension.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public extension Optional { 4 | func unwrapOrThrow(error: Error) throws -> Wrapped { 5 | if let value = self { 6 | return value 7 | } else { 8 | throw error 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/Result.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Used for callback in async operations. 4 | public enum Result { 5 | case value(T) 6 | case error(Error) 7 | 8 | public func map(_ transform: (T) -> U) -> Result { 9 | switch self { 10 | case .value(let value): 11 | return Result.value(transform(value)) 12 | case .error(let error): 13 | return Result.error(error) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/StorageError.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public enum StorageError: Error { 4 | /// Object can not be found 5 | case notFound 6 | /// Object is found, but casting to requested type failed 7 | case typeNotMatch 8 | /// The file attributes are malformed 9 | case malformedFileAttributes 10 | /// Can't perform Decode 11 | case decodingFailed 12 | /// Can't perform Encode 13 | case encodingFailed 14 | /// The storage has been deallocated 15 | case deallocated 16 | /// Fail to perform transformation to or from Data 17 | case transformerFail 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/Transformer.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public class Transformer { 4 | let toData: (T) throws -> Data 5 | let fromData: (Data) throws -> T 6 | 7 | public init(toData: @escaping (T) throws -> Data, fromData: @escaping (Data) throws -> T) { 8 | self.toData = toData 9 | self.fromData = fromData 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/TransformerFactory.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public class TransformerFactory { 4 | public static func forData() -> Transformer { 5 | let toData: (Data) throws -> Data = { $0 } 6 | 7 | let fromData: (Data) throws -> Data = { $0 } 8 | 9 | return Transformer(toData: toData, fromData: fromData) 10 | } 11 | 12 | public static func forImage() -> Transformer { 13 | let toData: (Image) throws -> Data = { image in 14 | return try image.cache_toData().unwrapOrThrow(error: StorageError.transformerFail) 15 | } 16 | 17 | let fromData: (Data) throws -> Image = { data in 18 | return try Image(data: data).unwrapOrThrow(error: StorageError.transformerFail) 19 | } 20 | 21 | return Transformer(toData: toData, fromData: fromData) 22 | } 23 | 24 | public static func forCodable(ofType: U.Type) -> Transformer { 25 | let toData: (U) throws -> Data = { object in 26 | let wrapper = TypeWrapper(object: object) 27 | let encoder = JSONEncoder() 28 | return try encoder.encode(wrapper) 29 | } 30 | 31 | let fromData: (Data) throws -> U = { data in 32 | let decoder = JSONDecoder() 33 | return try decoder.decode(TypeWrapper.self, from: data).object 34 | } 35 | 36 | return Transformer(toData: toData, fromData: fromData) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/TypeWrapper.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Used to wrap Codable object 4 | public struct TypeWrapper: Codable { 5 | enum CodingKeys: String, CodingKey { 6 | case object 7 | } 8 | 9 | public let object: T 10 | 11 | public init(object: T) { 12 | self.object = object 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Library/Types.swift: -------------------------------------------------------------------------------- 1 | #if os(iOS) || os(tvOS) 2 | import UIKit 3 | public typealias Image = UIImage 4 | #elseif os(watchOS) 5 | 6 | #elseif os(OSX) 7 | import AppKit 8 | public typealias Image = NSImage 9 | #endif 10 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Storage/KeyObservationRegistry.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A protocol used for adding and removing key observations 4 | public protocol KeyObservationRegistry { 5 | associatedtype S: StorageAware 6 | 7 | /** 8 | Registers observation closure which will be removed automatically 9 | when the weakly captured observer has been deallocated. 10 | - Parameter observer: Any object that helps determine if the observation is still valid 11 | - Parameter key: Unique key to identify the object in the cache 12 | - Parameter closure: Observation closure 13 | - Returns: Token used to cancel the observation and remove the observation closure 14 | */ 15 | @discardableResult 16 | func addObserver( 17 | _ observer: O, 18 | forKey key: String, 19 | closure: @escaping (O, S, KeyChange) -> Void 20 | ) -> ObservationToken 21 | 22 | /** 23 | Removes observer by the given key. 24 | - Parameter key: Unique key to identify the object in the cache 25 | */ 26 | func removeObserver(forKey key: String) 27 | 28 | /// Removes all registered key observers 29 | func removeAllKeyObservers() 30 | } 31 | 32 | // MARK: - KeyChange 33 | 34 | public enum KeyChange { 35 | case edit(before: T?, after: T) 36 | case remove 37 | } 38 | 39 | extension KeyChange: Equatable where T: Equatable { 40 | public static func == (lhs: KeyChange, rhs: KeyChange) -> Bool { 41 | switch (lhs, rhs) { 42 | case (.edit(let before1, let after1), .edit(let before2, let after2)): 43 | return before1 == before2 && after1 == after2 44 | case (.remove, .remove): 45 | return true 46 | default: 47 | return false 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Storage/MemoryStorage.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public class MemoryStorage: StorageAware { 4 | fileprivate let cache = NSCache() 5 | // Memory cache keys 6 | fileprivate var keys = Set() 7 | /// Configuration 8 | fileprivate let config: MemoryConfig 9 | 10 | public init(config: MemoryConfig) { 11 | self.config = config 12 | self.cache.countLimit = Int(config.countLimit) 13 | self.cache.totalCostLimit = Int(config.totalCostLimit) 14 | } 15 | } 16 | 17 | extension MemoryStorage { 18 | public func setObject(_ object: T, forKey key: String, expiry: Expiry? = nil) { 19 | let capsule = MemoryCapsule(value: object, expiry: .date(expiry?.date ?? config.expiry.date)) 20 | cache.setObject(capsule, forKey: NSString(string: key)) 21 | keys.insert(key) 22 | } 23 | 24 | public func removeAll() { 25 | cache.removeAllObjects() 26 | keys.removeAll() 27 | } 28 | 29 | public func removeExpiredObjects() { 30 | let allKeys = keys 31 | for key in allKeys { 32 | removeObjectIfExpired(forKey: key) 33 | } 34 | } 35 | 36 | public func removeObjectIfExpired(forKey key: String) { 37 | if let capsule = cache.object(forKey: NSString(string: key)), capsule.expiry.isExpired { 38 | removeObject(forKey: key) 39 | } 40 | } 41 | 42 | public func removeObject(forKey key: String) { 43 | cache.removeObject(forKey: NSString(string: key)) 44 | keys.remove(key) 45 | } 46 | 47 | public func entry(forKey key: String) throws -> Entry { 48 | guard let capsule = cache.object(forKey: NSString(string: key)) else { 49 | throw StorageError.notFound 50 | } 51 | 52 | guard let object = capsule.object as? T else { 53 | throw StorageError.typeNotMatch 54 | } 55 | 56 | return Entry(object: object, expiry: capsule.expiry) 57 | } 58 | } 59 | 60 | public extension MemoryStorage { 61 | func transform() -> MemoryStorage { 62 | let storage = MemoryStorage(config: config) 63 | return storage 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Storage/Storage+Transform.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public extension Storage { 4 | func transformData() -> Storage { 5 | let storage = transform(transformer: TransformerFactory.forData()) 6 | return storage 7 | } 8 | 9 | func transformImage() -> Storage { 10 | let storage = transform(transformer: TransformerFactory.forImage()) 11 | return storage 12 | } 13 | 14 | func transformCodable(ofType: U.Type) -> Storage { 15 | let storage = transform(transformer: TransformerFactory.forCodable(ofType: U.self)) 16 | return storage 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Storage/StorageAware.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A protocol used for saving and loading from storage 4 | public protocol StorageAware { 5 | associatedtype T 6 | /** 7 | Tries to retrieve the object from the storage. 8 | - Parameter key: Unique key to identify the object in the cache 9 | - Returns: Cached object or nil if not found 10 | */ 11 | func object(forKey key: String) throws -> T 12 | 13 | /** 14 | Get cache entry which includes object with metadata. 15 | - Parameter key: Unique key to identify the object in the cache 16 | - Returns: Object wrapper with metadata or nil if not found 17 | */ 18 | func entry(forKey key: String) throws -> Entry 19 | 20 | /** 21 | Removes the object by the given key. 22 | - Parameter key: Unique key to identify the object. 23 | */ 24 | func removeObject(forKey key: String) throws 25 | 26 | /** 27 | Saves passed object. 28 | - Parameter key: Unique key to identify the object in the cache. 29 | - Parameter object: Object that needs to be cached. 30 | - Parameter expiry: Overwrite expiry for this object only. 31 | */ 32 | func setObject(_ object: T, forKey key: String, expiry: Expiry?) throws 33 | 34 | /** 35 | Check if an object exist by the given key. 36 | - Parameter key: Unique key to identify the object. 37 | */ 38 | func existsObject(forKey key: String) throws -> Bool 39 | 40 | /** 41 | Removes all objects from the cache storage. 42 | */ 43 | func removeAll() throws 44 | 45 | /** 46 | Clears all expired objects. 47 | */ 48 | func removeExpiredObjects() throws 49 | 50 | /** 51 | Check if an expired object by the given key. 52 | - Parameter key: Unique key to identify the object. 53 | */ 54 | func isExpiredObject(forKey key: String) throws -> Bool 55 | } 56 | 57 | public extension StorageAware { 58 | func object(forKey key: String) throws -> T { 59 | return try entry(forKey: key).object 60 | } 61 | 62 | func existsObject(forKey key: String) throws -> Bool { 63 | do { 64 | let _: T = try object(forKey: key) 65 | return true 66 | } catch { 67 | return false 68 | } 69 | } 70 | 71 | func isExpiredObject(forKey key: String) throws -> Bool { 72 | do { 73 | let entry = try self.entry(forKey: key) 74 | return entry.expiry.isExpired 75 | } catch { 76 | return true 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Storage/StorageObservationRegistry.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A protocol used for adding and removing storage observations 4 | public protocol StorageObservationRegistry { 5 | associatedtype S: StorageAware 6 | 7 | /** 8 | Registers observation closure which will be removed automatically 9 | when the weakly captured observer has been deallocated. 10 | - Parameter observer: Any object that helps determine if the observation is still valid 11 | - Parameter closure: Observation closure 12 | - Returns: Token used to cancel the observation and remove the observation closure 13 | */ 14 | @discardableResult 15 | func addStorageObserver( 16 | _ observer: O, 17 | closure: @escaping (O, S, StorageChange) -> Void 18 | ) -> ObservationToken 19 | 20 | /// Removes all registered key observers 21 | func removeAllStorageObservers() 22 | } 23 | 24 | // MARK: - StorageChange 25 | 26 | public enum StorageChange: Equatable { 27 | case add(key: String) 28 | case remove(key: String) 29 | case removeAll 30 | case removeExpired 31 | } 32 | 33 | public func == (lhs: StorageChange, rhs: StorageChange) -> Bool { 34 | switch (lhs, rhs) { 35 | case (.add(let key1), .add(let key2)), (.remove(let key1), .remove(let key2)): 36 | return key1 == key2 37 | case (.removeAll, .removeAll), (.removeExpired, .removeExpired): 38 | return true 39 | default: 40 | return false 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/Shared/Storage/SyncStorage.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Dispatch 3 | 4 | /// Manipulate storage in a "all sync" manner. 5 | /// Block the current queue until the operation completes. 6 | public class SyncStorage { 7 | public let innerStorage: HybridStorage 8 | public let serialQueue: DispatchQueue 9 | 10 | public init(storage: HybridStorage, serialQueue: DispatchQueue) { 11 | self.innerStorage = storage 12 | self.serialQueue = serialQueue 13 | } 14 | } 15 | 16 | extension SyncStorage: StorageAware { 17 | public func entry(forKey key: String) throws -> Entry { 18 | var entry: Entry! 19 | try serialQueue.sync { 20 | entry = try innerStorage.entry(forKey: key) 21 | } 22 | 23 | return entry 24 | } 25 | 26 | public func removeObject(forKey key: String) throws { 27 | try serialQueue.sync { 28 | try self.innerStorage.removeObject(forKey: key) 29 | } 30 | } 31 | 32 | public func setObject(_ object: T, forKey key: String, expiry: Expiry? = nil) throws { 33 | try serialQueue.sync { 34 | try innerStorage.setObject(object, forKey: key, expiry: expiry) 35 | } 36 | } 37 | 38 | public func removeAll() throws { 39 | try serialQueue.sync { 40 | try innerStorage.removeAll() 41 | } 42 | } 43 | 44 | public func removeExpiredObjects() throws { 45 | try serialQueue.sync { 46 | try innerStorage.removeExpiredObjects() 47 | } 48 | } 49 | } 50 | 51 | public extension SyncStorage { 52 | func transform(transformer: Transformer) -> SyncStorage { 53 | let storage = SyncStorage( 54 | storage: innerStorage.transform(transformer: transformer), 55 | serialQueue: serialQueue 56 | ) 57 | 58 | return storage 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Example/Pods/Cache/Source/iOS/UIImage+Extensions.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | /// Helper UIImage extension. 4 | extension UIImage { 5 | /// Checks if image has alpha component 6 | var hasAlpha: Bool { 7 | let result: Bool 8 | 9 | guard let alpha = cgImage?.alphaInfo else { 10 | return false 11 | } 12 | 13 | switch alpha { 14 | case .none, .noneSkipFirst, .noneSkipLast: 15 | result = false 16 | default: 17 | result = true 18 | } 19 | 20 | return result 21 | } 22 | 23 | /// Convert to data 24 | func cache_toData() -> Data? { 25 | #if swift(>=4.2) 26 | return hasAlpha 27 | ? pngData() 28 | : jpegData(compressionQuality: 1.0) 29 | #else 30 | return hasAlpha 31 | ? UIImagePNGRepresentation(self) 32 | : UIImageJPEGRepresentation(self, 1.0) 33 | #endif 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/RxMoyaCache.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RxMoyaCache", 3 | "version": "0.1.0", 4 | "summary": "A network cache library based on RxSwift/Moya/Cache.", 5 | "homepage": "https://github.com/Pircate/RxMoyaCache", 6 | "license": { 7 | "type": "MIT", 8 | "file": "LICENSE" 9 | }, 10 | "authors": { 11 | "Pircate": "gao497868860@163.com" 12 | }, 13 | "source": { 14 | "git": "https://github.com/Pircate/RxMoyaCache.git", 15 | "tag": "0.1.0" 16 | }, 17 | "platforms": { 18 | "ios": "9.0" 19 | }, 20 | "swift_version": "4.2", 21 | "source_files": "RxMoyaCache/Classes/**/*", 22 | "dependencies": { 23 | "Moya/RxSwift": [ 24 | 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.8.1) 3 | - Cache (5.2.0) 4 | - Moya/Core (12.0.1): 5 | - Alamofire (~> 4.1) 6 | - Result (~> 4.0) 7 | - Moya/RxSwift (12.0.1): 8 | - Moya/Core 9 | - RxSwift (~> 4.0) 10 | - Result (4.1.0) 11 | - RxAtomic (4.4.1) 12 | - RxMoyaCache (0.1.0): 13 | - Moya/RxSwift 14 | - RxSwift (4.4.1): 15 | - RxAtomic (~> 4.4) 16 | 17 | DEPENDENCIES: 18 | - Cache 19 | - RxMoyaCache (from `../`) 20 | 21 | SPEC REPOS: 22 | https://github.com/cocoapods/specs.git: 23 | - Alamofire 24 | - Cache 25 | - Moya 26 | - Result 27 | - RxAtomic 28 | - RxSwift 29 | 30 | EXTERNAL SOURCES: 31 | RxMoyaCache: 32 | :path: "../" 33 | 34 | SPEC CHECKSUMS: 35 | Alamofire: 16ce2c353fb72865124ddae8a57c5942388f4f11 36 | Cache: 807c5d86d01a177f06ede9865add3aea269bbfd4 37 | Moya: cf730b3cd9e005401ef37a85143aa141a12fd38f 38 | Result: bd966fac789cc6c1563440b348ab2598cc24d5c7 39 | RxAtomic: f8d6adc1ccb87a767811269e4875887bc74dbf19 40 | RxMoyaCache: 717d45e69ccdf99690298792a991db5e8e28ed36 41 | RxSwift: 92fcf68dfef21f3e2ab1965363d9e7b3d787597e 42 | 43 | PODFILE CHECKSUM: 6c8eb1d6a106db6cd5209c8b5c9ff6efc2d05551 44 | 45 | COCOAPODS: 1.6.1 46 | -------------------------------------------------------------------------------- /Example/Pods/Moya/License.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-present Artsy, Ash Furrow 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 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/AnyEncodable.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | struct AnyEncodable: Encodable { 4 | 5 | private let encodable: Encodable 6 | 7 | public init(_ encodable: Encodable) { 8 | self.encodable = encodable 9 | } 10 | 11 | func encode(to encoder: Encoder) throws { 12 | try encodable.encode(to: encoder) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/Cancellable.swift: -------------------------------------------------------------------------------- 1 | /// Protocol to define the opaque type returned from a request. 2 | public protocol Cancellable { 3 | 4 | /// A Boolean value stating whether a request is cancelled. 5 | var isCancelled: Bool { get } 6 | 7 | /// Cancels the represented request. 8 | func cancel() 9 | } 10 | 11 | internal class CancellableWrapper: Cancellable { 12 | internal var innerCancellable: Cancellable = SimpleCancellable() 13 | 14 | var isCancelled: Bool { return innerCancellable.isCancelled } 15 | 16 | internal func cancel() { 17 | innerCancellable.cancel() 18 | } 19 | } 20 | 21 | internal class SimpleCancellable: Cancellable { 22 | var isCancelled = false 23 | func cancel() { 24 | isCancelled = true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/Image.swift: -------------------------------------------------------------------------------- 1 | #if os(iOS) || os(watchOS) || os(tvOS) 2 | import UIKit.UIImage 3 | public typealias ImageType = UIImage 4 | #elseif os(macOS) 5 | import AppKit.NSImage 6 | public typealias ImageType = NSImage 7 | #endif 8 | 9 | /// An alias for the SDK's image type. 10 | public typealias Image = ImageType 11 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// These functions are default mappings to `MoyaProvider`'s properties: endpoints, requests, manager, etc. 4 | public extension MoyaProvider { 5 | public final class func defaultEndpointMapping(for target: Target) -> Endpoint { 6 | return Endpoint( 7 | url: URL(target: target).absoluteString, 8 | sampleResponseClosure: { .networkResponse(200, target.sampleData) }, 9 | method: target.method, 10 | task: target.task, 11 | httpHeaderFields: target.headers 12 | ) 13 | } 14 | 15 | public final class func defaultRequestMapping(for endpoint: Endpoint, closure: RequestResultClosure) { 16 | do { 17 | let urlRequest = try endpoint.urlRequest() 18 | closure(.success(urlRequest)) 19 | } catch MoyaError.requestMapping(let url) { 20 | closure(.failure(MoyaError.requestMapping(url))) 21 | } catch MoyaError.parameterEncoding(let error) { 22 | closure(.failure(MoyaError.parameterEncoding(error))) 23 | } catch { 24 | closure(.failure(MoyaError.underlying(error, nil))) 25 | } 26 | } 27 | 28 | public final class func defaultAlamofireManager() -> Manager { 29 | let configuration = URLSessionConfiguration.default 30 | configuration.httpAdditionalHeaders = Manager.defaultHTTPHeaders 31 | 32 | let manager = Manager(configuration: configuration) 33 | manager.startRequestsImmediately = false 34 | return manager 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/MultiTarget.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A `TargetType` used to enable `MoyaProvider` to process multiple `TargetType`s. 4 | public enum MultiTarget: TargetType { 5 | /// The embedded `TargetType`. 6 | case target(TargetType) 7 | 8 | /// Initializes a `MultiTarget`. 9 | public init(_ target: TargetType) { 10 | self = MultiTarget.target(target) 11 | } 12 | 13 | /// The embedded target's base `URL`. 14 | public var path: String { 15 | return target.path 16 | } 17 | 18 | /// The baseURL of the embedded target. 19 | public var baseURL: URL { 20 | return target.baseURL 21 | } 22 | 23 | /// The HTTP method of the embedded target. 24 | public var method: Moya.Method { 25 | return target.method 26 | } 27 | 28 | /// The sampleData of the embedded target. 29 | public var sampleData: Data { 30 | return target.sampleData 31 | } 32 | 33 | /// The `Task` of the embedded target. 34 | public var task: Task { 35 | return target.task 36 | } 37 | 38 | /// The `ValidationType` of the embedded target. 39 | public var validationType: ValidationType { 40 | return target.validationType 41 | } 42 | 43 | /// The headers of the embedded target. 44 | public var headers: [String: String]? { 45 | return target.headers 46 | } 47 | 48 | /// The embedded `TargetType`. 49 | public var target: TargetType { 50 | switch self { 51 | case .target(let target): return target 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/MultipartFormData.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Alamofire 3 | 4 | /// Represents "multipart/form-data" for an upload. 5 | public struct MultipartFormData { 6 | 7 | /// Method to provide the form data. 8 | public enum FormDataProvider { 9 | case data(Foundation.Data) 10 | case file(URL) 11 | case stream(InputStream, UInt64) 12 | } 13 | 14 | public init(provider: FormDataProvider, name: String, fileName: String? = nil, mimeType: String? = nil) { 15 | self.provider = provider 16 | self.name = name 17 | self.fileName = fileName 18 | self.mimeType = mimeType 19 | } 20 | 21 | /// The method being used for providing form data. 22 | public let provider: FormDataProvider 23 | 24 | /// The name. 25 | public let name: String 26 | 27 | /// The file name. 28 | public let fileName: String? 29 | 30 | /// The MIME type 31 | public let mimeType: String? 32 | 33 | } 34 | 35 | // MARK: RequestMultipartFormData appending 36 | internal extension RequestMultipartFormData { 37 | func append(data: Data, bodyPart: MultipartFormData) { 38 | if let mimeType = bodyPart.mimeType { 39 | if let fileName = bodyPart.fileName { 40 | append(data, withName: bodyPart.name, fileName: fileName, mimeType: mimeType) 41 | } else { 42 | append(data, withName: bodyPart.name, mimeType: mimeType) 43 | } 44 | } else { 45 | append(data, withName: bodyPart.name) 46 | } 47 | } 48 | 49 | func append(fileURL url: URL, bodyPart: MultipartFormData) { 50 | if let fileName = bodyPart.fileName, let mimeType = bodyPart.mimeType { 51 | append(url, withName: bodyPart.name, fileName: fileName, mimeType: mimeType) 52 | } else { 53 | append(url, withName: bodyPart.name) 54 | } 55 | } 56 | 57 | func append(stream: InputStream, length: UInt64, bodyPart: MultipartFormData) { 58 | append(stream, withLength: length, name: bodyPart.name, fileName: bodyPart.fileName ?? "", mimeType: bodyPart.mimeType ?? "") 59 | } 60 | 61 | func applyMoyaMultipartFormData(_ multipartBody: [Moya.MultipartFormData]) { 62 | for bodyPart in multipartBody { 63 | switch bodyPart.provider { 64 | case .data(let data): 65 | append(data: data, bodyPart: bodyPart) 66 | case .file(let url): 67 | append(fileURL: url, bodyPart: bodyPart) 68 | case .stream(let stream, let length): 69 | append(stream: stream, length: length, bodyPart: bodyPart) 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/Plugin.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Result 3 | 4 | /// A Moya Plugin receives callbacks to perform side effects wherever a request is sent or received. 5 | /// 6 | /// for example, a plugin may be used to 7 | /// - log network requests 8 | /// - hide and show a network activity indicator 9 | /// - inject additional information into a request 10 | public protocol PluginType { 11 | /// Called to modify a request before sending. 12 | func prepare(_ request: URLRequest, target: TargetType) -> URLRequest 13 | 14 | /// Called immediately before a request is sent over the network (or stubbed). 15 | func willSend(_ request: RequestType, target: TargetType) 16 | 17 | /// Called after a response has been received, but before the MoyaProvider has invoked its completion handler. 18 | func didReceive(_ result: Result, target: TargetType) 19 | 20 | /// Called to modify a result before completion. 21 | func process(_ result: Result, target: TargetType) -> Result 22 | } 23 | 24 | public extension PluginType { 25 | func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { return request } 26 | func willSend(_ request: RequestType, target: TargetType) { } 27 | func didReceive(_ result: Result, target: TargetType) { } 28 | func process(_ result: Result, target: TargetType) -> Result { return result } 29 | } 30 | 31 | /// Request type used by `willSend` plugin function. 32 | public protocol RequestType { 33 | 34 | // Note: 35 | // 36 | // We use this protocol instead of the Alamofire request to avoid leaking that abstraction. 37 | // A plugin should not know about Alamofire at all. 38 | 39 | /// Retrieve an `NSURLRequest` representation. 40 | var request: URLRequest? { get } 41 | 42 | /// Authenticates the request with a username and password. 43 | func authenticate(user: String, password: String, persistence: URLCredential.Persistence) -> Self 44 | 45 | /// Authenticates the request with an `NSURLCredential` instance. 46 | func authenticate(usingCredential credential: URLCredential) -> Self 47 | } 48 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/Plugins/CredentialsPlugin.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Result 3 | 4 | /// Provides each request with optional URLCredentials. 5 | public final class CredentialsPlugin: PluginType { 6 | 7 | public typealias CredentialClosure = (TargetType) -> URLCredential? 8 | let credentialsClosure: CredentialClosure 9 | 10 | /// Initializes a CredentialsPlugin. 11 | public init(credentialsClosure: @escaping CredentialClosure) { 12 | self.credentialsClosure = credentialsClosure 13 | } 14 | 15 | // MARK: Plugin 16 | 17 | public func willSend(_ request: RequestType, target: TargetType) { 18 | if let credentials = credentialsClosure(target) { 19 | _ = request.authenticate(usingCredential: credentials) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/Plugins/NetworkActivityPlugin.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Result 3 | 4 | /// Network activity change notification type. 5 | public enum NetworkActivityChangeType { 6 | case began, ended 7 | } 8 | 9 | /// Notify a request's network activity changes (request begins or ends). 10 | public final class NetworkActivityPlugin: PluginType { 11 | 12 | public typealias NetworkActivityClosure = (_ change: NetworkActivityChangeType, _ target: TargetType) -> Void 13 | let networkActivityClosure: NetworkActivityClosure 14 | 15 | /// Initializes a NetworkActivityPlugin. 16 | public init(networkActivityClosure: @escaping NetworkActivityClosure) { 17 | self.networkActivityClosure = networkActivityClosure 18 | } 19 | 20 | // MARK: Plugin 21 | 22 | /// Called by the provider as soon as the request is about to start 23 | public func willSend(_ request: RequestType, target: TargetType) { 24 | networkActivityClosure(.began, target) 25 | } 26 | 27 | /// Called by the provider as soon as a response arrives, even if the request is canceled. 28 | public func didReceive(_ result: Result, target: TargetType) { 29 | networkActivityClosure(.ended, target) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/TargetType.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// The protocol used to define the specifications necessary for a `MoyaProvider`. 4 | public protocol TargetType { 5 | 6 | /// The target's base `URL`. 7 | var baseURL: URL { get } 8 | 9 | /// The path to be appended to `baseURL` to form the full `URL`. 10 | var path: String { get } 11 | 12 | /// The HTTP method used in the request. 13 | var method: Moya.Method { get } 14 | 15 | /// Provides stub data for use in testing. 16 | var sampleData: Data { get } 17 | 18 | /// The type of HTTP task to be performed. 19 | var task: Task { get } 20 | 21 | /// The type of validation to perform on the request. Default is `.none`. 22 | var validationType: ValidationType { get } 23 | 24 | /// The headers to be used in the request. 25 | var headers: [String: String]? { get } 26 | } 27 | 28 | public extension TargetType { 29 | 30 | /// The type of validation to perform on the request. Default is `.none`. 31 | var validationType: ValidationType { 32 | return .none 33 | } 34 | } 35 | 36 | // MARK: - Deprecated 37 | 38 | extension TargetType { 39 | @available(*, deprecated: 11.0, message: 40 | "TargetType's validate property has been deprecated in 11.0. Please use validationType: ValidationType.") 41 | var validate: Bool { 42 | return false 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/Task.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Represents an HTTP task. 4 | public enum Task { 5 | 6 | /// A request with no additional data. 7 | case requestPlain 8 | 9 | /// A requests body set with data. 10 | case requestData(Data) 11 | 12 | /// A request body set with `Encodable` type 13 | case requestJSONEncodable(Encodable) 14 | 15 | /// A request body set with `Encodable` type and custom encoder 16 | case requestCustomJSONEncodable(Encodable, encoder: JSONEncoder) 17 | 18 | /// A requests body set with encoded parameters. 19 | case requestParameters(parameters: [String: Any], encoding: ParameterEncoding) 20 | 21 | /// A requests body set with data, combined with url parameters. 22 | case requestCompositeData(bodyData: Data, urlParameters: [String: Any]) 23 | 24 | /// A requests body set with encoded parameters combined with url parameters. 25 | case requestCompositeParameters(bodyParameters: [String: Any], bodyEncoding: ParameterEncoding, urlParameters: [String: Any]) 26 | 27 | /// A file upload task. 28 | case uploadFile(URL) 29 | 30 | /// A "multipart/form-data" upload task. 31 | case uploadMultipart([MultipartFormData]) 32 | 33 | /// A "multipart/form-data" upload task combined with url parameters. 34 | case uploadCompositeMultipart([MultipartFormData], urlParameters: [String: Any]) 35 | 36 | /// A file download task to a destination. 37 | case downloadDestination(DownloadDestination) 38 | 39 | /// A file download task to a destination with extra parameters using the given encoding. 40 | case downloadParameters(parameters: [String: Any], encoding: ParameterEncoding, destination: DownloadDestination) 41 | } 42 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/URL+Moya.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public extension URL { 4 | 5 | /// Initialize URL from Moya's `TargetType`. 6 | init(target: T) { 7 | // When a TargetType's path is empty, URL.appendingPathComponent may introduce trailing /, which may not be wanted in some cases 8 | // See: https://github.com/Moya/Moya/pull/1053 9 | // And: https://github.com/Moya/Moya/issues/1049 10 | if target.path.isEmpty { 11 | self = target.baseURL 12 | } else { 13 | self = target.baseURL.appendingPathComponent(target.path) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/URLRequest+Encoding.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal extension URLRequest { 4 | 5 | mutating func encoded(encodable: Encodable, encoder: JSONEncoder = JSONEncoder()) throws -> URLRequest { 6 | do { 7 | let encodable = AnyEncodable(encodable) 8 | httpBody = try encoder.encode(encodable) 9 | 10 | let contentTypeHeaderName = "Content-Type" 11 | if value(forHTTPHeaderField: contentTypeHeaderName) == nil { 12 | setValue("application/json", forHTTPHeaderField: contentTypeHeaderName) 13 | } 14 | 15 | return self 16 | } catch { 17 | throw MoyaError.encodableMapping(error) 18 | } 19 | } 20 | 21 | func encoded(parameters: [String: Any], parameterEncoding: ParameterEncoding) throws -> URLRequest { 22 | do { 23 | return try parameterEncoding.encode(self, with: parameters) 24 | } catch { 25 | throw MoyaError.parameterEncoding(error) 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/Moya/ValidationType.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Represents the status codes to validate through Alamofire. 4 | public enum ValidationType { 5 | 6 | /// No validation. 7 | case none 8 | 9 | /// Validate success codes (only 2xx). 10 | case successCodes 11 | 12 | /// Validate success codes and redirection codes (only 2xx and 3xx). 13 | case successAndRedirectCodes 14 | 15 | /// Validate only the given status codes. 16 | case customCodes([Int]) 17 | 18 | /// The list of HTTP status codes to validate. 19 | var statusCodes: [Int] { 20 | switch self { 21 | case .successCodes: 22 | return Array(200..<300) 23 | case .successAndRedirectCodes: 24 | return Array(200..<400) 25 | case .customCodes(let codes): 26 | return codes 27 | case .none: 28 | return [] 29 | } 30 | } 31 | } 32 | 33 | extension ValidationType: Equatable { 34 | 35 | public static func == (lhs: ValidationType, rhs: ValidationType) -> Bool { 36 | switch (lhs, rhs) { 37 | case (.none, .none), 38 | (.successCodes, .successCodes), 39 | (.successAndRedirectCodes, .successAndRedirectCodes): 40 | return true 41 | case (.customCodes(let code1), .customCodes(let code2)): 42 | return code1 == code2 43 | default: 44 | return false 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Example/Pods/Moya/Sources/RxMoya/MoyaProvider+Rx.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import RxSwift 3 | #if !COCOAPODS 4 | import Moya 5 | #endif 6 | 7 | extension MoyaProvider: ReactiveCompatible {} 8 | 9 | public extension Reactive where Base: MoyaProviderType { 10 | 11 | /// Designated request-making method. 12 | /// 13 | /// - Parameters: 14 | /// - token: Entity, which provides specifications necessary for a `MoyaProvider`. 15 | /// - callbackQueue: Callback queue. If nil - queue from provider initializer will be used. 16 | /// - Returns: Single response object. 17 | public func request(_ token: Base.Target, callbackQueue: DispatchQueue? = nil) -> Single { 18 | return Single.create { [weak base] single in 19 | let cancellableToken = base?.request(token, callbackQueue: callbackQueue, progress: nil) { result in 20 | switch result { 21 | case let .success(response): 22 | single(.success(response)) 23 | case let .failure(error): 24 | single(.error(error)) 25 | } 26 | } 27 | 28 | return Disposables.create { 29 | cancellableToken?.cancel() 30 | } 31 | } 32 | } 33 | 34 | /// Designated request-making method with progress. 35 | public func requestWithProgress(_ token: Base.Target, callbackQueue: DispatchQueue? = nil) -> Observable { 36 | let progressBlock: (AnyObserver) -> (ProgressResponse) -> Void = { observer in 37 | return { progress in 38 | observer.onNext(progress) 39 | } 40 | } 41 | 42 | let response: Observable = Observable.create { [weak base] observer in 43 | let cancellableToken = base?.request(token, callbackQueue: callbackQueue, progress: progressBlock(observer)) { result in 44 | switch result { 45 | case .success: 46 | observer.onCompleted() 47 | case let .failure(error): 48 | observer.onError(error) 49 | } 50 | } 51 | 52 | return Disposables.create { 53 | cancellableToken?.cancel() 54 | } 55 | } 56 | 57 | // Accumulate all progress and combine them when the result comes 58 | return response.scan(ProgressResponse()) { last, progress in 59 | let progressObject = progress.progressObject ?? last.progressObject 60 | let response = progress.response ?? last.response 61 | return ProgressResponse(progress: progressObject, response: response) 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Example/Pods/Result/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Rob Rix 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. -------------------------------------------------------------------------------- /Example/Pods/Result/Result/AnyError.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A type-erased error which wraps an arbitrary error instance. This should be 4 | /// useful for generic contexts. 5 | public struct AnyError: Swift.Error { 6 | /// The underlying error. 7 | public let error: Swift.Error 8 | 9 | public init(_ error: Swift.Error) { 10 | if let anyError = error as? AnyError { 11 | self = anyError 12 | } else { 13 | self.error = error 14 | } 15 | } 16 | } 17 | 18 | extension AnyError: ErrorConvertible { 19 | public static func error(from error: Error) -> AnyError { 20 | return AnyError(error) 21 | } 22 | } 23 | 24 | extension AnyError: CustomStringConvertible { 25 | public var description: String { 26 | return String(describing: error) 27 | } 28 | } 29 | 30 | extension AnyError: LocalizedError { 31 | public var errorDescription: String? { 32 | return error.localizedDescription 33 | } 34 | 35 | public var failureReason: String? { 36 | return (error as? LocalizedError)?.failureReason 37 | } 38 | 39 | public var helpAnchor: String? { 40 | return (error as? LocalizedError)?.helpAnchor 41 | } 42 | 43 | public var recoverySuggestion: String? { 44 | return (error as? LocalizedError)?.recoverySuggestion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Example/Pods/Result/Result/NoError.swift: -------------------------------------------------------------------------------- 1 | /// An “error” that is impossible to construct. 2 | /// 3 | /// This can be used to describe `Result`s where failures will never 4 | /// be generated. For example, `Result` describes a result that 5 | /// contains an `Int`eger and is guaranteed never to be a `failure`. 6 | public enum NoError: Swift.Error, Equatable { 7 | public static func ==(lhs: NoError, rhs: NoError) -> Bool { 8 | return true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Example/Pods/RxAtomic/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. -------------------------------------------------------------------------------- /Example/Pods/RxAtomic/RxAtomic/RxAtomic.c: -------------------------------------------------------------------------------- 1 | // 2 | // RxAtomic.c 3 | // RxAtomic 4 | // 5 | // Created by Krunoslav Zaher on 10/28/18. 6 | // Copyright © 2018 Krunoslav Zaher. All rights reserved. 7 | // 8 | -------------------------------------------------------------------------------- /Example/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. -------------------------------------------------------------------------------- /Example/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 RxAtomic 10 | 11 | typealias AtomicInt = RxAtomic.AtomicInt 12 | 13 | extension AtomicInt { 14 | public init(_ value: Int32) { 15 | self.init() 16 | AtomicInt_initialize(&self, value) 17 | } 18 | } 19 | 20 | @discardableResult 21 | @inline(__always) 22 | func add(_ this: UnsafeMutablePointer, _ value: Int32) -> Int32 { 23 | return AtomicInt_add(this, value) 24 | } 25 | 26 | @discardableResult 27 | @inline(__always) 28 | func sub(_ this: UnsafeMutablePointer, _ value: Int32) -> Int32 { 29 | return AtomicInt_sub(this, value) 30 | } 31 | 32 | @discardableResult 33 | @inline(__always) 34 | func fetchOr(_ this: UnsafeMutablePointer, _ mask: Int32) -> Int32 { 35 | return AtomicInt_fetchOr(this, mask) 36 | } 37 | 38 | @inline(__always) 39 | func load(_ this: UnsafeMutablePointer) -> Int32 { 40 | return AtomicInt_load(this) 41 | } 42 | 43 | @discardableResult 44 | @inline(__always) 45 | func increment(_ this: UnsafeMutablePointer) -> Int32 { 46 | return add(this, 1) 47 | } 48 | 49 | @discardableResult 50 | @inline(__always) 51 | func decrement(_ this: UnsafeMutablePointer) -> Int32 { 52 | return sub(this, 1) 53 | } 54 | 55 | @inline(__always) 56 | func isFlagSet(_ this: UnsafeMutablePointer, _ mask: Int32) -> Bool { 57 | return (load(this) & mask) != 0 58 | } 59 | -------------------------------------------------------------------------------- /Example/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 Element = E 12 | typealias Iterator = AnyIterator 13 | 14 | private let _repeatedValue: E 15 | 16 | init(repeatedValue: E) { 17 | _repeatedValue = repeatedValue 18 | } 19 | 20 | func makeIterator() -> Iterator { 21 | let repeatedValue = _repeatedValue 22 | return AnyIterator { 23 | return repeatedValue 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Example/Pods/RxSwift/Platform/DeprecationWarner.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DeprecationWarner.swift 3 | // Platform 4 | // 5 | // Created by Shai Mishali on 1/9/18. 6 | // Copyright © 2018 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if DEBUG 12 | class DeprecationWarner { 13 | private static var warned = Set() 14 | private static var _lock = NSRecursiveLock() 15 | 16 | static func warnIfNeeded(_ kind: Kind) { 17 | _lock.lock(); defer { _lock.unlock() } 18 | guard !warned.contains(kind) else { return } 19 | 20 | warned.insert(kind) 21 | print("ℹ️ [DEPRECATED] \(kind.message)") 22 | } 23 | } 24 | 25 | extension DeprecationWarner { 26 | enum Kind { 27 | case variable 28 | case globalTestFunctionNext 29 | case globalTestFunctionError 30 | case globalTestFunctionCompleted 31 | 32 | var message: String { 33 | switch self { 34 | case .variable: return "`Variable` is planned for future deprecation. Please consider `BehaviorRelay` as a replacement. Read more at: https://git.io/vNqvx" 35 | case .globalTestFunctionNext: return "The `next()` global function is planned for future deprecation. Please use `Recorded.next()` instead." 36 | case .globalTestFunctionError: return "The `error()` global function is planned for future deprecation. Please use `Recorded.error()` instead." 37 | case .globalTestFunctionCompleted: return "The `completed()` global function is planned for future deprecation. Please use `Recorded.completed()` instead." 38 | } 39 | } 40 | } 41 | } 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | let currentThread = Thread.current 17 | var threadDictionary = currentThread.threadDictionary 18 | 19 | if let newValue = value { 20 | threadDictionary[key] = newValue 21 | } 22 | else { 23 | threadDictionary[key] = nil 24 | } 25 | 26 | currentThread.threadDictionary = threadDictionary 27 | } 28 | 29 | static func getThreadLocalStorageValueForKey(_ key: String) -> T? { 30 | let currentThread = Thread.current 31 | let threadDictionary = currentThread.threadDictionary 32 | 33 | return threadDictionary[key] as? T 34 | } 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | /// The type of elements in sequence that observer can observe. 14 | public typealias E = Element 15 | 16 | /// Anonymous event handler type. 17 | public typealias EventHandler = (Event) -> Void 18 | 19 | private let observer: EventHandler 20 | 21 | /// Construct an instance whose `on(event)` calls `eventHandler(event)` 22 | /// 23 | /// - parameter eventHandler: Event handler that observes sequences events. 24 | public init(eventHandler: @escaping EventHandler) { 25 | self.observer = eventHandler 26 | } 27 | 28 | /// Construct an instance whose `on(event)` calls `observer.on(event)` 29 | /// 30 | /// - parameter observer: Observer that receives sequence events. 31 | public init(_ observer: O) where O.E == Element { 32 | self.observer = observer.on 33 | } 34 | 35 | /// Send `event` to this observer. 36 | /// 37 | /// - parameter event: Event instance. 38 | public func on(_ event: Event) { 39 | return self.observer(event) 40 | } 41 | 42 | /// Erases type of observer and returns canonical observer. 43 | /// 44 | /// - returns: type erased observer. 45 | public func asObserver() -> AnyObserver { 46 | return self 47 | } 48 | } 49 | 50 | extension AnyObserver { 51 | /// Collection of `AnyObserver`s 52 | typealias s = Bag<(Event) -> Void> 53 | } 54 | 55 | extension ObserverType { 56 | /// Erases type of observer and returns canonical observer. 57 | /// 58 | /// - returns: type erased observer. 59 | public func asObserver() -> AnyObserver { 60 | return AnyObserver(self) 61 | } 62 | 63 | /// Transforms observer of type R to type E using custom transform method. 64 | /// Each event sent to result observer is transformed and sent to `self`. 65 | /// 66 | /// - returns: observer that transforms events. 67 | public func mapObserver(_ transform: @escaping (R) throws -> E) -> AnyObserver { 68 | return AnyObserver { e in 69 | self.on(e.map(transform)) 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | fileprivate final class AnonymousDisposable : DisposeBase, Cancelable { 13 | public typealias DisposeAction = () -> Void 14 | 15 | private var _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 | fileprivate 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 | -------------------------------------------------------------------------------- /Example/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 var _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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | fileprivate struct NopDisposable : Disposable { 13 | 14 | fileprivate static let noOp: Disposable = NopDisposable() 15 | 16 | fileprivate 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 | -------------------------------------------------------------------------------- /Example/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 var _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 !isFlagSet(&self._isDisposed, 1) { 46 | self._disposable!.dispose() 47 | self._disposable = nil 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | fileprivate enum DisposeState: Int32 { 17 | case disposed = 1 18 | case disposableSet = 2 19 | } 20 | 21 | // state 22 | private var _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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | /// Aritmetic 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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Rx.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 12/25/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | extension String { 10 | /// This is needed because on Linux Swift doesn't have `rangeOfString(..., options: .BackwardsSearch)` 11 | func lastIndexOf(_ character: Character) -> Index? { 12 | var index = self.endIndex 13 | while index > self.startIndex { 14 | index = self.index(before: index) 15 | if self[index] == character { 16 | return index 17 | } 18 | } 19 | 20 | return nil 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Example/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 | public typealias E = Element 12 | 13 | /// Gets the common key. 14 | public let key: Key 15 | 16 | private let source: Observable 17 | 18 | /// Initializes grouped observable sequence with key and source observable sequence. 19 | /// 20 | /// - parameter key: Grouped observable sequence key 21 | /// - parameter source: Observable sequence that represents sequence of elements for the key 22 | /// - returns: Grouped observable sequence of elements for the specific key 23 | public init(key: Key, source: Observable) { 24 | self.key = key 25 | self.source = source 26 | } 27 | 28 | /// Subscribes `observer` to receive events for this sequence. 29 | public func subscribe(_ observer: O) -> Disposable where O.E == E { 30 | return self.source.subscribe(observer) 31 | } 32 | 33 | /// Converts `self` to `Observable` sequence. 34 | public func asObservable() -> Observable { 35 | return self.source 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | /// Type of elements in sequence. 14 | public typealias E = Element 15 | 16 | init() { 17 | #if TRACE_RESOURCES 18 | _ = Resources.incrementTotal() 19 | #endif 20 | } 21 | 22 | public func subscribe(_ observer: O) -> Disposable where O.E == E { 23 | rxAbstractMethod() 24 | } 25 | 26 | public func asObservable() -> Observable { 27 | return self 28 | } 29 | 30 | deinit { 31 | #if TRACE_RESOURCES 32 | _ = Resources.decrementTotal() 33 | #endif 34 | } 35 | 36 | // this is kind of ugly I know :( 37 | // Swift compiler reports "Not supported yet" when trying to override protocol extensions, so ¯\_(ツ)_/¯ 38 | 39 | /// Optimizations for map operator 40 | internal func composeMap(_ transform: @escaping (Element) throws -> R) -> Observable { 41 | return _map(source: self, transform: transform) 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Example/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 E 13 | 14 | /// Converts `self` to `Observable` sequence. 15 | /// 16 | /// - returns: Observable sequence that represents `self`. 17 | func asObservable() -> Observable 18 | } 19 | -------------------------------------------------------------------------------- /Example/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: O) -> Disposable where O.E == E 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 | -------------------------------------------------------------------------------- /Example/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 = O.E 11 | 12 | override init(observer: O, 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == 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 | -------------------------------------------------------------------------------- /Example/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 | fileprivate final class AsMaybeSink : Sink, ObserverType { 10 | typealias ElementType = O.E 11 | typealias E = ElementType 12 | 13 | private var _element: Event? 14 | 15 | func on(_ event: Event) { 16 | switch event { 17 | case .next: 18 | if self._element != nil { 19 | self.forwardOn(.error(RxError.moreThanOneElement)) 20 | self.dispose() 21 | } 22 | 23 | self._element = event 24 | case .error: 25 | self.forwardOn(event) 26 | self.dispose() 27 | case .completed: 28 | if let element = self._element { 29 | self.forwardOn(element) 30 | } 31 | self.forwardOn(.completed) 32 | self.dispose() 33 | } 34 | } 35 | } 36 | 37 | final class AsMaybe: Producer { 38 | fileprivate let _source: Observable 39 | 40 | init(source: Observable) { 41 | self._source = source 42 | } 43 | 44 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 45 | let sink = AsMaybeSink(observer: observer, cancel: cancel) 46 | let subscription = self._source.subscribe(sink) 47 | return (sink: sink, subscription: subscription) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Example/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 | fileprivate final class AsSingleSink : Sink, ObserverType { 10 | typealias ElementType = O.E 11 | typealias E = ElementType 12 | 13 | private var _element: Event? 14 | 15 | func on(_ event: Event) { 16 | switch event { 17 | case .next: 18 | if self._element != nil { 19 | self.forwardOn(.error(RxError.moreThanOneElement)) 20 | self.dispose() 21 | } 22 | 23 | self._element = event 24 | case .error: 25 | self.forwardOn(event) 26 | self.dispose() 27 | case .completed: 28 | if let element = self._element { 29 | self.forwardOn(element) 30 | self.forwardOn(.completed) 31 | } 32 | else { 33 | self.forwardOn(.error(RxError.noElements)) 34 | } 35 | self.dispose() 36 | } 37 | } 38 | } 39 | 40 | final class AsSingle: Producer { 41 | fileprivate let _source: Observable 42 | 43 | init(source: Observable) { 44 | self._source = source 45 | } 46 | 47 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { 48 | let sink = AsSingleSink(observer: observer, cancel: cancel) 49 | let subscription = self._source.subscribe(sink) 50 | return (sink: sink, subscription: subscription) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Example/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: E) -> Observable { 20 | return DefaultIfEmpty(source: self.asObservable(), default: `default`) 21 | } 22 | } 23 | 24 | final private class DefaultIfEmptySink: Sink, ObserverType { 25 | typealias E = O.E 26 | private let _default: E 27 | private var _isEmpty = true 28 | 29 | init(default: E, observer: O, 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == 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 | -------------------------------------------------------------------------------- /Example/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 E = O.E 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == 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 | -------------------------------------------------------------------------------- /Example/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 E: 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 | fileprivate final class DematerializeSink: Sink, ObserverType where O.E == Element.ElementType { 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element.ElementType { 47 | let sink = DematerializeSink(observer: observer, cancel: cancel) 48 | let subscription = self._source.subscribe(sink) 49 | return (sink: sink, subscription: subscription) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Example/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: O) -> Disposable where O.E == Element { 24 | observer.on(.completed) 25 | return Disposables.create() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/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: E)> { 20 | return Enumerated(source: self.asObservable()) 21 | } 22 | } 23 | 24 | final private class EnumeratedSink: Sink, ObserverType where O.E == (index: Int, element: Element) { 25 | typealias E = Element 26 | var index = 0 27 | 28 | func on(_ event: Event) { 29 | switch event { 30 | case .next(let value): 31 | do { 32 | let nextIndex = try incrementChecked(&self.index) 33 | let next = (index: nextIndex, element: value) 34 | self.forwardOn(.next(next)) 35 | } 36 | catch let e { 37 | self.forwardOn(.error(e)) 38 | self.dispose() 39 | } 40 | case .completed: 41 | self.forwardOn(.completed) 42 | self.dispose() 43 | case .error(let error): 44 | self.forwardOn(.error(error)) 45 | self.dispose() 46 | } 47 | } 48 | } 49 | 50 | final private class Enumerated: Producer<(index: Int, element: Element)> { 51 | private let _source: Observable 52 | 53 | init(source: Observable) { 54 | self._source = source 55 | } 56 | 57 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == (index: Int, element: Element) { 58 | let sink = EnumeratedSink(observer: observer, cancel: cancel) 59 | let subscription = self._source.subscribe(sink) 60 | return (sink: sink, subscription: subscription) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Example/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: O) -> Disposable where O.E == Element { 30 | observer.on(.error(self._error)) 31 | return Disposables.create() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Example/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 | fileprivate final class FirstSink : Sink, ObserverType where O.E == Element? { 10 | typealias E = Element 11 | typealias Parent = First 12 | 13 | func on(_ event: Event) { 14 | switch event { 15 | case .next(let value): 16 | self.forwardOn(.next(value)) 17 | self.forwardOn(.completed) 18 | self.dispose() 19 | case .error(let error): 20 | self.forwardOn(.error(error)) 21 | self.dispose() 22 | case .completed: 23 | self.forwardOn(.next(nil)) 24 | self.forwardOn(.completed) 25 | self.dispose() 26 | } 27 | } 28 | } 29 | 30 | final class First: Producer { 31 | fileprivate let _source: Observable 32 | 33 | init(source: Observable) { 34 | self._source = source 35 | } 36 | 37 | override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element? { 38 | let sink = FirstSink(observer: observer, cancel: cancel) 39 | let subscription = self._source.subscribe(sink) 40 | return (sink: sink, subscription: subscription) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Example/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 | fileprivate final class MaterializeSink: Sink, ObserverType where O.E == 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { 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 | -------------------------------------------------------------------------------- /Example/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: O) -> Disposable where O.E == Element { 25 | return Disposables.create() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/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: E, 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == 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: O, 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 | -------------------------------------------------------------------------------- /Example/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: O 11 | fileprivate let _cancel: Cancelable 12 | fileprivate var _disposed = AtomicInt(0) 13 | 14 | #if DEBUG 15 | fileprivate let _synchronizationTracker = SynchronizationTracker() 16 | #endif 17 | 18 | init(observer: O, 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 E = O.E 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 | -------------------------------------------------------------------------------- /Example/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: E ...) 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == 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 | -------------------------------------------------------------------------------- /Example/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 another Observable 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: An observable sequence containing all the emitted elements as array. 20 | */ 21 | public func toArray() 22 | -> Observable<[E]> { 23 | return ToArray(source: self.asObservable()) 24 | } 25 | } 26 | 27 | final private class ToArraySink: Sink, ObserverType where O.E == [SourceType] { 28 | typealias Parent = ToArray 29 | 30 | let _parent: Parent 31 | var _list = [SourceType]() 32 | 33 | init(parent: Parent, observer: O, 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: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == [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 | -------------------------------------------------------------------------------- /Example/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 E 13 | 14 | /// Notify observer about sequence event. 15 | /// 16 | /// - parameter event: Event that occurred. 17 | func on(_ event: Event) 18 | } 19 | 20 | /// Convenience API extensions to provide alternate next, error, completed events 21 | extension ObserverType { 22 | 23 | /// Convenience method equivalent to `on(.next(element: E))` 24 | /// 25 | /// - parameter element: Next element to send to observer(s) 26 | public func onNext(_ element: E) { 27 | self.on(.next(element)) 28 | } 29 | 30 | /// Convenience method equivalent to `on(.completed)` 31 | public func onCompleted() { 32 | self.on(.completed) 33 | } 34 | 35 | /// Convenience method equivalent to `on(.error(Swift.Error))` 36 | /// - parameter error: Swift.Error to send to observer(s) 37 | public func onError(_ error: Swift.Error) { 38 | self.on(.error(error)) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Example/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 Element = ElementType 11 | 12 | typealias EventHandler = (Event) -> Void 13 | 14 | private let _eventHandler : EventHandler 15 | 16 | init(_ eventHandler: @escaping EventHandler) { 17 | #if TRACE_RESOURCES 18 | _ = Resources.incrementTotal() 19 | #endif 20 | self._eventHandler = eventHandler 21 | } 22 | 23 | override func onCore(_ event: Event) { 24 | return self._eventHandler(event) 25 | } 26 | 27 | #if TRACE_RESOURCES 28 | deinit { 29 | _ = Resources.decrementTotal() 30 | } 31 | #endif 32 | } 33 | -------------------------------------------------------------------------------- /Example/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 | typealias E = ElementType 11 | 12 | private var _isStopped = AtomicInt(0) 13 | 14 | func on(_ event: Event) { 15 | switch event { 16 | case .next: 17 | if load(&self._isStopped) == 0 { 18 | self.onCore(event) 19 | } 20 | case .error, .completed: 21 | if fetchOr(&self._isStopped, 1) == 0 { 22 | self.onCore(event) 23 | } 24 | } 25 | } 26 | 27 | func onCore(_ event: Event) { 28 | rxAbstractMethod() 29 | } 30 | 31 | func dispose() { 32 | fetchOr(&self._isStopped, 1) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Example/Pods/RxSwift/RxSwift/Reactive.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Reactive.swift 3 | // RxSwift 4 | // 5 | // Created by Yury Korolev on 5/2/16. 6 | // Copyright © 2016 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | /** 10 | Use `Reactive` proxy as customization point for constrained protocol extensions. 11 | 12 | General pattern would be: 13 | 14 | // 1. Extend Reactive protocol with constrain on Base 15 | // Read as: Reactive Extension where Base is a SomeType 16 | extension Reactive where Base: SomeType { 17 | // 2. Put any specific reactive extension for SomeType here 18 | } 19 | 20 | With this approach we can have more specialized methods and properties using 21 | `Base` and not just specialized on common base type. 22 | 23 | */ 24 | 25 | public struct Reactive { 26 | /// Base object to extend. 27 | public let base: Base 28 | 29 | /// Creates extensions with base object. 30 | /// 31 | /// - parameter base: Base object. 32 | public init(_ base: Base) { 33 | self.base = base 34 | } 35 | } 36 | 37 | /// A type that has reactive extensions. 38 | public protocol ReactiveCompatible { 39 | /// Extended type 40 | associatedtype CompatibleType 41 | 42 | /// Reactive extensions. 43 | static var rx: Reactive.Type { get set } 44 | 45 | /// Reactive extensions. 46 | var rx: Reactive { get set } 47 | } 48 | 49 | extension ReactiveCompatible { 50 | /// Reactive extensions. 51 | public static var rx: Reactive.Type { 52 | get { 53 | return Reactive.self 54 | } 55 | set { 56 | // this enables using Reactive to "mutate" base type 57 | } 58 | } 59 | 60 | /// Reactive extensions. 61 | public var rx: Reactive { 62 | get { 63 | return Reactive(self) 64 | } 65 | set { 66 | // this enables using Reactive to "mutate" base object 67 | } 68 | } 69 | } 70 | 71 | import class Foundation.NSObject 72 | 73 | /// Extend NSObject with `rx` proxy. 74 | extension NSObject: ReactiveCompatible { } 75 | -------------------------------------------------------------------------------- /Example/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 | /// Creates mutable reference wrapper for any type. 10 | final class RxMutableBox : CustomDebugStringConvertible { 11 | /// Wrapped value 12 | var value : T 13 | 14 | /// Creates reference wrapper for `value`. 15 | /// 16 | /// - parameter value: Value to wrap. 17 | init (_ value: T) { 18 | self.value = value 19 | } 20 | } 21 | 22 | extension RxMutableBox { 23 | /// - returns: Box description. 24 | var debugDescription: String { 25 | return "MutatingBox(\(self.value))" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainScheduler.swift 3 | // RxSwift 4 | // 5 | // Created by Krunoslav Zaher on 2/8/15. 6 | // Copyright © 2015 Krunoslav Zaher. All rights reserved. 7 | // 8 | 9 | import Dispatch 10 | 11 | /** 12 | Abstracts work that needs to be performed on `DispatchQueue.main`. In case `schedule` methods are called from `DispatchQueue.main`, it will perform action immediately without scheduling. 13 | 14 | This scheduler is usually used to perform UI work. 15 | 16 | Main scheduler is a specialization of `SerialDispatchQueueScheduler`. 17 | 18 | This scheduler is optimized for `observeOn` operator. To ensure observable sequence is subscribed on main thread using `subscribeOn` 19 | operator please use `ConcurrentMainScheduler` because it is more optimized for that purpose. 20 | */ 21 | public final class MainScheduler : SerialDispatchQueueScheduler { 22 | 23 | private let _mainQueue: DispatchQueue 24 | 25 | var numberEnqueued = AtomicInt(0) 26 | 27 | /// Initializes new instance of `MainScheduler`. 28 | public init() { 29 | self._mainQueue = DispatchQueue.main 30 | super.init(serialQueue: self._mainQueue) 31 | } 32 | 33 | /// Singleton instance of `MainScheduler` 34 | public static let instance = MainScheduler() 35 | 36 | /// Singleton instance of `MainScheduler` that always schedules work asynchronously 37 | /// and doesn't perform optimizations for calls scheduled from main queue. 38 | public static let asyncInstance = SerialDispatchQueueScheduler(serialQueue: DispatchQueue.main) 39 | 40 | /// In case this method is called on a background thread it will throw an exception. 41 | public class func ensureExecutingOnScheduler(errorMessage: String? = nil) { 42 | if !DispatchQueue.isMain { 43 | rxFatalError(errorMessage ?? "Executing on background thread. Please use `MainScheduler.instance.schedule` to schedule work on main thread.") 44 | } 45 | } 46 | 47 | override func scheduleInternal(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { 48 | let previousNumberEnqueued = increment(&self.numberEnqueued) 49 | 50 | if DispatchQueue.isMain && previousNumberEnqueued == 0 { 51 | let disposable = action(state) 52 | decrement(&self.numberEnqueued) 53 | return disposable 54 | } 55 | 56 | let cancel = SingleAssignmentDisposable() 57 | 58 | self._mainQueue.async { 59 | if !cancel.isDisposed { 60 | _ = action(state) 61 | } 62 | 63 | decrement(&self.numberEnqueued) 64 | } 65 | 66 | return cancel 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 var _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 | -------------------------------------------------------------------------------- /Example/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 SubjectObserverType : ObserverType 15 | 16 | /// Returns observer interface for subject. 17 | /// 18 | /// - returns: Observer interface for subject. 19 | func asObserver() -> SubjectObserverType 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 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 `asMaybe` operator throws a `RxError.moreThanOneElement` 24 | if the source Observable does not emit at most one element before successfully completing. 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, completes or throws an exception if more of them are emitted. 29 | */ 30 | public func asMaybe() -> Maybe { 31 | return PrimitiveSequence(raw: AsMaybe(source: self.asObservable())) 32 | } 33 | } 34 | 35 | extension ObservableType where E == Never { 36 | /** 37 | - returns: An observable sequence that completes. 38 | */ 39 | public func asCompletable() 40 | -> Completable { 41 | return PrimitiveSequence(raw: self.asObservable()) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Alamofire/Alamofire-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.8.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Alamofire : NSObject 3 | @end 4 | @implementation PodsDummy_Alamofire 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Alamofire/Alamofire-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Alamofire/Alamofire-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 AlamofireVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char AlamofireVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap: -------------------------------------------------------------------------------- 1 | framework module Alamofire { 2 | umbrella header "Alamofire-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire 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}/Alamofire 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Cache/Cache-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.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Cache/Cache-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Cache : NSObject 3 | @end 4 | @implementation PodsDummy_Cache 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Cache/Cache-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Cache/Cache-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 CacheVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char CacheVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Cache/Cache.modulemap: -------------------------------------------------------------------------------- 1 | framework module Cache { 2 | umbrella header "Cache-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Cache/Cache.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Cache 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" 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}/Cache 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | SWIFT_VERSION = 4.2 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Moya/Moya-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 | 12.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Moya/Moya-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Moya : NSObject 3 | @end 4 | @implementation PodsDummy_Moya 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Moya/Moya-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Moya/Moya-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 MoyaVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char MoyaVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Moya/Moya.modulemap: -------------------------------------------------------------------------------- 1 | framework module Moya { 2 | umbrella header "Moya-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Moya/Moya.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Moya 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" 5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Moya 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Example/Pods-RxMoyaCache_Example-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Example/Pods-RxMoyaCache_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RxMoyaCache_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RxMoyaCache_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Example/Pods-RxMoyaCache_Example-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_RxMoyaCache_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_RxMoyaCache_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Example/Pods-RxMoyaCache_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Cache" "${PODS_CONFIGURATION_BUILD_DIR}/Moya" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Cache/Cache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Result/Result.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic/RxAtomic.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache/RxMoyaCache.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 "Alamofire" -framework "Cache" -framework "Foundation" -framework "Moya" -framework "Result" -framework "RxAtomic" -framework "RxMoyaCache" -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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Example/Pods-RxMoyaCache_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_RxMoyaCache_Example { 2 | umbrella header "Pods-RxMoyaCache_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Example/Pods-RxMoyaCache_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Cache" "${PODS_CONFIGURATION_BUILD_DIR}/Moya" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Cache/Cache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Result/Result.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic/RxAtomic.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache/RxMoyaCache.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 "Alamofire" -framework "Cache" -framework "Foundation" -framework "Moya" -framework "Result" -framework "RxAtomic" -framework "RxMoyaCache" -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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RxMoyaCache_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RxMoyaCache_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests-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_RxMoyaCache_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_RxMoyaCache_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Cache" "${PODS_CONFIGURATION_BUILD_DIR}/Moya" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Cache/Cache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Result/Result.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic/RxAtomic.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache/RxMoyaCache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Cache" -framework "Foundation" -framework "Moya" -framework "Result" -framework "RxAtomic" -framework "RxMoyaCache" -framework "RxSwift" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_RxMoyaCache_Tests { 2 | umbrella header "Pods-RxMoyaCache_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-RxMoyaCache_Tests/Pods-RxMoyaCache_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Cache" "${PODS_CONFIGURATION_BUILD_DIR}/Moya" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Cache/Cache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Result/Result.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic/RxAtomic.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache/RxMoyaCache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Cache" -framework "Foundation" -framework "Moya" -framework "Result" -framework "RxAtomic" -framework "RxMoyaCache" -framework "RxSwift" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Result/Result-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.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Result/Result-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Result : NSObject 3 | @end 4 | @implementation PodsDummy_Result 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Result/Result-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Result/Result-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 ResultVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char ResultVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Result/Result.modulemap: -------------------------------------------------------------------------------- 1 | framework module Result { 2 | umbrella header "Result-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Result/Result.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Result 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}/Result 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxAtomic/RxAtomic-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.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxAtomic/RxAtomic-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxAtomic : NSObject 3 | @end 4 | @implementation PodsDummy_RxAtomic 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxAtomic/RxAtomic-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxAtomic/RxAtomic-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 | #import "RxAtomic.h" 14 | 15 | FOUNDATION_EXPORT double RxAtomicVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char RxAtomicVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxAtomic/RxAtomic.modulemap: -------------------------------------------------------------------------------- 1 | framework module RxAtomic { 2 | umbrella header "RxAtomic-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxAtomic/RxAtomic.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic 2 | DEFINES_MODULE = YES 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 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}/RxAtomic 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxMoyaCache/RxMoyaCache-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.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxMoyaCache/RxMoyaCache-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxMoyaCache : NSObject 3 | @end 4 | @implementation PodsDummy_RxMoyaCache 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxMoyaCache/RxMoyaCache-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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxMoyaCache/RxMoyaCache-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 RxMoyaCacheVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char RxMoyaCacheVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxMoyaCache/RxMoyaCache.modulemap: -------------------------------------------------------------------------------- 1 | framework module RxMoyaCache { 2 | umbrella header "RxMoyaCache-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxMoyaCache/RxMoyaCache.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxMoyaCache 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/Moya" "${PODS_CONFIGURATION_BUILD_DIR}/Result" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${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}/../.. 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/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 | 4.4.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxSwift/RxSwift-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RxSwift : NSObject 3 | @end 4 | @implementation PodsDummy_RxSwift 5 | @end 6 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/RxSwift/RxSwift.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" 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}/RxSwift 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/RxMoyaCache.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/RxMoyaCache.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/RxMoyaCache/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RxMoyaCache 4 | // 5 | // Created by Pircate on 09/10/2018. 6 | // Copyright (c) 2018 Pircate. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/RxMoyaCache/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Example/RxMoyaCache/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/RxMoyaCache/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/RxMoyaCache/Network+Cache.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Network+Cache.swift 3 | // RxNetwork 4 | // 5 | // Created by Pircate on 2018/7/7. 6 | // Copyright © 2018年 Pircate. All rights reserved. 7 | // 8 | 9 | import Cache 10 | import Moya 11 | import RxMoyaCache 12 | 13 | public class MoyaCache { 14 | 15 | public static let shared = MoyaCache() 16 | 17 | public var storagePolicyClosure: (Moya.Response) -> Bool = { _ in true } 18 | 19 | private init() {} 20 | } 21 | 22 | extension Storable where Self: TargetType { 23 | 24 | public var allowsStorage: (Response) -> Bool { 25 | return MoyaCache.shared.storagePolicyClosure 26 | } 27 | 28 | public func cachedResponse(for key: CachingKey) throws -> Response { 29 | return try Storage().object(forKey: key.stringValue) 30 | } 31 | 32 | public func storeCachedResponse(_ cachedResponse: Response, for key: CachingKey) throws { 33 | try Storage().setObject(cachedResponse, forKey: key.stringValue) 34 | } 35 | 36 | public func removeCachedResponse(for key: CachingKey) throws { 37 | try Storage().removeObject(forKey: key.stringValue) 38 | } 39 | 40 | public func removeAllCachedResponses() throws { 41 | try Storage().removeAll() 42 | } 43 | } 44 | 45 | private extension MoyaCache { 46 | 47 | struct DiskStorageName { 48 | 49 | static let response = "com.pircate.github.cache.response" 50 | } 51 | } 52 | 53 | private extension Storage where T == Moya.Response { 54 | 55 | convenience init() throws { 56 | try self.init(diskConfig: DiskConfig(name: MoyaCache.DiskStorageName.response), 57 | memoryConfig: MemoryConfig(), 58 | transformer: Transformer( 59 | toData: { $0.data }, 60 | fromData: { T(statusCode: 200, data: $0) })) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Example/RxMoyaCache/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // RxMoyaCache 4 | // 5 | // Created by Pircate on 09/10/2018. 6 | // Copyright (c) 2018 Pircate. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Moya 11 | import RxSwift 12 | import RxMoyaCache 13 | 14 | enum StoryAPI: TargetType, Cacheable { 15 | 16 | var baseURL: URL { 17 | return URL(string: "https://news-at.zhihu.com/api")! 18 | } 19 | 20 | var path: String { 21 | return "4/news/latest" 22 | } 23 | 24 | var method: Moya.Method { 25 | return .get 26 | } 27 | 28 | var sampleData: Data { 29 | return "".data(using: .utf8)! 30 | } 31 | 32 | var task: Task { 33 | return .requestPlain 34 | } 35 | 36 | var headers: [String : String]? { 37 | return nil 38 | } 39 | 40 | case latest 41 | } 42 | 43 | struct StoryListModel: Codable { 44 | let topStories: [StoryItemModel] 45 | 46 | enum CodingKeys: String, CodingKey { 47 | case topStories = "top_stories" 48 | } 49 | } 50 | 51 | struct StoryItemModel: Codable { 52 | let id: String 53 | let title: String 54 | let image: String 55 | } 56 | 57 | class ViewController: UIViewController { 58 | 59 | private let disposeBag = DisposeBag() 60 | 61 | override func viewDidLoad() { 62 | super.viewDidLoad() 63 | 64 | let provider = MoyaProvider() 65 | provider.rx.cache 66 | .request(.latest) 67 | .map(StoryListModel.self) 68 | .subscribe(onNext: { object in 69 | debugPrint("onNext:", object.topStories[0].title) 70 | }).disposed(by: disposeBag) 71 | 72 | provider.rx.onCache(.latest, type: StoryListModel.self) { object in 73 | debugPrint("onCache", object.topStories[0].title) 74 | }.request() 75 | .subscribe(onSuccess: { object in 76 | debugPrint("onSuccess", object.topStories[0].title) 77 | }).disposed(by: disposeBag) 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /Example/Tests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import RxMoyaCache 3 | 4 | class Tests: XCTestCase { 5 | 6 | override func setUp() { 7 | super.setUp() 8 | // Put setup code here. This method is called before the invocation of each test method in the class. 9 | } 10 | 11 | override func tearDown() { 12 | // Put teardown code here. This method is called after the invocation of each test method in the class. 13 | super.tearDown() 14 | } 15 | 16 | func testExample() { 17 | // This is an example of a functional test case. 18 | XCTAssert(true, "Pass") 19 | } 20 | 21 | func testPerformanceExample() { 22 | // This is an example of a performance test case. 23 | self.measure() { 24 | // Put the code you want to measure the time of here. 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Pircate 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /RxMoyaCache.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = 'RxMoyaCache' 4 | s.version = '0.2.1' 5 | s.summary = 'A network cache library based on RxSwift/Moya/Cache.' 6 | s.homepage = 'https://github.com/Pircate/RxMoyaCache' 7 | s.license = { :type => 'MIT', :file => 'LICENSE' } 8 | s.author = { 'Pircate' => 'gao497868860@163.com' } 9 | s.source = { :git => 'https://github.com/Pircate/RxMoyaCache.git', :tag => s.version.to_s } 10 | s.ios.deployment_target = '9.0' 11 | s.swift_version = '4.2' 12 | s.source_files = 'RxMoyaCache/Classes/**/*' 13 | s.dependency 'Moya/RxSwift' 14 | end 15 | -------------------------------------------------------------------------------- /RxMoyaCache/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pircate/RxMoyaCache/ae5a88ee0d0fb456dacebc3afb5fa58ca115e0a1/RxMoyaCache/Assets/.gitkeep -------------------------------------------------------------------------------- /RxMoyaCache/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pircate/RxMoyaCache/ae5a88ee0d0fb456dacebc3afb5fa58ca115e0a1/RxMoyaCache/Classes/.gitkeep -------------------------------------------------------------------------------- /RxMoyaCache/Classes/Cacheable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Cacheable.swift 3 | // RxNetwork 4 | // 5 | // Created by Pircate(gao497868860@gmail.com) on 2019/3/5 6 | // Copyright © 2019年 Pircate. All rights reserved. 7 | // 8 | 9 | import Moya 10 | 11 | public typealias Cacheable = Storable & CachingKey 12 | 13 | public protocol Storable { 14 | 15 | var allowsStorage: (Moya.Response) -> Bool { get } 16 | 17 | func cachedResponse(for key: CachingKey) throws -> Moya.Response 18 | 19 | func storeCachedResponse(_ cachedResponse: Moya.Response, for key: CachingKey) throws 20 | 21 | func removeCachedResponse(for key: CachingKey) throws 22 | 23 | func removeAllCachedResponses() throws 24 | } 25 | -------------------------------------------------------------------------------- /RxMoyaCache/Classes/CachingKey.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CachingKey.swift 3 | // RxNetwork 4 | // 5 | // Created by Pircate(gao497868860@gmail.com) on 2019/3/6 6 | // Copyright © 2019年 Pircate. All rights reserved. 7 | // 8 | 9 | import Moya 10 | 11 | public protocol CachingKey { 12 | var stringValue: String { get } 13 | } 14 | 15 | extension CachingKey where Self: TargetType { 16 | public var stringValue: String { 17 | return cachedKey 18 | } 19 | } 20 | 21 | private extension TargetType { 22 | 23 | var cachedKey: String { 24 | if let urlRequest = try? endpoint.urlRequest(), 25 | let data = urlRequest.httpBody, 26 | let parameters = String(data: data, encoding: .utf8) { 27 | return "\(method.rawValue):\(endpoint.url)?\(parameters)" 28 | } 29 | return "\(method.rawValue):\(endpoint.url)" 30 | } 31 | 32 | var endpoint: Endpoint { 33 | return Endpoint(url: URL(target: self).absoluteString, 34 | sampleResponseClosure: { .networkResponse(200, self.sampleData) }, 35 | method: method, 36 | task: task, 37 | httpHeaderFields: headers) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /RxMoyaCache/Classes/MoyaProviderType+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MoyaProviderType+Rx.swift 3 | // RxMoyaCache 4 | // 5 | // Created by Pircate on 2018/4/18. 6 | // Copyright © 2018年 Pircate. All rights reserved. 7 | // 8 | 9 | import RxSwift 10 | import Moya 11 | 12 | extension Reactive where Base: MoyaProviderType, Base.Target: Cacheable { 13 | 14 | public var cache: CacheProvider { 15 | return CacheProvider(provider: base) 16 | } 17 | 18 | public func onCache( 19 | _ target: Base.Target, 20 | type: T.Type, 21 | atKeyPath keyPath: String? = nil, 22 | using decoder: JSONDecoder = .init(), 23 | _ closure: (T) -> Void) 24 | -> OnCacheProvider 25 | { 26 | if let object = try? target.cachedResponse() 27 | .map(type, atKeyPath: keyPath, using: decoder) { 28 | closure(object) 29 | } 30 | 31 | return OnCacheProvider(target: target, provider: base, keyPath: keyPath, decoder: decoder) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RxMoyaCache/Classes/Provider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Provider.swift 3 | // RxMoyaCache 4 | // 5 | // Created by Pircate on 2018/6/14. 6 | // Copyright © 2018年 Pircate. All rights reserved. 7 | // 8 | 9 | import Moya 10 | import RxSwift 11 | 12 | public struct CacheProvider where Provider.Target: Cacheable { 13 | 14 | let provider: Provider 15 | 16 | public func request( 17 | _ target: Provider.Target, 18 | callbackQueue: DispatchQueue? = nil) 19 | -> Observable 20 | { 21 | let source = Single.create { single -> Disposable in 22 | let cancellableToken = self.provider.request( 23 | target, 24 | callbackQueue: callbackQueue, 25 | progress: nil) 26 | { result in 27 | switch result { 28 | case let .success(response): 29 | single(.success(response)) 30 | case let .failure(error): 31 | single(.error(error)) 32 | } 33 | } 34 | 35 | return Disposables.create { 36 | cancellableToken.cancel() 37 | } 38 | }.storeCachedResponse(for: target).asObservable() 39 | 40 | if let response = try? target.cachedResponse(), 41 | target.allowsStorage(response) { 42 | return source.startWith(response) 43 | } 44 | return source 45 | } 46 | } 47 | 48 | public struct OnCacheProvider where Provider.Target: Cacheable { 49 | 50 | let target: Provider.Target 51 | 52 | let provider: Provider 53 | 54 | let keyPath: String? 55 | 56 | let decoder: JSONDecoder 57 | 58 | public func request(callbackQueue: DispatchQueue? = nil) -> Single { 59 | return Single.create { single -> Disposable in 60 | let cancellableToken = self.provider.request( 61 | self.target, 62 | callbackQueue: callbackQueue, 63 | progress: nil) 64 | { result in 65 | switch result { 66 | case let .success(response): 67 | single(.success(response)) 68 | case let .failure(error): 69 | single(.error(error)) 70 | } 71 | } 72 | 73 | return Disposables.create { cancellableToken.cancel() } 74 | } 75 | .storeCachedResponse(for: target) 76 | .map(T.self, atKeyPath: keyPath, using: decoder) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /RxMoyaCache/Classes/Single+Cache.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Single+Cache.swift 3 | // RxNetwork 4 | // 5 | // Created by Pircate on 2018/4/18. 6 | // Copyright © 2018年 Pircate. All rights reserved. 7 | // 8 | 9 | import RxSwift 10 | import Moya 11 | 12 | extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Moya.Response { 13 | 14 | public func storeCachedResponse(for target: Target) 15 | -> Single 16 | where Target: TargetType, Target: Cacheable { 17 | return map { response -> ElementType in 18 | if target.allowsStorage(response) { 19 | try? target.storeCachedResponse(response) 20 | } 21 | 22 | return response 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /RxMoyaCache/Classes/TargetType+Cache.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TargetType+Cache.swift 3 | // RxNetwork 4 | // 5 | // Created by Pircate on 2018/7/7. 6 | // Copyright © 2018年 Pircate. All rights reserved. 7 | // 8 | 9 | import Moya 10 | import RxSwift 11 | 12 | public extension TargetType where Self: Cacheable { 13 | 14 | func cachedResponse() throws -> Moya.Response { 15 | return try cachedResponse(for: self) 16 | } 17 | 18 | func storeCachedResponse(_ cachedResponse: Moya.Response) throws { 19 | try storeCachedResponse(cachedResponse, for: self) 20 | } 21 | 22 | func removeCachedResponse() throws { 23 | try removeCachedResponse(for: self) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /fastlane/Appfile: -------------------------------------------------------------------------------- 1 | # app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app 2 | # apple_id("[[APPLE_ID]]") # Your Apple email address 3 | 4 | 5 | # For more information about the Appfile, see: 6 | # https://docs.fastlane.tools/advanced/#appfile -------------------------------------------------------------------------------- /fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | # This file contains the fastlane.tools configuration 2 | # You can find the documentation at https://docs.fastlane.tools 3 | # 4 | # For a list of all available actions, check out 5 | # 6 | # https://docs.fastlane.tools/actions 7 | # 8 | # For a list of all available plugins, check out 9 | # 10 | # https://docs.fastlane.tools/plugins/available-plugins 11 | # 12 | 13 | # Uncomment the line if you want fastlane to automatically update itself 14 | # update_fastlane 15 | 16 | default_platform(:ios) 17 | 18 | platform :ios do 19 | desc "release new version" 20 | lane :release do |options| 21 | target_version = options[:version] 22 | raise "The version is missed." if target_version.nil? 23 | 24 | version_bump_podspec( 25 | path: "RxMoyaCache.podspec", 26 | version_number: target_version) 27 | git_add(path: "./RxMoyaCache.podspec") 28 | git_commit(path: ["./RxMoyaCache.podspec", "./fastlane"], message: "release #{target_version} version") 29 | add_git_tag tag: target_version 30 | push_to_git_remote 31 | pod_push(allow_warnings: true) 32 | end 33 | end 34 | --------------------------------------------------------------------------------