From 3a805782daad10004c47df4d61df3a8626f3b0fa Mon Sep 17 00:00:00 2001 From: mbianchelli Date: Sat, 7 Jul 2018 12:21:59 +0200 Subject: [PATCH 01/10] Base project --- .DS_Store | Bin 0 -> 6148 bytes Poc.Mauro.Bianchelli.germanAutolabs/.DS_Store | Bin 0 -> 6148 bytes .../project.pbxproj | 769 +++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../Poc.Mauro.Bianchelli/API/Models.swift | 26 + .../Poc.Mauro.Bianchelli/API/WeatherApi.swift | 76 + .../Poc.Mauro.Bianchelli/AppDelegate.swift | 99 + .../AppIcon.appiconset/Contents.json | 98 + .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 + .../Base.lproj/Main.storyboard | 80 + .../Coordinators/MainCoordinator.swift | 33 + .../Coordinators/ResultCoordinator.swift | 31 + .../Coordinators/VoiceCoordinator.swift | 46 + .../Poc.Mauro.Bianchelli/Info.plist | 49 + .../Observable/Observable.swift | 29 + .../.xccurrentversion | 8 + .../Poc_Mauro_Bianchelli.xcdatamodel/contents | 4 + .../ResultViewController.swift | 21 + .../ViewControllers/VoiceViewController.swift | 34 + .../ViewModels/WeatherViewModel.swift | 34 + .../Poc.Mauro.BianchelliTests/Info.plist | 22 + .../Poc_Mauro_BianchelliTests.swift | 36 + .../Poc.Mauro.BianchelliUITests/Info.plist | 22 + .../Poc_Mauro_BianchelliUITests.swift | 36 + Poc.Mauro.Bianchelli.germanAutolabs/Podfile | 13 + .../Podfile.lock | 27 + .../Pods/Alamofire/LICENSE | 19 + .../Pods/Alamofire/README.md | 235 ++ .../Pods/Alamofire/Source/AFError.swift | 460 +++ .../Pods/Alamofire/Source/Alamofire.swift | 465 +++ .../Source/DispatchQueue+Alamofire.swift | 37 + .../Alamofire/Source/MultipartFormData.swift | 580 ++++ .../Source/NetworkReachabilityManager.swift | 233 ++ .../Pods/Alamofire/Source/Notifications.swift | 55 + .../Alamofire/Source/ParameterEncoding.swift | 483 ++++ .../Pods/Alamofire/Source/Request.swift | 654 +++++ .../Pods/Alamofire/Source/Response.swift | 567 ++++ .../Source/ResponseSerialization.swift | 715 +++++ .../Pods/Alamofire/Source/Result.swift | 300 ++ .../Alamofire/Source/ServerTrustPolicy.swift | 307 ++ .../Alamofire/Source/SessionDelegate.swift | 725 +++++ .../Alamofire/Source/SessionManager.swift | 892 ++++++ .../Pods/Alamofire/Source/TaskDelegate.swift | 466 +++ .../Pods/Alamofire/Source/Timeline.swift | 136 + .../Pods/Alamofire/Source/Validation.swift | 315 +++ .../Pods/Manifest.lock | 27 + .../Pods/Moya/License.md | 21 + .../Pods/Moya/Readme.md | 320 +++ .../Pods/Moya/Sources/Moya/AnyEncodable.swift | 14 + .../Pods/Moya/Sources/Moya/Cancellable.swift | 26 + .../Pods/Moya/Sources/Moya/Endpoint.swift | 137 + .../Pods/Moya/Sources/Moya/Image.swift | 10 + .../Moya/Sources/Moya/Moya+Alamofire.swift | 90 + .../Pods/Moya/Sources/Moya/MoyaError.swift | 76 + .../Sources/Moya/MoyaProvider+Defaults.swift | 36 + .../Sources/Moya/MoyaProvider+Internal.swift | 274 ++ .../Pods/Moya/Sources/Moya/MoyaProvider.swift | 206 ++ .../Pods/Moya/Sources/Moya/MultiTarget.swift | 54 + .../Moya/Sources/Moya/MultipartFormData.swift | 73 + .../Pods/Moya/Sources/Moya/Plugin.swift | 47 + .../Moya/Plugins/AccessTokenPlugin.swift | 78 + .../Moya/Plugins/CredentialsPlugin.swift | 22 + .../Moya/Plugins/NetworkActivityPlugin.swift | 31 + .../Moya/Plugins/NetworkLoggerPlugin.swift | 114 + .../Pods/Moya/Sources/Moya/Response.swift | 192 ++ .../Pods/Moya/Sources/Moya/TargetType.swift | 44 + .../Pods/Moya/Sources/Moya/Task.swift | 41 + .../Pods/Moya/Sources/Moya/URL+Moya.swift | 16 + .../Sources/Moya/URLRequest+Encoding.swift | 28 + .../Moya/Sources/Moya/ValidationType.swift | 47 + .../Pods/Pods.xcodeproj/project.pbxproj | 2502 +++++++++++++++++ .../Pods/Result/LICENSE | 21 + .../Pods/Result/README.md | 113 + .../Pods/Result/Result/Result.swift | 276 ++ .../Pods/Result/Result/ResultProtocol.swift | 203 ++ .../Pods/RxCocoa/LICENSE.md | 9 + .../RxCocoa/Platform/DataStructures/Bag.swift | 183 ++ .../DataStructures/InfiniteSequence.swift | 26 + .../DataStructures/PriorityQueue.swift | 123 + .../Platform/DataStructures/Queue.swift | 152 + .../RxCocoa/Platform/DeprecationWarner.swift | 43 + .../Platform/DispatchQueue+Extensions.swift | 21 + .../RxCocoa/Platform/Platform.Darwin.swift | 66 + .../RxCocoa/Platform/Platform.Linux.swift | 105 + .../Pods/RxCocoa/Platform/RecursiveLock.swift | 34 + .../Pods/RxCocoa/README.md | 217 ++ .../Pods/RxCocoa/RxCocoa/Common/Binder.swift | 61 + .../RxCocoa/Common/ControlTarget.swift | 89 + .../RxCocoa/Common/DelegateProxy.swift | 293 ++ .../RxCocoa/Common/DelegateProxyType.swift | 408 +++ .../Common/NSLayoutConstraint+Rx.swift | 39 + .../RxCocoa/Common/Observable+Bind.swift | 151 + .../RxCocoaObjCRuntimeError+Extensions.swift | 159 ++ .../RxCocoa/RxCocoa/Common/RxTarget.swift | 43 + .../Common/SectionedViewDataSourceType.swift | 20 + .../RxCocoa/RxCocoa/Common/TextInput.swift | 78 + .../Pods/RxCocoa/RxCocoa/Deprecated.swift | 489 ++++ .../KVORepresentable+CoreGraphics.swift | 68 + .../Foundation/KVORepresentable+Swift.swift | 88 + .../RxCocoa/Foundation/KVORepresentable.swift | 28 + .../RxCocoa/RxCocoa/Foundation/Logging.swift | 23 + .../NSObject+Rx+KVORepresentable.swift | 60 + .../NSObject+Rx+RawRepresentable.swift | 52 + .../RxCocoa/Foundation/NSObject+Rx.swift | 544 ++++ .../Foundation/NotificationCenter+Rx.swift | 33 + .../RxCocoa/Foundation/URLSession+Rx.swift | 243 ++ .../Pods/RxCocoa/RxCocoa/Runtime/_RX.m | 10 + .../RxCocoa/Runtime/_RXDelegateProxy.m | 147 + .../RxCocoa/RxCocoa/Runtime/_RXKVOObserver.m | 54 + .../RxCocoa/RxCocoa/Runtime/_RXObjCRuntime.m | 1022 +++++++ .../RxCocoa/Runtime/include/RxCocoaRuntime.h | 19 + .../RxCocoa/RxCocoa/Runtime/include/_RX.h | 93 + .../Runtime/include/_RXDelegateProxy.h | 27 + .../RxCocoa/Runtime/include/_RXKVOObserver.h | 28 + .../RxCocoa/Runtime/include/_RXObjCRuntime.h | 102 + .../Pods/RxCocoa/RxCocoa/RxCocoa.h | 19 + .../Pods/RxCocoa/RxCocoa/RxCocoa.swift | 152 + .../RxCocoa/Traits/BehaviorRelay.swift | 44 + .../RxCocoa/RxCocoa/Traits/ControlEvent.swift | 69 + .../RxCocoa/Traits/ControlProperty.swift | 121 + .../Traits/Driver/BehaviorRelay+Driver.swift | 20 + .../Traits/Driver/ControlEvent+Driver.swift | 24 + .../Driver/ControlProperty+Driver.swift | 24 + .../Traits/Driver/Driver+Subscription.swift | 121 + .../RxCocoa/Traits/Driver/Driver.swift | 53 + .../ObservableConvertibleType+Driver.swift | 57 + .../RxCocoa/RxCocoa/Traits/PublishRelay.swift | 38 + ...rvableConvertibleType+SharedSequence.swift | 57 + .../SchedulerType+SharedSequence.swift | 61 + .../SharedSequence+Operators+arity.swift | 656 +++++ .../SharedSequence+Operators.swift | 515 ++++ .../SharedSequence/SharedSequence.swift | 229 ++ .../Traits/Signal/ControlEvent+Signal.swift | 25 + .../ObservableConvertibleType+Signal.swift | 58 + .../Traits/Signal/PublishRelay+Signal.swift | 20 + .../Traits/Signal/Signal+Subscription.swift | 78 + .../RxCocoa/Traits/Signal/Signal.swift | 45 + ...ollectionViewReactiveArrayDataSource.swift | 108 + .../iOS/DataSources/RxPickerViewAdapter.swift | 92 + .../RxTableViewReactiveArrayDataSource.swift | 101 + .../RxCocoa/iOS/Events/ItemEvents.swift | 15 + .../RxCocoa/iOS/NSTextStorage+Rx.swift | 35 + .../RxCollectionViewDataSourceType.swift | 27 + .../RxPickerViewDataSourceType.swift | 26 + .../Protocols/RxTableViewDataSourceType.swift | 27 + .../RxCollectionViewDataSourceProxy.swift | 77 + .../RxCollectionViewDelegateProxy.swift | 32 + .../RxNavigationControllerDelegateProxy.swift | 38 + .../Proxies/RxPickerViewDataSourceProxy.swift | 71 + .../Proxies/RxPickerViewDelegateProxy.swift | 37 + .../Proxies/RxScrollViewDelegateProxy.swift | 92 + .../Proxies/RxSearchBarDelegateProxy.swift | 39 + .../RxSearchControllerDelegateProxy.swift | 40 + .../RxTabBarControllerDelegateProxy.swift | 39 + .../iOS/Proxies/RxTabBarDelegateProxy.swift | 49 + .../Proxies/RxTableViewDataSourceProxy.swift | 75 + .../Proxies/RxTableViewDelegateProxy.swift | 30 + .../Proxies/RxTextStorageDelegateProxy.swift | 37 + .../iOS/Proxies/RxTextViewDelegateProxy.swift | 43 + .../iOS/Proxies/RxWebViewDelegateProxy.swift | 38 + .../iOS/UIActivityIndicatorView+Rx.swift | 29 + .../RxCocoa/iOS/UIAlertAction+Rx.swift | 25 + .../RxCocoa/iOS/UIApplication+Rx.swift | 24 + .../RxCocoa/iOS/UIBarButtonItem+Rx.swift | 87 + .../RxCocoa/RxCocoa/iOS/UIButton+Rx.swift | 86 + .../RxCocoa/iOS/UICollectionView+Rx.swift | 338 +++ .../RxCocoa/RxCocoa/iOS/UIControl+Rx.swift | 102 + .../RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift | 43 + .../RxCocoa/iOS/UIGestureRecognizer+Rx.swift | 76 + .../RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift | 24 + .../Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift | 32 + .../iOS/UINavigationController+Rx.swift | 49 + .../RxCocoa/iOS/UINavigationItem+Rx.swift | 25 + .../RxCocoa/iOS/UIPageControl+Rx.swift | 32 + .../RxCocoa/RxCocoa/iOS/UIPickerView+Rx.swift | 224 ++ .../RxCocoa/iOS/UIProgressView+Rx.swift | 25 + .../RxCocoa/iOS/UIRefreshControl+Rx.swift | 28 + .../RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift | 138 + .../RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift | 124 + .../RxCocoa/iOS/UISearchController+Rx.swift | 59 + .../RxCocoa/iOS/UISegmentedControl+Rx.swift | 40 + .../RxCocoa/RxCocoa/iOS/UISlider+Rx.swift | 29 + .../RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift | 37 + .../RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift | 41 + .../RxCocoa/RxCocoa/iOS/UITabBar+Rx.swift | 92 + .../RxCocoa/iOS/UITabBarController+Rx.swift | 79 + .../RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift | 25 + .../RxCocoa/RxCocoa/iOS/UITableView+Rx.swift | 396 +++ .../RxCocoa/RxCocoa/iOS/UITextField+Rx.swift | 56 + .../RxCocoa/RxCocoa/iOS/UITextView+Rx.swift | 125 + .../Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift | 38 + .../RxCocoa/iOS/UIViewController+Rx.swift | 24 + .../RxCocoa/RxCocoa/iOS/UIWebView+Rx.swift | 46 + .../Pods/RxSwift/LICENSE.md | 9 + .../RxSwift/Platform/DataStructures/Bag.swift | 183 ++ .../DataStructures/InfiniteSequence.swift | 26 + .../DataStructures/PriorityQueue.swift | 123 + .../Platform/DataStructures/Queue.swift | 152 + .../RxSwift/Platform/DeprecationWarner.swift | 43 + .../Platform/DispatchQueue+Extensions.swift | 21 + .../RxSwift/Platform/Platform.Darwin.swift | 66 + .../RxSwift/Platform/Platform.Linux.swift | 105 + .../Pods/RxSwift/Platform/RecursiveLock.swift | 34 + .../Pods/RxSwift/README.md | 217 ++ .../Pods/RxSwift/RxSwift/AnyObserver.swift | 72 + .../Pods/RxSwift/RxSwift/Cancelable.swift | 13 + .../RxSwift/Concurrency/AsyncLock.swift | 102 + .../RxSwift/RxSwift/Concurrency/Lock.swift | 36 + .../RxSwift/Concurrency/LockOwnerType.swift | 21 + .../Concurrency/SynchronizedDisposeType.swift | 18 + .../Concurrency/SynchronizedOnType.swift | 18 + .../SynchronizedUnsubscribeType.swift | 13 + .../RxSwift/ConnectableObservableType.swift | 19 + .../Pods/RxSwift/RxSwift/Deprecated.swift | 228 ++ .../Pods/RxSwift/RxSwift/Disposable.swift | 13 + .../Disposables/AnonymousDisposable.swift | 61 + .../Disposables/BinaryDisposable.swift | 53 + .../Disposables/BooleanDisposable.swift | 33 + .../Disposables/CompositeDisposable.swift | 151 + .../RxSwift/Disposables/Disposables.swift | 13 + .../RxSwift/Disposables/DisposeBag.swift | 84 + .../RxSwift/Disposables/DisposeBase.swift | 22 + .../RxSwift/Disposables/NopDisposable.swift | 32 + .../Disposables/RefCountDisposable.swift | 117 + .../Disposables/ScheduledDisposable.swift | 50 + .../Disposables/SerialDisposable.swift | 75 + .../SingleAssignmentDisposable.swift | 76 + .../Disposables/SubscriptionDisposable.swift | 21 + .../Pods/RxSwift/RxSwift/Errors.swift | 52 + .../Pods/RxSwift/RxSwift/Event.swift | 106 + .../RxSwift/RxSwift/Extensions/Bag+Rx.swift | 62 + .../RxSwift/Extensions/String+Rx.swift | 22 + .../RxSwift/RxSwift/GroupedObservable.swift | 37 + .../RxSwift/ImmediateSchedulerType.swift | 36 + .../Pods/RxSwift/RxSwift/Observable.swift | 44 + .../RxSwift/ObservableConvertibleType.swift | 18 + .../RxSwift/ObservableType+Extensions.swift | 141 + .../Pods/RxSwift/RxSwift/ObservableType.swift | 47 + .../RxSwift/RxSwift/Observables/AddRef.swift | 45 + .../RxSwift/RxSwift/Observables/Amb.swift | 157 ++ .../RxSwift/RxSwift/Observables/AsMaybe.swift | 49 + .../RxSwift/Observables/AsSingle.swift | 52 + .../RxSwift/RxSwift/Observables/Buffer.swift | 139 + .../RxSwift/RxSwift/Observables/Catch.swift | 235 ++ .../CombineLatest+Collection.swift | 157 ++ .../Observables/CombineLatest+arity.swift | 843 ++++++ .../RxSwift/Observables/CombineLatest.swift | 132 + .../RxSwift/RxSwift/Observables/Concat.swift | 131 + .../RxSwift/RxSwift/Observables/Create.swift | 78 + .../RxSwift/Observables/Debounce.swift | 119 + .../RxSwift/RxSwift/Observables/Debug.swift | 103 + .../RxSwift/Observables/DefaultIfEmpty.swift | 66 + .../RxSwift/Observables/Deferred.swift | 74 + .../RxSwift/RxSwift/Observables/Delay.swift | 181 ++ .../Observables/DelaySubscription.swift | 66 + .../RxSwift/Observables/Dematerialize.swift | 51 + .../Observables/DistinctUntilChanged.swift | 125 + .../Pods/RxSwift/RxSwift/Observables/Do.swift | 93 + .../RxSwift/Observables/ElementAt.swift | 93 + .../RxSwift/RxSwift/Observables/Empty.swift | 27 + .../RxSwift/Observables/Enumerated.swift | 62 + .../RxSwift/RxSwift/Observables/Error.swift | 33 + .../RxSwift/RxSwift/Observables/Filter.swift | 90 + .../RxSwift/RxSwift/Observables/First.swift | 42 + .../RxSwift/Observables/Generate.swift | 87 + .../RxSwift/RxSwift/Observables/GroupBy.swift | 134 + .../RxSwift/RxSwift/Observables/Just.swift | 87 + .../RxSwift/RxSwift/Observables/Map.swift | 108 + .../RxSwift/Observables/Materialize.swift | 44 + .../RxSwift/RxSwift/Observables/Merge.swift | 600 ++++ .../RxSwift/Observables/Multicast.swift | 408 +++ .../RxSwift/RxSwift/Observables/Never.swift | 27 + .../RxSwift/Observables/ObserveOn.swift | 229 ++ .../RxSwift/Observables/Optional.swift | 95 + .../RxSwift/Observables/Producer.swift | 98 + .../RxSwift/RxSwift/Observables/Range.swift | 73 + .../RxSwift/RxSwift/Observables/Reduce.swift | 109 + .../RxSwift/RxSwift/Observables/Repeat.swift | 57 + .../RxSwift/Observables/RetryWhen.swift | 182 ++ .../RxSwift/RxSwift/Observables/Sample.swift | 142 + .../RxSwift/RxSwift/Observables/Scan.swift | 82 + .../RxSwift/Observables/Sequence.swift | 89 + .../Observables/ShareReplayScope.swift | 458 +++ .../RxSwift/Observables/SingleAsync.swift | 105 + .../RxSwift/RxSwift/Observables/Sink.swift | 76 + .../RxSwift/RxSwift/Observables/Skip.swift | 159 ++ .../RxSwift/Observables/SkipUntil.swift | 139 + .../RxSwift/Observables/SkipWhile.swift | 77 + .../RxSwift/Observables/StartWith.swift | 42 + .../RxSwift/Observables/SubscribeOn.swift | 83 + .../RxSwift/RxSwift/Observables/Switch.swift | 233 ++ .../RxSwift/Observables/SwitchIfEmpty.swift | 104 + .../RxSwift/RxSwift/Observables/Take.swift | 180 ++ .../RxSwift/Observables/TakeLast.swift | 78 + .../RxSwift/Observables/TakeUntil.swift | 131 + .../RxSwift/Observables/TakeWhile.swift | 85 + .../RxSwift/Observables/Throttle.swift | 163 ++ .../RxSwift/RxSwift/Observables/Timeout.swift | 152 + .../RxSwift/RxSwift/Observables/Timer.swift | 111 + .../RxSwift/RxSwift/Observables/ToArray.swift | 66 + .../RxSwift/RxSwift/Observables/Using.swift | 90 + .../RxSwift/RxSwift/Observables/Window.swift | 170 ++ .../RxSwift/Observables/WithLatestFrom.swift | 149 + .../RxSwift/Observables/Zip+Collection.swift | 169 ++ .../RxSwift/Observables/Zip+arity.swift | 948 +++++++ .../RxSwift/RxSwift/Observables/Zip.swift | 155 + .../Pods/RxSwift/RxSwift/ObserverType.swift | 40 + .../RxSwift/Observers/AnonymousObserver.swift | 32 + .../RxSwift/Observers/ObserverBase.swift | 34 + .../RxSwift/Observers/TailRecursiveSink.swift | 151 + .../Pods/RxSwift/RxSwift/Reactive.swift | 74 + .../Pods/RxSwift/RxSwift/Rx.swift | 142 + .../Pods/RxSwift/RxSwift/RxMutableBox.swift | 27 + .../Pods/RxSwift/RxSwift/SchedulerType.swift | 71 + .../ConcurrentDispatchQueueScheduler.swift | 82 + .../Schedulers/ConcurrentMainScheduler.swift | 88 + .../Schedulers/CurrentThreadScheduler.swift | 140 + .../Schedulers/HistoricalScheduler.swift | 22 + .../HistoricalSchedulerTimeConverter.swift | 67 + .../Internal/DispatchQueueConfiguration.swift | 112 + .../Internal/InvocableScheduledItem.swift | 22 + .../Schedulers/Internal/InvocableType.swift | 17 + .../Schedulers/Internal/ScheduledItem.swift | 35 + .../Internal/ScheduledItemType.swift | 13 + .../RxSwift/Schedulers/MainScheduler.swift | 68 + .../Schedulers/OperationQueueScheduler.swift | 50 + .../Schedulers/RecursiveScheduler.swift | 226 ++ .../SchedulerServices+Emulation.swift | 61 + .../SerialDispatchQueueScheduler.swift | 123 + .../Schedulers/VirtualTimeConverterType.swift | 95 + .../Schedulers/VirtualTimeScheduler.swift | 269 ++ .../RxSwift/Subjects/AsyncSubject.swift | 155 + .../RxSwift/Subjects/BehaviorSubject.swift | 166 ++ .../RxSwift/Subjects/PublishSubject.swift | 150 + .../RxSwift/Subjects/ReplaySubject.swift | 281 ++ .../RxSwift/Subjects/SubjectType.swift | 21 + .../RxSwift/SwiftSupport/SwiftSupport.swift | 29 + .../RxSwift/Traits/Completable+AndThen.swift | 132 + .../RxSwift/RxSwift/Traits/Completable.swift | 259 ++ .../Pods/RxSwift/RxSwift/Traits/Maybe.swift | 244 ++ .../ObservableType+PrimitiveSequence.swift | 43 + .../Traits/PrimitiveSequence+Zip+arity.swift | 521 ++++ .../RxSwift/Traits/PrimitiveSequence.swift | 269 ++ .../Pods/RxSwift/RxSwift/Traits/Single.swift | 251 ++ .../Alamofire/Alamofire-dummy.m | 5 + .../Alamofire/Alamofire-prefix.pch | 12 + .../Alamofire/Alamofire-umbrella.h | 16 + .../Alamofire/Alamofire.modulemap | 6 + .../Alamofire/Alamofire.xcconfig | 10 + .../Target Support Files/Alamofire/Info.plist | 26 + .../Pods/Target Support Files/Moya/Info.plist | 26 + .../Target Support Files/Moya/Moya-dummy.m | 5 + .../Target Support Files/Moya/Moya-prefix.pch | 12 + .../Target Support Files/Moya/Moya-umbrella.h | 16 + .../Target Support Files/Moya/Moya.modulemap | 6 + .../Target Support Files/Moya/Moya.xcconfig | 12 + .../Pods-Poc.Mauro.Bianchelli/Info.plist | 26 + ...Mauro.Bianchelli-acknowledgements.markdown | 99 + ...oc.Mauro.Bianchelli-acknowledgements.plist | 155 + .../Pods-Poc.Mauro.Bianchelli-dummy.m | 5 + .../Pods-Poc.Mauro.Bianchelli-frameworks.sh | 152 + .../Pods-Poc.Mauro.Bianchelli-resources.sh | 106 + .../Pods-Poc.Mauro.Bianchelli-umbrella.h | 16 + .../Pods-Poc.Mauro.Bianchelli.debug.xcconfig | 11 + .../Pods-Poc.Mauro.Bianchelli.modulemap | 6 + ...Pods-Poc.Mauro.Bianchelli.release.xcconfig | 11 + .../Target Support Files/Result/Info.plist | 26 + .../Result/Result-dummy.m | 5 + .../Result/Result-prefix.pch | 12 + .../Result/Result-umbrella.h | 16 + .../Result/Result.modulemap | 6 + .../Result/Result.xcconfig | 10 + .../Target Support Files/RxCocoa/Info.plist | 26 + .../RxCocoa/RxCocoa-dummy.m | 5 + .../RxCocoa/RxCocoa-prefix.pch | 12 + .../RxCocoa/RxCocoa-umbrella.h | 22 + .../RxCocoa/RxCocoa.modulemap | 6 + .../RxCocoa/RxCocoa.xcconfig | 11 + .../Target Support Files/RxSwift/Info.plist | 26 + .../RxSwift/RxSwift-dummy.m | 5 + .../RxSwift/RxSwift-prefix.pch | 12 + .../RxSwift/RxSwift-umbrella.h | 16 + .../RxSwift/RxSwift.modulemap | 6 + .../RxSwift/RxSwift.xcconfig | 10 + 388 files changed, 44597 insertions(+) create mode 100644 .DS_Store create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/.DS_Store create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.pbxproj create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/contents.xcworkspacedata create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/Models.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/WeatherApi.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/AppDelegate.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/Contents.json create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/LaunchScreen.storyboard create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/Main.storyboard create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/MainCoordinator.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/ResultCoordinator.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/VoiceCoordinator.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Observable/Observable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/.xccurrentversion create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/Poc_Mauro_Bianchelli.xcdatamodel/contents create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/ResultViewController.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/VoiceViewController.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewModels/WeatherViewModel.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Poc_Mauro_BianchelliTests.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Poc_Mauro_BianchelliUITests.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Podfile create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Podfile.lock create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/LICENSE create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/README.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/AFError.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Alamofire.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/MultipartFormData.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/NetworkReachabilityManager.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Notifications.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ParameterEncoding.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Request.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Response.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ResponseSerialization.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Result.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ServerTrustPolicy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionDelegate.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionManager.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/TaskDelegate.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Timeline.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Validation.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Manifest.lock create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/License.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Readme.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/AnyEncodable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Cancellable.swift create mode 100755 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Endpoint.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Image.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Moya+Alamofire.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaError.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Internal.swift create mode 100755 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultiTarget.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultipartFormData.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugin.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/AccessTokenPlugin.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/CredentialsPlugin.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkActivityPlugin.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkLoggerPlugin.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Response.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/TargetType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Task.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URL+Moya.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URLRequest+Encoding.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/ValidationType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Pods.xcodeproj/project.pbxproj create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/LICENSE create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/README.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/Result.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/ResultProtocol.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/LICENSE.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Bag.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/InfiniteSequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/PriorityQueue.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Queue.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DeprecationWarner.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DispatchQueue+Extensions.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Darwin.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Linux.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/RecursiveLock.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/README.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Binder.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/ControlTarget.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/TextInput.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Deprecated.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+Swift.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/Logging.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NotificationCenter+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/URLSession+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RX.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXDelegateProxy.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXKVOObserver.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXObjCRuntime.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/BehaviorRelay.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlEvent.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlProperty.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlEvent+Driver.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlProperty+Driver.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver+Subscription.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/PublishRelay.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ControlEvent+Signal.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/PublishRelay+Signal.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal+Subscription.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxWebViewDelegateProxy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIAlertAction+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationController+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationItem+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPageControl+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPickerView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchController+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBar+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarController+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIViewController+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIWebView+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/LICENSE.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Bag.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Queue.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DeprecationWarner.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Darwin.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Linux.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/RecursiveLock.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/README.md create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/AnyObserver.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Cancelable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/Lock.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ConnectableObservableType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Deprecated.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/Disposables.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Errors.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Event.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/GroupedObservable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AddRef.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Amb.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsSingle.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Buffer.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Catch.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Concat.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Create.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debounce.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debug.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Deferred.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Delay.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Do.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ElementAt.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Empty.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Enumerated.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Error.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Filter.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/First.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Generate.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/GroupBy.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Just.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Map.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Materialize.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Merge.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Multicast.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Never.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Optional.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Producer.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Range.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Reduce.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Repeat.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sample.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Scan.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sink.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Skip.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/StartWith.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Switch.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Take.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeLast.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeUntil.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeWhile.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Throttle.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timeout.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timer.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ToArray.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Using.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Window.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObserverType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Reactive.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Rx.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/RxMutableBox.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/SchedulerType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Subjects/AsyncSubject.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Subjects/BehaviorSubject.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Subjects/PublishSubject.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Subjects/ReplaySubject.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Subjects/SubjectType.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/SwiftSupport/SwiftSupport.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Traits/Completable+AndThen.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Traits/Completable.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Traits/Maybe.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Traits/ObservableType+PrimitiveSequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence+Zip+arity.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Traits/Single.swift create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Alamofire/Alamofire-dummy.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Alamofire/Alamofire.modulemap create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Alamofire/Alamofire.xcconfig create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Alamofire/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Moya/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Moya/Moya-dummy.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Moya/Moya-prefix.pch create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Moya/Moya-umbrella.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Moya/Moya.modulemap create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Moya/Moya.xcconfig create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli-acknowledgements.markdown create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli-acknowledgements.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli-dummy.m create mode 100755 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli-frameworks.sh create mode 100755 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli-resources.sh create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli-umbrella.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli.debug.xcconfig create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli.modulemap create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli.release.xcconfig create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Result/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Result/Result-dummy.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Result/Result-prefix.pch create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Result/Result-umbrella.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Result/Result.modulemap create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/Result/Result.xcconfig create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxCocoa/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxCocoa/RxCocoa-dummy.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxCocoa/RxCocoa-prefix.pch create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxCocoa/RxCocoa-umbrella.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxCocoa/RxCocoa.modulemap create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxCocoa/RxCocoa.xcconfig create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxSwift/Info.plist create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxSwift/RxSwift-dummy.m create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxSwift/RxSwift-prefix.pch create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxSwift/RxSwift-umbrella.h create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxSwift/RxSwift.modulemap create mode 100644 Poc.Mauro.Bianchelli.germanAutolabs/Pods/Target Support Files/RxSwift/RxSwift.xcconfig diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..606b810d130b75d996256db13be655acf8367a94 GIT binary patch literal 6148 zcmeHKyH3ME5S)b+k!Vs2%k9ly=&1C+?2rAT(8y}8@l zxr?XpdI3nYdA0H$|mxEy8g4=DEncVs+~v(0a? z;%Ob@uXsVr--;Pa&U?Js&Nc7)AhYG_5$~UizH8Ur(*Mo=>oS@OqynixDv$~sy#iW$ zY11>u98-Z*AQkvkK;I9Au2=&HM|*W}uoi$gVc3jw>m`Uq1H>9QI5I*LrxKki(PD_x z884An0|!T^L!$YRxLKk@5xbq|7fXj!#~f3ERA5(uQ(w-s{@>95=>K;~xk?36frC;& zCiBI-;Uh(D9X*`Z+Csml{}^*Eor9HPqLpGUv=pCjS5T2<$RJ`=)NftbL5&8y8XpcgnFJNhl{nLb&qQ|_CFX=Zwl!oX*3ZgO- zcD~JIW-|LNWHUs>#bG`m>Jw29L$GrR^@+%H87=9!r3+-u@jz2L(2h#FZ+VB|H!>i5 zcSB?B*bIAix_RmKzyxXA0vvW4<9P9E!1p~oAFz`nhz?m)5yD|(N3xv@ zJ|qmm>{uJ>rvpk`0HFLvs$ed?gv2Dr>{uJ(34|>aXrb&a23t7n$^EipZD`@d-h8mX znY}|{eLM0ebtle-p@V^7pvl06-S*}DAAQ~bH-q9X7zhUb6$9KIPKE`R /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + CEA2F775192C2CD97004142E /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 340D8B2C20930E8B0005E974 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 340D8B76209320DD0005E974 /* ResultViewController.swift in Sources */, + 340D8B3C20930E8B0005E974 /* Poc_Mauro_Bianchelli.xcdatamodeld in Sources */, + 34AD476320A99FCF00159ACA /* WeatherViewModel.swift in Sources */, + 340D8B74209320C60005E974 /* ResultCoordinator.swift in Sources */, + 34A400D620AB21C40033C2C0 /* Observable.swift in Sources */, + 3468307820F0B5D2000B98C5 /* Models.swift in Sources */, + 340D8B6C209315110005E974 /* VoiceCoordinator.swift in Sources */, + 340D8B6720930FC80005E974 /* MainCoordinator.swift in Sources */, + 340D8B3620930E8B0005E974 /* VoiceViewController.swift in Sources */, + 3468307920F0B5D2000B98C5 /* WeatherApi.swift in Sources */, + 340D8B3420930E8B0005E974 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 340D8B4320930E8C0005E974 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 340D8B4C20930E8C0005E974 /* Poc_Mauro_BianchelliTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 340D8B4E20930E8D0005E974 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 340D8B5720930E8D0005E974 /* Poc_Mauro_BianchelliUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 340D8B4920930E8C0005E974 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 340D8B2F20930E8B0005E974 /* Poc.Mauro.Bianchelli */; + targetProxy = 340D8B4820930E8C0005E974 /* PBXContainerItemProxy */; + }; + 340D8B5420930E8D0005E974 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 340D8B2F20930E8B0005E974 /* Poc.Mauro.Bianchelli */; + targetProxy = 340D8B5320930E8D0005E974 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 340D8B3720930E8B0005E974 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 340D8B3820930E8B0005E974 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 340D8B3F20930E8C0005E974 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 340D8B4020930E8C0005E974 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 340D8B5920930E8D0005E974 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 340D8B5A20930E8D0005E974 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 340D8B5C20930E8D0005E974 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7D780AEE72ADE29F6FA726C4 /* Pods-Poc.Mauro.Bianchelli.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KVK84M25K4; + INFOPLIST_FILE = Poc.Mauro.Bianchelli/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "app.co.cha.Poc-Mauro-Bianchelli"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 340D8B5D20930E8D0005E974 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7C89E8E8E31308B676791D79 /* Pods-Poc.Mauro.Bianchelli.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KVK84M25K4; + INFOPLIST_FILE = Poc.Mauro.Bianchelli/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "app.co.cha.Poc-Mauro-Bianchelli"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 340D8B5F20930E8D0005E974 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KVK84M25K4; + INFOPLIST_FILE = Poc.Mauro.BianchelliTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "app.co.cha.Poc-Mauro-BianchelliTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Poc.Mauro.Bianchelli.app/Poc.Mauro.Bianchelli"; + }; + name = Debug; + }; + 340D8B6020930E8D0005E974 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KVK84M25K4; + INFOPLIST_FILE = Poc.Mauro.BianchelliTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "app.co.cha.Poc-Mauro-BianchelliTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Poc.Mauro.Bianchelli.app/Poc.Mauro.Bianchelli"; + }; + name = Release; + }; + 340D8B6220930E8D0005E974 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KVK84M25K4; + INFOPLIST_FILE = Poc.Mauro.BianchelliUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "app.co.cha.Poc-Mauro-BianchelliUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Poc.Mauro.Bianchelli; + }; + name = Debug; + }; + 340D8B6320930E8D0005E974 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KVK84M25K4; + INFOPLIST_FILE = Poc.Mauro.BianchelliUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "app.co.cha.Poc-Mauro-BianchelliUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Poc.Mauro.Bianchelli; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 340D8B2B20930E8B0005E974 /* Build configuration list for PBXProject "Poc.Mauro.Bianchelli" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 340D8B5920930E8D0005E974 /* Debug */, + 340D8B5A20930E8D0005E974 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 340D8B5B20930E8D0005E974 /* Build configuration list for PBXNativeTarget "Poc.Mauro.Bianchelli" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 340D8B5C20930E8D0005E974 /* Debug */, + 340D8B5D20930E8D0005E974 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 340D8B5E20930E8D0005E974 /* Build configuration list for PBXNativeTarget "Poc.Mauro.BianchelliTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 340D8B5F20930E8D0005E974 /* Debug */, + 340D8B6020930E8D0005E974 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 340D8B6120930E8D0005E974 /* Build configuration list for PBXNativeTarget "Poc.Mauro.BianchelliUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 340D8B6220930E8D0005E974 /* Debug */, + 340D8B6320930E8D0005E974 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + 340D8B3A20930E8B0005E974 /* Poc_Mauro_Bianchelli.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + 340D8B3B20930E8B0005E974 /* Poc_Mauro_Bianchelli.xcdatamodel */, + ); + currentVersion = 340D8B3B20930E8B0005E974 /* Poc_Mauro_Bianchelli.xcdatamodel */; + path = Poc_Mauro_Bianchelli.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = 340D8B2820930E8B0005E974 /* Project object */; +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..a1d8c9a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/contents.xcworkspacedata b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..d0d70e0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/Models.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/Models.swift new file mode 100644 index 0000000..50c97e1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/Models.swift @@ -0,0 +1,26 @@ +// +// CityWeatherModel.swift +// Challenge.Mauro +// +// Created by Mauro on 4/5/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation + + +struct CityWeather: Decodable { + let weather: [Weather] + let name: String +} + +struct Weather: Decodable { + let id: Int + let main: String + let description: String + let icon: String + +} + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/WeatherApi.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/WeatherApi.swift new file mode 100644 index 0000000..d831cbf --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/API/WeatherApi.swift @@ -0,0 +1,76 @@ +// +// WeatherManager.swift +// Challenge.Mauro +// +// Created by Mauro on 4/5/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation +import Moya + +/** + Api resolves all the networking methods to Weather + The API used is http://api.openweathermap.org/data/2.5/ + */ +enum WeatherApi{ + case getWeather(cityName: String) + case getIcon(id:String) +} + +extension WeatherApi: TargetType{ + + private var appId: String { + return "69e36b63bdd890715d23b430d63e510e" + } + + + var baseURL: URL { + return URL(fileURLWithPath: "http://api.openweathermap.org") + } + + var path: String { + switch self { + case .getWeather(_) : + return "/data/2.5/weather" + case .getIcon(let id): + return "/img/w/\(id).png" + } + } + + var method: Moya.Method { + switch self { + case .getWeather(_), .getIcon(_): + return .get + } + } + + var sampleData: Data { + return Data() + } + + var parameterEncoding: ParameterEncoding { + return URLEncoding.queryString + } + + var task: Task { + switch self { + case .getWeather(let cityName): + return .requestParameters(parameters: ["q":cityName, "appId": appId], encoding: URLEncoding.queryString) + case .getIcon(_): + return .requestPlain + } + } + + + var headers: [String : String]? { + switch self { + case .getIcon(_): + return ["Accept" : "image/jpeg", "content-type": "image/jpeg"] + case .getWeather(_): + return ["Content-Type":"application/x-www-form-urlencoded"] + } + } + + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/AppDelegate.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/AppDelegate.swift new file mode 100644 index 0000000..acde42f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/AppDelegate.swift @@ -0,0 +1,99 @@ +// +// AppDelegate.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import UIKit +import CoreData + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + private var coordinator: MainCoordinator? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + + let window = UIWindow() + self.window = window + let coordinator = MainCoordinator(window: window) + self.coordinator = coordinator + coordinator.start() + + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // 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. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // 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. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Saves changes in the application's managed object context before the application terminates. + self.saveContext() + } + + // MARK: - Core Data stack + + lazy var persistentContainer: NSPersistentContainer = { + /* + The persistent container for the application. This implementation + creates and returns a container, having loaded the store for the + application to it. This property is optional since there are legitimate + error conditions that could cause the creation of the store to fail. + */ + let container = NSPersistentContainer(name: "Poc_Mauro_Bianchelli") + container.loadPersistentStores(completionHandler: { (storeDescription, error) in + if let error = error as NSError? { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + fatalError("Unresolved error \(error), \(error.userInfo)") + } + }) + return container + }() + + // MARK: - Core Data Saving support + + func saveContext () { + let context = persistentContainer.viewContext + if context.hasChanges { + do { + try context.save() + } catch { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + let nserror = error as NSError + fatalError("Unresolved error \(nserror), \(nserror.userInfo)") + } + } + } + +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/AppIcon.appiconset/Contents.json b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/Contents.json b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/LaunchScreen.storyboard b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/Main.storyboard b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e127cc9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Base.lproj/Main.storyboard @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/MainCoordinator.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/MainCoordinator.swift new file mode 100644 index 0000000..7627f22 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/MainCoordinator.swift @@ -0,0 +1,33 @@ +// +// MainCoordinator.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation +import UIKit + +/** + Is called from AppDelegate to start the navigation + */ +class MainCoordinator { + var window: UIWindow? + var rootViewController: UINavigationController + var voiceCoordinator: VoiceCoordinator? + + init(window:UIWindow) { + self.window = window + rootViewController = UINavigationController() + voiceCoordinator = VoiceCoordinator(presenter: rootViewController) + } + + func start() { + window?.rootViewController = rootViewController + window?.makeKeyAndVisible() + voiceCoordinator?.start() + + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/ResultCoordinator.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/ResultCoordinator.swift new file mode 100644 index 0000000..f0e3fa2 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/ResultCoordinator.swift @@ -0,0 +1,31 @@ +// +// DetailCoordinator.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation +import UIKit + +class ResultCoordinator{ + var viewController: ResultViewController? + let presenter: UINavigationController + var weather: CityWeather? + + init(presenter:UINavigationController, data: CityWeather) { + self.presenter = presenter + self.weather = data + } + + + func start() { + let st = UIStoryboard(name: "Main", bundle: nil) + guard let vc = st.instantiateViewController(withIdentifier: "ResultViewController") as? ResultViewController else {return} + self.viewController = vc + vc.weather = weather + presenter.pushViewController(vc, animated: true) + + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/VoiceCoordinator.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/VoiceCoordinator.swift new file mode 100644 index 0000000..5e628cf --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Coordinators/VoiceCoordinator.swift @@ -0,0 +1,46 @@ +// +// ViewControllerCoordinator.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation +import UIKit +import Moya + + +class VoiceCoordinator { + let presenter: UINavigationController + var voiceViewController: VoiceViewController? + var resultCoordinator: ResultCoordinator? + + + init(presenter: UINavigationController){ + self.presenter = presenter + } + + func start() { + let st = UIStoryboard(name: "Main", bundle: nil) + guard let vc = st.instantiateViewController(withIdentifier: "VoiceViewController") as? VoiceViewController else{return} + vc.delegate = self + self.presenter.pushViewController(vc, animated: true) + } + +} + + +extension VoiceCoordinator: GoToResultProtocol{ + func goToResult(withWeather: CityWeather) { + let resultCoordinator = ResultCoordinator(presenter: self.presenter, data: withWeather ) + resultCoordinator.start() + + + } + + +} + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Info.plist b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Info.plist new file mode 100644 index 0000000..1fe8c96 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Info.plist @@ -0,0 +1,49 @@ + + + + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Observable/Observable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Observable/Observable.swift new file mode 100644 index 0000000..3a88677 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Observable/Observable.swift @@ -0,0 +1,29 @@ +// +// Observable.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 15/5/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation + +class Observable{ + typealias Listener = (T) -> Void + var listener: Listener? + var value:T{ + didSet{ + listener?(value) + } + } + + + init(_ value: T){ + self.value = value + } + + func bind(listener:Listener?){ + self.listener = listener + listener?(value) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/.xccurrentversion b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..ae6c4d5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + Poc_Mauro_Bianchelli.xcdatamodel + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/Poc_Mauro_Bianchelli.xcdatamodel/contents b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/Poc_Mauro_Bianchelli.xcdatamodel/contents new file mode 100644 index 0000000..476e5b6 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/Poc_Mauro_Bianchelli.xcdatamodeld/Poc_Mauro_Bianchelli.xcdatamodel/contents @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/ResultViewController.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/ResultViewController.swift new file mode 100644 index 0000000..1d921d7 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/ResultViewController.swift @@ -0,0 +1,21 @@ +// +// DetailViewController.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation +import UIKit + +class ResultViewController: UIViewController{ + + var weather: CityWeather? + @IBOutlet weak var label: UILabel! + + override func viewDidLoad() { + label.text = weather?.name + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/VoiceViewController.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/VoiceViewController.swift new file mode 100644 index 0000000..c559443 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewControllers/VoiceViewController.swift @@ -0,0 +1,34 @@ +// +// ViewController.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import UIKit + +protocol GoToResultProtocol: class { + func goToResult(withWeather: CityWeather) +} + + +class VoiceViewController: UIViewController { + weak var delegate: GoToResultProtocol? + override func viewDidLoad() { + } + + + @IBAction func hearAction(_ sender: Any) { + let viewModel = WeatherViewModel() + viewModel.getWeather( completion: { [weak self] (weather) in + guard let weather = weather else {return} + self?.delegate?.goToResult(withWeather: weather) + }) + + } + + + +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewModels/WeatherViewModel.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewModels/WeatherViewModel.swift new file mode 100644 index 0000000..4b1b744 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.Bianchelli/ViewModels/WeatherViewModel.swift @@ -0,0 +1,34 @@ +// +// TableViewModel.swift +// Poc.Mauro.Bianchelli +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import Foundation +import Moya + +class WeatherViewModel { +// var weather: Observable = Observable(nil) + var weather: CityWeather? + var provider = MoyaProvider() + + func getWeather( completion: @escaping (_ weather: CityWeather?) -> Void) { + provider.request(.getWeather(cityName: "Berlin"), completion: { [weak self] (result) in + switch result{ + case .success(let response): + do{ + let weather = try JSONDecoder().decode(CityWeather.self, from: response.data) + self?.weather = weather + completion(weather) + }catch{ + print("Error") + } + case .failure(let error): + print("Error") + } + }) + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Info.plist b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Info.plist new file mode 100644 index 0000000..6c40a6c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Poc_Mauro_BianchelliTests.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Poc_Mauro_BianchelliTests.swift new file mode 100644 index 0000000..23be276 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliTests/Poc_Mauro_BianchelliTests.swift @@ -0,0 +1,36 @@ +// +// Poc_Mauro_BianchelliTests.swift +// Poc.Mauro.BianchelliTests +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import XCTest +@testable import Poc_Mauro_Bianchelli + +class Poc_Mauro_BianchelliTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Info.plist b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Info.plist new file mode 100644 index 0000000..6c40a6c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Poc_Mauro_BianchelliUITests.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Poc_Mauro_BianchelliUITests.swift new file mode 100644 index 0000000..81ca91b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Poc.Mauro.BianchelliUITests/Poc_Mauro_BianchelliUITests.swift @@ -0,0 +1,36 @@ +// +// Poc_Mauro_BianchelliUITests.swift +// Poc.Mauro.BianchelliUITests +// +// Created by Mauro on 07/7/18. +// Copyright © 2018 Mauro. All rights reserved. +// + +import XCTest + +class Poc_Mauro_BianchelliUITests: XCTestCase { + + override func setUp() { + super.setUp() + + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. + XCUIApplication().launch() + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Podfile b/Poc.Mauro.Bianchelli.germanAutolabs/Podfile new file mode 100644 index 0000000..b721fed --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Podfile @@ -0,0 +1,13 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '10.0' +use_frameworks! + +target 'Poc.Mauro.Bianchelli' do + + pod 'Moya', '~> 11.0' + pod 'RxSwift', '~> 4.0' + pod 'RxCocoa', '~> 4.0' + +end + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Podfile.lock b/Poc.Mauro.Bianchelli.germanAutolabs/Podfile.lock new file mode 100644 index 0000000..52f1073 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Podfile.lock @@ -0,0 +1,27 @@ +PODS: + - Alamofire (4.7.1) + - Moya (11.0.2): + - Moya/Core (= 11.0.2) + - Moya/Core (11.0.2): + - Alamofire (~> 4.1) + - Result (~> 3.0) + - Result (3.2.4) + - RxCocoa (4.1.2): + - RxSwift (~> 4.0) + - RxSwift (4.1.2) + +DEPENDENCIES: + - Moya (~> 11.0) + - RxCocoa (~> 4.0) + - RxSwift (~> 4.0) + +SPEC CHECKSUMS: + Alamofire: 68d7d521118d49c615a8d2214d87cdf525599d30 + Moya: a725035953bc1c0eb1be505ab903984501d82440 + Result: d2d07204ce72856f1fd9130bbe42c35a7b0fea10 + RxCocoa: d88ba0f1f6abf040011a9eb4b539324fc426843a + RxSwift: e49536837d9901277638493ea537394d4b55f570 + +PODFILE CHECKSUM: 8c8df858f0b72706302c397fb14b19845c9e623a + +COCOAPODS: 1.4.0 diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/LICENSE b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/LICENSE new file mode 100644 index 0000000..2ec3cb1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/README.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/README.md new file mode 100644 index 0000000..3b04d71 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/README.md @@ -0,0 +1,235 @@ +![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/master/alamofire.png) + +[![Build Status](https://travis-ci.org/Alamofire/Alamofire.svg?branch=master)](https://travis-ci.org/Alamofire/Alamofire) +[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg)](https://img.shields.io/cocoapods/v/Alamofire.svg) +[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Platform](https://img.shields.io/cocoapods/p/Alamofire.svg?style=flat)](https://alamofire.github.io/Alamofire) +[![Twitter](https://img.shields.io/badge/twitter-@AlamofireSF-blue.svg?style=flat)](http://twitter.com/AlamofireSF) +[![Gitter](https://badges.gitter.im/Alamofire/Alamofire.svg)](https://gitter.im/Alamofire/Alamofire?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + +Alamofire is an HTTP networking library written in Swift. + +- [Features](#features) +- [Component Libraries](#component-libraries) +- [Requirements](#requirements) +- [Migration Guides](#migration-guides) +- [Communication](#communication) +- [Installation](#installation) +- [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md) + - **Intro -** [Making a Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-a-request), [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling), [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation), [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching) + - **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods), [Parameter Encoding](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#parameter-encoding), [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers), [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication) + - **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file), [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server) + - **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics), [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output) +- [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md) + - **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session-manager), [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session-delegate), [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request) + - **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests), [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests) + - **Model Objects -** [Custom Response Serialization](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#custom-response-serialization) + - **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security), [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability) +- [Open Radars](#open-radars) +- [FAQ](#faq) +- [Credits](#credits) +- [Donations](#donations) +- [License](#license) + +## Features + +- [x] Chainable Request / Response Methods +- [x] URL / JSON / plist Parameter Encoding +- [x] Upload File / Data / Stream / MultipartFormData +- [x] Download File using Request or Resume Data +- [x] Authentication with URLCredential +- [x] HTTP Response Validation +- [x] Upload and Download Progress Closures with Progress +- [x] cURL Command Output +- [x] Dynamically Adapt and Retry Requests +- [x] TLS Certificate and Public Key Pinning +- [x] Network Reachability +- [x] Comprehensive Unit and Integration Test Coverage +- [x] [Complete Documentation](https://alamofire.github.io/Alamofire) + +## Component Libraries + +In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem. + +- [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache and a priority-based image downloading system. +- [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire. + +## Requirements + +- iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ +- Xcode 8.3+ +- Swift 3.1+ + +## Migration Guides + +- [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md) +- [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md) +- [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md) + +## Communication + +- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/alamofire). (Tag 'alamofire') +- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/alamofire). +- If you **found a bug**, open an issue. +- If you **have a feature request**, open an issue. +- If you **want to contribute**, submit a pull request. + +## Installation + +### CocoaPods + +[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: + +```bash +$ gem install cocoapods +``` + +> CocoaPods 1.1+ is required to build Alamofire 4.0+. + +To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`: + +```ruby +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '10.0' +use_frameworks! + +target '' do + pod 'Alamofire', '~> 4.7' +end +``` + +Then, run the following command: + +```bash +$ pod install +``` + +### Carthage + +[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. + +You can install Carthage with [Homebrew](http://brew.sh/) using the following command: + +```bash +$ brew update +$ brew install carthage +``` + +To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`: + +```ogdl +github "Alamofire/Alamofire" ~> 4.7 +``` + +Run `carthage update` to build the framework and drag the built `Alamofire.framework` into your Xcode project. + +### Swift Package Manager + +The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms. + +Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. + +#### Swift 3 + +```swift +dependencies: [ + .Package(url: "https://github.com/Alamofire/Alamofire.git", majorVersion: 4) +] +``` + +#### Swift 4 + +```swift +dependencies: [ + .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.0.0") +] +``` + +### Manually + +If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually. + +#### Embedded Framework + +- Open up Terminal, `cd` into your top-level project directory, and run the following command "if" your project is not initialized as a git repository: + + ```bash + $ git init + ``` + +- Add Alamofire as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command: + + ```bash + $ git submodule add https://github.com/Alamofire/Alamofire.git + ``` + +- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project. + + > It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter. + +- Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target. +- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar. +- In the tab bar at the top of that window, open the "General" panel. +- Click on the `+` button under the "Embedded Binaries" section. +- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder. + + > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`. + +- Select the top `Alamofire.framework` for iOS and the bottom one for OS X. + + > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as either `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS` or `Alamofire watchOS`. + +- And that's it! + + > The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device. + +## Open Radars + +The following radars have some effect on the current implementation of Alamofire. + +- [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in test case +- `rdar://26870455` - Background URL Session Configurations do not work in the simulator +- `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest` +- [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+ + +## Resolved Radars + +The following radars have been resolved over time after being filed against the Alamofire project. + +- [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage (Resolved on 9/1/17 in Xcode 9 beta 6). + +## FAQ + +### What's the origin of the name Alamofire? + +Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html), a hybrid variant of the Bluebonnet, the official state flower of Texas. + +### What logic belongs in a Router vs. a Request Adapter? + +Simple, static data such as paths, parameters and common headers belong in the `Router`. Dynamic data such as an `Authorization` header whose value can changed based on an authentication system belongs in a `RequestAdapter`. + +The reason the dynamic data MUST be placed into the `RequestAdapter` is to support retry operations. When a `Request` is retried, the original request is not rebuilt meaning the `Router` will not be called again. The `RequestAdapter` is called again allowing the dynamic data to be updated on the original request before retrying the `Request`. + +## Credits + +Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org). You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases. + +### Security Disclosure + +If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker. + +## Donations + +The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially register as a federal non-profit organization. Registering will allow us members to gain some legal protections and also allow us to put donations to use, tax free. Donating to the ASF will enable us to: + +- Pay our legal fees to register as a federal non-profit organization +- Pay our yearly legal fees to keep the non-profit in good status +- Pay for our mail servers to help us stay on top of all questions and security issues +- Potentially fund test servers to make it easier for us to test the edge cases +- Potentially fund developers to work on one of our projects full-time + +The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects, and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Our initial goal is to raise $1000 to get all our legal ducks in a row and kickstart this campaign. Any amount you can donate today to help us reach our goal would be greatly appreciated. + +## License + +Alamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE) for details. diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/AFError.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/AFError.swift new file mode 100644 index 0000000..8b90d84 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/AFError.swift @@ -0,0 +1,460 @@ +// +// AFError.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with +/// their own associated reasons. +/// +/// - invalidURL: Returned when a `URLConvertible` type fails to create a valid `URL`. +/// - parameterEncodingFailed: Returned when a parameter encoding object throws an error during the encoding process. +/// - multipartEncodingFailed: Returned when some step in the multipart encoding process fails. +/// - responseValidationFailed: Returned when a `validate()` call fails. +/// - responseSerializationFailed: Returned when a response serializer encounters an error in the serialization process. +public enum AFError: Error { + /// The underlying reason the parameter encoding error occurred. + /// + /// - missingURL: The URL request did not have a URL to encode. + /// - jsonEncodingFailed: JSON serialization failed with an underlying system error during the + /// encoding process. + /// - propertyListEncodingFailed: Property list serialization failed with an underlying system error during + /// encoding process. + public enum ParameterEncodingFailureReason { + case missingURL + case jsonEncodingFailed(error: Error) + case propertyListEncodingFailed(error: Error) + } + + /// The underlying reason the multipart encoding error occurred. + /// + /// - bodyPartURLInvalid: The `fileURL` provided for reading an encodable body part isn't a + /// file URL. + /// - bodyPartFilenameInvalid: The filename of the `fileURL` provided has either an empty + /// `lastPathComponent` or `pathExtension. + /// - bodyPartFileNotReachable: The file at the `fileURL` provided was not reachable. + /// - bodyPartFileNotReachableWithError: Attempting to check the reachability of the `fileURL` provided threw + /// an error. + /// - bodyPartFileIsDirectory: The file at the `fileURL` provided is actually a directory. + /// - bodyPartFileSizeNotAvailable: The size of the file at the `fileURL` provided was not returned by + /// the system. + /// - bodyPartFileSizeQueryFailedWithError: The attempt to find the size of the file at the `fileURL` provided + /// threw an error. + /// - bodyPartInputStreamCreationFailed: An `InputStream` could not be created for the provided `fileURL`. + /// - outputStreamCreationFailed: An `OutputStream` could not be created when attempting to write the + /// encoded data to disk. + /// - outputStreamFileAlreadyExists: The encoded body data could not be writtent disk because a file + /// already exists at the provided `fileURL`. + /// - outputStreamURLInvalid: The `fileURL` provided for writing the encoded body data to disk is + /// not a file URL. + /// - outputStreamWriteFailed: The attempt to write the encoded body data to disk failed with an + /// underlying error. + /// - inputStreamReadFailed: The attempt to read an encoded body part `InputStream` failed with + /// underlying system error. + public enum MultipartEncodingFailureReason { + case bodyPartURLInvalid(url: URL) + case bodyPartFilenameInvalid(in: URL) + case bodyPartFileNotReachable(at: URL) + case bodyPartFileNotReachableWithError(atURL: URL, error: Error) + case bodyPartFileIsDirectory(at: URL) + case bodyPartFileSizeNotAvailable(at: URL) + case bodyPartFileSizeQueryFailedWithError(forURL: URL, error: Error) + case bodyPartInputStreamCreationFailed(for: URL) + + case outputStreamCreationFailed(for: URL) + case outputStreamFileAlreadyExists(at: URL) + case outputStreamURLInvalid(url: URL) + case outputStreamWriteFailed(error: Error) + + case inputStreamReadFailed(error: Error) + } + + /// The underlying reason the response validation error occurred. + /// + /// - dataFileNil: The data file containing the server response did not exist. + /// - dataFileReadFailed: The data file containing the server response could not be read. + /// - missingContentType: The response did not contain a `Content-Type` and the `acceptableContentTypes` + /// provided did not contain wildcard type. + /// - unacceptableContentType: The response `Content-Type` did not match any type in the provided + /// `acceptableContentTypes`. + /// - unacceptableStatusCode: The response status code was not acceptable. + public enum ResponseValidationFailureReason { + case dataFileNil + case dataFileReadFailed(at: URL) + case missingContentType(acceptableContentTypes: [String]) + case unacceptableContentType(acceptableContentTypes: [String], responseContentType: String) + case unacceptableStatusCode(code: Int) + } + + /// The underlying reason the response serialization error occurred. + /// + /// - inputDataNil: The server response contained no data. + /// - inputDataNilOrZeroLength: The server response contained no data or the data was zero length. + /// - inputFileNil: The file containing the server response did not exist. + /// - inputFileReadFailed: The file containing the server response could not be read. + /// - stringSerializationFailed: String serialization failed using the provided `String.Encoding`. + /// - jsonSerializationFailed: JSON serialization failed with an underlying system error. + /// - propertyListSerializationFailed: Property list serialization failed with an underlying system error. + public enum ResponseSerializationFailureReason { + case inputDataNil + case inputDataNilOrZeroLength + case inputFileNil + case inputFileReadFailed(at: URL) + case stringSerializationFailed(encoding: String.Encoding) + case jsonSerializationFailed(error: Error) + case propertyListSerializationFailed(error: Error) + } + + case invalidURL(url: URLConvertible) + case parameterEncodingFailed(reason: ParameterEncodingFailureReason) + case multipartEncodingFailed(reason: MultipartEncodingFailureReason) + case responseValidationFailed(reason: ResponseValidationFailureReason) + case responseSerializationFailed(reason: ResponseSerializationFailureReason) +} + +// MARK: - Adapt Error + +struct AdaptError: Error { + let error: Error +} + +extension Error { + var underlyingAdaptError: Error? { return (self as? AdaptError)?.error } +} + +// MARK: - Error Booleans + +extension AFError { + /// Returns whether the AFError is an invalid URL error. + public var isInvalidURLError: Bool { + if case .invalidURL = self { return true } + return false + } + + /// Returns whether the AFError is a parameter encoding error. When `true`, the `underlyingError` property will + /// contain the associated value. + public var isParameterEncodingError: Bool { + if case .parameterEncodingFailed = self { return true } + return false + } + + /// Returns whether the AFError is a multipart encoding error. When `true`, the `url` and `underlyingError` properties + /// will contain the associated values. + public var isMultipartEncodingError: Bool { + if case .multipartEncodingFailed = self { return true } + return false + } + + /// Returns whether the `AFError` is a response validation error. When `true`, the `acceptableContentTypes`, + /// `responseContentType`, and `responseCode` properties will contain the associated values. + public var isResponseValidationError: Bool { + if case .responseValidationFailed = self { return true } + return false + } + + /// Returns whether the `AFError` is a response serialization error. When `true`, the `failedStringEncoding` and + /// `underlyingError` properties will contain the associated values. + public var isResponseSerializationError: Bool { + if case .responseSerializationFailed = self { return true } + return false + } +} + +// MARK: - Convenience Properties + +extension AFError { + /// The `URLConvertible` associated with the error. + public var urlConvertible: URLConvertible? { + switch self { + case .invalidURL(let url): + return url + default: + return nil + } + } + + /// The `URL` associated with the error. + public var url: URL? { + switch self { + case .multipartEncodingFailed(let reason): + return reason.url + default: + return nil + } + } + + /// The `Error` returned by a system framework associated with a `.parameterEncodingFailed`, + /// `.multipartEncodingFailed` or `.responseSerializationFailed` error. + public var underlyingError: Error? { + switch self { + case .parameterEncodingFailed(let reason): + return reason.underlyingError + case .multipartEncodingFailed(let reason): + return reason.underlyingError + case .responseSerializationFailed(let reason): + return reason.underlyingError + default: + return nil + } + } + + /// The acceptable `Content-Type`s of a `.responseValidationFailed` error. + public var acceptableContentTypes: [String]? { + switch self { + case .responseValidationFailed(let reason): + return reason.acceptableContentTypes + default: + return nil + } + } + + /// The response `Content-Type` of a `.responseValidationFailed` error. + public var responseContentType: String? { + switch self { + case .responseValidationFailed(let reason): + return reason.responseContentType + default: + return nil + } + } + + /// The response code of a `.responseValidationFailed` error. + public var responseCode: Int? { + switch self { + case .responseValidationFailed(let reason): + return reason.responseCode + default: + return nil + } + } + + /// The `String.Encoding` associated with a failed `.stringResponse()` call. + public var failedStringEncoding: String.Encoding? { + switch self { + case .responseSerializationFailed(let reason): + return reason.failedStringEncoding + default: + return nil + } + } +} + +extension AFError.ParameterEncodingFailureReason { + var underlyingError: Error? { + switch self { + case .jsonEncodingFailed(let error), .propertyListEncodingFailed(let error): + return error + default: + return nil + } + } +} + +extension AFError.MultipartEncodingFailureReason { + var url: URL? { + switch self { + case .bodyPartURLInvalid(let url), .bodyPartFilenameInvalid(let url), .bodyPartFileNotReachable(let url), + .bodyPartFileIsDirectory(let url), .bodyPartFileSizeNotAvailable(let url), + .bodyPartInputStreamCreationFailed(let url), .outputStreamCreationFailed(let url), + .outputStreamFileAlreadyExists(let url), .outputStreamURLInvalid(let url), + .bodyPartFileNotReachableWithError(let url, _), .bodyPartFileSizeQueryFailedWithError(let url, _): + return url + default: + return nil + } + } + + var underlyingError: Error? { + switch self { + case .bodyPartFileNotReachableWithError(_, let error), .bodyPartFileSizeQueryFailedWithError(_, let error), + .outputStreamWriteFailed(let error), .inputStreamReadFailed(let error): + return error + default: + return nil + } + } +} + +extension AFError.ResponseValidationFailureReason { + var acceptableContentTypes: [String]? { + switch self { + case .missingContentType(let types), .unacceptableContentType(let types, _): + return types + default: + return nil + } + } + + var responseContentType: String? { + switch self { + case .unacceptableContentType(_, let responseType): + return responseType + default: + return nil + } + } + + var responseCode: Int? { + switch self { + case .unacceptableStatusCode(let code): + return code + default: + return nil + } + } +} + +extension AFError.ResponseSerializationFailureReason { + var failedStringEncoding: String.Encoding? { + switch self { + case .stringSerializationFailed(let encoding): + return encoding + default: + return nil + } + } + + var underlyingError: Error? { + switch self { + case .jsonSerializationFailed(let error), .propertyListSerializationFailed(let error): + return error + default: + return nil + } + } +} + +// MARK: - Error Descriptions + +extension AFError: LocalizedError { + public var errorDescription: String? { + switch self { + case .invalidURL(let url): + return "URL is not valid: \(url)" + case .parameterEncodingFailed(let reason): + return reason.localizedDescription + case .multipartEncodingFailed(let reason): + return reason.localizedDescription + case .responseValidationFailed(let reason): + return reason.localizedDescription + case .responseSerializationFailed(let reason): + return reason.localizedDescription + } + } +} + +extension AFError.ParameterEncodingFailureReason { + var localizedDescription: String { + switch self { + case .missingURL: + return "URL request to encode was missing a URL" + case .jsonEncodingFailed(let error): + return "JSON could not be encoded because of error:\n\(error.localizedDescription)" + case .propertyListEncodingFailed(let error): + return "PropertyList could not be encoded because of error:\n\(error.localizedDescription)" + } + } +} + +extension AFError.MultipartEncodingFailureReason { + var localizedDescription: String { + switch self { + case .bodyPartURLInvalid(let url): + return "The URL provided is not a file URL: \(url)" + case .bodyPartFilenameInvalid(let url): + return "The URL provided does not have a valid filename: \(url)" + case .bodyPartFileNotReachable(let url): + return "The URL provided is not reachable: \(url)" + case .bodyPartFileNotReachableWithError(let url, let error): + return ( + "The system returned an error while checking the provided URL for " + + "reachability.\nURL: \(url)\nError: \(error)" + ) + case .bodyPartFileIsDirectory(let url): + return "The URL provided is a directory: \(url)" + case .bodyPartFileSizeNotAvailable(let url): + return "Could not fetch the file size from the provided URL: \(url)" + case .bodyPartFileSizeQueryFailedWithError(let url, let error): + return ( + "The system returned an error while attempting to fetch the file size from the " + + "provided URL.\nURL: \(url)\nError: \(error)" + ) + case .bodyPartInputStreamCreationFailed(let url): + return "Failed to create an InputStream for the provided URL: \(url)" + case .outputStreamCreationFailed(let url): + return "Failed to create an OutputStream for URL: \(url)" + case .outputStreamFileAlreadyExists(let url): + return "A file already exists at the provided URL: \(url)" + case .outputStreamURLInvalid(let url): + return "The provided OutputStream URL is invalid: \(url)" + case .outputStreamWriteFailed(let error): + return "OutputStream write failed with error: \(error)" + case .inputStreamReadFailed(let error): + return "InputStream read failed with error: \(error)" + } + } +} + +extension AFError.ResponseSerializationFailureReason { + var localizedDescription: String { + switch self { + case .inputDataNil: + return "Response could not be serialized, input data was nil." + case .inputDataNilOrZeroLength: + return "Response could not be serialized, input data was nil or zero length." + case .inputFileNil: + return "Response could not be serialized, input file was nil." + case .inputFileReadFailed(let url): + return "Response could not be serialized, input file could not be read: \(url)." + case .stringSerializationFailed(let encoding): + return "String could not be serialized with encoding: \(encoding)." + case .jsonSerializationFailed(let error): + return "JSON could not be serialized because of error:\n\(error.localizedDescription)" + case .propertyListSerializationFailed(let error): + return "PropertyList could not be serialized because of error:\n\(error.localizedDescription)" + } + } +} + +extension AFError.ResponseValidationFailureReason { + var localizedDescription: String { + switch self { + case .dataFileNil: + return "Response could not be validated, data file was nil." + case .dataFileReadFailed(let url): + return "Response could not be validated, data file could not be read: \(url)." + case .missingContentType(let types): + return ( + "Response Content-Type was missing and acceptable content types " + + "(\(types.joined(separator: ","))) do not match \"*/*\"." + ) + case .unacceptableContentType(let acceptableTypes, let responseType): + return ( + "Response Content-Type \"\(responseType)\" does not match any acceptable types: " + + "\(acceptableTypes.joined(separator: ","))." + ) + case .unacceptableStatusCode(let code): + return "Response status code was unacceptable: \(code)." + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Alamofire.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Alamofire.swift new file mode 100644 index 0000000..2fcc05c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Alamofire.swift @@ -0,0 +1,465 @@ +// +// Alamofire.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Types adopting the `URLConvertible` protocol can be used to construct URLs, which are then used to construct +/// URL requests. +public protocol URLConvertible { + /// Returns a URL that conforms to RFC 2396 or throws an `Error`. + /// + /// - throws: An `Error` if the type cannot be converted to a `URL`. + /// + /// - returns: A URL or throws an `Error`. + func asURL() throws -> URL +} + +extension String: URLConvertible { + /// Returns a URL if `self` represents a valid URL string that conforms to RFC 2396 or throws an `AFError`. + /// + /// - throws: An `AFError.invalidURL` if `self` is not a valid URL string. + /// + /// - returns: A URL or throws an `AFError`. + public func asURL() throws -> URL { + guard let url = URL(string: self) else { throw AFError.invalidURL(url: self) } + return url + } +} + +extension URL: URLConvertible { + /// Returns self. + public func asURL() throws -> URL { return self } +} + +extension URLComponents: URLConvertible { + /// Returns a URL if `url` is not nil, otherwise throws an `Error`. + /// + /// - throws: An `AFError.invalidURL` if `url` is `nil`. + /// + /// - returns: A URL or throws an `AFError`. + public func asURL() throws -> URL { + guard let url = url else { throw AFError.invalidURL(url: self) } + return url + } +} + +// MARK: - + +/// Types adopting the `URLRequestConvertible` protocol can be used to construct URL requests. +public protocol URLRequestConvertible { + /// Returns a URL request or throws if an `Error` was encountered. + /// + /// - throws: An `Error` if the underlying `URLRequest` is `nil`. + /// + /// - returns: A URL request. + func asURLRequest() throws -> URLRequest +} + +extension URLRequestConvertible { + /// The URL request. + public var urlRequest: URLRequest? { return try? asURLRequest() } +} + +extension URLRequest: URLRequestConvertible { + /// Returns a URL request or throws if an `Error` was encountered. + public func asURLRequest() throws -> URLRequest { return self } +} + +// MARK: - + +extension URLRequest { + /// Creates an instance with the specified `method`, `urlString` and `headers`. + /// + /// - parameter url: The URL. + /// - parameter method: The HTTP method. + /// - parameter headers: The HTTP headers. `nil` by default. + /// + /// - returns: The new `URLRequest` instance. + public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws { + let url = try url.asURL() + + self.init(url: url) + + httpMethod = method.rawValue + + if let headers = headers { + for (headerField, headerValue) in headers { + setValue(headerValue, forHTTPHeaderField: headerField) + } + } + } + + func adapt(using adapter: RequestAdapter?) throws -> URLRequest { + guard let adapter = adapter else { return self } + return try adapter.adapt(self) + } +} + +// MARK: - Data Request + +/// Creates a `DataRequest` using the default `SessionManager` to retrieve the contents of the specified `url`, +/// `method`, `parameters`, `encoding` and `headers`. +/// +/// - parameter url: The URL. +/// - parameter method: The HTTP method. `.get` by default. +/// - parameter parameters: The parameters. `nil` by default. +/// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. +/// - parameter headers: The HTTP headers. `nil` by default. +/// +/// - returns: The created `DataRequest`. +@discardableResult +public func request( + _ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil) + -> DataRequest +{ + return SessionManager.default.request( + url, + method: method, + parameters: parameters, + encoding: encoding, + headers: headers + ) +} + +/// Creates a `DataRequest` using the default `SessionManager` to retrieve the contents of a URL based on the +/// specified `urlRequest`. +/// +/// - parameter urlRequest: The URL request +/// +/// - returns: The created `DataRequest`. +@discardableResult +public func request(_ urlRequest: URLRequestConvertible) -> DataRequest { + return SessionManager.default.request(urlRequest) +} + +// MARK: - Download Request + +// MARK: URL Request + +/// Creates a `DownloadRequest` using the default `SessionManager` to retrieve the contents of the specified `url`, +/// `method`, `parameters`, `encoding`, `headers` and save them to the `destination`. +/// +/// If `destination` is not specified, the contents will remain in the temporary location determined by the +/// underlying URL session. +/// +/// - parameter url: The URL. +/// - parameter method: The HTTP method. `.get` by default. +/// - parameter parameters: The parameters. `nil` by default. +/// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. +/// - parameter headers: The HTTP headers. `nil` by default. +/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. +/// +/// - returns: The created `DownloadRequest`. +@discardableResult +public func download( + _ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil, + to destination: DownloadRequest.DownloadFileDestination? = nil) + -> DownloadRequest +{ + return SessionManager.default.download( + url, + method: method, + parameters: parameters, + encoding: encoding, + headers: headers, + to: destination + ) +} + +/// Creates a `DownloadRequest` using the default `SessionManager` to retrieve the contents of a URL based on the +/// specified `urlRequest` and save them to the `destination`. +/// +/// If `destination` is not specified, the contents will remain in the temporary location determined by the +/// underlying URL session. +/// +/// - parameter urlRequest: The URL request. +/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. +/// +/// - returns: The created `DownloadRequest`. +@discardableResult +public func download( + _ urlRequest: URLRequestConvertible, + to destination: DownloadRequest.DownloadFileDestination? = nil) + -> DownloadRequest +{ + return SessionManager.default.download(urlRequest, to: destination) +} + +// MARK: Resume Data + +/// Creates a `DownloadRequest` using the default `SessionManager` from the `resumeData` produced from a +/// previous request cancellation to retrieve the contents of the original request and save them to the `destination`. +/// +/// If `destination` is not specified, the contents will remain in the temporary location determined by the +/// underlying URL session. +/// +/// On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), `resumeData` is broken +/// on background URL session configurations. There's an underlying bug in the `resumeData` generation logic where the +/// data is written incorrectly and will always fail to resume the download. For more information about the bug and +/// possible workarounds, please refer to the following Stack Overflow post: +/// +/// - http://stackoverflow.com/a/39347461/1342462 +/// +/// - parameter resumeData: The resume data. This is an opaque data blob produced by `URLSessionDownloadTask` +/// when a task is cancelled. See `URLSession -downloadTask(withResumeData:)` for additional +/// information. +/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. +/// +/// - returns: The created `DownloadRequest`. +@discardableResult +public func download( + resumingWith resumeData: Data, + to destination: DownloadRequest.DownloadFileDestination? = nil) + -> DownloadRequest +{ + return SessionManager.default.download(resumingWith: resumeData, to: destination) +} + +// MARK: - Upload Request + +// MARK: File + +/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers` +/// for uploading the `file`. +/// +/// - parameter file: The file to upload. +/// - parameter url: The URL. +/// - parameter method: The HTTP method. `.post` by default. +/// - parameter headers: The HTTP headers. `nil` by default. +/// +/// - returns: The created `UploadRequest`. +@discardableResult +public func upload( + _ fileURL: URL, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil) + -> UploadRequest +{ + return SessionManager.default.upload(fileURL, to: url, method: method, headers: headers) +} + +/// Creates a `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for +/// uploading the `file`. +/// +/// - parameter file: The file to upload. +/// - parameter urlRequest: The URL request. +/// +/// - returns: The created `UploadRequest`. +@discardableResult +public func upload(_ fileURL: URL, with urlRequest: URLRequestConvertible) -> UploadRequest { + return SessionManager.default.upload(fileURL, with: urlRequest) +} + +// MARK: Data + +/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers` +/// for uploading the `data`. +/// +/// - parameter data: The data to upload. +/// - parameter url: The URL. +/// - parameter method: The HTTP method. `.post` by default. +/// - parameter headers: The HTTP headers. `nil` by default. +/// +/// - returns: The created `UploadRequest`. +@discardableResult +public func upload( + _ data: Data, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil) + -> UploadRequest +{ + return SessionManager.default.upload(data, to: url, method: method, headers: headers) +} + +/// Creates an `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for +/// uploading the `data`. +/// +/// - parameter data: The data to upload. +/// - parameter urlRequest: The URL request. +/// +/// - returns: The created `UploadRequest`. +@discardableResult +public func upload(_ data: Data, with urlRequest: URLRequestConvertible) -> UploadRequest { + return SessionManager.default.upload(data, with: urlRequest) +} + +// MARK: InputStream + +/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers` +/// for uploading the `stream`. +/// +/// - parameter stream: The stream to upload. +/// - parameter url: The URL. +/// - parameter method: The HTTP method. `.post` by default. +/// - parameter headers: The HTTP headers. `nil` by default. +/// +/// - returns: The created `UploadRequest`. +@discardableResult +public func upload( + _ stream: InputStream, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil) + -> UploadRequest +{ + return SessionManager.default.upload(stream, to: url, method: method, headers: headers) +} + +/// Creates an `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for +/// uploading the `stream`. +/// +/// - parameter urlRequest: The URL request. +/// - parameter stream: The stream to upload. +/// +/// - returns: The created `UploadRequest`. +@discardableResult +public func upload(_ stream: InputStream, with urlRequest: URLRequestConvertible) -> UploadRequest { + return SessionManager.default.upload(stream, with: urlRequest) +} + +// MARK: MultipartFormData + +/// Encodes `multipartFormData` using `encodingMemoryThreshold` with the default `SessionManager` and calls +/// `encodingCompletion` with new `UploadRequest` using the `url`, `method` and `headers`. +/// +/// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative +/// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most +/// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to +/// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory +/// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be +/// used for larger payloads such as video content. +/// +/// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory +/// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, +/// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk +/// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding +/// technique was used. +/// +/// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. +/// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. +/// `multipartFormDataEncodingMemoryThreshold` by default. +/// - parameter url: The URL. +/// - parameter method: The HTTP method. `.post` by default. +/// - parameter headers: The HTTP headers. `nil` by default. +/// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. +public func upload( + multipartFormData: @escaping (MultipartFormData) -> Void, + usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?) +{ + return SessionManager.default.upload( + multipartFormData: multipartFormData, + usingThreshold: encodingMemoryThreshold, + to: url, + method: method, + headers: headers, + encodingCompletion: encodingCompletion + ) +} + +/// Encodes `multipartFormData` using `encodingMemoryThreshold` and the default `SessionManager` and +/// calls `encodingCompletion` with new `UploadRequest` using the `urlRequest`. +/// +/// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative +/// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most +/// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to +/// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory +/// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be +/// used for larger payloads such as video content. +/// +/// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory +/// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, +/// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk +/// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding +/// technique was used. +/// +/// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. +/// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. +/// `multipartFormDataEncodingMemoryThreshold` by default. +/// - parameter urlRequest: The URL request. +/// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. +public func upload( + multipartFormData: @escaping (MultipartFormData) -> Void, + usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, + with urlRequest: URLRequestConvertible, + encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?) +{ + return SessionManager.default.upload( + multipartFormData: multipartFormData, + usingThreshold: encodingMemoryThreshold, + with: urlRequest, + encodingCompletion: encodingCompletion + ) +} + +#if !os(watchOS) + +// MARK: - Stream Request + +// MARK: Hostname and Port + +/// Creates a `StreamRequest` using the default `SessionManager` for bidirectional streaming with the `hostname` +/// and `port`. +/// +/// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. +/// +/// - parameter hostName: The hostname of the server to connect to. +/// - parameter port: The port of the server to connect to. +/// +/// - returns: The created `StreamRequest`. +@discardableResult +@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) +public func stream(withHostName hostName: String, port: Int) -> StreamRequest { + return SessionManager.default.stream(withHostName: hostName, port: port) +} + +// MARK: NetService + +/// Creates a `StreamRequest` using the default `SessionManager` for bidirectional streaming with the `netService`. +/// +/// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. +/// +/// - parameter netService: The net service used to identify the endpoint. +/// +/// - returns: The created `StreamRequest`. +@discardableResult +@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) +public func stream(with netService: NetService) -> StreamRequest { + return SessionManager.default.stream(with: netService) +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift new file mode 100644 index 0000000..dea3ebc --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift @@ -0,0 +1,37 @@ +// +// DispatchQueue+Alamofire.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Dispatch +import Foundation + +extension DispatchQueue { + static var userInteractive: DispatchQueue { return DispatchQueue.global(qos: .userInteractive) } + static var userInitiated: DispatchQueue { return DispatchQueue.global(qos: .userInitiated) } + static var utility: DispatchQueue { return DispatchQueue.global(qos: .utility) } + static var background: DispatchQueue { return DispatchQueue.global(qos: .background) } + + func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) { + asyncAfter(deadline: .now() + delay, execute: closure) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/MultipartFormData.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/MultipartFormData.swift new file mode 100644 index 0000000..057e68b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/MultipartFormData.swift @@ -0,0 +1,580 @@ +// +// MultipartFormData.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +#if os(iOS) || os(watchOS) || os(tvOS) +import MobileCoreServices +#elseif os(macOS) +import CoreServices +#endif + +/// Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode +/// multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead +/// to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the +/// data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for +/// larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset. +/// +/// For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well +/// and the w3 form documentation. +/// +/// - https://www.ietf.org/rfc/rfc2388.txt +/// - https://www.ietf.org/rfc/rfc2045.txt +/// - https://www.w3.org/TR/html401/interact/forms.html#h-17.13 +open class MultipartFormData { + + // MARK: - Helper Types + + struct EncodingCharacters { + static let crlf = "\r\n" + } + + struct BoundaryGenerator { + enum BoundaryType { + case initial, encapsulated, final + } + + static func randomBoundary() -> String { + return String(format: "alamofire.boundary.%08x%08x", arc4random(), arc4random()) + } + + static func boundaryData(forBoundaryType boundaryType: BoundaryType, boundary: String) -> Data { + let boundaryText: String + + switch boundaryType { + case .initial: + boundaryText = "--\(boundary)\(EncodingCharacters.crlf)" + case .encapsulated: + boundaryText = "\(EncodingCharacters.crlf)--\(boundary)\(EncodingCharacters.crlf)" + case .final: + boundaryText = "\(EncodingCharacters.crlf)--\(boundary)--\(EncodingCharacters.crlf)" + } + + return boundaryText.data(using: String.Encoding.utf8, allowLossyConversion: false)! + } + } + + class BodyPart { + let headers: HTTPHeaders + let bodyStream: InputStream + let bodyContentLength: UInt64 + var hasInitialBoundary = false + var hasFinalBoundary = false + + init(headers: HTTPHeaders, bodyStream: InputStream, bodyContentLength: UInt64) { + self.headers = headers + self.bodyStream = bodyStream + self.bodyContentLength = bodyContentLength + } + } + + // MARK: - Properties + + /// The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`. + open lazy var contentType: String = "multipart/form-data; boundary=\(self.boundary)" + + /// The content length of all body parts used to generate the `multipart/form-data` not including the boundaries. + public var contentLength: UInt64 { return bodyParts.reduce(0) { $0 + $1.bodyContentLength } } + + /// The boundary used to separate the body parts in the encoded form data. + public let boundary: String + + private var bodyParts: [BodyPart] + private var bodyPartError: AFError? + private let streamBufferSize: Int + + // MARK: - Lifecycle + + /// Creates a multipart form data object. + /// + /// - returns: The multipart form data object. + public init() { + self.boundary = BoundaryGenerator.randomBoundary() + self.bodyParts = [] + + /// + /// The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more + /// information, please refer to the following article: + /// - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html + /// + + self.streamBufferSize = 1024 + } + + // MARK: - Body Parts + + /// Creates a body part from the data and appends it to the multipart form data object. + /// + /// The body part data will be encoded using the following format: + /// + /// - `Content-Disposition: form-data; name=#{name}` (HTTP Header) + /// - Encoded data + /// - Multipart form boundary + /// + /// - parameter data: The data to encode into the multipart form data. + /// - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. + public func append(_ data: Data, withName name: String) { + let headers = contentHeaders(withName: name) + let stream = InputStream(data: data) + let length = UInt64(data.count) + + append(stream, withLength: length, headers: headers) + } + + /// Creates a body part from the data and appends it to the multipart form data object. + /// + /// The body part data will be encoded using the following format: + /// + /// - `Content-Disposition: form-data; name=#{name}` (HTTP Header) + /// - `Content-Type: #{generated mimeType}` (HTTP Header) + /// - Encoded data + /// - Multipart form boundary + /// + /// - parameter data: The data to encode into the multipart form data. + /// - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. + /// - parameter mimeType: The MIME type to associate with the data content type in the `Content-Type` HTTP header. + public func append(_ data: Data, withName name: String, mimeType: String) { + let headers = contentHeaders(withName: name, mimeType: mimeType) + let stream = InputStream(data: data) + let length = UInt64(data.count) + + append(stream, withLength: length, headers: headers) + } + + /// Creates a body part from the data and appends it to the multipart form data object. + /// + /// The body part data will be encoded using the following format: + /// + /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header) + /// - `Content-Type: #{mimeType}` (HTTP Header) + /// - Encoded file data + /// - Multipart form boundary + /// + /// - parameter data: The data to encode into the multipart form data. + /// - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. + /// - parameter fileName: The filename to associate with the data in the `Content-Disposition` HTTP header. + /// - parameter mimeType: The MIME type to associate with the data in the `Content-Type` HTTP header. + public func append(_ data: Data, withName name: String, fileName: String, mimeType: String) { + let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType) + let stream = InputStream(data: data) + let length = UInt64(data.count) + + append(stream, withLength: length, headers: headers) + } + + /// Creates a body part from the file and appends it to the multipart form data object. + /// + /// The body part data will be encoded using the following format: + /// + /// - `Content-Disposition: form-data; name=#{name}; filename=#{generated filename}` (HTTP Header) + /// - `Content-Type: #{generated mimeType}` (HTTP Header) + /// - Encoded file data + /// - Multipart form boundary + /// + /// The filename in the `Content-Disposition` HTTP header is generated from the last path component of the + /// `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the + /// system associated MIME type. + /// + /// - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data. + /// - parameter name: The name to associate with the file content in the `Content-Disposition` HTTP header. + public func append(_ fileURL: URL, withName name: String) { + let fileName = fileURL.lastPathComponent + let pathExtension = fileURL.pathExtension + + if !fileName.isEmpty && !pathExtension.isEmpty { + let mime = mimeType(forPathExtension: pathExtension) + append(fileURL, withName: name, fileName: fileName, mimeType: mime) + } else { + setBodyPartError(withReason: .bodyPartFilenameInvalid(in: fileURL)) + } + } + + /// Creates a body part from the file and appends it to the multipart form data object. + /// + /// The body part data will be encoded using the following format: + /// + /// - Content-Disposition: form-data; name=#{name}; filename=#{filename} (HTTP Header) + /// - Content-Type: #{mimeType} (HTTP Header) + /// - Encoded file data + /// - Multipart form boundary + /// + /// - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data. + /// - parameter name: The name to associate with the file content in the `Content-Disposition` HTTP header. + /// - parameter fileName: The filename to associate with the file content in the `Content-Disposition` HTTP header. + /// - parameter mimeType: The MIME type to associate with the file content in the `Content-Type` HTTP header. + public func append(_ fileURL: URL, withName name: String, fileName: String, mimeType: String) { + let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType) + + //============================================================ + // Check 1 - is file URL? + //============================================================ + + guard fileURL.isFileURL else { + setBodyPartError(withReason: .bodyPartURLInvalid(url: fileURL)) + return + } + + //============================================================ + // Check 2 - is file URL reachable? + //============================================================ + + do { + let isReachable = try fileURL.checkPromisedItemIsReachable() + guard isReachable else { + setBodyPartError(withReason: .bodyPartFileNotReachable(at: fileURL)) + return + } + } catch { + setBodyPartError(withReason: .bodyPartFileNotReachableWithError(atURL: fileURL, error: error)) + return + } + + //============================================================ + // Check 3 - is file URL a directory? + //============================================================ + + var isDirectory: ObjCBool = false + let path = fileURL.path + + guard FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else { + setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL)) + return + } + + //============================================================ + // Check 4 - can the file size be extracted? + //============================================================ + + let bodyContentLength: UInt64 + + do { + guard let fileSize = try FileManager.default.attributesOfItem(atPath: path)[.size] as? NSNumber else { + setBodyPartError(withReason: .bodyPartFileSizeNotAvailable(at: fileURL)) + return + } + + bodyContentLength = fileSize.uint64Value + } + catch { + setBodyPartError(withReason: .bodyPartFileSizeQueryFailedWithError(forURL: fileURL, error: error)) + return + } + + //============================================================ + // Check 5 - can a stream be created from file URL? + //============================================================ + + guard let stream = InputStream(url: fileURL) else { + setBodyPartError(withReason: .bodyPartInputStreamCreationFailed(for: fileURL)) + return + } + + append(stream, withLength: bodyContentLength, headers: headers) + } + + /// Creates a body part from the stream and appends it to the multipart form data object. + /// + /// The body part data will be encoded using the following format: + /// + /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header) + /// - `Content-Type: #{mimeType}` (HTTP Header) + /// - Encoded stream data + /// - Multipart form boundary + /// + /// - parameter stream: The input stream to encode in the multipart form data. + /// - parameter length: The content length of the stream. + /// - parameter name: The name to associate with the stream content in the `Content-Disposition` HTTP header. + /// - parameter fileName: The filename to associate with the stream content in the `Content-Disposition` HTTP header. + /// - parameter mimeType: The MIME type to associate with the stream content in the `Content-Type` HTTP header. + public func append( + _ stream: InputStream, + withLength length: UInt64, + name: String, + fileName: String, + mimeType: String) + { + let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType) + append(stream, withLength: length, headers: headers) + } + + /// Creates a body part with the headers, stream and length and appends it to the multipart form data object. + /// + /// The body part data will be encoded using the following format: + /// + /// - HTTP headers + /// - Encoded stream data + /// - Multipart form boundary + /// + /// - parameter stream: The input stream to encode in the multipart form data. + /// - parameter length: The content length of the stream. + /// - parameter headers: The HTTP headers for the body part. + public func append(_ stream: InputStream, withLength length: UInt64, headers: HTTPHeaders) { + let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length) + bodyParts.append(bodyPart) + } + + // MARK: - Data Encoding + + /// Encodes all the appended body parts into a single `Data` value. + /// + /// It is important to note that this method will load all the appended body parts into memory all at the same + /// time. This method should only be used when the encoded data will have a small memory footprint. For large data + /// cases, please use the `writeEncodedDataToDisk(fileURL:completionHandler:)` method. + /// + /// - throws: An `AFError` if encoding encounters an error. + /// + /// - returns: The encoded `Data` if encoding is successful. + public func encode() throws -> Data { + if let bodyPartError = bodyPartError { + throw bodyPartError + } + + var encoded = Data() + + bodyParts.first?.hasInitialBoundary = true + bodyParts.last?.hasFinalBoundary = true + + for bodyPart in bodyParts { + let encodedData = try encode(bodyPart) + encoded.append(encodedData) + } + + return encoded + } + + /// Writes the appended body parts into the given file URL. + /// + /// This process is facilitated by reading and writing with input and output streams, respectively. Thus, + /// this approach is very memory efficient and should be used for large body part data. + /// + /// - parameter fileURL: The file URL to write the multipart form data into. + /// + /// - throws: An `AFError` if encoding encounters an error. + public func writeEncodedData(to fileURL: URL) throws { + if let bodyPartError = bodyPartError { + throw bodyPartError + } + + if FileManager.default.fileExists(atPath: fileURL.path) { + throw AFError.multipartEncodingFailed(reason: .outputStreamFileAlreadyExists(at: fileURL)) + } else if !fileURL.isFileURL { + throw AFError.multipartEncodingFailed(reason: .outputStreamURLInvalid(url: fileURL)) + } + + guard let outputStream = OutputStream(url: fileURL, append: false) else { + throw AFError.multipartEncodingFailed(reason: .outputStreamCreationFailed(for: fileURL)) + } + + outputStream.open() + defer { outputStream.close() } + + self.bodyParts.first?.hasInitialBoundary = true + self.bodyParts.last?.hasFinalBoundary = true + + for bodyPart in self.bodyParts { + try write(bodyPart, to: outputStream) + } + } + + // MARK: - Private - Body Part Encoding + + private func encode(_ bodyPart: BodyPart) throws -> Data { + var encoded = Data() + + let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData() + encoded.append(initialData) + + let headerData = encodeHeaders(for: bodyPart) + encoded.append(headerData) + + let bodyStreamData = try encodeBodyStream(for: bodyPart) + encoded.append(bodyStreamData) + + if bodyPart.hasFinalBoundary { + encoded.append(finalBoundaryData()) + } + + return encoded + } + + private func encodeHeaders(for bodyPart: BodyPart) -> Data { + var headerText = "" + + for (key, value) in bodyPart.headers { + headerText += "\(key): \(value)\(EncodingCharacters.crlf)" + } + headerText += EncodingCharacters.crlf + + return headerText.data(using: String.Encoding.utf8, allowLossyConversion: false)! + } + + private func encodeBodyStream(for bodyPart: BodyPart) throws -> Data { + let inputStream = bodyPart.bodyStream + inputStream.open() + defer { inputStream.close() } + + var encoded = Data() + + while inputStream.hasBytesAvailable { + var buffer = [UInt8](repeating: 0, count: streamBufferSize) + let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize) + + if let error = inputStream.streamError { + throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: error)) + } + + if bytesRead > 0 { + encoded.append(buffer, count: bytesRead) + } else { + break + } + } + + return encoded + } + + // MARK: - Private - Writing Body Part to Output Stream + + private func write(_ bodyPart: BodyPart, to outputStream: OutputStream) throws { + try writeInitialBoundaryData(for: bodyPart, to: outputStream) + try writeHeaderData(for: bodyPart, to: outputStream) + try writeBodyStream(for: bodyPart, to: outputStream) + try writeFinalBoundaryData(for: bodyPart, to: outputStream) + } + + private func writeInitialBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws { + let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData() + return try write(initialData, to: outputStream) + } + + private func writeHeaderData(for bodyPart: BodyPart, to outputStream: OutputStream) throws { + let headerData = encodeHeaders(for: bodyPart) + return try write(headerData, to: outputStream) + } + + private func writeBodyStream(for bodyPart: BodyPart, to outputStream: OutputStream) throws { + let inputStream = bodyPart.bodyStream + + inputStream.open() + defer { inputStream.close() } + + while inputStream.hasBytesAvailable { + var buffer = [UInt8](repeating: 0, count: streamBufferSize) + let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize) + + if let streamError = inputStream.streamError { + throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: streamError)) + } + + if bytesRead > 0 { + if buffer.count != bytesRead { + buffer = Array(buffer[0.. 0, outputStream.hasSpaceAvailable { + let bytesWritten = outputStream.write(buffer, maxLength: bytesToWrite) + + if let error = outputStream.streamError { + throw AFError.multipartEncodingFailed(reason: .outputStreamWriteFailed(error: error)) + } + + bytesToWrite -= bytesWritten + + if bytesToWrite > 0 { + buffer = Array(buffer[bytesWritten.. String { + if + let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(), + let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue() + { + return contentType as String + } + + return "application/octet-stream" + } + + // MARK: - Private - Content Headers + + private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> [String: String] { + var disposition = "form-data; name=\"\(name)\"" + if let fileName = fileName { disposition += "; filename=\"\(fileName)\"" } + + var headers = ["Content-Disposition": disposition] + if let mimeType = mimeType { headers["Content-Type"] = mimeType } + + return headers + } + + // MARK: - Private - Boundary Encoding + + private func initialBoundaryData() -> Data { + return BoundaryGenerator.boundaryData(forBoundaryType: .initial, boundary: boundary) + } + + private func encapsulatedBoundaryData() -> Data { + return BoundaryGenerator.boundaryData(forBoundaryType: .encapsulated, boundary: boundary) + } + + private func finalBoundaryData() -> Data { + return BoundaryGenerator.boundaryData(forBoundaryType: .final, boundary: boundary) + } + + // MARK: - Private - Errors + + private func setBodyPartError(withReason reason: AFError.MultipartEncodingFailureReason) { + guard bodyPartError == nil else { return } + bodyPartError = AFError.multipartEncodingFailed(reason: reason) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/NetworkReachabilityManager.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/NetworkReachabilityManager.swift new file mode 100644 index 0000000..3ff2e7f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/NetworkReachabilityManager.swift @@ -0,0 +1,233 @@ +// +// NetworkReachabilityManager.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#if !os(watchOS) + +import Foundation +import SystemConfiguration + +/// The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both WWAN and +/// WiFi network interfaces. +/// +/// Reachability can be used to determine background information about why a network operation failed, or to retry +/// network requests when a connection is established. It should not be used to prevent a user from initiating a network +/// request, as it's possible that an initial request may be required to establish reachability. +open class NetworkReachabilityManager { + /// Defines the various states of network reachability. + /// + /// - unknown: It is unknown whether the network is reachable. + /// - notReachable: The network is not reachable. + /// - reachable: The network is reachable. + public enum NetworkReachabilityStatus { + case unknown + case notReachable + case reachable(ConnectionType) + } + + /// Defines the various connection types detected by reachability flags. + /// + /// - ethernetOrWiFi: The connection type is either over Ethernet or WiFi. + /// - wwan: The connection type is a WWAN connection. + public enum ConnectionType { + case ethernetOrWiFi + case wwan + } + + /// A closure executed when the network reachability status changes. The closure takes a single argument: the + /// network reachability status. + public typealias Listener = (NetworkReachabilityStatus) -> Void + + // MARK: - Properties + + /// Whether the network is currently reachable. + open var isReachable: Bool { return isReachableOnWWAN || isReachableOnEthernetOrWiFi } + + /// Whether the network is currently reachable over the WWAN interface. + open var isReachableOnWWAN: Bool { return networkReachabilityStatus == .reachable(.wwan) } + + /// Whether the network is currently reachable over Ethernet or WiFi interface. + open var isReachableOnEthernetOrWiFi: Bool { return networkReachabilityStatus == .reachable(.ethernetOrWiFi) } + + /// The current network reachability status. + open var networkReachabilityStatus: NetworkReachabilityStatus { + guard let flags = self.flags else { return .unknown } + return networkReachabilityStatusForFlags(flags) + } + + /// The dispatch queue to execute the `listener` closure on. + open var listenerQueue: DispatchQueue = DispatchQueue.main + + /// A closure executed when the network reachability status changes. + open var listener: Listener? + + open var flags: SCNetworkReachabilityFlags? { + var flags = SCNetworkReachabilityFlags() + + if SCNetworkReachabilityGetFlags(reachability, &flags) { + return flags + } + + return nil + } + + private let reachability: SCNetworkReachability + open var previousFlags: SCNetworkReachabilityFlags + + // MARK: - Initialization + + /// Creates a `NetworkReachabilityManager` instance with the specified host. + /// + /// - parameter host: The host used to evaluate network reachability. + /// + /// - returns: The new `NetworkReachabilityManager` instance. + public convenience init?(host: String) { + guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil } + self.init(reachability: reachability) + } + + /// Creates a `NetworkReachabilityManager` instance that monitors the address 0.0.0.0. + /// + /// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing + /// status of the device, both IPv4 and IPv6. + /// + /// - returns: The new `NetworkReachabilityManager` instance. + public convenience init?() { + var address = sockaddr_in() + address.sin_len = UInt8(MemoryLayout.size) + address.sin_family = sa_family_t(AF_INET) + + guard let reachability = withUnsafePointer(to: &address, { pointer in + return pointer.withMemoryRebound(to: sockaddr.self, capacity: MemoryLayout.size) { + return SCNetworkReachabilityCreateWithAddress(nil, $0) + } + }) else { return nil } + + self.init(reachability: reachability) + } + + private init(reachability: SCNetworkReachability) { + self.reachability = reachability + self.previousFlags = SCNetworkReachabilityFlags() + } + + deinit { + stopListening() + } + + // MARK: - Listening + + /// Starts listening for changes in network reachability status. + /// + /// - returns: `true` if listening was started successfully, `false` otherwise. + @discardableResult + open func startListening() -> Bool { + var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil) + context.info = Unmanaged.passUnretained(self).toOpaque() + + let callbackEnabled = SCNetworkReachabilitySetCallback( + reachability, + { (_, flags, info) in + let reachability = Unmanaged.fromOpaque(info!).takeUnretainedValue() + reachability.notifyListener(flags) + }, + &context + ) + + let queueEnabled = SCNetworkReachabilitySetDispatchQueue(reachability, listenerQueue) + + listenerQueue.async { + self.previousFlags = SCNetworkReachabilityFlags() + self.notifyListener(self.flags ?? SCNetworkReachabilityFlags()) + } + + return callbackEnabled && queueEnabled + } + + /// Stops listening for changes in network reachability status. + open func stopListening() { + SCNetworkReachabilitySetCallback(reachability, nil, nil) + SCNetworkReachabilitySetDispatchQueue(reachability, nil) + } + + // MARK: - Internal - Listener Notification + + func notifyListener(_ flags: SCNetworkReachabilityFlags) { + guard previousFlags != flags else { return } + previousFlags = flags + + listener?(networkReachabilityStatusForFlags(flags)) + } + + // MARK: - Internal - Network Reachability Status + + func networkReachabilityStatusForFlags(_ flags: SCNetworkReachabilityFlags) -> NetworkReachabilityStatus { + guard isNetworkReachable(with: flags) else { return .notReachable } + + var networkStatus: NetworkReachabilityStatus = .reachable(.ethernetOrWiFi) + + #if os(iOS) + if flags.contains(.isWWAN) { networkStatus = .reachable(.wwan) } + #endif + + return networkStatus + } + + func isNetworkReachable(with flags: SCNetworkReachabilityFlags) -> Bool { + let isReachable = flags.contains(.reachable) + let needsConnection = flags.contains(.connectionRequired) + let canConnectAutomatically = flags.contains(.connectionOnDemand) || flags.contains(.connectionOnTraffic) + let canConnectWithoutUserInteraction = canConnectAutomatically && !flags.contains(.interventionRequired) + + return isReachable && (!needsConnection || canConnectWithoutUserInteraction) + } +} + +// MARK: - + +extension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {} + +/// Returns whether the two network reachability status values are equal. +/// +/// - parameter lhs: The left-hand side value to compare. +/// - parameter rhs: The right-hand side value to compare. +/// +/// - returns: `true` if the two values are equal, `false` otherwise. +public func ==( + lhs: NetworkReachabilityManager.NetworkReachabilityStatus, + rhs: NetworkReachabilityManager.NetworkReachabilityStatus) + -> Bool +{ + switch (lhs, rhs) { + case (.unknown, .unknown): + return true + case (.notReachable, .notReachable): + return true + case let (.reachable(lhsConnectionType), .reachable(rhsConnectionType)): + return lhsConnectionType == rhsConnectionType + default: + return false + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Notifications.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Notifications.swift new file mode 100644 index 0000000..e1b6120 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Notifications.swift @@ -0,0 +1,55 @@ +// +// Notifications.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Notification.Name { + /// Used as a namespace for all `URLSessionTask` related notifications. + public struct Task { + /// Posted when a `URLSessionTask` is resumed. The notification `object` contains the resumed `URLSessionTask`. + public static let DidResume = Notification.Name(rawValue: "org.alamofire.notification.name.task.didResume") + + /// Posted when a `URLSessionTask` is suspended. The notification `object` contains the suspended `URLSessionTask`. + public static let DidSuspend = Notification.Name(rawValue: "org.alamofire.notification.name.task.didSuspend") + + /// Posted when a `URLSessionTask` is cancelled. The notification `object` contains the cancelled `URLSessionTask`. + public static let DidCancel = Notification.Name(rawValue: "org.alamofire.notification.name.task.didCancel") + + /// Posted when a `URLSessionTask` is completed. The notification `object` contains the completed `URLSessionTask`. + public static let DidComplete = Notification.Name(rawValue: "org.alamofire.notification.name.task.didComplete") + } +} + +// MARK: - + +extension Notification { + /// Used as a namespace for all `Notification` user info dictionary keys. + public struct Key { + /// User info dictionary key representing the `URLSessionTask` associated with the notification. + public static let Task = "org.alamofire.notification.key.task" + + /// User info dictionary key representing the responseData associated with the notification. + public static let ResponseData = "org.alamofire.notification.key.responseData" + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ParameterEncoding.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ParameterEncoding.swift new file mode 100644 index 0000000..4a54f2d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ParameterEncoding.swift @@ -0,0 +1,483 @@ +// +// ParameterEncoding.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// HTTP method definitions. +/// +/// See https://tools.ietf.org/html/rfc7231#section-4.3 +public enum HTTPMethod: String { + case options = "OPTIONS" + case get = "GET" + case head = "HEAD" + case post = "POST" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" + case trace = "TRACE" + case connect = "CONNECT" +} + +// MARK: - + +/// A dictionary of parameters to apply to a `URLRequest`. +public typealias Parameters = [String: Any] + +/// A type used to define how a set of parameters are applied to a `URLRequest`. +public protocol ParameterEncoding { + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. + /// + /// - throws: An `AFError.parameterEncodingFailed` error if encoding fails. + /// + /// - returns: The encoded request. + func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest +} + +// MARK: - + +/// Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP +/// body of the URL request. Whether the query string is set or appended to any existing URL query string or set as +/// the HTTP body depends on the destination of the encoding. +/// +/// The `Content-Type` HTTP header field of an encoded request with HTTP body is set to +/// `application/x-www-form-urlencoded; charset=utf-8`. +/// +/// There is no published specification for how to encode collection types. By default the convention of appending +/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for +/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the +/// square brackets appended to array keys. +/// +/// `BoolEncoding` can be used to configure how boolean values are encoded. The default behavior is to encode +/// `true` as 1 and `false` as 0. +public struct URLEncoding: ParameterEncoding { + + // MARK: Helper Types + + /// Defines whether the url-encoded query string is applied to the existing query string or HTTP body of the + /// resulting URL request. + /// + /// - methodDependent: Applies encoded query string result to existing query string for `GET`, `HEAD` and `DELETE` + /// requests and sets as the HTTP body for requests with any other HTTP method. + /// - queryString: Sets or appends encoded query string result to existing query string. + /// - httpBody: Sets encoded query string result as the HTTP body of the URL request. + public enum Destination { + case methodDependent, queryString, httpBody + } + + /// Configures how `Array` parameters are encoded. + /// + /// - brackets: An empty set of square brackets is appended to the key for every value. + /// This is the default behavior. + /// - noBrackets: No brackets are appended. The key is encoded as is. + public enum ArrayEncoding { + case brackets, noBrackets + + func encode(key: String) -> String { + switch self { + case .brackets: + return "\(key)[]" + case .noBrackets: + return key + } + } + } + + /// Configures how `Bool` parameters are encoded. + /// + /// - numeric: Encode `true` as `1` and `false` as `0`. This is the default behavior. + /// - literal: Encode `true` and `false` as string literals. + public enum BoolEncoding { + case numeric, literal + + func encode(value: Bool) -> String { + switch self { + case .numeric: + return value ? "1" : "0" + case .literal: + return value ? "true" : "false" + } + } + } + + // MARK: Properties + + /// Returns a default `URLEncoding` instance. + public static var `default`: URLEncoding { return URLEncoding() } + + /// Returns a `URLEncoding` instance with a `.methodDependent` destination. + public static var methodDependent: URLEncoding { return URLEncoding() } + + /// Returns a `URLEncoding` instance with a `.queryString` destination. + public static var queryString: URLEncoding { return URLEncoding(destination: .queryString) } + + /// Returns a `URLEncoding` instance with an `.httpBody` destination. + public static var httpBody: URLEncoding { return URLEncoding(destination: .httpBody) } + + /// The destination defining where the encoded query string is to be applied to the URL request. + public let destination: Destination + + /// The encoding to use for `Array` parameters. + public let arrayEncoding: ArrayEncoding + + /// The encoding to use for `Bool` parameters. + public let boolEncoding: BoolEncoding + + // MARK: Initialization + + /// Creates a `URLEncoding` instance using the specified destination. + /// + /// - parameter destination: The destination defining where the encoded query string is to be applied. + /// - parameter arrayEncoding: The encoding to use for `Array` parameters. + /// - parameter boolEncoding: The encoding to use for `Bool` parameters. + /// + /// - returns: The new `URLEncoding` instance. + public init(destination: Destination = .methodDependent, arrayEncoding: ArrayEncoding = .brackets, boolEncoding: BoolEncoding = .numeric) { + self.destination = destination + self.arrayEncoding = arrayEncoding + self.boolEncoding = boolEncoding + } + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { + var urlRequest = try urlRequest.asURLRequest() + + guard let parameters = parameters else { return urlRequest } + + if let method = HTTPMethod(rawValue: urlRequest.httpMethod ?? "GET"), encodesParametersInURL(with: method) { + guard let url = urlRequest.url else { + throw AFError.parameterEncodingFailed(reason: .missingURL) + } + + if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { + let percentEncodedQuery = (urlComponents.percentEncodedQuery.map { $0 + "&" } ?? "") + query(parameters) + urlComponents.percentEncodedQuery = percentEncodedQuery + urlRequest.url = urlComponents.url + } + } else { + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = query(parameters).data(using: .utf8, allowLossyConversion: false) + } + + return urlRequest + } + + /// Creates percent-escaped, URL encoded query string components from the given key-value pair using recursion. + /// + /// - parameter key: The key of the query component. + /// - parameter value: The value of the query component. + /// + /// - returns: The percent-escaped, URL encoded query string components. + public func queryComponents(fromKey key: String, value: Any) -> [(String, String)] { + var components: [(String, String)] = [] + + if let dictionary = value as? [String: Any] { + for (nestedKey, value) in dictionary { + components += queryComponents(fromKey: "\(key)[\(nestedKey)]", value: value) + } + } else if let array = value as? [Any] { + for value in array { + components += queryComponents(fromKey: arrayEncoding.encode(key: key), value: value) + } + } else if let value = value as? NSNumber { + if value.isBool { + components.append((escape(key), escape(boolEncoding.encode(value: value.boolValue)))) + } else { + components.append((escape(key), escape("\(value)"))) + } + } else if let bool = value as? Bool { + components.append((escape(key), escape(boolEncoding.encode(value: bool)))) + } else { + components.append((escape(key), escape("\(value)"))) + } + + return components + } + + /// Returns a percent-escaped string following RFC 3986 for a query string key or value. + /// + /// RFC 3986 states that the following characters are "reserved" characters. + /// + /// - General Delimiters: ":", "#", "[", "]", "@", "?", "/" + /// - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" + /// + /// In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow + /// query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" + /// should be percent-escaped in the query string. + /// + /// - parameter string: The string to be percent-escaped. + /// + /// - returns: The percent-escaped string. + public func escape(_ string: String) -> String { + let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4 + let subDelimitersToEncode = "!$&'()*+,;=" + + var allowedCharacterSet = CharacterSet.urlQueryAllowed + allowedCharacterSet.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)") + + var escaped = "" + + //========================================================================================================== + // + // Batching is required for escaping due to an internal bug in iOS 8.1 and 8.2. Encoding more than a few + // hundred Chinese characters causes various malloc error crashes. To avoid this issue until iOS 8 is no + // longer supported, batching MUST be used for encoding. This introduces roughly a 20% overhead. For more + // info, please refer to: + // + // - https://github.com/Alamofire/Alamofire/issues/206 + // + //========================================================================================================== + + if #available(iOS 8.3, *) { + escaped = string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? string + } else { + let batchSize = 50 + var index = string.startIndex + + while index != string.endIndex { + let startIndex = index + let endIndex = string.index(index, offsetBy: batchSize, limitedBy: string.endIndex) ?? string.endIndex + let range = startIndex.. String { + var components: [(String, String)] = [] + + for key in parameters.keys.sorted(by: <) { + let value = parameters[key]! + components += queryComponents(fromKey: key, value: value) + } + return components.map { "\($0)=\($1)" }.joined(separator: "&") + } + + private func encodesParametersInURL(with method: HTTPMethod) -> Bool { + switch destination { + case .queryString: + return true + case .httpBody: + return false + default: + break + } + + switch method { + case .get, .head, .delete: + return true + default: + return false + } + } +} + +// MARK: - + +/// Uses `JSONSerialization` to create a JSON representation of the parameters object, which is set as the body of the +/// request. The `Content-Type` HTTP header field of an encoded request is set to `application/json`. +public struct JSONEncoding: ParameterEncoding { + + // MARK: Properties + + /// Returns a `JSONEncoding` instance with default writing options. + public static var `default`: JSONEncoding { return JSONEncoding() } + + /// Returns a `JSONEncoding` instance with `.prettyPrinted` writing options. + public static var prettyPrinted: JSONEncoding { return JSONEncoding(options: .prettyPrinted) } + + /// The options for writing the parameters as JSON data. + public let options: JSONSerialization.WritingOptions + + // MARK: Initialization + + /// Creates a `JSONEncoding` instance using the specified options. + /// + /// - parameter options: The options for writing the parameters as JSON data. + /// + /// - returns: The new `JSONEncoding` instance. + public init(options: JSONSerialization.WritingOptions = []) { + self.options = options + } + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { + var urlRequest = try urlRequest.asURLRequest() + + guard let parameters = parameters else { return urlRequest } + + do { + let data = try JSONSerialization.data(withJSONObject: parameters, options: options) + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = data + } catch { + throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error)) + } + + return urlRequest + } + + /// Creates a URL request by encoding the JSON object and setting the resulting data on the HTTP body. + /// + /// - parameter urlRequest: The request to apply the JSON object to. + /// - parameter jsonObject: The JSON object to apply to the request. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequestConvertible, withJSONObject jsonObject: Any? = nil) throws -> URLRequest { + var urlRequest = try urlRequest.asURLRequest() + + guard let jsonObject = jsonObject else { return urlRequest } + + do { + let data = try JSONSerialization.data(withJSONObject: jsonObject, options: options) + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = data + } catch { + throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error)) + } + + return urlRequest + } +} + +// MARK: - + +/// Uses `PropertyListSerialization` to create a plist representation of the parameters object, according to the +/// associated format and write options values, which is set as the body of the request. The `Content-Type` HTTP header +/// field of an encoded request is set to `application/x-plist`. +public struct PropertyListEncoding: ParameterEncoding { + + // MARK: Properties + + /// Returns a default `PropertyListEncoding` instance. + public static var `default`: PropertyListEncoding { return PropertyListEncoding() } + + /// Returns a `PropertyListEncoding` instance with xml formatting and default writing options. + public static var xml: PropertyListEncoding { return PropertyListEncoding(format: .xml) } + + /// Returns a `PropertyListEncoding` instance with binary formatting and default writing options. + public static var binary: PropertyListEncoding { return PropertyListEncoding(format: .binary) } + + /// The property list serialization format. + public let format: PropertyListSerialization.PropertyListFormat + + /// The options for writing the parameters as plist data. + public let options: PropertyListSerialization.WriteOptions + + // MARK: Initialization + + /// Creates a `PropertyListEncoding` instance using the specified format and options. + /// + /// - parameter format: The property list serialization format. + /// - parameter options: The options for writing the parameters as plist data. + /// + /// - returns: The new `PropertyListEncoding` instance. + public init( + format: PropertyListSerialization.PropertyListFormat = .xml, + options: PropertyListSerialization.WriteOptions = 0) + { + self.format = format + self.options = options + } + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { + var urlRequest = try urlRequest.asURLRequest() + + guard let parameters = parameters else { return urlRequest } + + do { + let data = try PropertyListSerialization.data( + fromPropertyList: parameters, + format: format, + options: options + ) + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/x-plist", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = data + } catch { + throw AFError.parameterEncodingFailed(reason: .propertyListEncodingFailed(error: error)) + } + + return urlRequest + } +} + +// MARK: - + +extension NSNumber { + fileprivate var isBool: Bool { return CFBooleanGetTypeID() == CFGetTypeID(self) } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Request.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Request.swift new file mode 100644 index 0000000..94e7b6e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Request.swift @@ -0,0 +1,654 @@ +// +// Request.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary. +public protocol RequestAdapter { + /// Inspects and adapts the specified `URLRequest` in some manner if necessary and returns the result. + /// + /// - parameter urlRequest: The URL request to adapt. + /// + /// - throws: An `Error` if the adaptation encounters an error. + /// + /// - returns: The adapted `URLRequest`. + func adapt(_ urlRequest: URLRequest) throws -> URLRequest +} + +// MARK: - + +/// A closure executed when the `RequestRetrier` determines whether a `Request` should be retried or not. +public typealias RequestRetryCompletion = (_ shouldRetry: Bool, _ timeDelay: TimeInterval) -> Void + +/// A type that determines whether a request should be retried after being executed by the specified session manager +/// and encountering an error. +public protocol RequestRetrier { + /// Determines whether the `Request` should be retried by calling the `completion` closure. + /// + /// This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs + /// to be retried. The one requirement is that the completion closure is called to ensure the request is properly + /// cleaned up after. + /// + /// - parameter manager: The session manager the request was executed on. + /// - parameter request: The request that failed due to the encountered error. + /// - parameter error: The error encountered when executing the request. + /// - parameter completion: The completion closure to be executed when retry decision has been determined. + func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) +} + +// MARK: - + +protocol TaskConvertible { + func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask +} + +/// A dictionary of headers to apply to a `URLRequest`. +public typealias HTTPHeaders = [String: String] + +// MARK: - + +/// Responsible for sending a request and receiving the response and associated data from the server, as well as +/// managing its underlying `URLSessionTask`. +open class Request { + + // MARK: Helper Types + + /// A closure executed when monitoring upload or download progress of a request. + public typealias ProgressHandler = (Progress) -> Void + + enum RequestTask { + case data(TaskConvertible?, URLSessionTask?) + case download(TaskConvertible?, URLSessionTask?) + case upload(TaskConvertible?, URLSessionTask?) + case stream(TaskConvertible?, URLSessionTask?) + } + + // MARK: Properties + + /// The delegate for the underlying task. + open internal(set) var delegate: TaskDelegate { + get { + taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() } + return taskDelegate + } + set { + taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() } + taskDelegate = newValue + } + } + + /// The underlying task. + open var task: URLSessionTask? { return delegate.task } + + /// The session belonging to the underlying task. + open let session: URLSession + + /// The request sent or to be sent to the server. + open var request: URLRequest? { return task?.originalRequest } + + /// The response received from the server, if any. + open var response: HTTPURLResponse? { return task?.response as? HTTPURLResponse } + + /// The number of times the request has been retried. + open internal(set) var retryCount: UInt = 0 + + let originalTask: TaskConvertible? + + var startTime: CFAbsoluteTime? + var endTime: CFAbsoluteTime? + + var validations: [() -> Void] = [] + + private var taskDelegate: TaskDelegate + private var taskDelegateLock = NSLock() + + // MARK: Lifecycle + + init(session: URLSession, requestTask: RequestTask, error: Error? = nil) { + self.session = session + + switch requestTask { + case .data(let originalTask, let task): + taskDelegate = DataTaskDelegate(task: task) + self.originalTask = originalTask + case .download(let originalTask, let task): + taskDelegate = DownloadTaskDelegate(task: task) + self.originalTask = originalTask + case .upload(let originalTask, let task): + taskDelegate = UploadTaskDelegate(task: task) + self.originalTask = originalTask + case .stream(let originalTask, let task): + taskDelegate = TaskDelegate(task: task) + self.originalTask = originalTask + } + + delegate.error = error + delegate.queue.addOperation { self.endTime = CFAbsoluteTimeGetCurrent() } + } + + // MARK: Authentication + + /// Associates an HTTP Basic credential with the request. + /// + /// - parameter user: The user. + /// - parameter password: The password. + /// - parameter persistence: The URL credential persistence. `.ForSession` by default. + /// + /// - returns: The request. + @discardableResult + open func authenticate( + user: String, + password: String, + persistence: URLCredential.Persistence = .forSession) + -> Self + { + let credential = URLCredential(user: user, password: password, persistence: persistence) + return authenticate(usingCredential: credential) + } + + /// Associates a specified credential with the request. + /// + /// - parameter credential: The credential. + /// + /// - returns: The request. + @discardableResult + open func authenticate(usingCredential credential: URLCredential) -> Self { + delegate.credential = credential + return self + } + + /// Returns a base64 encoded basic authentication credential as an authorization header tuple. + /// + /// - parameter user: The user. + /// - parameter password: The password. + /// + /// - returns: A tuple with Authorization header and credential value if encoding succeeds, `nil` otherwise. + open static func authorizationHeader(user: String, password: String) -> (key: String, value: String)? { + guard let data = "\(user):\(password)".data(using: .utf8) else { return nil } + + let credential = data.base64EncodedString(options: []) + + return (key: "Authorization", value: "Basic \(credential)") + } + + // MARK: State + + /// Resumes the request. + open func resume() { + guard let task = task else { delegate.queue.isSuspended = false ; return } + + if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() } + + task.resume() + + NotificationCenter.default.post( + name: Notification.Name.Task.DidResume, + object: self, + userInfo: [Notification.Key.Task: task] + ) + } + + /// Suspends the request. + open func suspend() { + guard let task = task else { return } + + task.suspend() + + NotificationCenter.default.post( + name: Notification.Name.Task.DidSuspend, + object: self, + userInfo: [Notification.Key.Task: task] + ) + } + + /// Cancels the request. + open func cancel() { + guard let task = task else { return } + + task.cancel() + + NotificationCenter.default.post( + name: Notification.Name.Task.DidCancel, + object: self, + userInfo: [Notification.Key.Task: task] + ) + } +} + +// MARK: - CustomStringConvertible + +extension Request: CustomStringConvertible { + /// The textual representation used when written to an output stream, which includes the HTTP method and URL, as + /// well as the response status code if a response has been received. + open var description: String { + var components: [String] = [] + + if let HTTPMethod = request?.httpMethod { + components.append(HTTPMethod) + } + + if let urlString = request?.url?.absoluteString { + components.append(urlString) + } + + if let response = response { + components.append("(\(response.statusCode))") + } + + return components.joined(separator: " ") + } +} + +// MARK: - CustomDebugStringConvertible + +extension Request: CustomDebugStringConvertible { + /// The textual representation used when written to an output stream, in the form of a cURL command. + open var debugDescription: String { + return cURLRepresentation() + } + + func cURLRepresentation() -> String { + var components = ["$ curl -v"] + + guard let request = self.request, + let url = request.url, + let host = url.host + else { + return "$ curl command could not be created" + } + + if let httpMethod = request.httpMethod, httpMethod != "GET" { + components.append("-X \(httpMethod)") + } + + if let credentialStorage = self.session.configuration.urlCredentialStorage { + let protectionSpace = URLProtectionSpace( + host: host, + port: url.port ?? 0, + protocol: url.scheme, + realm: host, + authenticationMethod: NSURLAuthenticationMethodHTTPBasic + ) + + if let credentials = credentialStorage.credentials(for: protectionSpace)?.values { + for credential in credentials { + guard let user = credential.user, let password = credential.password else { continue } + components.append("-u \(user):\(password)") + } + } else { + if let credential = delegate.credential, let user = credential.user, let password = credential.password { + components.append("-u \(user):\(password)") + } + } + } + + if session.configuration.httpShouldSetCookies { + if + let cookieStorage = session.configuration.httpCookieStorage, + let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty + { + let string = cookies.reduce("") { $0 + "\($1.name)=\($1.value);" } + + #if swift(>=3.2) + components.append("-b \"\(string[.. URLSessionTask { + do { + let urlRequest = try self.urlRequest.adapt(using: adapter) + return queue.sync { session.dataTask(with: urlRequest) } + } catch { + throw AdaptError(error: error) + } + } + } + + // MARK: Properties + + /// The request sent or to be sent to the server. + open override var request: URLRequest? { + if let request = super.request { return request } + if let requestable = originalTask as? Requestable { return requestable.urlRequest } + + return nil + } + + /// The progress of fetching the response data from the server for the request. + open var progress: Progress { return dataDelegate.progress } + + var dataDelegate: DataTaskDelegate { return delegate as! DataTaskDelegate } + + // MARK: Stream + + /// Sets a closure to be called periodically during the lifecycle of the request as data is read from the server. + /// + /// This closure returns the bytes most recently received from the server, not including data from previous calls. + /// If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is + /// also important to note that the server data in any `Response` object will be `nil`. + /// + /// - parameter closure: The code to be executed periodically during the lifecycle of the request. + /// + /// - returns: The request. + @discardableResult + open func stream(closure: ((Data) -> Void)? = nil) -> Self { + dataDelegate.dataStream = closure + return self + } + + // MARK: Progress + + /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is read from the server. + /// + /// - parameter queue: The dispatch queue to execute the closure on. + /// - parameter closure: The code to be executed periodically as data is read from the server. + /// + /// - returns: The request. + @discardableResult + open func downloadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self { + dataDelegate.progressHandler = (closure, queue) + return self + } +} + +// MARK: - + +/// Specific type of `Request` that manages an underlying `URLSessionDownloadTask`. +open class DownloadRequest: Request { + + // MARK: Helper Types + + /// A collection of options to be executed prior to moving a downloaded file from the temporary URL to the + /// destination URL. + public struct DownloadOptions: OptionSet { + /// Returns the raw bitmask value of the option and satisfies the `RawRepresentable` protocol. + public let rawValue: UInt + + /// A `DownloadOptions` flag that creates intermediate directories for the destination URL if specified. + public static let createIntermediateDirectories = DownloadOptions(rawValue: 1 << 0) + + /// A `DownloadOptions` flag that removes a previous file from the destination URL if specified. + public static let removePreviousFile = DownloadOptions(rawValue: 1 << 1) + + /// Creates a `DownloadFileDestinationOptions` instance with the specified raw value. + /// + /// - parameter rawValue: The raw bitmask value for the option. + /// + /// - returns: A new log level instance. + public init(rawValue: UInt) { + self.rawValue = rawValue + } + } + + /// A closure executed once a download request has successfully completed in order to determine where to move the + /// temporary file written to during the download process. The closure takes two arguments: the temporary file URL + /// and the URL response, and returns a two arguments: the file URL where the temporary file should be moved and + /// the options defining how the file should be moved. + public typealias DownloadFileDestination = ( + _ temporaryURL: URL, + _ response: HTTPURLResponse) + -> (destinationURL: URL, options: DownloadOptions) + + enum Downloadable: TaskConvertible { + case request(URLRequest) + case resumeData(Data) + + func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { + do { + let task: URLSessionTask + + switch self { + case let .request(urlRequest): + let urlRequest = try urlRequest.adapt(using: adapter) + task = queue.sync { session.downloadTask(with: urlRequest) } + case let .resumeData(resumeData): + task = queue.sync { session.downloadTask(withResumeData: resumeData) } + } + + return task + } catch { + throw AdaptError(error: error) + } + } + } + + // MARK: Properties + + /// The request sent or to be sent to the server. + open override var request: URLRequest? { + if let request = super.request { return request } + + if let downloadable = originalTask as? Downloadable, case let .request(urlRequest) = downloadable { + return urlRequest + } + + return nil + } + + /// The resume data of the underlying download task if available after a failure. + open var resumeData: Data? { return downloadDelegate.resumeData } + + /// The progress of downloading the response data from the server for the request. + open var progress: Progress { return downloadDelegate.progress } + + var downloadDelegate: DownloadTaskDelegate { return delegate as! DownloadTaskDelegate } + + // MARK: State + + /// Cancels the request. + open override func cancel() { + downloadDelegate.downloadTask.cancel { self.downloadDelegate.resumeData = $0 } + + NotificationCenter.default.post( + name: Notification.Name.Task.DidCancel, + object: self, + userInfo: [Notification.Key.Task: task as Any] + ) + } + + // MARK: Progress + + /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is read from the server. + /// + /// - parameter queue: The dispatch queue to execute the closure on. + /// - parameter closure: The code to be executed periodically as data is read from the server. + /// + /// - returns: The request. + @discardableResult + open func downloadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self { + downloadDelegate.progressHandler = (closure, queue) + return self + } + + // MARK: Destination + + /// Creates a download file destination closure which uses the default file manager to move the temporary file to a + /// file URL in the first available directory with the specified search path directory and search path domain mask. + /// + /// - parameter directory: The search path directory. `.DocumentDirectory` by default. + /// - parameter domain: The search path domain mask. `.UserDomainMask` by default. + /// + /// - returns: A download file destination closure. + open class func suggestedDownloadDestination( + for directory: FileManager.SearchPathDirectory = .documentDirectory, + in domain: FileManager.SearchPathDomainMask = .userDomainMask) + -> DownloadFileDestination + { + return { temporaryURL, response in + let directoryURLs = FileManager.default.urls(for: directory, in: domain) + + if !directoryURLs.isEmpty { + return (directoryURLs[0].appendingPathComponent(response.suggestedFilename!), []) + } + + return (temporaryURL, []) + } + } +} + +// MARK: - + +/// Specific type of `Request` that manages an underlying `URLSessionUploadTask`. +open class UploadRequest: DataRequest { + + // MARK: Helper Types + + enum Uploadable: TaskConvertible { + case data(Data, URLRequest) + case file(URL, URLRequest) + case stream(InputStream, URLRequest) + + func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { + do { + let task: URLSessionTask + + switch self { + case let .data(data, urlRequest): + let urlRequest = try urlRequest.adapt(using: adapter) + task = queue.sync { session.uploadTask(with: urlRequest, from: data) } + case let .file(url, urlRequest): + let urlRequest = try urlRequest.adapt(using: adapter) + task = queue.sync { session.uploadTask(with: urlRequest, fromFile: url) } + case let .stream(_, urlRequest): + let urlRequest = try urlRequest.adapt(using: adapter) + task = queue.sync { session.uploadTask(withStreamedRequest: urlRequest) } + } + + return task + } catch { + throw AdaptError(error: error) + } + } + } + + // MARK: Properties + + /// The request sent or to be sent to the server. + open override var request: URLRequest? { + if let request = super.request { return request } + + guard let uploadable = originalTask as? Uploadable else { return nil } + + switch uploadable { + case .data(_, let urlRequest), .file(_, let urlRequest), .stream(_, let urlRequest): + return urlRequest + } + } + + /// The progress of uploading the payload to the server for the upload request. + open var uploadProgress: Progress { return uploadDelegate.uploadProgress } + + var uploadDelegate: UploadTaskDelegate { return delegate as! UploadTaskDelegate } + + // MARK: Upload Progress + + /// Sets a closure to be called periodically during the lifecycle of the `UploadRequest` as data is sent to + /// the server. + /// + /// After the data is sent to the server, the `progress(queue:closure:)` APIs can be used to monitor the progress + /// of data being read from the server. + /// + /// - parameter queue: The dispatch queue to execute the closure on. + /// - parameter closure: The code to be executed periodically as data is sent to the server. + /// + /// - returns: The request. + @discardableResult + open func uploadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self { + uploadDelegate.uploadProgressHandler = (closure, queue) + return self + } +} + +// MARK: - + +#if !os(watchOS) + +/// Specific type of `Request` that manages an underlying `URLSessionStreamTask`. +@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) +open class StreamRequest: Request { + enum Streamable: TaskConvertible { + case stream(hostName: String, port: Int) + case netService(NetService) + + func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { + let task: URLSessionTask + + switch self { + case let .stream(hostName, port): + task = queue.sync { session.streamTask(withHostName: hostName, port: port) } + case let .netService(netService): + task = queue.sync { session.streamTask(with: netService) } + } + + return task + } + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Response.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Response.swift new file mode 100644 index 0000000..74b1ef5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Response.swift @@ -0,0 +1,567 @@ +// +// Response.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Used to store all data associated with an non-serialized response of a data or upload request. +public struct DefaultDataResponse { + /// The URL request sent to the server. + public let request: URLRequest? + + /// The server's response to the URL request. + public let response: HTTPURLResponse? + + /// The data returned by the server. + public let data: Data? + + /// The error encountered while executing or validating the request. + public let error: Error? + + /// The timeline of the complete lifecycle of the request. + public let timeline: Timeline + + var _metrics: AnyObject? + + /// Creates a `DefaultDataResponse` instance from the specified parameters. + /// + /// - Parameters: + /// - request: The URL request sent to the server. + /// - response: The server's response to the URL request. + /// - data: The data returned by the server. + /// - error: The error encountered while executing or validating the request. + /// - timeline: The timeline of the complete lifecycle of the request. `Timeline()` by default. + /// - metrics: The task metrics containing the request / response statistics. `nil` by default. + public init( + request: URLRequest?, + response: HTTPURLResponse?, + data: Data?, + error: Error?, + timeline: Timeline = Timeline(), + metrics: AnyObject? = nil) + { + self.request = request + self.response = response + self.data = data + self.error = error + self.timeline = timeline + } +} + +// MARK: - + +/// Used to store all data associated with a serialized response of a data or upload request. +public struct DataResponse { + /// The URL request sent to the server. + public let request: URLRequest? + + /// The server's response to the URL request. + public let response: HTTPURLResponse? + + /// The data returned by the server. + public let data: Data? + + /// The result of response serialization. + public let result: Result + + /// The timeline of the complete lifecycle of the request. + public let timeline: Timeline + + /// Returns the associated value of the result if it is a success, `nil` otherwise. + public var value: Value? { return result.value } + + /// Returns the associated error value if the result if it is a failure, `nil` otherwise. + public var error: Error? { return result.error } + + var _metrics: AnyObject? + + /// Creates a `DataResponse` instance with the specified parameters derived from response serialization. + /// + /// - parameter request: The URL request sent to the server. + /// - parameter response: The server's response to the URL request. + /// - parameter data: The data returned by the server. + /// - parameter result: The result of response serialization. + /// - parameter timeline: The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`. + /// + /// - returns: The new `DataResponse` instance. + public init( + request: URLRequest?, + response: HTTPURLResponse?, + data: Data?, + result: Result, + timeline: Timeline = Timeline()) + { + self.request = request + self.response = response + self.data = data + self.result = result + self.timeline = timeline + } +} + +// MARK: - + +extension DataResponse: CustomStringConvertible, CustomDebugStringConvertible { + /// The textual representation used when written to an output stream, which includes whether the result was a + /// success or failure. + public var description: String { + return result.debugDescription + } + + /// The debug textual representation used when written to an output stream, which includes the URL request, the URL + /// response, the server data, the response serialization result and the timeline. + public var debugDescription: String { + var output: [String] = [] + + output.append(request != nil ? "[Request]: \(request!.httpMethod ?? "GET") \(request!)" : "[Request]: nil") + output.append(response != nil ? "[Response]: \(response!)" : "[Response]: nil") + output.append("[Data]: \(data?.count ?? 0) bytes") + output.append("[Result]: \(result.debugDescription)") + output.append("[Timeline]: \(timeline.debugDescription)") + + return output.joined(separator: "\n") + } +} + +// MARK: - + +extension DataResponse { + /// Evaluates the specified closure when the result of this `DataResponse` is a success, passing the unwrapped + /// result value as a parameter. + /// + /// Use the `map` method with a closure that does not throw. For example: + /// + /// let possibleData: DataResponse = ... + /// let possibleInt = possibleData.map { $0.count } + /// + /// - parameter transform: A closure that takes the success value of the instance's result. + /// + /// - returns: A `DataResponse` whose result wraps the value returned by the given closure. If this instance's + /// result is a failure, returns a response wrapping the same failure. + public func map(_ transform: (Value) -> T) -> DataResponse { + var response = DataResponse( + request: request, + response: self.response, + data: data, + result: result.map(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } + + /// Evaluates the given closure when the result of this `DataResponse` is a success, passing the unwrapped result + /// value as a parameter. + /// + /// Use the `flatMap` method with a closure that may throw an error. For example: + /// + /// let possibleData: DataResponse = ... + /// let possibleObject = possibleData.flatMap { + /// try JSONSerialization.jsonObject(with: $0) + /// } + /// + /// - parameter transform: A closure that takes the success value of the instance's result. + /// + /// - returns: A success or failure `DataResponse` depending on the result of the given closure. If this instance's + /// result is a failure, returns the same failure. + public func flatMap(_ transform: (Value) throws -> T) -> DataResponse { + var response = DataResponse( + request: request, + response: self.response, + data: data, + result: result.flatMap(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } + + /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `mapError` function with a closure that does not throw. For example: + /// + /// let possibleData: DataResponse = ... + /// let withMyError = possibleData.mapError { MyError.error($0) } + /// + /// - Parameter transform: A closure that takes the error of the instance. + /// - Returns: A `DataResponse` instance containing the result of the transform. + public func mapError(_ transform: (Error) -> E) -> DataResponse { + var response = DataResponse( + request: request, + response: self.response, + data: data, + result: result.mapError(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } + + /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `flatMapError` function with a closure that may throw an error. For example: + /// + /// let possibleData: DataResponse = ... + /// let possibleObject = possibleData.flatMapError { + /// try someFailableFunction(taking: $0) + /// } + /// + /// - Parameter transform: A throwing closure that takes the error of the instance. + /// + /// - Returns: A `DataResponse` instance containing the result of the transform. + public func flatMapError(_ transform: (Error) throws -> E) -> DataResponse { + var response = DataResponse( + request: request, + response: self.response, + data: data, + result: result.flatMapError(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } +} + +// MARK: - + +/// Used to store all data associated with an non-serialized response of a download request. +public struct DefaultDownloadResponse { + /// The URL request sent to the server. + public let request: URLRequest? + + /// The server's response to the URL request. + public let response: HTTPURLResponse? + + /// The temporary destination URL of the data returned from the server. + public let temporaryURL: URL? + + /// The final destination URL of the data returned from the server if it was moved. + public let destinationURL: URL? + + /// The resume data generated if the request was cancelled. + public let resumeData: Data? + + /// The error encountered while executing or validating the request. + public let error: Error? + + /// The timeline of the complete lifecycle of the request. + public let timeline: Timeline + + var _metrics: AnyObject? + + /// Creates a `DefaultDownloadResponse` instance from the specified parameters. + /// + /// - Parameters: + /// - request: The URL request sent to the server. + /// - response: The server's response to the URL request. + /// - temporaryURL: The temporary destination URL of the data returned from the server. + /// - destinationURL: The final destination URL of the data returned from the server if it was moved. + /// - resumeData: The resume data generated if the request was cancelled. + /// - error: The error encountered while executing or validating the request. + /// - timeline: The timeline of the complete lifecycle of the request. `Timeline()` by default. + /// - metrics: The task metrics containing the request / response statistics. `nil` by default. + public init( + request: URLRequest?, + response: HTTPURLResponse?, + temporaryURL: URL?, + destinationURL: URL?, + resumeData: Data?, + error: Error?, + timeline: Timeline = Timeline(), + metrics: AnyObject? = nil) + { + self.request = request + self.response = response + self.temporaryURL = temporaryURL + self.destinationURL = destinationURL + self.resumeData = resumeData + self.error = error + self.timeline = timeline + } +} + +// MARK: - + +/// Used to store all data associated with a serialized response of a download request. +public struct DownloadResponse { + /// The URL request sent to the server. + public let request: URLRequest? + + /// The server's response to the URL request. + public let response: HTTPURLResponse? + + /// The temporary destination URL of the data returned from the server. + public let temporaryURL: URL? + + /// The final destination URL of the data returned from the server if it was moved. + public let destinationURL: URL? + + /// The resume data generated if the request was cancelled. + public let resumeData: Data? + + /// The result of response serialization. + public let result: Result + + /// The timeline of the complete lifecycle of the request. + public let timeline: Timeline + + /// Returns the associated value of the result if it is a success, `nil` otherwise. + public var value: Value? { return result.value } + + /// Returns the associated error value if the result if it is a failure, `nil` otherwise. + public var error: Error? { return result.error } + + var _metrics: AnyObject? + + /// Creates a `DownloadResponse` instance with the specified parameters derived from response serialization. + /// + /// - parameter request: The URL request sent to the server. + /// - parameter response: The server's response to the URL request. + /// - parameter temporaryURL: The temporary destination URL of the data returned from the server. + /// - parameter destinationURL: The final destination URL of the data returned from the server if it was moved. + /// - parameter resumeData: The resume data generated if the request was cancelled. + /// - parameter result: The result of response serialization. + /// - parameter timeline: The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`. + /// + /// - returns: The new `DownloadResponse` instance. + public init( + request: URLRequest?, + response: HTTPURLResponse?, + temporaryURL: URL?, + destinationURL: URL?, + resumeData: Data?, + result: Result, + timeline: Timeline = Timeline()) + { + self.request = request + self.response = response + self.temporaryURL = temporaryURL + self.destinationURL = destinationURL + self.resumeData = resumeData + self.result = result + self.timeline = timeline + } +} + +// MARK: - + +extension DownloadResponse: CustomStringConvertible, CustomDebugStringConvertible { + /// The textual representation used when written to an output stream, which includes whether the result was a + /// success or failure. + public var description: String { + return result.debugDescription + } + + /// The debug textual representation used when written to an output stream, which includes the URL request, the URL + /// response, the temporary and destination URLs, the resume data, the response serialization result and the + /// timeline. + public var debugDescription: String { + var output: [String] = [] + + output.append(request != nil ? "[Request]: \(request!.httpMethod ?? "GET") \(request!)" : "[Request]: nil") + output.append(response != nil ? "[Response]: \(response!)" : "[Response]: nil") + output.append("[TemporaryURL]: \(temporaryURL?.path ?? "nil")") + output.append("[DestinationURL]: \(destinationURL?.path ?? "nil")") + output.append("[ResumeData]: \(resumeData?.count ?? 0) bytes") + output.append("[Result]: \(result.debugDescription)") + output.append("[Timeline]: \(timeline.debugDescription)") + + return output.joined(separator: "\n") + } +} + +// MARK: - + +extension DownloadResponse { + /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped + /// result value as a parameter. + /// + /// Use the `map` method with a closure that does not throw. For example: + /// + /// let possibleData: DownloadResponse = ... + /// let possibleInt = possibleData.map { $0.count } + /// + /// - parameter transform: A closure that takes the success value of the instance's result. + /// + /// - returns: A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance's + /// result is a failure, returns a response wrapping the same failure. + public func map(_ transform: (Value) -> T) -> DownloadResponse { + var response = DownloadResponse( + request: request, + response: self.response, + temporaryURL: temporaryURL, + destinationURL: destinationURL, + resumeData: resumeData, + result: result.map(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } + + /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped + /// result value as a parameter. + /// + /// Use the `flatMap` method with a closure that may throw an error. For example: + /// + /// let possibleData: DownloadResponse = ... + /// let possibleObject = possibleData.flatMap { + /// try JSONSerialization.jsonObject(with: $0) + /// } + /// + /// - parameter transform: A closure that takes the success value of the instance's result. + /// + /// - returns: A success or failure `DownloadResponse` depending on the result of the given closure. If this + /// instance's result is a failure, returns the same failure. + public func flatMap(_ transform: (Value) throws -> T) -> DownloadResponse { + var response = DownloadResponse( + request: request, + response: self.response, + temporaryURL: temporaryURL, + destinationURL: destinationURL, + resumeData: resumeData, + result: result.flatMap(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } + + /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `mapError` function with a closure that does not throw. For example: + /// + /// let possibleData: DownloadResponse = ... + /// let withMyError = possibleData.mapError { MyError.error($0) } + /// + /// - Parameter transform: A closure that takes the error of the instance. + /// - Returns: A `DownloadResponse` instance containing the result of the transform. + public func mapError(_ transform: (Error) -> E) -> DownloadResponse { + var response = DownloadResponse( + request: request, + response: self.response, + temporaryURL: temporaryURL, + destinationURL: destinationURL, + resumeData: resumeData, + result: result.mapError(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } + + /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `flatMapError` function with a closure that may throw an error. For example: + /// + /// let possibleData: DownloadResponse = ... + /// let possibleObject = possibleData.flatMapError { + /// try someFailableFunction(taking: $0) + /// } + /// + /// - Parameter transform: A throwing closure that takes the error of the instance. + /// + /// - Returns: A `DownloadResponse` instance containing the result of the transform. + public func flatMapError(_ transform: (Error) throws -> E) -> DownloadResponse { + var response = DownloadResponse( + request: request, + response: self.response, + temporaryURL: temporaryURL, + destinationURL: destinationURL, + resumeData: resumeData, + result: result.flatMapError(transform), + timeline: timeline + ) + + response._metrics = _metrics + + return response + } +} + +// MARK: - + +protocol Response { + /// The task metrics containing the request / response statistics. + var _metrics: AnyObject? { get set } + mutating func add(_ metrics: AnyObject?) +} + +extension Response { + mutating func add(_ metrics: AnyObject?) { + #if !os(watchOS) + guard #available(iOS 10.0, macOS 10.12, tvOS 10.0, *) else { return } + guard let metrics = metrics as? URLSessionTaskMetrics else { return } + + _metrics = metrics + #endif + } +} + +// MARK: - + +@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) +extension DefaultDataResponse: Response { +#if !os(watchOS) + /// The task metrics containing the request / response statistics. + public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } +#endif +} + +@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) +extension DataResponse: Response { +#if !os(watchOS) + /// The task metrics containing the request / response statistics. + public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } +#endif +} + +@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) +extension DefaultDownloadResponse: Response { +#if !os(watchOS) + /// The task metrics containing the request / response statistics. + public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } +#endif +} + +@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) +extension DownloadResponse: Response { +#if !os(watchOS) + /// The task metrics containing the request / response statistics. + public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } +#endif +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ResponseSerialization.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ResponseSerialization.swift new file mode 100644 index 0000000..3333726 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ResponseSerialization.swift @@ -0,0 +1,715 @@ +// +// ResponseSerialization.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// The type in which all data response serializers must conform to in order to serialize a response. +public protocol DataResponseSerializerProtocol { + /// The type of serialized object to be created by this `DataResponseSerializerType`. + associatedtype SerializedObject + + /// A closure used by response handlers that takes a request, response, data and error and returns a result. + var serializeResponse: (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result { get } +} + +// MARK: - + +/// A generic `DataResponseSerializerType` used to serialize a request, response, and data into a serialized object. +public struct DataResponseSerializer: DataResponseSerializerProtocol { + /// The type of serialized object to be created by this `DataResponseSerializer`. + public typealias SerializedObject = Value + + /// A closure used by response handlers that takes a request, response, data and error and returns a result. + public var serializeResponse: (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result + + /// Initializes the `ResponseSerializer` instance with the given serialize response closure. + /// + /// - parameter serializeResponse: The closure used to serialize the response. + /// + /// - returns: The new generic response serializer instance. + public init(serializeResponse: @escaping (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result) { + self.serializeResponse = serializeResponse + } +} + +// MARK: - + +/// The type in which all download response serializers must conform to in order to serialize a response. +public protocol DownloadResponseSerializerProtocol { + /// The type of serialized object to be created by this `DownloadResponseSerializerType`. + associatedtype SerializedObject + + /// A closure used by response handlers that takes a request, response, url and error and returns a result. + var serializeResponse: (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result { get } +} + +// MARK: - + +/// A generic `DownloadResponseSerializerType` used to serialize a request, response, and data into a serialized object. +public struct DownloadResponseSerializer: DownloadResponseSerializerProtocol { + /// The type of serialized object to be created by this `DownloadResponseSerializer`. + public typealias SerializedObject = Value + + /// A closure used by response handlers that takes a request, response, url and error and returns a result. + public var serializeResponse: (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result + + /// Initializes the `ResponseSerializer` instance with the given serialize response closure. + /// + /// - parameter serializeResponse: The closure used to serialize the response. + /// + /// - returns: The new generic response serializer instance. + public init(serializeResponse: @escaping (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result) { + self.serializeResponse = serializeResponse + } +} + +// MARK: - Timeline + +extension Request { + var timeline: Timeline { + let requestStartTime = self.startTime ?? CFAbsoluteTimeGetCurrent() + let requestCompletedTime = self.endTime ?? CFAbsoluteTimeGetCurrent() + let initialResponseTime = self.delegate.initialResponseTime ?? requestCompletedTime + + return Timeline( + requestStartTime: requestStartTime, + initialResponseTime: initialResponseTime, + requestCompletedTime: requestCompletedTime, + serializationCompletedTime: CFAbsoluteTimeGetCurrent() + ) + } +} + +// MARK: - Default + +extension DataRequest { + /// Adds a handler to be called once the request has finished. + /// + /// - parameter queue: The queue on which the completion handler is dispatched. + /// - parameter completionHandler: The code to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func response(queue: DispatchQueue? = nil, completionHandler: @escaping (DefaultDataResponse) -> Void) -> Self { + delegate.queue.addOperation { + (queue ?? DispatchQueue.main).async { + var dataResponse = DefaultDataResponse( + request: self.request, + response: self.response, + data: self.delegate.data, + error: self.delegate.error, + timeline: self.timeline + ) + + dataResponse.add(self.delegate.metrics) + + completionHandler(dataResponse) + } + } + + return self + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter queue: The queue on which the completion handler is dispatched. + /// - parameter responseSerializer: The response serializer responsible for serializing the request, response, + /// and data. + /// - parameter completionHandler: The code to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func response( + queue: DispatchQueue? = nil, + responseSerializer: T, + completionHandler: @escaping (DataResponse) -> Void) + -> Self + { + delegate.queue.addOperation { + let result = responseSerializer.serializeResponse( + self.request, + self.response, + self.delegate.data, + self.delegate.error + ) + + var dataResponse = DataResponse( + request: self.request, + response: self.response, + data: self.delegate.data, + result: result, + timeline: self.timeline + ) + + dataResponse.add(self.delegate.metrics) + + (queue ?? DispatchQueue.main).async { completionHandler(dataResponse) } + } + + return self + } +} + +extension DownloadRequest { + /// Adds a handler to be called once the request has finished. + /// + /// - parameter queue: The queue on which the completion handler is dispatched. + /// - parameter completionHandler: The code to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func response( + queue: DispatchQueue? = nil, + completionHandler: @escaping (DefaultDownloadResponse) -> Void) + -> Self + { + delegate.queue.addOperation { + (queue ?? DispatchQueue.main).async { + var downloadResponse = DefaultDownloadResponse( + request: self.request, + response: self.response, + temporaryURL: self.downloadDelegate.temporaryURL, + destinationURL: self.downloadDelegate.destinationURL, + resumeData: self.downloadDelegate.resumeData, + error: self.downloadDelegate.error, + timeline: self.timeline + ) + + downloadResponse.add(self.delegate.metrics) + + completionHandler(downloadResponse) + } + } + + return self + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter queue: The queue on which the completion handler is dispatched. + /// - parameter responseSerializer: The response serializer responsible for serializing the request, response, + /// and data contained in the destination url. + /// - parameter completionHandler: The code to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func response( + queue: DispatchQueue? = nil, + responseSerializer: T, + completionHandler: @escaping (DownloadResponse) -> Void) + -> Self + { + delegate.queue.addOperation { + let result = responseSerializer.serializeResponse( + self.request, + self.response, + self.downloadDelegate.fileURL, + self.downloadDelegate.error + ) + + var downloadResponse = DownloadResponse( + request: self.request, + response: self.response, + temporaryURL: self.downloadDelegate.temporaryURL, + destinationURL: self.downloadDelegate.destinationURL, + resumeData: self.downloadDelegate.resumeData, + result: result, + timeline: self.timeline + ) + + downloadResponse.add(self.delegate.metrics) + + (queue ?? DispatchQueue.main).async { completionHandler(downloadResponse) } + } + + return self + } +} + +// MARK: - Data + +extension Request { + /// Returns a result data type that contains the response data as-is. + /// + /// - parameter response: The response from the server. + /// - parameter data: The data returned from the server. + /// - parameter error: The error already encountered if it exists. + /// + /// - returns: The result data type. + public static func serializeResponseData(response: HTTPURLResponse?, data: Data?, error: Error?) -> Result { + guard error == nil else { return .failure(error!) } + + if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(Data()) } + + guard let validData = data else { + return .failure(AFError.responseSerializationFailed(reason: .inputDataNil)) + } + + return .success(validData) + } +} + +extension DataRequest { + /// Creates a response serializer that returns the associated data as-is. + /// + /// - returns: A data response serializer. + public static func dataResponseSerializer() -> DataResponseSerializer { + return DataResponseSerializer { _, response, data, error in + return Request.serializeResponseData(response: response, data: data, error: error) + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter completionHandler: The code to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responseData( + queue: DispatchQueue? = nil, + completionHandler: @escaping (DataResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DataRequest.dataResponseSerializer(), + completionHandler: completionHandler + ) + } +} + +extension DownloadRequest { + /// Creates a response serializer that returns the associated data as-is. + /// + /// - returns: A data response serializer. + public static func dataResponseSerializer() -> DownloadResponseSerializer { + return DownloadResponseSerializer { _, response, fileURL, error in + guard error == nil else { return .failure(error!) } + + guard let fileURL = fileURL else { + return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) + } + + do { + let data = try Data(contentsOf: fileURL) + return Request.serializeResponseData(response: response, data: data, error: error) + } catch { + return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) + } + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter completionHandler: The code to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responseData( + queue: DispatchQueue? = nil, + completionHandler: @escaping (DownloadResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DownloadRequest.dataResponseSerializer(), + completionHandler: completionHandler + ) + } +} + +// MARK: - String + +extension Request { + /// Returns a result string type initialized from the response data with the specified string encoding. + /// + /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server + /// response, falling back to the default HTTP default character set, ISO-8859-1. + /// - parameter response: The response from the server. + /// - parameter data: The data returned from the server. + /// - parameter error: The error already encountered if it exists. + /// + /// - returns: The result data type. + public static func serializeResponseString( + encoding: String.Encoding?, + response: HTTPURLResponse?, + data: Data?, + error: Error?) + -> Result + { + guard error == nil else { return .failure(error!) } + + if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success("") } + + guard let validData = data else { + return .failure(AFError.responseSerializationFailed(reason: .inputDataNil)) + } + + var convertedEncoding = encoding + + if let encodingName = response?.textEncodingName as CFString?, convertedEncoding == nil { + convertedEncoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding( + CFStringConvertIANACharSetNameToEncoding(encodingName)) + ) + } + + let actualEncoding = convertedEncoding ?? .isoLatin1 + + if let string = String(data: validData, encoding: actualEncoding) { + return .success(string) + } else { + return .failure(AFError.responseSerializationFailed(reason: .stringSerializationFailed(encoding: actualEncoding))) + } + } +} + +extension DataRequest { + /// Creates a response serializer that returns a result string type initialized from the response data with + /// the specified string encoding. + /// + /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server + /// response, falling back to the default HTTP default character set, ISO-8859-1. + /// + /// - returns: A string response serializer. + public static func stringResponseSerializer(encoding: String.Encoding? = nil) -> DataResponseSerializer { + return DataResponseSerializer { _, response, data, error in + return Request.serializeResponseString(encoding: encoding, response: response, data: data, error: error) + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the + /// server response, falling back to the default HTTP default character set, + /// ISO-8859-1. + /// - parameter completionHandler: A closure to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responseString( + queue: DispatchQueue? = nil, + encoding: String.Encoding? = nil, + completionHandler: @escaping (DataResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DataRequest.stringResponseSerializer(encoding: encoding), + completionHandler: completionHandler + ) + } +} + +extension DownloadRequest { + /// Creates a response serializer that returns a result string type initialized from the response data with + /// the specified string encoding. + /// + /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server + /// response, falling back to the default HTTP default character set, ISO-8859-1. + /// + /// - returns: A string response serializer. + public static func stringResponseSerializer(encoding: String.Encoding? = nil) -> DownloadResponseSerializer { + return DownloadResponseSerializer { _, response, fileURL, error in + guard error == nil else { return .failure(error!) } + + guard let fileURL = fileURL else { + return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) + } + + do { + let data = try Data(contentsOf: fileURL) + return Request.serializeResponseString(encoding: encoding, response: response, data: data, error: error) + } catch { + return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) + } + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the + /// server response, falling back to the default HTTP default character set, + /// ISO-8859-1. + /// - parameter completionHandler: A closure to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responseString( + queue: DispatchQueue? = nil, + encoding: String.Encoding? = nil, + completionHandler: @escaping (DownloadResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DownloadRequest.stringResponseSerializer(encoding: encoding), + completionHandler: completionHandler + ) + } +} + +// MARK: - JSON + +extension Request { + /// Returns a JSON object contained in a result type constructed from the response data using `JSONSerialization` + /// with the specified reading options. + /// + /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. + /// - parameter response: The response from the server. + /// - parameter data: The data returned from the server. + /// - parameter error: The error already encountered if it exists. + /// + /// - returns: The result data type. + public static func serializeResponseJSON( + options: JSONSerialization.ReadingOptions, + response: HTTPURLResponse?, + data: Data?, + error: Error?) + -> Result + { + guard error == nil else { return .failure(error!) } + + if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(NSNull()) } + + guard let validData = data, validData.count > 0 else { + return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)) + } + + do { + let json = try JSONSerialization.jsonObject(with: validData, options: options) + return .success(json) + } catch { + return .failure(AFError.responseSerializationFailed(reason: .jsonSerializationFailed(error: error))) + } + } +} + +extension DataRequest { + /// Creates a response serializer that returns a JSON object result type constructed from the response data using + /// `JSONSerialization` with the specified reading options. + /// + /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. + /// + /// - returns: A JSON object response serializer. + public static func jsonResponseSerializer( + options: JSONSerialization.ReadingOptions = .allowFragments) + -> DataResponseSerializer + { + return DataResponseSerializer { _, response, data, error in + return Request.serializeResponseJSON(options: options, response: response, data: data, error: error) + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. + /// - parameter completionHandler: A closure to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responseJSON( + queue: DispatchQueue? = nil, + options: JSONSerialization.ReadingOptions = .allowFragments, + completionHandler: @escaping (DataResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DataRequest.jsonResponseSerializer(options: options), + completionHandler: completionHandler + ) + } +} + +extension DownloadRequest { + /// Creates a response serializer that returns a JSON object result type constructed from the response data using + /// `JSONSerialization` with the specified reading options. + /// + /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. + /// + /// - returns: A JSON object response serializer. + public static func jsonResponseSerializer( + options: JSONSerialization.ReadingOptions = .allowFragments) + -> DownloadResponseSerializer + { + return DownloadResponseSerializer { _, response, fileURL, error in + guard error == nil else { return .failure(error!) } + + guard let fileURL = fileURL else { + return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) + } + + do { + let data = try Data(contentsOf: fileURL) + return Request.serializeResponseJSON(options: options, response: response, data: data, error: error) + } catch { + return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) + } + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. + /// - parameter completionHandler: A closure to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responseJSON( + queue: DispatchQueue? = nil, + options: JSONSerialization.ReadingOptions = .allowFragments, + completionHandler: @escaping (DownloadResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DownloadRequest.jsonResponseSerializer(options: options), + completionHandler: completionHandler + ) + } +} + +// MARK: - Property List + +extension Request { + /// Returns a plist object contained in a result type constructed from the response data using + /// `PropertyListSerialization` with the specified reading options. + /// + /// - parameter options: The property list reading options. Defaults to `[]`. + /// - parameter response: The response from the server. + /// - parameter data: The data returned from the server. + /// - parameter error: The error already encountered if it exists. + /// + /// - returns: The result data type. + public static func serializeResponsePropertyList( + options: PropertyListSerialization.ReadOptions, + response: HTTPURLResponse?, + data: Data?, + error: Error?) + -> Result + { + guard error == nil else { return .failure(error!) } + + if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(NSNull()) } + + guard let validData = data, validData.count > 0 else { + return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)) + } + + do { + let plist = try PropertyListSerialization.propertyList(from: validData, options: options, format: nil) + return .success(plist) + } catch { + return .failure(AFError.responseSerializationFailed(reason: .propertyListSerializationFailed(error: error))) + } + } +} + +extension DataRequest { + /// Creates a response serializer that returns an object constructed from the response data using + /// `PropertyListSerialization` with the specified reading options. + /// + /// - parameter options: The property list reading options. Defaults to `[]`. + /// + /// - returns: A property list object response serializer. + public static func propertyListResponseSerializer( + options: PropertyListSerialization.ReadOptions = []) + -> DataResponseSerializer + { + return DataResponseSerializer { _, response, data, error in + return Request.serializeResponsePropertyList(options: options, response: response, data: data, error: error) + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter options: The property list reading options. Defaults to `[]`. + /// - parameter completionHandler: A closure to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responsePropertyList( + queue: DispatchQueue? = nil, + options: PropertyListSerialization.ReadOptions = [], + completionHandler: @escaping (DataResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DataRequest.propertyListResponseSerializer(options: options), + completionHandler: completionHandler + ) + } +} + +extension DownloadRequest { + /// Creates a response serializer that returns an object constructed from the response data using + /// `PropertyListSerialization` with the specified reading options. + /// + /// - parameter options: The property list reading options. Defaults to `[]`. + /// + /// - returns: A property list object response serializer. + public static func propertyListResponseSerializer( + options: PropertyListSerialization.ReadOptions = []) + -> DownloadResponseSerializer + { + return DownloadResponseSerializer { _, response, fileURL, error in + guard error == nil else { return .failure(error!) } + + guard let fileURL = fileURL else { + return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) + } + + do { + let data = try Data(contentsOf: fileURL) + return Request.serializeResponsePropertyList(options: options, response: response, data: data, error: error) + } catch { + return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) + } + } + } + + /// Adds a handler to be called once the request has finished. + /// + /// - parameter options: The property list reading options. Defaults to `[]`. + /// - parameter completionHandler: A closure to be executed once the request has finished. + /// + /// - returns: The request. + @discardableResult + public func responsePropertyList( + queue: DispatchQueue? = nil, + options: PropertyListSerialization.ReadOptions = [], + completionHandler: @escaping (DownloadResponse) -> Void) + -> Self + { + return response( + queue: queue, + responseSerializer: DownloadRequest.propertyListResponseSerializer(options: options), + completionHandler: completionHandler + ) + } +} + +/// A set of HTTP response status code that do not contain response data. +private let emptyDataStatusCodes: Set = [204, 205] diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Result.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Result.swift new file mode 100644 index 0000000..df62e12 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Result.swift @@ -0,0 +1,300 @@ +// +// Result.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Used to represent whether a request was successful or encountered an error. +/// +/// - success: The request and all post processing operations were successful resulting in the serialization of the +/// provided associated value. +/// +/// - failure: The request encountered an error resulting in a failure. The associated values are the original data +/// provided by the server as well as the error that caused the failure. +public enum Result { + case success(Value) + case failure(Error) + + /// Returns `true` if the result is a success, `false` otherwise. + public var isSuccess: Bool { + switch self { + case .success: + return true + case .failure: + return false + } + } + + /// Returns `true` if the result is a failure, `false` otherwise. + public var isFailure: Bool { + return !isSuccess + } + + /// Returns the associated value if the result is a success, `nil` otherwise. + public var value: Value? { + switch self { + case .success(let value): + return value + case .failure: + return nil + } + } + + /// Returns the associated error value if the result is a failure, `nil` otherwise. + public var error: Error? { + switch self { + case .success: + return nil + case .failure(let error): + return error + } + } +} + +// MARK: - CustomStringConvertible + +extension Result: CustomStringConvertible { + /// The textual representation used when written to an output stream, which includes whether the result was a + /// success or failure. + public var description: String { + switch self { + case .success: + return "SUCCESS" + case .failure: + return "FAILURE" + } + } +} + +// MARK: - CustomDebugStringConvertible + +extension Result: CustomDebugStringConvertible { + /// The debug textual representation used when written to an output stream, which includes whether the result was a + /// success or failure in addition to the value or error. + public var debugDescription: String { + switch self { + case .success(let value): + return "SUCCESS: \(value)" + case .failure(let error): + return "FAILURE: \(error)" + } + } +} + +// MARK: - Functional APIs + +extension Result { + /// Creates a `Result` instance from the result of a closure. + /// + /// A failure result is created when the closure throws, and a success result is created when the closure + /// succeeds without throwing an error. + /// + /// func someString() throws -> String { ... } + /// + /// let result = Result(value: { + /// return try someString() + /// }) + /// + /// // The type of result is Result + /// + /// The trailing closure syntax is also supported: + /// + /// let result = Result { try someString() } + /// + /// - parameter value: The closure to execute and create the result for. + public init(value: () throws -> Value) { + do { + self = try .success(value()) + } catch { + self = .failure(error) + } + } + + /// Returns the success value, or throws the failure error. + /// + /// let possibleString: Result = .success("success") + /// try print(possibleString.unwrap()) + /// // Prints "success" + /// + /// let noString: Result = .failure(error) + /// try print(noString.unwrap()) + /// // Throws error + public func unwrap() throws -> Value { + switch self { + case .success(let value): + return value + case .failure(let error): + throw error + } + } + + /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter. + /// + /// Use the `map` method with a closure that does not throw. For example: + /// + /// let possibleData: Result = .success(Data()) + /// let possibleInt = possibleData.map { $0.count } + /// try print(possibleInt.unwrap()) + /// // Prints "0" + /// + /// let noData: Result = .failure(error) + /// let noInt = noData.map { $0.count } + /// try print(noInt.unwrap()) + /// // Throws error + /// + /// - parameter transform: A closure that takes the success value of the `Result` instance. + /// + /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the + /// same failure. + public func map(_ transform: (Value) -> T) -> Result { + switch self { + case .success(let value): + return .success(transform(value)) + case .failure(let error): + return .failure(error) + } + } + + /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter. + /// + /// Use the `flatMap` method with a closure that may throw an error. For example: + /// + /// let possibleData: Result = .success(Data(...)) + /// let possibleObject = possibleData.flatMap { + /// try JSONSerialization.jsonObject(with: $0) + /// } + /// + /// - parameter transform: A closure that takes the success value of the instance. + /// + /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the + /// same failure. + public func flatMap(_ transform: (Value) throws -> T) -> Result { + switch self { + case .success(let value): + do { + return try .success(transform(value)) + } catch { + return .failure(error) + } + case .failure(let error): + return .failure(error) + } + } + + /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `mapError` function with a closure that does not throw. For example: + /// + /// let possibleData: Result = .failure(someError) + /// let withMyError: Result = possibleData.mapError { MyError.error($0) } + /// + /// - Parameter transform: A closure that takes the error of the instance. + /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns + /// the same instance. + public func mapError(_ transform: (Error) -> T) -> Result { + switch self { + case .failure(let error): + return .failure(transform(error)) + case .success: + return self + } + } + + /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `flatMapError` function with a closure that may throw an error. For example: + /// + /// let possibleData: Result = .success(Data(...)) + /// let possibleObject = possibleData.flatMapError { + /// try someFailableFunction(taking: $0) + /// } + /// + /// - Parameter transform: A throwing closure that takes the error of the instance. + /// + /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns + /// the same instance. + public func flatMapError(_ transform: (Error) throws -> T) -> Result { + switch self { + case .failure(let error): + do { + return try .failure(transform(error)) + } catch { + return .failure(error) + } + case .success: + return self + } + } + + /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter. + /// + /// Use the `withValue` function to evaluate the passed closure without modifying the `Result` instance. + /// + /// - Parameter closure: A closure that takes the success value of this instance. + /// - Returns: This `Result` instance, unmodified. + @discardableResult + public func withValue(_ closure: (Value) -> Void) -> Result { + if case let .success(value) = self { closure(value) } + + return self + } + + /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `withError` function to evaluate the passed closure without modifying the `Result` instance. + /// + /// - Parameter closure: A closure that takes the success value of this instance. + /// - Returns: This `Result` instance, unmodified. + @discardableResult + public func withError(_ closure: (Error) -> Void) -> Result { + if case let .failure(error) = self { closure(error) } + + return self + } + + /// Evaluates the specified closure when the `Result` is a success. + /// + /// Use the `ifSuccess` function to evaluate the passed closure without modifying the `Result` instance. + /// + /// - Parameter closure: A `Void` closure. + /// - Returns: This `Result` instance, unmodified. + @discardableResult + public func ifSuccess(_ closure: () -> Void) -> Result { + if isSuccess { closure() } + + return self + } + + /// Evaluates the specified closure when the `Result` is a failure. + /// + /// Use the `ifFailure` function to evaluate the passed closure without modifying the `Result` instance. + /// + /// - Parameter closure: A `Void` closure. + /// - Returns: This `Result` instance, unmodified. + @discardableResult + public func ifFailure(_ closure: () -> Void) -> Result { + if isFailure { closure() } + + return self + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ServerTrustPolicy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ServerTrustPolicy.swift new file mode 100644 index 0000000..a644ad8 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/ServerTrustPolicy.swift @@ -0,0 +1,307 @@ +// +// ServerTrustPolicy.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Responsible for managing the mapping of `ServerTrustPolicy` objects to a given host. +open class ServerTrustPolicyManager { + /// The dictionary of policies mapped to a particular host. + open let policies: [String: ServerTrustPolicy] + + /// Initializes the `ServerTrustPolicyManager` instance with the given policies. + /// + /// Since different servers and web services can have different leaf certificates, intermediate and even root + /// certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This + /// allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key + /// pinning for host3 and disabling evaluation for host4. + /// + /// - parameter policies: A dictionary of all policies mapped to a particular host. + /// + /// - returns: The new `ServerTrustPolicyManager` instance. + public init(policies: [String: ServerTrustPolicy]) { + self.policies = policies + } + + /// Returns the `ServerTrustPolicy` for the given host if applicable. + /// + /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override + /// this method and implement more complex mapping implementations such as wildcards. + /// + /// - parameter host: The host to use when searching for a matching policy. + /// + /// - returns: The server trust policy for the given host if found. + open func serverTrustPolicy(forHost host: String) -> ServerTrustPolicy? { + return policies[host] + } +} + +// MARK: - + +extension URLSession { + private struct AssociatedKeys { + static var managerKey = "URLSession.ServerTrustPolicyManager" + } + + var serverTrustPolicyManager: ServerTrustPolicyManager? { + get { + return objc_getAssociatedObject(self, &AssociatedKeys.managerKey) as? ServerTrustPolicyManager + } + set (manager) { + objc_setAssociatedObject(self, &AssociatedKeys.managerKey, manager, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + } + } +} + +// MARK: - ServerTrustPolicy + +/// The `ServerTrustPolicy` evaluates the server trust generally provided by an `NSURLAuthenticationChallenge` when +/// connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust +/// with a given set of criteria to determine whether the server trust is valid and the connection should be made. +/// +/// Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other +/// vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged +/// to route all communication over an HTTPS connection with pinning enabled. +/// +/// - performDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to +/// validate the host provided by the challenge. Applications are encouraged to always +/// validate the host in production environments to guarantee the validity of the server's +/// certificate chain. +/// +/// - performRevokedEvaluation: Uses the default and revoked server trust evaluations allowing you to control whether to +/// validate the host provided by the challenge as well as specify the revocation flags for +/// testing for revoked certificates. Apple platforms did not start testing for revoked +/// certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is +/// demonstrated in our TLS tests. Applications are encouraged to always validate the host +/// in production environments to guarantee the validity of the server's certificate chain. +/// +/// - pinCertificates: Uses the pinned certificates to validate the server trust. The server trust is +/// considered valid if one of the pinned certificates match one of the server certificates. +/// By validating both the certificate chain and host, certificate pinning provides a very +/// secure form of server trust validation mitigating most, if not all, MITM attacks. +/// Applications are encouraged to always validate the host and require a valid certificate +/// chain in production environments. +/// +/// - pinPublicKeys: Uses the pinned public keys to validate the server trust. The server trust is considered +/// valid if one of the pinned public keys match one of the server certificate public keys. +/// By validating both the certificate chain and host, public key pinning provides a very +/// secure form of server trust validation mitigating most, if not all, MITM attacks. +/// Applications are encouraged to always validate the host and require a valid certificate +/// chain in production environments. +/// +/// - disableEvaluation: Disables all evaluation which in turn will always consider any server trust as valid. +/// +/// - customEvaluation: Uses the associated closure to evaluate the validity of the server trust. +public enum ServerTrustPolicy { + case performDefaultEvaluation(validateHost: Bool) + case performRevokedEvaluation(validateHost: Bool, revocationFlags: CFOptionFlags) + case pinCertificates(certificates: [SecCertificate], validateCertificateChain: Bool, validateHost: Bool) + case pinPublicKeys(publicKeys: [SecKey], validateCertificateChain: Bool, validateHost: Bool) + case disableEvaluation + case customEvaluation((_ serverTrust: SecTrust, _ host: String) -> Bool) + + // MARK: - Bundle Location + + /// Returns all certificates within the given bundle with a `.cer` file extension. + /// + /// - parameter bundle: The bundle to search for all `.cer` files. + /// + /// - returns: All certificates within the given bundle. + public static func certificates(in bundle: Bundle = Bundle.main) -> [SecCertificate] { + var certificates: [SecCertificate] = [] + + let paths = Set([".cer", ".CER", ".crt", ".CRT", ".der", ".DER"].map { fileExtension in + bundle.paths(forResourcesOfType: fileExtension, inDirectory: nil) + }.joined()) + + for path in paths { + if + let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData, + let certificate = SecCertificateCreateWithData(nil, certificateData) + { + certificates.append(certificate) + } + } + + return certificates + } + + /// Returns all public keys within the given bundle with a `.cer` file extension. + /// + /// - parameter bundle: The bundle to search for all `*.cer` files. + /// + /// - returns: All public keys within the given bundle. + public static func publicKeys(in bundle: Bundle = Bundle.main) -> [SecKey] { + var publicKeys: [SecKey] = [] + + for certificate in certificates(in: bundle) { + if let publicKey = publicKey(for: certificate) { + publicKeys.append(publicKey) + } + } + + return publicKeys + } + + // MARK: - Evaluation + + /// Evaluates whether the server trust is valid for the given host. + /// + /// - parameter serverTrust: The server trust to evaluate. + /// - parameter host: The host of the challenge protection space. + /// + /// - returns: Whether the server trust is valid. + public func evaluate(_ serverTrust: SecTrust, forHost host: String) -> Bool { + var serverTrustIsValid = false + + switch self { + case let .performDefaultEvaluation(validateHost): + let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) + SecTrustSetPolicies(serverTrust, policy) + + serverTrustIsValid = trustIsValid(serverTrust) + case let .performRevokedEvaluation(validateHost, revocationFlags): + let defaultPolicy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) + let revokedPolicy = SecPolicyCreateRevocation(revocationFlags) + SecTrustSetPolicies(serverTrust, [defaultPolicy, revokedPolicy] as CFTypeRef) + + serverTrustIsValid = trustIsValid(serverTrust) + case let .pinCertificates(pinnedCertificates, validateCertificateChain, validateHost): + if validateCertificateChain { + let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) + SecTrustSetPolicies(serverTrust, policy) + + SecTrustSetAnchorCertificates(serverTrust, pinnedCertificates as CFArray) + SecTrustSetAnchorCertificatesOnly(serverTrust, true) + + serverTrustIsValid = trustIsValid(serverTrust) + } else { + let serverCertificatesDataArray = certificateData(for: serverTrust) + let pinnedCertificatesDataArray = certificateData(for: pinnedCertificates) + + outerLoop: for serverCertificateData in serverCertificatesDataArray { + for pinnedCertificateData in pinnedCertificatesDataArray { + if serverCertificateData == pinnedCertificateData { + serverTrustIsValid = true + break outerLoop + } + } + } + } + case let .pinPublicKeys(pinnedPublicKeys, validateCertificateChain, validateHost): + var certificateChainEvaluationPassed = true + + if validateCertificateChain { + let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) + SecTrustSetPolicies(serverTrust, policy) + + certificateChainEvaluationPassed = trustIsValid(serverTrust) + } + + if certificateChainEvaluationPassed { + outerLoop: for serverPublicKey in ServerTrustPolicy.publicKeys(for: serverTrust) as [AnyObject] { + for pinnedPublicKey in pinnedPublicKeys as [AnyObject] { + if serverPublicKey.isEqual(pinnedPublicKey) { + serverTrustIsValid = true + break outerLoop + } + } + } + } + case .disableEvaluation: + serverTrustIsValid = true + case let .customEvaluation(closure): + serverTrustIsValid = closure(serverTrust, host) + } + + return serverTrustIsValid + } + + // MARK: - Private - Trust Validation + + private func trustIsValid(_ trust: SecTrust) -> Bool { + var isValid = false + + var result = SecTrustResultType.invalid + let status = SecTrustEvaluate(trust, &result) + + if status == errSecSuccess { + let unspecified = SecTrustResultType.unspecified + let proceed = SecTrustResultType.proceed + + + isValid = result == unspecified || result == proceed + } + + return isValid + } + + // MARK: - Private - Certificate Data + + private func certificateData(for trust: SecTrust) -> [Data] { + var certificates: [SecCertificate] = [] + + for index in 0.. [Data] { + return certificates.map { SecCertificateCopyData($0) as Data } + } + + // MARK: - Private - Public Key Extraction + + private static func publicKeys(for trust: SecTrust) -> [SecKey] { + var publicKeys: [SecKey] = [] + + for index in 0.. SecKey? { + var publicKey: SecKey? + + let policy = SecPolicyCreateBasicX509() + var trust: SecTrust? + let trustCreationStatus = SecTrustCreateWithCertificates(certificate, policy, &trust) + + if let trust = trust, trustCreationStatus == errSecSuccess { + publicKey = SecTrustCopyPublicKey(trust) + } + + return publicKey + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionDelegate.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionDelegate.swift new file mode 100644 index 0000000..7e06b0e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionDelegate.swift @@ -0,0 +1,725 @@ +// +// SessionDelegate.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Responsible for handling all delegate callbacks for the underlying session. +open class SessionDelegate: NSObject { + + // MARK: URLSessionDelegate Overrides + + /// Overrides default behavior for URLSessionDelegate method `urlSession(_:didBecomeInvalidWithError:)`. + open var sessionDidBecomeInvalidWithError: ((URLSession, Error?) -> Void)? + + /// Overrides default behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)`. + open var sessionDidReceiveChallenge: ((URLSession, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? + + /// Overrides all behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)` and requires the caller to call the `completionHandler`. + open var sessionDidReceiveChallengeWithCompletion: ((URLSession, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)? + + /// Overrides default behavior for URLSessionDelegate method `urlSessionDidFinishEvents(forBackgroundURLSession:)`. + open var sessionDidFinishEventsForBackgroundURLSession: ((URLSession) -> Void)? + + // MARK: URLSessionTaskDelegate Overrides + + /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)`. + open var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> URLRequest?)? + + /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` and + /// requires the caller to call the `completionHandler`. + open var taskWillPerformHTTPRedirectionWithCompletion: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest, @escaping (URLRequest?) -> Void) -> Void)? + + /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didReceive:completionHandler:)`. + open var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? + + /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:didReceive:completionHandler:)` and + /// requires the caller to call the `completionHandler`. + open var taskDidReceiveChallengeWithCompletion: ((URLSession, URLSessionTask, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)? + + /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:needNewBodyStream:)`. + open var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> InputStream?)? + + /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:needNewBodyStream:)` and + /// requires the caller to call the `completionHandler`. + open var taskNeedNewBodyStreamWithCompletion: ((URLSession, URLSessionTask, @escaping (InputStream?) -> Void) -> Void)? + + /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)`. + open var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)? + + /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didCompleteWithError:)`. + open var taskDidComplete: ((URLSession, URLSessionTask, Error?) -> Void)? + + // MARK: URLSessionDataDelegate Overrides + + /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:completionHandler:)`. + open var dataTaskDidReceiveResponse: ((URLSession, URLSessionDataTask, URLResponse) -> URLSession.ResponseDisposition)? + + /// Overrides all behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:completionHandler:)` and + /// requires caller to call the `completionHandler`. + open var dataTaskDidReceiveResponseWithCompletion: ((URLSession, URLSessionDataTask, URLResponse, @escaping (URLSession.ResponseDisposition) -> Void) -> Void)? + + /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didBecome:)`. + open var dataTaskDidBecomeDownloadTask: ((URLSession, URLSessionDataTask, URLSessionDownloadTask) -> Void)? + + /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:)`. + open var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)? + + /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)`. + open var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)? + + /// Overrides all behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)` and + /// requires caller to call the `completionHandler`. + open var dataTaskWillCacheResponseWithCompletion: ((URLSession, URLSessionDataTask, CachedURLResponse, @escaping (CachedURLResponse?) -> Void) -> Void)? + + // MARK: URLSessionDownloadDelegate Overrides + + /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didFinishDownloadingTo:)`. + open var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> Void)? + + /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)`. + open var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)? + + /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)`. + open var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)? + + // MARK: URLSessionStreamDelegate Overrides + +#if !os(watchOS) + + /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:readClosedFor:)`. + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + open var streamTaskReadClosed: ((URLSession, URLSessionStreamTask) -> Void)? { + get { + return _streamTaskReadClosed as? (URLSession, URLSessionStreamTask) -> Void + } + set { + _streamTaskReadClosed = newValue + } + } + + /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:writeClosedFor:)`. + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + open var streamTaskWriteClosed: ((URLSession, URLSessionStreamTask) -> Void)? { + get { + return _streamTaskWriteClosed as? (URLSession, URLSessionStreamTask) -> Void + } + set { + _streamTaskWriteClosed = newValue + } + } + + /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:betterRouteDiscoveredFor:)`. + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + open var streamTaskBetterRouteDiscovered: ((URLSession, URLSessionStreamTask) -> Void)? { + get { + return _streamTaskBetterRouteDiscovered as? (URLSession, URLSessionStreamTask) -> Void + } + set { + _streamTaskBetterRouteDiscovered = newValue + } + } + + /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:streamTask:didBecome:outputStream:)`. + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + open var streamTaskDidBecomeInputAndOutputStreams: ((URLSession, URLSessionStreamTask, InputStream, OutputStream) -> Void)? { + get { + return _streamTaskDidBecomeInputStream as? (URLSession, URLSessionStreamTask, InputStream, OutputStream) -> Void + } + set { + _streamTaskDidBecomeInputStream = newValue + } + } + + var _streamTaskReadClosed: Any? + var _streamTaskWriteClosed: Any? + var _streamTaskBetterRouteDiscovered: Any? + var _streamTaskDidBecomeInputStream: Any? + +#endif + + // MARK: Properties + + var retrier: RequestRetrier? + weak var sessionManager: SessionManager? + + private var requests: [Int: Request] = [:] + private let lock = NSLock() + + /// Access the task delegate for the specified task in a thread-safe manner. + open subscript(task: URLSessionTask) -> Request? { + get { + lock.lock() ; defer { lock.unlock() } + return requests[task.taskIdentifier] + } + set { + lock.lock() ; defer { lock.unlock() } + requests[task.taskIdentifier] = newValue + } + } + + // MARK: Lifecycle + + /// Initializes the `SessionDelegate` instance. + /// + /// - returns: The new `SessionDelegate` instance. + public override init() { + super.init() + } + + // MARK: NSObject Overrides + + /// Returns a `Bool` indicating whether the `SessionDelegate` implements or inherits a method that can respond + /// to a specified message. + /// + /// - parameter selector: A selector that identifies a message. + /// + /// - returns: `true` if the receiver implements or inherits a method that can respond to selector, otherwise `false`. + open override func responds(to selector: Selector) -> Bool { + #if !os(macOS) + if selector == #selector(URLSessionDelegate.urlSessionDidFinishEvents(forBackgroundURLSession:)) { + return sessionDidFinishEventsForBackgroundURLSession != nil + } + #endif + + #if !os(watchOS) + if #available(iOS 9.0, macOS 10.11, tvOS 9.0, *) { + switch selector { + case #selector(URLSessionStreamDelegate.urlSession(_:readClosedFor:)): + return streamTaskReadClosed != nil + case #selector(URLSessionStreamDelegate.urlSession(_:writeClosedFor:)): + return streamTaskWriteClosed != nil + case #selector(URLSessionStreamDelegate.urlSession(_:betterRouteDiscoveredFor:)): + return streamTaskBetterRouteDiscovered != nil + case #selector(URLSessionStreamDelegate.urlSession(_:streamTask:didBecome:outputStream:)): + return streamTaskDidBecomeInputAndOutputStreams != nil + default: + break + } + } + #endif + + switch selector { + case #selector(URLSessionDelegate.urlSession(_:didBecomeInvalidWithError:)): + return sessionDidBecomeInvalidWithError != nil + case #selector(URLSessionDelegate.urlSession(_:didReceive:completionHandler:)): + return (sessionDidReceiveChallenge != nil || sessionDidReceiveChallengeWithCompletion != nil) + case #selector(URLSessionTaskDelegate.urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)): + return (taskWillPerformHTTPRedirection != nil || taskWillPerformHTTPRedirectionWithCompletion != nil) + case #selector(URLSessionDataDelegate.urlSession(_:dataTask:didReceive:completionHandler:)): + return (dataTaskDidReceiveResponse != nil || dataTaskDidReceiveResponseWithCompletion != nil) + default: + return type(of: self).instancesRespond(to: selector) + } + } +} + +// MARK: - URLSessionDelegate + +extension SessionDelegate: URLSessionDelegate { + /// Tells the delegate that the session has been invalidated. + /// + /// - parameter session: The session object that was invalidated. + /// - parameter error: The error that caused invalidation, or nil if the invalidation was explicit. + open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { + sessionDidBecomeInvalidWithError?(session, error) + } + + /// Requests credentials from the delegate in response to a session-level authentication request from the + /// remote server. + /// + /// - parameter session: The session containing the task that requested authentication. + /// - parameter challenge: An object that contains the request for authentication. + /// - parameter completionHandler: A handler that your delegate method must call providing the disposition + /// and credential. + open func urlSession( + _ session: URLSession, + didReceive challenge: URLAuthenticationChallenge, + completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + { + guard sessionDidReceiveChallengeWithCompletion == nil else { + sessionDidReceiveChallengeWithCompletion?(session, challenge, completionHandler) + return + } + + var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling + var credential: URLCredential? + + if let sessionDidReceiveChallenge = sessionDidReceiveChallenge { + (disposition, credential) = sessionDidReceiveChallenge(session, challenge) + } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { + let host = challenge.protectionSpace.host + + if + let serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicy(forHost: host), + let serverTrust = challenge.protectionSpace.serverTrust + { + if serverTrustPolicy.evaluate(serverTrust, forHost: host) { + disposition = .useCredential + credential = URLCredential(trust: serverTrust) + } else { + disposition = .cancelAuthenticationChallenge + } + } + } + + completionHandler(disposition, credential) + } + +#if !os(macOS) + + /// Tells the delegate that all messages enqueued for a session have been delivered. + /// + /// - parameter session: The session that no longer has any outstanding requests. + open func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) { + sessionDidFinishEventsForBackgroundURLSession?(session) + } + +#endif +} + +// MARK: - URLSessionTaskDelegate + +extension SessionDelegate: URLSessionTaskDelegate { + /// Tells the delegate that the remote server requested an HTTP redirect. + /// + /// - parameter session: The session containing the task whose request resulted in a redirect. + /// - parameter task: The task whose request resulted in a redirect. + /// - parameter response: An object containing the server’s response to the original request. + /// - parameter request: A URL request object filled out with the new location. + /// - parameter completionHandler: A closure that your handler should call with either the value of the request + /// parameter, a modified URL request object, or NULL to refuse the redirect and + /// return the body of the redirect response. + open func urlSession( + _ session: URLSession, + task: URLSessionTask, + willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest, + completionHandler: @escaping (URLRequest?) -> Void) + { + guard taskWillPerformHTTPRedirectionWithCompletion == nil else { + taskWillPerformHTTPRedirectionWithCompletion?(session, task, response, request, completionHandler) + return + } + + var redirectRequest: URLRequest? = request + + if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection { + redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request) + } + + completionHandler(redirectRequest) + } + + /// Requests credentials from the delegate in response to an authentication request from the remote server. + /// + /// - parameter session: The session containing the task whose request requires authentication. + /// - parameter task: The task whose request requires authentication. + /// - parameter challenge: An object that contains the request for authentication. + /// - parameter completionHandler: A handler that your delegate method must call providing the disposition + /// and credential. + open func urlSession( + _ session: URLSession, + task: URLSessionTask, + didReceive challenge: URLAuthenticationChallenge, + completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + { + guard taskDidReceiveChallengeWithCompletion == nil else { + taskDidReceiveChallengeWithCompletion?(session, task, challenge, completionHandler) + return + } + + if let taskDidReceiveChallenge = taskDidReceiveChallenge { + let result = taskDidReceiveChallenge(session, task, challenge) + completionHandler(result.0, result.1) + } else if let delegate = self[task]?.delegate { + delegate.urlSession( + session, + task: task, + didReceive: challenge, + completionHandler: completionHandler + ) + } else { + urlSession(session, didReceive: challenge, completionHandler: completionHandler) + } + } + + /// Tells the delegate when a task requires a new request body stream to send to the remote server. + /// + /// - parameter session: The session containing the task that needs a new body stream. + /// - parameter task: The task that needs a new body stream. + /// - parameter completionHandler: A completion handler that your delegate method should call with the new body stream. + open func urlSession( + _ session: URLSession, + task: URLSessionTask, + needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) + { + guard taskNeedNewBodyStreamWithCompletion == nil else { + taskNeedNewBodyStreamWithCompletion?(session, task, completionHandler) + return + } + + if let taskNeedNewBodyStream = taskNeedNewBodyStream { + completionHandler(taskNeedNewBodyStream(session, task)) + } else if let delegate = self[task]?.delegate { + delegate.urlSession(session, task: task, needNewBodyStream: completionHandler) + } + } + + /// Periodically informs the delegate of the progress of sending body content to the server. + /// + /// - parameter session: The session containing the data task. + /// - parameter task: The data task. + /// - parameter bytesSent: The number of bytes sent since the last time this delegate method was called. + /// - parameter totalBytesSent: The total number of bytes sent so far. + /// - parameter totalBytesExpectedToSend: The expected length of the body data. + open func urlSession( + _ session: URLSession, + task: URLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) + { + if let taskDidSendBodyData = taskDidSendBodyData { + taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend) + } else if let delegate = self[task]?.delegate as? UploadTaskDelegate { + delegate.URLSession( + session, + task: task, + didSendBodyData: bytesSent, + totalBytesSent: totalBytesSent, + totalBytesExpectedToSend: totalBytesExpectedToSend + ) + } + } + +#if !os(watchOS) + + /// Tells the delegate that the session finished collecting metrics for the task. + /// + /// - parameter session: The session collecting the metrics. + /// - parameter task: The task whose metrics have been collected. + /// - parameter metrics: The collected metrics. + @available(iOS 10.0, macOS 10.12, tvOS 10.0, *) + @objc(URLSession:task:didFinishCollectingMetrics:) + open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) { + self[task]?.delegate.metrics = metrics + } + +#endif + + /// Tells the delegate that the task finished transferring data. + /// + /// - parameter session: The session containing the task whose request finished transferring data. + /// - parameter task: The task whose request finished transferring data. + /// - parameter error: If an error occurred, an error object indicating how the transfer failed, otherwise nil. + open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { + /// Executed after it is determined that the request is not going to be retried + let completeTask: (URLSession, URLSessionTask, Error?) -> Void = { [weak self] session, task, error in + guard let strongSelf = self else { return } + + strongSelf.taskDidComplete?(session, task, error) + + strongSelf[task]?.delegate.urlSession(session, task: task, didCompleteWithError: error) + + var userInfo: [String: Any] = [Notification.Key.Task: task] + + if let data = (strongSelf[task]?.delegate as? DataTaskDelegate)?.data { + userInfo[Notification.Key.ResponseData] = data + } + + NotificationCenter.default.post( + name: Notification.Name.Task.DidComplete, + object: strongSelf, + userInfo: userInfo + ) + + strongSelf[task] = nil + } + + guard let request = self[task], let sessionManager = sessionManager else { + completeTask(session, task, error) + return + } + + // Run all validations on the request before checking if an error occurred + request.validations.forEach { $0() } + + // Determine whether an error has occurred + var error: Error? = error + + if request.delegate.error != nil { + error = request.delegate.error + } + + /// If an error occurred and the retrier is set, asynchronously ask the retrier if the request + /// should be retried. Otherwise, complete the task by notifying the task delegate. + if let retrier = retrier, let error = error { + retrier.should(sessionManager, retry: request, with: error) { [weak self] shouldRetry, timeDelay in + guard shouldRetry else { completeTask(session, task, error) ; return } + + DispatchQueue.utility.after(timeDelay) { [weak self] in + guard let strongSelf = self else { return } + + let retrySucceeded = strongSelf.sessionManager?.retry(request) ?? false + + if retrySucceeded, let task = request.task { + strongSelf[task] = request + return + } else { + completeTask(session, task, error) + } + } + } + } else { + completeTask(session, task, error) + } + } +} + +// MARK: - URLSessionDataDelegate + +extension SessionDelegate: URLSessionDataDelegate { + /// Tells the delegate that the data task received the initial reply (headers) from the server. + /// + /// - parameter session: The session containing the data task that received an initial reply. + /// - parameter dataTask: The data task that received an initial reply. + /// - parameter response: A URL response object populated with headers. + /// - parameter completionHandler: A completion handler that your code calls to continue the transfer, passing a + /// constant to indicate whether the transfer should continue as a data task or + /// should become a download task. + open func urlSession( + _ session: URLSession, + dataTask: URLSessionDataTask, + didReceive response: URLResponse, + completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) + { + guard dataTaskDidReceiveResponseWithCompletion == nil else { + dataTaskDidReceiveResponseWithCompletion?(session, dataTask, response, completionHandler) + return + } + + var disposition: URLSession.ResponseDisposition = .allow + + if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse { + disposition = dataTaskDidReceiveResponse(session, dataTask, response) + } + + completionHandler(disposition) + } + + /// Tells the delegate that the data task was changed to a download task. + /// + /// - parameter session: The session containing the task that was replaced by a download task. + /// - parameter dataTask: The data task that was replaced by a download task. + /// - parameter downloadTask: The new download task that replaced the data task. + open func urlSession( + _ session: URLSession, + dataTask: URLSessionDataTask, + didBecome downloadTask: URLSessionDownloadTask) + { + if let dataTaskDidBecomeDownloadTask = dataTaskDidBecomeDownloadTask { + dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask) + } else { + self[downloadTask]?.delegate = DownloadTaskDelegate(task: downloadTask) + } + } + + /// Tells the delegate that the data task has received some of the expected data. + /// + /// - parameter session: The session containing the data task that provided data. + /// - parameter dataTask: The data task that provided data. + /// - parameter data: A data object containing the transferred data. + open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { + if let dataTaskDidReceiveData = dataTaskDidReceiveData { + dataTaskDidReceiveData(session, dataTask, data) + } else if let delegate = self[dataTask]?.delegate as? DataTaskDelegate { + delegate.urlSession(session, dataTask: dataTask, didReceive: data) + } + } + + /// Asks the delegate whether the data (or upload) task should store the response in the cache. + /// + /// - parameter session: The session containing the data (or upload) task. + /// - parameter dataTask: The data (or upload) task. + /// - parameter proposedResponse: The default caching behavior. This behavior is determined based on the current + /// caching policy and the values of certain received headers, such as the Pragma + /// and Cache-Control headers. + /// - parameter completionHandler: A block that your handler must call, providing either the original proposed + /// response, a modified version of that response, or NULL to prevent caching the + /// response. If your delegate implements this method, it must call this completion + /// handler; otherwise, your app leaks memory. + open func urlSession( + _ session: URLSession, + dataTask: URLSessionDataTask, + willCacheResponse proposedResponse: CachedURLResponse, + completionHandler: @escaping (CachedURLResponse?) -> Void) + { + guard dataTaskWillCacheResponseWithCompletion == nil else { + dataTaskWillCacheResponseWithCompletion?(session, dataTask, proposedResponse, completionHandler) + return + } + + if let dataTaskWillCacheResponse = dataTaskWillCacheResponse { + completionHandler(dataTaskWillCacheResponse(session, dataTask, proposedResponse)) + } else if let delegate = self[dataTask]?.delegate as? DataTaskDelegate { + delegate.urlSession( + session, + dataTask: dataTask, + willCacheResponse: proposedResponse, + completionHandler: completionHandler + ) + } else { + completionHandler(proposedResponse) + } + } +} + +// MARK: - URLSessionDownloadDelegate + +extension SessionDelegate: URLSessionDownloadDelegate { + /// Tells the delegate that a download task has finished downloading. + /// + /// - parameter session: The session containing the download task that finished. + /// - parameter downloadTask: The download task that finished. + /// - parameter location: A file URL for the temporary file. Because the file is temporary, you must either + /// open the file for reading or move it to a permanent location in your app’s sandbox + /// container directory before returning from this delegate method. + open func urlSession( + _ session: URLSession, + downloadTask: URLSessionDownloadTask, + didFinishDownloadingTo location: URL) + { + if let downloadTaskDidFinishDownloadingToURL = downloadTaskDidFinishDownloadingToURL { + downloadTaskDidFinishDownloadingToURL(session, downloadTask, location) + } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate { + delegate.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) + } + } + + /// Periodically informs the delegate about the download’s progress. + /// + /// - parameter session: The session containing the download task. + /// - parameter downloadTask: The download task. + /// - parameter bytesWritten: The number of bytes transferred since the last time this delegate + /// method was called. + /// - parameter totalBytesWritten: The total number of bytes transferred so far. + /// - parameter totalBytesExpectedToWrite: The expected length of the file, as provided by the Content-Length + /// header. If this header was not provided, the value is + /// `NSURLSessionTransferSizeUnknown`. + open func urlSession( + _ session: URLSession, + downloadTask: URLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) + { + if let downloadTaskDidWriteData = downloadTaskDidWriteData { + downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) + } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate { + delegate.urlSession( + session, + downloadTask: downloadTask, + didWriteData: bytesWritten, + totalBytesWritten: totalBytesWritten, + totalBytesExpectedToWrite: totalBytesExpectedToWrite + ) + } + } + + /// Tells the delegate that the download task has resumed downloading. + /// + /// - parameter session: The session containing the download task that finished. + /// - parameter downloadTask: The download task that resumed. See explanation in the discussion. + /// - parameter fileOffset: If the file's cache policy or last modified date prevents reuse of the + /// existing content, then this value is zero. Otherwise, this value is an + /// integer representing the number of bytes on disk that do not need to be + /// retrieved again. + /// - parameter expectedTotalBytes: The expected length of the file, as provided by the Content-Length header. + /// If this header was not provided, the value is NSURLSessionTransferSizeUnknown. + open func urlSession( + _ session: URLSession, + downloadTask: URLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) + { + if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset { + downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes) + } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate { + delegate.urlSession( + session, + downloadTask: downloadTask, + didResumeAtOffset: fileOffset, + expectedTotalBytes: expectedTotalBytes + ) + } + } +} + +// MARK: - URLSessionStreamDelegate + +#if !os(watchOS) + +@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) +extension SessionDelegate: URLSessionStreamDelegate { + /// Tells the delegate that the read side of the connection has been closed. + /// + /// - parameter session: The session. + /// - parameter streamTask: The stream task. + open func urlSession(_ session: URLSession, readClosedFor streamTask: URLSessionStreamTask) { + streamTaskReadClosed?(session, streamTask) + } + + /// Tells the delegate that the write side of the connection has been closed. + /// + /// - parameter session: The session. + /// - parameter streamTask: The stream task. + open func urlSession(_ session: URLSession, writeClosedFor streamTask: URLSessionStreamTask) { + streamTaskWriteClosed?(session, streamTask) + } + + /// Tells the delegate that the system has determined that a better route to the host is available. + /// + /// - parameter session: The session. + /// - parameter streamTask: The stream task. + open func urlSession(_ session: URLSession, betterRouteDiscoveredFor streamTask: URLSessionStreamTask) { + streamTaskBetterRouteDiscovered?(session, streamTask) + } + + /// Tells the delegate that the stream task has been completed and provides the unopened stream objects. + /// + /// - parameter session: The session. + /// - parameter streamTask: The stream task. + /// - parameter inputStream: The new input stream. + /// - parameter outputStream: The new output stream. + open func urlSession( + _ session: URLSession, + streamTask: URLSessionStreamTask, + didBecome inputStream: InputStream, + outputStream: OutputStream) + { + streamTaskDidBecomeInputAndOutputStreams?(session, streamTask, inputStream, outputStream) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionManager.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionManager.swift new file mode 100644 index 0000000..321672f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/SessionManager.swift @@ -0,0 +1,892 @@ +// +// SessionManager.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Responsible for creating and managing `Request` objects, as well as their underlying `NSURLSession`. +open class SessionManager { + + // MARK: - Helper Types + + /// Defines whether the `MultipartFormData` encoding was successful and contains result of the encoding as + /// associated values. + /// + /// - Success: Represents a successful `MultipartFormData` encoding and contains the new `UploadRequest` along with + /// streaming information. + /// - Failure: Used to represent a failure in the `MultipartFormData` encoding and also contains the encoding + /// error. + public enum MultipartFormDataEncodingResult { + case success(request: UploadRequest, streamingFromDisk: Bool, streamFileURL: URL?) + case failure(Error) + } + + // MARK: - Properties + + /// A default instance of `SessionManager`, used by top-level Alamofire request methods, and suitable for use + /// directly for any ad hoc requests. + open static let `default`: SessionManager = { + let configuration = URLSessionConfiguration.default + configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders + + return SessionManager(configuration: configuration) + }() + + /// Creates default values for the "Accept-Encoding", "Accept-Language" and "User-Agent" headers. + open static let defaultHTTPHeaders: HTTPHeaders = { + // Accept-Encoding HTTP Header; see https://tools.ietf.org/html/rfc7230#section-4.2.3 + let acceptEncoding: String = "gzip;q=1.0, compress;q=0.5" + + // Accept-Language HTTP Header; see https://tools.ietf.org/html/rfc7231#section-5.3.5 + let acceptLanguage = Locale.preferredLanguages.prefix(6).enumerated().map { index, languageCode in + let quality = 1.0 - (Double(index) * 0.1) + return "\(languageCode);q=\(quality)" + }.joined(separator: ", ") + + // User-Agent Header; see https://tools.ietf.org/html/rfc7231#section-5.5.3 + // Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 10.0.0) Alamofire/4.0.0` + let userAgent: String = { + if let info = Bundle.main.infoDictionary { + let executable = info[kCFBundleExecutableKey as String] as? String ?? "Unknown" + let bundle = info[kCFBundleIdentifierKey as String] as? String ?? "Unknown" + let appVersion = info["CFBundleShortVersionString"] as? String ?? "Unknown" + let appBuild = info[kCFBundleVersionKey as String] as? String ?? "Unknown" + + let osNameVersion: String = { + let version = ProcessInfo.processInfo.operatingSystemVersion + let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)" + + let osName: String = { + #if os(iOS) + return "iOS" + #elseif os(watchOS) + return "watchOS" + #elseif os(tvOS) + return "tvOS" + #elseif os(macOS) + return "OS X" + #elseif os(Linux) + return "Linux" + #else + return "Unknown" + #endif + }() + + return "\(osName) \(versionString)" + }() + + let alamofireVersion: String = { + guard + let afInfo = Bundle(for: SessionManager.self).infoDictionary, + let build = afInfo["CFBundleShortVersionString"] + else { return "Unknown" } + + return "Alamofire/\(build)" + }() + + return "\(executable)/\(appVersion) (\(bundle); build:\(appBuild); \(osNameVersion)) \(alamofireVersion)" + } + + return "Alamofire" + }() + + return [ + "Accept-Encoding": acceptEncoding, + "Accept-Language": acceptLanguage, + "User-Agent": userAgent + ] + }() + + /// Default memory threshold used when encoding `MultipartFormData` in bytes. + open static let multipartFormDataEncodingMemoryThreshold: UInt64 = 10_000_000 + + /// The underlying session. + open let session: URLSession + + /// The session delegate handling all the task and session delegate callbacks. + open let delegate: SessionDelegate + + /// Whether to start requests immediately after being constructed. `true` by default. + open var startRequestsImmediately: Bool = true + + /// The request adapter called each time a new request is created. + open var adapter: RequestAdapter? + + /// The request retrier called each time a request encounters an error to determine whether to retry the request. + open var retrier: RequestRetrier? { + get { return delegate.retrier } + set { delegate.retrier = newValue } + } + + /// The background completion handler closure provided by the UIApplicationDelegate + /// `application:handleEventsForBackgroundURLSession:completionHandler:` method. By setting the background + /// completion handler, the SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` closure implementation + /// will automatically call the handler. + /// + /// If you need to handle your own events before the handler is called, then you need to override the + /// SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` and manually call the handler when finished. + /// + /// `nil` by default. + open var backgroundCompletionHandler: (() -> Void)? + + let queue = DispatchQueue(label: "org.alamofire.session-manager." + UUID().uuidString) + + // MARK: - Lifecycle + + /// Creates an instance with the specified `configuration`, `delegate` and `serverTrustPolicyManager`. + /// + /// - parameter configuration: The configuration used to construct the managed session. + /// `URLSessionConfiguration.default` by default. + /// - parameter delegate: The delegate used when initializing the session. `SessionDelegate()` by + /// default. + /// - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust + /// challenges. `nil` by default. + /// + /// - returns: The new `SessionManager` instance. + public init( + configuration: URLSessionConfiguration = URLSessionConfiguration.default, + delegate: SessionDelegate = SessionDelegate(), + serverTrustPolicyManager: ServerTrustPolicyManager? = nil) + { + self.delegate = delegate + self.session = URLSession(configuration: configuration, delegate: delegate, delegateQueue: nil) + + commonInit(serverTrustPolicyManager: serverTrustPolicyManager) + } + + /// Creates an instance with the specified `session`, `delegate` and `serverTrustPolicyManager`. + /// + /// - parameter session: The URL session. + /// - parameter delegate: The delegate of the URL session. Must equal the URL session's delegate. + /// - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust + /// challenges. `nil` by default. + /// + /// - returns: The new `SessionManager` instance if the URL session's delegate matches; `nil` otherwise. + public init?( + session: URLSession, + delegate: SessionDelegate, + serverTrustPolicyManager: ServerTrustPolicyManager? = nil) + { + guard delegate === session.delegate else { return nil } + + self.delegate = delegate + self.session = session + + commonInit(serverTrustPolicyManager: serverTrustPolicyManager) + } + + private func commonInit(serverTrustPolicyManager: ServerTrustPolicyManager?) { + session.serverTrustPolicyManager = serverTrustPolicyManager + + delegate.sessionManager = self + + delegate.sessionDidFinishEventsForBackgroundURLSession = { [weak self] session in + guard let strongSelf = self else { return } + DispatchQueue.main.async { strongSelf.backgroundCompletionHandler?() } + } + } + + deinit { + session.invalidateAndCancel() + } + + // MARK: - Data Request + + /// Creates a `DataRequest` to retrieve the contents of the specified `url`, `method`, `parameters`, `encoding` + /// and `headers`. + /// + /// - parameter url: The URL. + /// - parameter method: The HTTP method. `.get` by default. + /// - parameter parameters: The parameters. `nil` by default. + /// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + /// - parameter headers: The HTTP headers. `nil` by default. + /// + /// - returns: The created `DataRequest`. + @discardableResult + open func request( + _ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil) + -> DataRequest + { + var originalRequest: URLRequest? + + do { + originalRequest = try URLRequest(url: url, method: method, headers: headers) + let encodedURLRequest = try encoding.encode(originalRequest!, with: parameters) + return request(encodedURLRequest) + } catch { + return request(originalRequest, failedWith: error) + } + } + + /// Creates a `DataRequest` to retrieve the contents of a URL based on the specified `urlRequest`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter urlRequest: The URL request. + /// + /// - returns: The created `DataRequest`. + @discardableResult + open func request(_ urlRequest: URLRequestConvertible) -> DataRequest { + var originalRequest: URLRequest? + + do { + originalRequest = try urlRequest.asURLRequest() + let originalTask = DataRequest.Requestable(urlRequest: originalRequest!) + + let task = try originalTask.task(session: session, adapter: adapter, queue: queue) + let request = DataRequest(session: session, requestTask: .data(originalTask, task)) + + delegate[task] = request + + if startRequestsImmediately { request.resume() } + + return request + } catch { + return request(originalRequest, failedWith: error) + } + } + + // MARK: Private - Request Implementation + + private func request(_ urlRequest: URLRequest?, failedWith error: Error) -> DataRequest { + var requestTask: Request.RequestTask = .data(nil, nil) + + if let urlRequest = urlRequest { + let originalTask = DataRequest.Requestable(urlRequest: urlRequest) + requestTask = .data(originalTask, nil) + } + + let underlyingError = error.underlyingAdaptError ?? error + let request = DataRequest(session: session, requestTask: requestTask, error: underlyingError) + + if let retrier = retrier, error is AdaptError { + allowRetrier(retrier, toRetry: request, with: underlyingError) + } else { + if startRequestsImmediately { request.resume() } + } + + return request + } + + // MARK: - Download Request + + // MARK: URL Request + + /// Creates a `DownloadRequest` to retrieve the contents the specified `url`, `method`, `parameters`, `encoding`, + /// `headers` and save them to the `destination`. + /// + /// If `destination` is not specified, the contents will remain in the temporary location determined by the + /// underlying URL session. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter url: The URL. + /// - parameter method: The HTTP method. `.get` by default. + /// - parameter parameters: The parameters. `nil` by default. + /// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + /// - parameter headers: The HTTP headers. `nil` by default. + /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. + /// + /// - returns: The created `DownloadRequest`. + @discardableResult + open func download( + _ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil, + to destination: DownloadRequest.DownloadFileDestination? = nil) + -> DownloadRequest + { + do { + let urlRequest = try URLRequest(url: url, method: method, headers: headers) + let encodedURLRequest = try encoding.encode(urlRequest, with: parameters) + return download(encodedURLRequest, to: destination) + } catch { + return download(nil, to: destination, failedWith: error) + } + } + + /// Creates a `DownloadRequest` to retrieve the contents of a URL based on the specified `urlRequest` and save + /// them to the `destination`. + /// + /// If `destination` is not specified, the contents will remain in the temporary location determined by the + /// underlying URL session. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter urlRequest: The URL request + /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. + /// + /// - returns: The created `DownloadRequest`. + @discardableResult + open func download( + _ urlRequest: URLRequestConvertible, + to destination: DownloadRequest.DownloadFileDestination? = nil) + -> DownloadRequest + { + do { + let urlRequest = try urlRequest.asURLRequest() + return download(.request(urlRequest), to: destination) + } catch { + return download(nil, to: destination, failedWith: error) + } + } + + // MARK: Resume Data + + /// Creates a `DownloadRequest` from the `resumeData` produced from a previous request cancellation to retrieve + /// the contents of the original request and save them to the `destination`. + /// + /// If `destination` is not specified, the contents will remain in the temporary location determined by the + /// underlying URL session. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), `resumeData` is broken + /// on background URL session configurations. There's an underlying bug in the `resumeData` generation logic where the + /// data is written incorrectly and will always fail to resume the download. For more information about the bug and + /// possible workarounds, please refer to the following Stack Overflow post: + /// + /// - http://stackoverflow.com/a/39347461/1342462 + /// + /// - parameter resumeData: The resume data. This is an opaque data blob produced by `URLSessionDownloadTask` + /// when a task is cancelled. See `URLSession -downloadTask(withResumeData:)` for + /// additional information. + /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. + /// + /// - returns: The created `DownloadRequest`. + @discardableResult + open func download( + resumingWith resumeData: Data, + to destination: DownloadRequest.DownloadFileDestination? = nil) + -> DownloadRequest + { + return download(.resumeData(resumeData), to: destination) + } + + // MARK: Private - Download Implementation + + private func download( + _ downloadable: DownloadRequest.Downloadable, + to destination: DownloadRequest.DownloadFileDestination?) + -> DownloadRequest + { + do { + let task = try downloadable.task(session: session, adapter: adapter, queue: queue) + let download = DownloadRequest(session: session, requestTask: .download(downloadable, task)) + + download.downloadDelegate.destination = destination + + delegate[task] = download + + if startRequestsImmediately { download.resume() } + + return download + } catch { + return download(downloadable, to: destination, failedWith: error) + } + } + + private func download( + _ downloadable: DownloadRequest.Downloadable?, + to destination: DownloadRequest.DownloadFileDestination?, + failedWith error: Error) + -> DownloadRequest + { + var downloadTask: Request.RequestTask = .download(nil, nil) + + if let downloadable = downloadable { + downloadTask = .download(downloadable, nil) + } + + let underlyingError = error.underlyingAdaptError ?? error + + let download = DownloadRequest(session: session, requestTask: downloadTask, error: underlyingError) + download.downloadDelegate.destination = destination + + if let retrier = retrier, error is AdaptError { + allowRetrier(retrier, toRetry: download, with: underlyingError) + } else { + if startRequestsImmediately { download.resume() } + } + + return download + } + + // MARK: - Upload Request + + // MARK: File + + /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `file`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter file: The file to upload. + /// - parameter url: The URL. + /// - parameter method: The HTTP method. `.post` by default. + /// - parameter headers: The HTTP headers. `nil` by default. + /// + /// - returns: The created `UploadRequest`. + @discardableResult + open func upload( + _ fileURL: URL, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil) + -> UploadRequest + { + do { + let urlRequest = try URLRequest(url: url, method: method, headers: headers) + return upload(fileURL, with: urlRequest) + } catch { + return upload(nil, failedWith: error) + } + } + + /// Creates a `UploadRequest` from the specified `urlRequest` for uploading the `file`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter file: The file to upload. + /// - parameter urlRequest: The URL request. + /// + /// - returns: The created `UploadRequest`. + @discardableResult + open func upload(_ fileURL: URL, with urlRequest: URLRequestConvertible) -> UploadRequest { + do { + let urlRequest = try urlRequest.asURLRequest() + return upload(.file(fileURL, urlRequest)) + } catch { + return upload(nil, failedWith: error) + } + } + + // MARK: Data + + /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `data`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter data: The data to upload. + /// - parameter url: The URL. + /// - parameter method: The HTTP method. `.post` by default. + /// - parameter headers: The HTTP headers. `nil` by default. + /// + /// - returns: The created `UploadRequest`. + @discardableResult + open func upload( + _ data: Data, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil) + -> UploadRequest + { + do { + let urlRequest = try URLRequest(url: url, method: method, headers: headers) + return upload(data, with: urlRequest) + } catch { + return upload(nil, failedWith: error) + } + } + + /// Creates an `UploadRequest` from the specified `urlRequest` for uploading the `data`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter data: The data to upload. + /// - parameter urlRequest: The URL request. + /// + /// - returns: The created `UploadRequest`. + @discardableResult + open func upload(_ data: Data, with urlRequest: URLRequestConvertible) -> UploadRequest { + do { + let urlRequest = try urlRequest.asURLRequest() + return upload(.data(data, urlRequest)) + } catch { + return upload(nil, failedWith: error) + } + } + + // MARK: InputStream + + /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `stream`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter stream: The stream to upload. + /// - parameter url: The URL. + /// - parameter method: The HTTP method. `.post` by default. + /// - parameter headers: The HTTP headers. `nil` by default. + /// + /// - returns: The created `UploadRequest`. + @discardableResult + open func upload( + _ stream: InputStream, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil) + -> UploadRequest + { + do { + let urlRequest = try URLRequest(url: url, method: method, headers: headers) + return upload(stream, with: urlRequest) + } catch { + return upload(nil, failedWith: error) + } + } + + /// Creates an `UploadRequest` from the specified `urlRequest` for uploading the `stream`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter stream: The stream to upload. + /// - parameter urlRequest: The URL request. + /// + /// - returns: The created `UploadRequest`. + @discardableResult + open func upload(_ stream: InputStream, with urlRequest: URLRequestConvertible) -> UploadRequest { + do { + let urlRequest = try urlRequest.asURLRequest() + return upload(.stream(stream, urlRequest)) + } catch { + return upload(nil, failedWith: error) + } + } + + // MARK: MultipartFormData + + /// Encodes `multipartFormData` using `encodingMemoryThreshold` and calls `encodingCompletion` with new + /// `UploadRequest` using the `url`, `method` and `headers`. + /// + /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative + /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most + /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to + /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory + /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be + /// used for larger payloads such as video content. + /// + /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory + /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, + /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk + /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding + /// technique was used. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. + /// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. + /// `multipartFormDataEncodingMemoryThreshold` by default. + /// - parameter url: The URL. + /// - parameter method: The HTTP method. `.post` by default. + /// - parameter headers: The HTTP headers. `nil` by default. + /// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. + open func upload( + multipartFormData: @escaping (MultipartFormData) -> Void, + usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?) + { + do { + let urlRequest = try URLRequest(url: url, method: method, headers: headers) + + return upload( + multipartFormData: multipartFormData, + usingThreshold: encodingMemoryThreshold, + with: urlRequest, + encodingCompletion: encodingCompletion + ) + } catch { + DispatchQueue.main.async { encodingCompletion?(.failure(error)) } + } + } + + /// Encodes `multipartFormData` using `encodingMemoryThreshold` and calls `encodingCompletion` with new + /// `UploadRequest` using the `urlRequest`. + /// + /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative + /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most + /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to + /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory + /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be + /// used for larger payloads such as video content. + /// + /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory + /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, + /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk + /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding + /// technique was used. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. + /// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. + /// `multipartFormDataEncodingMemoryThreshold` by default. + /// - parameter urlRequest: The URL request. + /// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. + open func upload( + multipartFormData: @escaping (MultipartFormData) -> Void, + usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, + with urlRequest: URLRequestConvertible, + encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?) + { + DispatchQueue.global(qos: .utility).async { + let formData = MultipartFormData() + multipartFormData(formData) + + var tempFileURL: URL? + + do { + var urlRequestWithContentType = try urlRequest.asURLRequest() + urlRequestWithContentType.setValue(formData.contentType, forHTTPHeaderField: "Content-Type") + + let isBackgroundSession = self.session.configuration.identifier != nil + + if formData.contentLength < encodingMemoryThreshold && !isBackgroundSession { + let data = try formData.encode() + + let encodingResult = MultipartFormDataEncodingResult.success( + request: self.upload(data, with: urlRequestWithContentType), + streamingFromDisk: false, + streamFileURL: nil + ) + + DispatchQueue.main.async { encodingCompletion?(encodingResult) } + } else { + let fileManager = FileManager.default + let tempDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory()) + let directoryURL = tempDirectoryURL.appendingPathComponent("org.alamofire.manager/multipart.form.data") + let fileName = UUID().uuidString + let fileURL = directoryURL.appendingPathComponent(fileName) + + tempFileURL = fileURL + + var directoryError: Error? + + // Create directory inside serial queue to ensure two threads don't do this in parallel + self.queue.sync { + do { + try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil) + } catch { + directoryError = error + } + } + + if let directoryError = directoryError { throw directoryError } + + try formData.writeEncodedData(to: fileURL) + + let upload = self.upload(fileURL, with: urlRequestWithContentType) + + // Cleanup the temp file once the upload is complete + upload.delegate.queue.addOperation { + do { + try FileManager.default.removeItem(at: fileURL) + } catch { + // No-op + } + } + + DispatchQueue.main.async { + let encodingResult = MultipartFormDataEncodingResult.success( + request: upload, + streamingFromDisk: true, + streamFileURL: fileURL + ) + + encodingCompletion?(encodingResult) + } + } + } catch { + // Cleanup the temp file in the event that the multipart form data encoding failed + if let tempFileURL = tempFileURL { + do { + try FileManager.default.removeItem(at: tempFileURL) + } catch { + // No-op + } + } + + DispatchQueue.main.async { encodingCompletion?(.failure(error)) } + } + } + } + + // MARK: Private - Upload Implementation + + private func upload(_ uploadable: UploadRequest.Uploadable) -> UploadRequest { + do { + let task = try uploadable.task(session: session, adapter: adapter, queue: queue) + let upload = UploadRequest(session: session, requestTask: .upload(uploadable, task)) + + if case let .stream(inputStream, _) = uploadable { + upload.delegate.taskNeedNewBodyStream = { _, _ in inputStream } + } + + delegate[task] = upload + + if startRequestsImmediately { upload.resume() } + + return upload + } catch { + return upload(uploadable, failedWith: error) + } + } + + private func upload(_ uploadable: UploadRequest.Uploadable?, failedWith error: Error) -> UploadRequest { + var uploadTask: Request.RequestTask = .upload(nil, nil) + + if let uploadable = uploadable { + uploadTask = .upload(uploadable, nil) + } + + let underlyingError = error.underlyingAdaptError ?? error + let upload = UploadRequest(session: session, requestTask: uploadTask, error: underlyingError) + + if let retrier = retrier, error is AdaptError { + allowRetrier(retrier, toRetry: upload, with: underlyingError) + } else { + if startRequestsImmediately { upload.resume() } + } + + return upload + } + +#if !os(watchOS) + + // MARK: - Stream Request + + // MARK: Hostname and Port + + /// Creates a `StreamRequest` for bidirectional streaming using the `hostname` and `port`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter hostName: The hostname of the server to connect to. + /// - parameter port: The port of the server to connect to. + /// + /// - returns: The created `StreamRequest`. + @discardableResult + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + open func stream(withHostName hostName: String, port: Int) -> StreamRequest { + return stream(.stream(hostName: hostName, port: port)) + } + + // MARK: NetService + + /// Creates a `StreamRequest` for bidirectional streaming using the `netService`. + /// + /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + /// + /// - parameter netService: The net service used to identify the endpoint. + /// + /// - returns: The created `StreamRequest`. + @discardableResult + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + open func stream(with netService: NetService) -> StreamRequest { + return stream(.netService(netService)) + } + + // MARK: Private - Stream Implementation + + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + private func stream(_ streamable: StreamRequest.Streamable) -> StreamRequest { + do { + let task = try streamable.task(session: session, adapter: adapter, queue: queue) + let request = StreamRequest(session: session, requestTask: .stream(streamable, task)) + + delegate[task] = request + + if startRequestsImmediately { request.resume() } + + return request + } catch { + return stream(failedWith: error) + } + } + + @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) + private func stream(failedWith error: Error) -> StreamRequest { + let stream = StreamRequest(session: session, requestTask: .stream(nil, nil), error: error) + if startRequestsImmediately { stream.resume() } + return stream + } + +#endif + + // MARK: - Internal - Retry Request + + func retry(_ request: Request) -> Bool { + guard let originalTask = request.originalTask else { return false } + + do { + let task = try originalTask.task(session: session, adapter: adapter, queue: queue) + + request.delegate.task = task // resets all task delegate data + + request.retryCount += 1 + request.startTime = CFAbsoluteTimeGetCurrent() + request.endTime = nil + + task.resume() + + return true + } catch { + request.delegate.error = error.underlyingAdaptError ?? error + return false + } + } + + private func allowRetrier(_ retrier: RequestRetrier, toRetry request: Request, with error: Error) { + DispatchQueue.utility.async { [weak self] in + guard let strongSelf = self else { return } + + retrier.should(strongSelf, retry: request, with: error) { shouldRetry, timeDelay in + guard let strongSelf = self else { return } + + guard shouldRetry else { + if strongSelf.startRequestsImmediately { request.resume() } + return + } + + DispatchQueue.utility.after(timeDelay) { + guard let strongSelf = self else { return } + + let retrySucceeded = strongSelf.retry(request) + + if retrySucceeded, let task = request.task { + strongSelf.delegate[task] = request + } else { + if strongSelf.startRequestsImmediately { request.resume() } + } + } + } + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/TaskDelegate.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/TaskDelegate.swift new file mode 100644 index 0000000..1d537ea --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/TaskDelegate.swift @@ -0,0 +1,466 @@ +// +// TaskDelegate.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// The task delegate is responsible for handling all delegate callbacks for the underlying task as well as +/// executing all operations attached to the serial operation queue upon task completion. +open class TaskDelegate: NSObject { + + // MARK: Properties + + /// The serial operation queue used to execute all operations after the task completes. + open let queue: OperationQueue + + /// The data returned by the server. + public var data: Data? { return nil } + + /// The error generated throughout the lifecyle of the task. + public var error: Error? + + var task: URLSessionTask? { + set { + taskLock.lock(); defer { taskLock.unlock() } + _task = newValue + } + get { + taskLock.lock(); defer { taskLock.unlock() } + return _task + } + } + + var initialResponseTime: CFAbsoluteTime? + var credential: URLCredential? + var metrics: AnyObject? // URLSessionTaskMetrics + + private var _task: URLSessionTask? { + didSet { reset() } + } + + private let taskLock = NSLock() + + // MARK: Lifecycle + + init(task: URLSessionTask?) { + _task = task + + self.queue = { + let operationQueue = OperationQueue() + + operationQueue.maxConcurrentOperationCount = 1 + operationQueue.isSuspended = true + operationQueue.qualityOfService = .utility + + return operationQueue + }() + } + + func reset() { + error = nil + initialResponseTime = nil + } + + // MARK: URLSessionTaskDelegate + + var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> URLRequest?)? + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? + var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> InputStream?)? + var taskDidCompleteWithError: ((URLSession, URLSessionTask, Error?) -> Void)? + + @objc(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:) + func urlSession( + _ session: URLSession, + task: URLSessionTask, + willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest, + completionHandler: @escaping (URLRequest?) -> Void) + { + var redirectRequest: URLRequest? = request + + if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection { + redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request) + } + + completionHandler(redirectRequest) + } + + @objc(URLSession:task:didReceiveChallenge:completionHandler:) + func urlSession( + _ session: URLSession, + task: URLSessionTask, + didReceive challenge: URLAuthenticationChallenge, + completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + { + var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling + var credential: URLCredential? + + if let taskDidReceiveChallenge = taskDidReceiveChallenge { + (disposition, credential) = taskDidReceiveChallenge(session, task, challenge) + } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { + let host = challenge.protectionSpace.host + + if + let serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicy(forHost: host), + let serverTrust = challenge.protectionSpace.serverTrust + { + if serverTrustPolicy.evaluate(serverTrust, forHost: host) { + disposition = .useCredential + credential = URLCredential(trust: serverTrust) + } else { + disposition = .cancelAuthenticationChallenge + } + } + } else { + if challenge.previousFailureCount > 0 { + disposition = .rejectProtectionSpace + } else { + credential = self.credential ?? session.configuration.urlCredentialStorage?.defaultCredential(for: challenge.protectionSpace) + + if credential != nil { + disposition = .useCredential + } + } + } + + completionHandler(disposition, credential) + } + + @objc(URLSession:task:needNewBodyStream:) + func urlSession( + _ session: URLSession, + task: URLSessionTask, + needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) + { + var bodyStream: InputStream? + + if let taskNeedNewBodyStream = taskNeedNewBodyStream { + bodyStream = taskNeedNewBodyStream(session, task) + } + + completionHandler(bodyStream) + } + + @objc(URLSession:task:didCompleteWithError:) + func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { + if let taskDidCompleteWithError = taskDidCompleteWithError { + taskDidCompleteWithError(session, task, error) + } else { + if let error = error { + if self.error == nil { self.error = error } + + if + let downloadDelegate = self as? DownloadTaskDelegate, + let resumeData = (error as NSError).userInfo[NSURLSessionDownloadTaskResumeData] as? Data + { + downloadDelegate.resumeData = resumeData + } + } + + queue.isSuspended = false + } + } +} + +// MARK: - + +class DataTaskDelegate: TaskDelegate, URLSessionDataDelegate { + + // MARK: Properties + + var dataTask: URLSessionDataTask { return task as! URLSessionDataTask } + + override var data: Data? { + if dataStream != nil { + return nil + } else { + return mutableData + } + } + + var progress: Progress + var progressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)? + + var dataStream: ((_ data: Data) -> Void)? + + private var totalBytesReceived: Int64 = 0 + private var mutableData: Data + + private var expectedContentLength: Int64? + + // MARK: Lifecycle + + override init(task: URLSessionTask?) { + mutableData = Data() + progress = Progress(totalUnitCount: 0) + + super.init(task: task) + } + + override func reset() { + super.reset() + + progress = Progress(totalUnitCount: 0) + totalBytesReceived = 0 + mutableData = Data() + expectedContentLength = nil + } + + // MARK: URLSessionDataDelegate + + var dataTaskDidReceiveResponse: ((URLSession, URLSessionDataTask, URLResponse) -> URLSession.ResponseDisposition)? + var dataTaskDidBecomeDownloadTask: ((URLSession, URLSessionDataTask, URLSessionDownloadTask) -> Void)? + var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)? + var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)? + + func urlSession( + _ session: URLSession, + dataTask: URLSessionDataTask, + didReceive response: URLResponse, + completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) + { + var disposition: URLSession.ResponseDisposition = .allow + + expectedContentLength = response.expectedContentLength + + if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse { + disposition = dataTaskDidReceiveResponse(session, dataTask, response) + } + + completionHandler(disposition) + } + + func urlSession( + _ session: URLSession, + dataTask: URLSessionDataTask, + didBecome downloadTask: URLSessionDownloadTask) + { + dataTaskDidBecomeDownloadTask?(session, dataTask, downloadTask) + } + + func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { + if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } + + if let dataTaskDidReceiveData = dataTaskDidReceiveData { + dataTaskDidReceiveData(session, dataTask, data) + } else { + if let dataStream = dataStream { + dataStream(data) + } else { + mutableData.append(data) + } + + let bytesReceived = Int64(data.count) + totalBytesReceived += bytesReceived + let totalBytesExpected = dataTask.response?.expectedContentLength ?? NSURLSessionTransferSizeUnknown + + progress.totalUnitCount = totalBytesExpected + progress.completedUnitCount = totalBytesReceived + + if let progressHandler = progressHandler { + progressHandler.queue.async { progressHandler.closure(self.progress) } + } + } + } + + func urlSession( + _ session: URLSession, + dataTask: URLSessionDataTask, + willCacheResponse proposedResponse: CachedURLResponse, + completionHandler: @escaping (CachedURLResponse?) -> Void) + { + var cachedResponse: CachedURLResponse? = proposedResponse + + if let dataTaskWillCacheResponse = dataTaskWillCacheResponse { + cachedResponse = dataTaskWillCacheResponse(session, dataTask, proposedResponse) + } + + completionHandler(cachedResponse) + } +} + +// MARK: - + +class DownloadTaskDelegate: TaskDelegate, URLSessionDownloadDelegate { + + // MARK: Properties + + var downloadTask: URLSessionDownloadTask { return task as! URLSessionDownloadTask } + + var progress: Progress + var progressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)? + + var resumeData: Data? + override var data: Data? { return resumeData } + + var destination: DownloadRequest.DownloadFileDestination? + + var temporaryURL: URL? + var destinationURL: URL? + + var fileURL: URL? { return destination != nil ? destinationURL : temporaryURL } + + // MARK: Lifecycle + + override init(task: URLSessionTask?) { + progress = Progress(totalUnitCount: 0) + super.init(task: task) + } + + override func reset() { + super.reset() + + progress = Progress(totalUnitCount: 0) + resumeData = nil + } + + // MARK: URLSessionDownloadDelegate + + var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> URL)? + var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)? + var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)? + + func urlSession( + _ session: URLSession, + downloadTask: URLSessionDownloadTask, + didFinishDownloadingTo location: URL) + { + temporaryURL = location + + guard + let destination = destination, + let response = downloadTask.response as? HTTPURLResponse + else { return } + + let result = destination(location, response) + let destinationURL = result.destinationURL + let options = result.options + + self.destinationURL = destinationURL + + do { + if options.contains(.removePreviousFile), FileManager.default.fileExists(atPath: destinationURL.path) { + try FileManager.default.removeItem(at: destinationURL) + } + + if options.contains(.createIntermediateDirectories) { + let directory = destinationURL.deletingLastPathComponent() + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + } + + try FileManager.default.moveItem(at: location, to: destinationURL) + } catch { + self.error = error + } + } + + func urlSession( + _ session: URLSession, + downloadTask: URLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) + { + if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } + + if let downloadTaskDidWriteData = downloadTaskDidWriteData { + downloadTaskDidWriteData( + session, + downloadTask, + bytesWritten, + totalBytesWritten, + totalBytesExpectedToWrite + ) + } else { + progress.totalUnitCount = totalBytesExpectedToWrite + progress.completedUnitCount = totalBytesWritten + + if let progressHandler = progressHandler { + progressHandler.queue.async { progressHandler.closure(self.progress) } + } + } + } + + func urlSession( + _ session: URLSession, + downloadTask: URLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) + { + if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset { + downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes) + } else { + progress.totalUnitCount = expectedTotalBytes + progress.completedUnitCount = fileOffset + } + } +} + +// MARK: - + +class UploadTaskDelegate: DataTaskDelegate { + + // MARK: Properties + + var uploadTask: URLSessionUploadTask { return task as! URLSessionUploadTask } + + var uploadProgress: Progress + var uploadProgressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)? + + // MARK: Lifecycle + + override init(task: URLSessionTask?) { + uploadProgress = Progress(totalUnitCount: 0) + super.init(task: task) + } + + override func reset() { + super.reset() + uploadProgress = Progress(totalUnitCount: 0) + } + + // MARK: URLSessionTaskDelegate + + var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)? + + func URLSession( + _ session: URLSession, + task: URLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) + { + if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } + + if let taskDidSendBodyData = taskDidSendBodyData { + taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend) + } else { + uploadProgress.totalUnitCount = totalBytesExpectedToSend + uploadProgress.completedUnitCount = totalBytesSent + + if let uploadProgressHandler = uploadProgressHandler { + uploadProgressHandler.queue.async { uploadProgressHandler.closure(self.uploadProgress) } + } + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Timeline.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Timeline.swift new file mode 100644 index 0000000..181c988 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Timeline.swift @@ -0,0 +1,136 @@ +// +// Timeline.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Responsible for computing the timing metrics for the complete lifecycle of a `Request`. +public struct Timeline { + /// The time the request was initialized. + public let requestStartTime: CFAbsoluteTime + + /// The time the first bytes were received from or sent to the server. + public let initialResponseTime: CFAbsoluteTime + + /// The time when the request was completed. + public let requestCompletedTime: CFAbsoluteTime + + /// The time when the response serialization was completed. + public let serializationCompletedTime: CFAbsoluteTime + + /// The time interval in seconds from the time the request started to the initial response from the server. + public let latency: TimeInterval + + /// The time interval in seconds from the time the request started to the time the request completed. + public let requestDuration: TimeInterval + + /// The time interval in seconds from the time the request completed to the time response serialization completed. + public let serializationDuration: TimeInterval + + /// The time interval in seconds from the time the request started to the time response serialization completed. + public let totalDuration: TimeInterval + + /// Creates a new `Timeline` instance with the specified request times. + /// + /// - parameter requestStartTime: The time the request was initialized. Defaults to `0.0`. + /// - parameter initialResponseTime: The time the first bytes were received from or sent to the server. + /// Defaults to `0.0`. + /// - parameter requestCompletedTime: The time when the request was completed. Defaults to `0.0`. + /// - parameter serializationCompletedTime: The time when the response serialization was completed. Defaults + /// to `0.0`. + /// + /// - returns: The new `Timeline` instance. + public init( + requestStartTime: CFAbsoluteTime = 0.0, + initialResponseTime: CFAbsoluteTime = 0.0, + requestCompletedTime: CFAbsoluteTime = 0.0, + serializationCompletedTime: CFAbsoluteTime = 0.0) + { + self.requestStartTime = requestStartTime + self.initialResponseTime = initialResponseTime + self.requestCompletedTime = requestCompletedTime + self.serializationCompletedTime = serializationCompletedTime + + self.latency = initialResponseTime - requestStartTime + self.requestDuration = requestCompletedTime - requestStartTime + self.serializationDuration = serializationCompletedTime - requestCompletedTime + self.totalDuration = serializationCompletedTime - requestStartTime + } +} + +// MARK: - CustomStringConvertible + +extension Timeline: CustomStringConvertible { + /// The textual representation used when written to an output stream, which includes the latency, the request + /// duration and the total duration. + public var description: String { + let latency = String(format: "%.3f", self.latency) + let requestDuration = String(format: "%.3f", self.requestDuration) + let serializationDuration = String(format: "%.3f", self.serializationDuration) + let totalDuration = String(format: "%.3f", self.totalDuration) + + // NOTE: Had to move to string concatenation due to memory leak filed as rdar://26761490. Once memory leak is + // fixed, we should move back to string interpolation by reverting commit 7d4a43b1. + let timings = [ + "\"Latency\": " + latency + " secs", + "\"Request Duration\": " + requestDuration + " secs", + "\"Serialization Duration\": " + serializationDuration + " secs", + "\"Total Duration\": " + totalDuration + " secs" + ] + + return "Timeline: { " + timings.joined(separator: ", ") + " }" + } +} + +// MARK: - CustomDebugStringConvertible + +extension Timeline: CustomDebugStringConvertible { + /// The textual representation used when written to an output stream, which includes the request start time, the + /// initial response time, the request completed time, the serialization completed time, the latency, the request + /// duration and the total duration. + public var debugDescription: String { + let requestStartTime = String(format: "%.3f", self.requestStartTime) + let initialResponseTime = String(format: "%.3f", self.initialResponseTime) + let requestCompletedTime = String(format: "%.3f", self.requestCompletedTime) + let serializationCompletedTime = String(format: "%.3f", self.serializationCompletedTime) + let latency = String(format: "%.3f", self.latency) + let requestDuration = String(format: "%.3f", self.requestDuration) + let serializationDuration = String(format: "%.3f", self.serializationDuration) + let totalDuration = String(format: "%.3f", self.totalDuration) + + // NOTE: Had to move to string concatenation due to memory leak filed as rdar://26761490. Once memory leak is + // fixed, we should move back to string interpolation by reverting commit 7d4a43b1. + let timings = [ + "\"Request Start Time\": " + requestStartTime, + "\"Initial Response Time\": " + initialResponseTime, + "\"Request Completed Time\": " + requestCompletedTime, + "\"Serialization Completed Time\": " + serializationCompletedTime, + "\"Latency\": " + latency + " secs", + "\"Request Duration\": " + requestDuration + " secs", + "\"Serialization Duration\": " + serializationDuration + " secs", + "\"Total Duration\": " + totalDuration + " secs" + ] + + return "Timeline: { " + timings.joined(separator: ", ") + " }" + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Validation.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Validation.swift new file mode 100644 index 0000000..ec2c5c3 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Alamofire/Source/Validation.swift @@ -0,0 +1,315 @@ +// +// Validation.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +extension Request { + + // MARK: Helper Types + + fileprivate typealias ErrorReason = AFError.ResponseValidationFailureReason + + /// Used to represent whether validation was successful or encountered an error resulting in a failure. + /// + /// - success: The validation was successful. + /// - failure: The validation failed encountering the provided error. + public enum ValidationResult { + case success + case failure(Error) + } + + fileprivate struct MIMEType { + let type: String + let subtype: String + + var isWildcard: Bool { return type == "*" && subtype == "*" } + + init?(_ string: String) { + let components: [String] = { + let stripped = string.trimmingCharacters(in: .whitespacesAndNewlines) + + #if swift(>=3.2) + let split = stripped[..<(stripped.range(of: ";")?.lowerBound ?? stripped.endIndex)] + #else + let split = stripped.substring(to: stripped.range(of: ";")?.lowerBound ?? stripped.endIndex) + #endif + + return split.components(separatedBy: "/") + }() + + if let type = components.first, let subtype = components.last { + self.type = type + self.subtype = subtype + } else { + return nil + } + } + + func matches(_ mime: MIMEType) -> Bool { + switch (type, subtype) { + case (mime.type, mime.subtype), (mime.type, "*"), ("*", mime.subtype), ("*", "*"): + return true + default: + return false + } + } + } + + // MARK: Properties + + fileprivate var acceptableStatusCodes: [Int] { return Array(200..<300) } + + fileprivate var acceptableContentTypes: [String] { + if let accept = request?.value(forHTTPHeaderField: "Accept") { + return accept.components(separatedBy: ",") + } + + return ["*/*"] + } + + // MARK: Status Code + + fileprivate func validate( + statusCode acceptableStatusCodes: S, + response: HTTPURLResponse) + -> ValidationResult + where S.Iterator.Element == Int + { + if acceptableStatusCodes.contains(response.statusCode) { + return .success + } else { + let reason: ErrorReason = .unacceptableStatusCode(code: response.statusCode) + return .failure(AFError.responseValidationFailed(reason: reason)) + } + } + + // MARK: Content Type + + fileprivate func validate( + contentType acceptableContentTypes: S, + response: HTTPURLResponse, + data: Data?) + -> ValidationResult + where S.Iterator.Element == String + { + guard let data = data, data.count > 0 else { return .success } + + guard + let responseContentType = response.mimeType, + let responseMIMEType = MIMEType(responseContentType) + else { + for contentType in acceptableContentTypes { + if let mimeType = MIMEType(contentType), mimeType.isWildcard { + return .success + } + } + + let error: AFError = { + let reason: ErrorReason = .missingContentType(acceptableContentTypes: Array(acceptableContentTypes)) + return AFError.responseValidationFailed(reason: reason) + }() + + return .failure(error) + } + + for contentType in acceptableContentTypes { + if let acceptableMIMEType = MIMEType(contentType), acceptableMIMEType.matches(responseMIMEType) { + return .success + } + } + + let error: AFError = { + let reason: ErrorReason = .unacceptableContentType( + acceptableContentTypes: Array(acceptableContentTypes), + responseContentType: responseContentType + ) + + return AFError.responseValidationFailed(reason: reason) + }() + + return .failure(error) + } +} + +// MARK: - + +extension DataRequest { + /// A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the + /// request was valid. + public typealias Validation = (URLRequest?, HTTPURLResponse, Data?) -> ValidationResult + + /// Validates the request, using the specified closure. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - parameter validation: A closure to validate the request. + /// + /// - returns: The request. + @discardableResult + public func validate(_ validation: @escaping Validation) -> Self { + let validationExecution: () -> Void = { [unowned self] in + if + let response = self.response, + self.delegate.error == nil, + case let .failure(error) = validation(self.request, response, self.delegate.data) + { + self.delegate.error = error + } + } + + validations.append(validationExecution) + + return self + } + + /// Validates that the response has a status code in the specified sequence. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - parameter range: The range of acceptable status codes. + /// + /// - returns: The request. + @discardableResult + public func validate(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int { + return validate { [unowned self] _, response, _ in + return self.validate(statusCode: acceptableStatusCodes, response: response) + } + } + + /// Validates that the response has a content type in the specified sequence. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes. + /// + /// - returns: The request. + @discardableResult + public func validate(contentType acceptableContentTypes: S) -> Self where S.Iterator.Element == String { + return validate { [unowned self] _, response, data in + return self.validate(contentType: acceptableContentTypes, response: response, data: data) + } + } + + /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content + /// type matches any specified in the Accept HTTP header field. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - returns: The request. + @discardableResult + public func validate() -> Self { + return validate(statusCode: self.acceptableStatusCodes).validate(contentType: self.acceptableContentTypes) + } +} + +// MARK: - + +extension DownloadRequest { + /// A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a + /// destination URL, and returns whether the request was valid. + public typealias Validation = ( + _ request: URLRequest?, + _ response: HTTPURLResponse, + _ temporaryURL: URL?, + _ destinationURL: URL?) + -> ValidationResult + + /// Validates the request, using the specified closure. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - parameter validation: A closure to validate the request. + /// + /// - returns: The request. + @discardableResult + public func validate(_ validation: @escaping Validation) -> Self { + let validationExecution: () -> Void = { [unowned self] in + let request = self.request + let temporaryURL = self.downloadDelegate.temporaryURL + let destinationURL = self.downloadDelegate.destinationURL + + if + let response = self.response, + self.delegate.error == nil, + case let .failure(error) = validation(request, response, temporaryURL, destinationURL) + { + self.delegate.error = error + } + } + + validations.append(validationExecution) + + return self + } + + /// Validates that the response has a status code in the specified sequence. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - parameter range: The range of acceptable status codes. + /// + /// - returns: The request. + @discardableResult + public func validate(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int { + return validate { [unowned self] _, response, _, _ in + return self.validate(statusCode: acceptableStatusCodes, response: response) + } + } + + /// Validates that the response has a content type in the specified sequence. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes. + /// + /// - returns: The request. + @discardableResult + public func validate(contentType acceptableContentTypes: S) -> Self where S.Iterator.Element == String { + return validate { [unowned self] _, response, _, _ in + let fileURL = self.downloadDelegate.fileURL + + guard let validFileURL = fileURL else { + return .failure(AFError.responseValidationFailed(reason: .dataFileNil)) + } + + do { + let data = try Data(contentsOf: validFileURL) + return self.validate(contentType: acceptableContentTypes, response: response, data: data) + } catch { + return .failure(AFError.responseValidationFailed(reason: .dataFileReadFailed(at: validFileURL))) + } + } + } + + /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content + /// type matches any specified in the Accept HTTP header field. + /// + /// If validation fails, subsequent calls to response handlers will have an associated error. + /// + /// - returns: The request. + @discardableResult + public func validate() -> Self { + return validate(statusCode: self.acceptableStatusCodes).validate(contentType: self.acceptableContentTypes) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Manifest.lock b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Manifest.lock new file mode 100644 index 0000000..52f1073 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Manifest.lock @@ -0,0 +1,27 @@ +PODS: + - Alamofire (4.7.1) + - Moya (11.0.2): + - Moya/Core (= 11.0.2) + - Moya/Core (11.0.2): + - Alamofire (~> 4.1) + - Result (~> 3.0) + - Result (3.2.4) + - RxCocoa (4.1.2): + - RxSwift (~> 4.0) + - RxSwift (4.1.2) + +DEPENDENCIES: + - Moya (~> 11.0) + - RxCocoa (~> 4.0) + - RxSwift (~> 4.0) + +SPEC CHECKSUMS: + Alamofire: 68d7d521118d49c615a8d2214d87cdf525599d30 + Moya: a725035953bc1c0eb1be505ab903984501d82440 + Result: d2d07204ce72856f1fd9130bbe42c35a7b0fea10 + RxCocoa: d88ba0f1f6abf040011a9eb4b539324fc426843a + RxSwift: e49536837d9901277638493ea537394d4b55f570 + +PODFILE CHECKSUM: 8c8df858f0b72706302c397fb14b19845c9e623a + +COCOAPODS: 1.4.0 diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/License.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/License.md new file mode 100644 index 0000000..58ef14f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/License.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present Artsy, Ash Furrow + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Readme.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Readme.md new file mode 100644 index 0000000..383d700 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Readme.md @@ -0,0 +1,320 @@ +

+ +

+ +# Moya + +[![CircleCI](https://img.shields.io/circleci/project/github/Moya/Moya/master.svg)](https://circleci.com/gh/Moya/Moya/tree/master) +[![codecov.io](https://codecov.io/github/Moya/Moya/coverage.svg?branch=master)](https://codecov.io/github/Moya/Moya?branch=master) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![CocoaPods compatible](https://img.shields.io/cocoapods/v/Moya.svg)](https://cocoapods.org/pods/Moya) +[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) + +*A Chinese version of this document can be found [here](Readme_CN.md).* + +You're a smart developer. You probably use [Alamofire](https://github.com/Alamofire/Alamofire) to abstract away access to +`URLSession` and all those nasty details you don't really care about. But then, +like lots of smart developers, you write ad hoc network abstraction layers. They +are probably called "APIManager" or "NetworkModel", and they always end in tears. + +![Moya Overview](web/diagram.png) + +Ad hoc network layers are common in iOS apps. They're bad for a few reasons: + +- Makes it hard to write new apps ("where do I begin?") +- Makes it hard to maintain existing apps ("oh my god, this mess...") +- Makes it hard to write unit tests ("how do I do this again?") + +So the basic idea of Moya is that we want some network abstraction layer that +sufficiently encapsulates actually calling Alamofire directly. It should be simple +enough that common things are easy, but comprehensive enough that complicated things +are also easy. + +> If you use Alamofire to abstract away `URLSession`, why not use something +to abstract away the nitty gritty of URLs, parameters, etc? + +Some awesome features of Moya: + +- Compile-time checking for correct API endpoint accesses. +- Lets you define a clear usage of different endpoints with associated enum values. +- Treats test stubs as first-class citizens so unit testing is super-easy. + +You can check out more about the project direction in the [vision document](Vision.md). + +## Sample Projects + +We have provided two sample projects in the repository. To use it download the repo, run `carthage update` to download the required libraries and open [Moya.xcodeproj](https://github.com/Moya/Moya/tree/master/Moya.xcodeproj). You'll see two schemes: `Basic` and `Multi-Target` - select one and then build & run! Source files for these are in the `Examples` directory in project navigator. Have fun! + +## Project Status + +This project is actively under development, and is being used in [Artsy's +new auction app](https://github.com/Artsy/eidolon). We consider it +ready for production use. + +## Installation + +### Moya version vs Swift version. + +Below is a table that shows which version of Moya you should use for +your Swift version. + +| Swift | Moya | RxMoya | ReactiveMoya | +| ----- | ------------- |---------------|---------------| +| 4.X | >= 9.0 | >= 10.0 | >= 9.0 | +| 3.X | 8.0.0 - 8.0.5 | 8.0.0 - 8.0.5 | 8.0.0 - 8.0.5 | +| 2.3 | 7.0.2 - 7.0.4 | 7.0.2 - 7.0.4 | 7.0.2 - 7.0.4 | +| 2.2 | <= 7.0.1 | <= 7.0.1 | <= 7.0.1 | + +**Upgrading to a new major version of Moya? Check out our [migration guides](https://github.com/Moya/Moya/blob/master/docs/MigrationGuides).** + +### Swift Package Manager + +To integrate using Apple's Swift package manager, add the following as a dependency to your `Package.swift`: + +```swift +.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "11.0.0")) +``` + +and then specify `"Moya"` as a dependency of the Target in which you wish to use Moya. +If you want to use reactive extensions, add also `"ReactiveMoya"` or `"RxMoya"` as your Target dependency respectively. +Here's an example `PackageDescription`: + +```swift +// swift-tools-version:4.0 +import PackageDescription + +let package = Package( + name: "MyPackage", + products: [ + .library( + name: "MyPackage", + targets: ["MyPackage"]), + ], + dependencies: [ + .package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "11.0.0")) + ], + targets: [ + .target( + name: "MyPackage", + dependencies: ["ReactiveMoya"]) + ] +) +``` + +Note that as of Moya 10, SPM only works with Swift 4 toolchain and greater. + +### CocoaPods + +For Moya, use the following entry in your Podfile: + +```rb +pod 'Moya', '~> 11.0' + +# or + +pod 'Moya/RxSwift', '~> 11.0' + +# or + +pod 'Moya/ReactiveSwift', '~> 11.0' +``` + +Then run `pod install`. + +In any file you'd like to use Moya in, don't forget to +import the framework with `import Moya`. + +### Carthage + +Carthage users can point to this repository and use whichever +generated framework they'd like, `Moya`, `RxMoya`, or `ReactiveMoya`. + +Make the following entry in your Cartfile: + +``` +github "Moya/Moya" +``` + +Then run `carthage update`. + +If this is your first time using Carthage in the project, you'll need to go through some additional steps as explained [over at Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application). + +> NOTE: At this time, Carthage does not provide a way to build only specific repository submodules. All submodules and their dependencies will be built with the above command. However, you don't need to copy frameworks you aren't using into your project. For instance, if you aren't using `ReactiveSwift`, feel free to delete that framework along with `ReactiveMoya` from the Carthage Build directory after `carthage update` completes. Or if you are using `ReactiveSwift` but not `RxSwift`, then `RxMoya`, `RxTest`, `RxCocoa`, etc. can safely be deleted. + +### Manually + +- Open up Terminal, `cd` into your top-level project directory, and run the following command *if* your project is not initialized as a git repository: + +```bash +$ git init +``` + +- Add Alamofire, Result & Moya as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following commands: + +```bash +$ git submodule add https://github.com/Alamofire/Alamofire.git +$ git submodule add https://github.com/antitypical/Result.git +$ git submodule add https://github.com/Moya/Moya.git +``` + +- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project. Do the same with the `Result.xcodeproj` in the `Result` folder and `Moya.xcodeproj` in the `Moya` folder. + +> They should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter. + +- Verify that the deployment targets of the `xcodeproj`s match that of your application target in the Project Navigator. +- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar. +- In the tab bar at the top of that window, open the "General" panel. +- Click on the `+` button under the "Embedded Binaries" section. +- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder. + +> It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`. + +- Select the top `Alamofire.framework` for iOS and the bottom one for OS X. + +> You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as either `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS` or `Alamofire watchOS`. + +- Click on the `+` button under "Embedded Binaries" again and add the build target you need for `Result`. +- Click on the `+` button again and add the correct build target for `Moya`. + +- And that's it! + +> The three frameworks are automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device. + +## Usage + +After [some setup](docs/Examples/Basic.md), using Moya is really simple. You can access an API like this: + +```swift +provider = MoyaProvider() +provider.request(.zen) { result in + switch result { + case let .success(moyaResponse): + let data = moyaResponse.data + let statusCode = moyaResponse.statusCode + // do something with the response data or statusCode + case let .failure(error): + // this means there was a network failure - either the request + // wasn't sent (connectivity), or no response was received (server + // timed out). If the server responds with a 4xx or 5xx error, that + // will be sent as a ".success"-ful response. + } +} +``` + +That's a basic example. Many API requests need parameters. Moya encodes these +into the enum you use to access the endpoint, like this: + +```swift +provider = MoyaProvider() +provider.request(.userProfile("ashfurrow")) { result in + // do something with the result +} +``` + +No more typos in URLs. No more missing parameter values. No more messing with +parameter encoding. + +For more examples, see the [documentation](docs/Examples). + +## Reactive Extensions + +Even cooler are the reactive extensions. Moya provides reactive extensions for +[ReactiveSwift](https://github.com/ReactiveCocoa/ReactiveSwift) and +[RxSwift](https://github.com/ReactiveX/RxSwift). + +### ReactiveSwift + +[`ReactiveSwift` extension](docs/ReactiveSwift.md) provides both `reactive.request(:callbackQueue:)` and +`reactive.requestWithProgress(:callbackQueue:)` methods that immediately return +`SignalProducer`s that you can start, bind, map, or whatever you want to do. +To handle errors, for instance, we could do the following: + +```swift +provider = MoyaProvider() +provider.reactive.request(.userProfile("ashfurrow")).start { event in + switch event { + case let .value(response): + image = UIImage(data: response.data) + case let .failed(error): + print(error) + default: + break + } +} +``` + +### RxSwift + +[`RxSwift` extension](docs/RxSwift.md) also provide both `rx.request(:callbackQueue:)` and +`rx.requestWithProgress(:callbackQueue:)` methods, but return type is +different for both. In case of a normal `rx.request(:callbackQueue)`, the +return type is `Single` which emits either single element or an +error. In case of a `rx.requestWithProgress(:callbackQueue:)`, the return +type is `Observable`, since we may get multiple events +from progress and one last event which is a response. + +To handle errors, for instance, we could do the following: + +```swift +provider = MoyaProvider() +provider.rx.request(.userProfile("ashfurrow")).subscribe { event in + switch event { + case let .success(response): + image = UIImage(data: response.data) + case let .error(error): + print(error) + } +} +``` + +In addition to the option of using signals instead of callback blocks, there are +also a series of signal operators for RxSwift and ReactiveSwift that will attempt +to map the data received from the network response into either an image, some JSON, +or a string, with `mapImage()`, `mapJSON()`, and `mapString()`, respectively. If the mapping is unsuccessful, you'll get an error on the signal. You also get handy methods +for filtering out certain status codes. This means that you can place your code for +handling API errors like 400's in the same places as code for handling invalid +responses. + +## Community Projects + +[Moya has a great community around it and some people have created some very helpful extensions](https://github.com/Moya/Moya/blob/master/docs/CommunityProjects.md). + +## Contributing + +Hey! Do you like Moya? Awesome! We could actually really use your help! + +Open source isn't just writing code. Moya could use your help with any of the +following: + +- Finding (and reporting!) bugs. +- New feature suggestions. +- Answering questions on issues. +- Documentation improvements. +- Reviewing pull requests. +- Helping to manage issue priorities. +- Fixing bugs/new features. + +If any of that sounds cool to you, send a pull request! After your first +contribution, we will add you as a member to the repo so you can merge pull +requests and help steer the ship :ship: You can read more details about that [in our contributor guidelines](https://github.com/Moya/Moya/blob/master/Contributing.md). + +Moya's community has a tremendous positive energy, and the maintainers are committed to keeping things awesome. Like [in the CocoaPods community](https://github.com/CocoaPods/CocoaPods/wiki/Communication-&-Design-Rules), always assume positive intent; even if a comment sounds mean-spirited, give the person the benefit of the doubt. + +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by [its terms](https://github.com/Moya/Moya/blob/master/Code%20of%20Conduct.md). + +### Adding new source files + +If you add or remove a source file from Moya, a corresponding change needs to be made to the `Moya.xcodeproj` project at the root of this repository. This project is used for Carthage. Don't worry, you'll get an automated warning when submitting a pull request if you forget. + +### Help us improve Moya documentation +Whether you’re a core member or a user trying it out for the first time, you can make a valuable contribution to Moya by improving the documentation. Help us by: + +- sending us feedback about something you thought was confusing or simply missing +- suggesting better wording or ways of explaining certain topics +- sending us a pull request via GitHub +- improving the [Chinese documentation](Readme_CN.md) + + +## License + +Moya is released under an MIT license. See [License.md](License.md) for more information. diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/AnyEncodable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/AnyEncodable.swift new file mode 100644 index 0000000..15c7128 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/AnyEncodable.swift @@ -0,0 +1,14 @@ +import Foundation + +struct AnyEncodable: Encodable { + + private let encodable: Encodable + + public init(_ encodable: Encodable) { + self.encodable = encodable + } + + func encode(to encoder: Encoder) throws { + try encodable.encode(to: encoder) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Cancellable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Cancellable.swift new file mode 100644 index 0000000..9a9c783 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Cancellable.swift @@ -0,0 +1,26 @@ +/// Protocol to define the opaque type returned from a request. +public protocol Cancellable { + + /// A Boolean value stating whether a request is cancelled. + var isCancelled: Bool { get } + + /// Cancels the represented request. + func cancel() +} + +internal class CancellableWrapper: Cancellable { + internal var innerCancellable: Cancellable = SimpleCancellable() + + var isCancelled: Bool { return innerCancellable.isCancelled } + + internal func cancel() { + innerCancellable.cancel() + } +} + +internal class SimpleCancellable: Cancellable { + var isCancelled = false + func cancel() { + isCancelled = true + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Endpoint.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Endpoint.swift new file mode 100755 index 0000000..51a843e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Endpoint.swift @@ -0,0 +1,137 @@ +import Foundation + +/// Used for stubbing responses. +public enum EndpointSampleResponse { + + /// The network returned a response, including status code and data. + case networkResponse(Int, Data) + + /// The network returned response which can be fully customized. + case response(HTTPURLResponse, Data) + + /// The network failed to send the request, or failed to retrieve a response (eg a timeout). + case networkError(NSError) +} + +/// Class for reifying a target of the `Target` enum unto a concrete `Endpoint`. +/// - Note: As of Moya 11.0.0 Endpoint is no longer generic. +/// Existing code should work as is after removing the generic. +/// See #1529 and #1524 for the discussion. +open class Endpoint { + public typealias SampleResponseClosure = () -> EndpointSampleResponse + + /// A string representation of the URL for the request. + open let url: String + + /// A closure responsible for returning an `EndpointSampleResponse`. + open let sampleResponseClosure: SampleResponseClosure + + /// The HTTP method for the request. + open let method: Moya.Method + + /// The `Task` for the request. + open let task: Task + + /// The HTTP header fields for the request. + open let httpHeaderFields: [String: String]? + + public init(url: String, + sampleResponseClosure: @escaping SampleResponseClosure, + method: Moya.Method, + task: Task, + httpHeaderFields: [String: String]?) { + + self.url = url + self.sampleResponseClosure = sampleResponseClosure + self.method = method + self.task = task + self.httpHeaderFields = httpHeaderFields + } + + /// Convenience method for creating a new `Endpoint` with the same properties as the receiver, but with added HTTP header fields. + open func adding(newHTTPHeaderFields: [String: String]) -> Endpoint { + return Endpoint(url: url, sampleResponseClosure: sampleResponseClosure, method: method, task: task, httpHeaderFields: add(httpHeaderFields: newHTTPHeaderFields)) + } + + /// Convenience method for creating a new `Endpoint` with the same properties as the receiver, but with replaced `task` parameter. + open func replacing(task: Task) -> Endpoint { + return Endpoint(url: url, sampleResponseClosure: sampleResponseClosure, method: method, task: task, httpHeaderFields: httpHeaderFields) + } + + fileprivate func add(httpHeaderFields headers: [String: String]?) -> [String: String]? { + guard let unwrappedHeaders = headers, unwrappedHeaders.isEmpty == false else { + return self.httpHeaderFields + } + + var newHTTPHeaderFields = self.httpHeaderFields ?? [:] + unwrappedHeaders.forEach { key, value in + newHTTPHeaderFields[key] = value + } + return newHTTPHeaderFields + } +} + +/// Extension for converting an `Endpoint` into a `URLRequest`. +extension Endpoint { + // swiftlint:disable cyclomatic_complexity + /// Returns the `Endpoint` converted to a `URLRequest` if valid. Throws an error otherwise. + public func urlRequest() throws -> URLRequest { + guard let requestURL = Foundation.URL(string: url) else { + throw MoyaError.requestMapping(url) + } + + var request = URLRequest(url: requestURL) + request.httpMethod = method.rawValue + request.allHTTPHeaderFields = httpHeaderFields + + switch task { + case .requestPlain, .uploadFile, .uploadMultipart, .downloadDestination: + return request + case .requestData(let data): + request.httpBody = data + return request + case let .requestJSONEncodable(encodable): + return try request.encoded(encodable: encodable) + case let .requestCustomJSONEncodable(encodable, encoder: encoder): + return try request.encoded(encodable: encodable, encoder: encoder) + case let .requestParameters(parameters, parameterEncoding): + return try request.encoded(parameters: parameters, parameterEncoding: parameterEncoding) + case let .uploadCompositeMultipart(_, urlParameters): + let parameterEncoding = URLEncoding(destination: .queryString) + return try request.encoded(parameters: urlParameters, parameterEncoding: parameterEncoding) + case let .downloadParameters(parameters, parameterEncoding, _): + return try request.encoded(parameters: parameters, parameterEncoding: parameterEncoding) + case let .requestCompositeData(bodyData: bodyData, urlParameters: urlParameters): + request.httpBody = bodyData + let parameterEncoding = URLEncoding(destination: .queryString) + return try request.encoded(parameters: urlParameters, parameterEncoding: parameterEncoding) + case let .requestCompositeParameters(bodyParameters: bodyParameters, bodyEncoding: bodyParameterEncoding, urlParameters: urlParameters): + if let bodyParameterEncoding = bodyParameterEncoding as? URLEncoding, bodyParameterEncoding.destination != .httpBody { + fatalError("Only URLEncoding that `bodyEncoding` accepts is URLEncoding.httpBody. Others like `default`, `queryString` or `methodDependent` are prohibited - if you want to use them, add your parameters to `urlParameters` instead.") + } + let bodyfulRequest = try request.encoded(parameters: bodyParameters, parameterEncoding: bodyParameterEncoding) + let urlEncoding = URLEncoding(destination: .queryString) + return try bodyfulRequest.encoded(parameters: urlParameters, parameterEncoding: urlEncoding) + } + } + // swiftlint:enable cyclomatic_complexity +} + +/// Required for using `Endpoint` as a key type in a `Dictionary`. +extension Endpoint: Equatable, Hashable { + public var hashValue: Int { + let request = try? urlRequest() + return request?.hashValue ?? url.hashValue + } + + /// Note: If both Endpoints fail to produce a URLRequest the comparison will + /// fall back to comparing each Endpoint's hashValue. + public static func == (lhs: Endpoint, rhs: Endpoint) -> Bool { + let lhsRequest = try? lhs.urlRequest() + let rhsRequest = try? rhs.urlRequest() + if lhsRequest != nil, rhsRequest == nil { return false } + if lhsRequest == nil, rhsRequest != nil { return false } + if lhsRequest == nil, rhsRequest == nil { return lhs.hashValue == rhs.hashValue } + return (lhsRequest == rhsRequest) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Image.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Image.swift new file mode 100644 index 0000000..6e82908 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Image.swift @@ -0,0 +1,10 @@ +#if os(iOS) || os(watchOS) || os(tvOS) + import UIKit.UIImage + public typealias ImageType = UIImage +#elseif os(OSX) + import AppKit.NSImage + public typealias ImageType = NSImage +#endif + +/// An alias for the SDK's image type. +public typealias Image = ImageType diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Moya+Alamofire.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Moya+Alamofire.swift new file mode 100644 index 0000000..8d4cd4a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Moya+Alamofire.swift @@ -0,0 +1,90 @@ +import Foundation +import Alamofire + +public typealias Manager = Alamofire.SessionManager +internal typealias Request = Alamofire.Request +internal typealias DownloadRequest = Alamofire.DownloadRequest +internal typealias UploadRequest = Alamofire.UploadRequest +internal typealias DataRequest = Alamofire.DataRequest + +internal typealias URLRequestConvertible = Alamofire.URLRequestConvertible + +/// Represents an HTTP method. +public typealias Method = Alamofire.HTTPMethod + +/// Choice of parameter encoding. +public typealias ParameterEncoding = Alamofire.ParameterEncoding +public typealias JSONEncoding = Alamofire.JSONEncoding +public typealias URLEncoding = Alamofire.URLEncoding +public typealias PropertyListEncoding = Alamofire.PropertyListEncoding + +/// Multipart form. +public typealias RequestMultipartFormData = Alamofire.MultipartFormData + +/// Multipart form data encoding result. +public typealias MultipartFormDataEncodingResult = Manager.MultipartFormDataEncodingResult +public typealias DownloadDestination = Alamofire.DownloadRequest.DownloadFileDestination + +/// Make the Alamofire Request type conform to our type, to prevent leaking Alamofire to plugins. +extension Request: RequestType { } + +/// Internal token that can be used to cancel requests +public final class CancellableToken: Cancellable, CustomDebugStringConvertible { + let cancelAction: () -> Void + let request: Request? + + public fileprivate(set) var isCancelled = false + + fileprivate var lock: DispatchSemaphore = DispatchSemaphore(value: 1) + + public func cancel() { + _ = lock.wait(timeout: DispatchTime.distantFuture) + defer { lock.signal() } + guard !isCancelled else { return } + isCancelled = true + cancelAction() + } + + public init(action: @escaping () -> Void) { + self.cancelAction = action + self.request = nil + } + + init(request: Request) { + self.request = request + self.cancelAction = { + request.cancel() + } + } + + /// A textual representation of this instance, suitable for debugging. + public var debugDescription: String { + guard let request = self.request else { + return "Empty Request" + } + return request.debugDescription + } + +} + +internal typealias RequestableCompletion = (HTTPURLResponse?, URLRequest?, Data?, Swift.Error?) -> Void + +internal protocol Requestable { + func response(callbackQueue: DispatchQueue?, completionHandler: @escaping RequestableCompletion) -> Self +} + +extension DataRequest: Requestable { + internal func response(callbackQueue: DispatchQueue?, completionHandler: @escaping RequestableCompletion) -> Self { + return response(queue: callbackQueue) { handler in + completionHandler(handler.response, handler.request, handler.data, handler.error) + } + } +} + +extension DownloadRequest: Requestable { + internal func response(callbackQueue: DispatchQueue?, completionHandler: @escaping RequestableCompletion) -> Self { + return response(queue: callbackQueue) { handler in + completionHandler(handler.response, handler.request, nil, handler.error) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaError.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaError.swift new file mode 100644 index 0000000..472026c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaError.swift @@ -0,0 +1,76 @@ +import Foundation + +/// A type representing possible errors Moya can throw. +public enum MoyaError: Swift.Error { + + /// Indicates a response failed to map to an image. + case imageMapping(Response) + + /// Indicates a response failed to map to a JSON structure. + case jsonMapping(Response) + + /// Indicates a response failed to map to a String. + case stringMapping(Response) + + /// Indicates a response failed to map to a Decodable object. + case objectMapping(Swift.Error, Response) + + /// Indicates that Encodable couldn't be encoded into Data + case encodableMapping(Swift.Error) + + /// Indicates a response failed with an invalid HTTP status code. + case statusCode(Response) + + /// Indicates a response failed due to an underlying `Error`. + case underlying(Swift.Error, Response?) + + /// Indicates that an `Endpoint` failed to map to a `URLRequest`. + case requestMapping(String) + + /// Indicates that an `Endpoint` failed to encode the parameters for the `URLRequest`. + case parameterEncoding(Swift.Error) +} + +public extension MoyaError { + /// Depending on error type, returns a `Response` object. + var response: Moya.Response? { + switch self { + case .imageMapping(let response): return response + case .jsonMapping(let response): return response + case .stringMapping(let response): return response + case .objectMapping(_, let response): return response + case .statusCode(let response): return response + case .underlying(_, let response): return response + case .encodableMapping: return nil + case .requestMapping: return nil + case .parameterEncoding: return nil + } + } +} + +// MARK: - Error Descriptions + +extension MoyaError: LocalizedError { + public var errorDescription: String? { + switch self { + case .imageMapping: + return "Failed to map data to an Image." + case .jsonMapping: + return "Failed to map data to JSON." + case .stringMapping: + return "Failed to map data to a String." + case .objectMapping: + return "Failed to map data to a Decodable object." + case .encodableMapping: + return "Failed to encode Encodable object into data." + case .statusCode: + return "Status code didn't fall within the given range." + case .requestMapping: + return "Failed to map Endpoint to a URLRequest." + case .parameterEncoding(let error): + return "Failed to encode parameters for URLRequest. \(error.localizedDescription)" + case .underlying(let error, _): + return error.localizedDescription + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift new file mode 100644 index 0000000..7f39824 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift @@ -0,0 +1,36 @@ +import Foundation + +/// These functions are default mappings to `MoyaProvider`'s properties: endpoints, requests, manager, etc. +public extension MoyaProvider { + public final class func defaultEndpointMapping(for target: Target) -> Endpoint { + return Endpoint( + url: URL(target: target).absoluteString, + sampleResponseClosure: { .networkResponse(200, target.sampleData) }, + method: target.method, + task: target.task, + httpHeaderFields: target.headers + ) + } + + public final class func defaultRequestMapping(for endpoint: Endpoint, closure: RequestResultClosure) { + do { + let urlRequest = try endpoint.urlRequest() + closure(.success(urlRequest)) + } catch MoyaError.requestMapping(let url) { + closure(.failure(MoyaError.requestMapping(url))) + } catch MoyaError.parameterEncoding(let error) { + closure(.failure(MoyaError.parameterEncoding(error))) + } catch { + closure(.failure(MoyaError.underlying(error, nil))) + } + } + + public final class func defaultAlamofireManager() -> Manager { + let configuration = URLSessionConfiguration.default + configuration.httpAdditionalHeaders = Manager.defaultHTTPHeaders + + let manager = Manager(configuration: configuration) + manager.startRequestsImmediately = false + return manager + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Internal.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Internal.swift new file mode 100644 index 0000000..e8bb4d2 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider+Internal.swift @@ -0,0 +1,274 @@ +import Foundation +import Result + +// MARK: - Method + +extension Method { + /// A Boolean value determining whether the request supports multipart. + public var supportsMultipart: Bool { + switch self { + case .post, .put, .patch, .connect: + return true + case .get, .delete, .head, .options, .trace: + return false + } + } +} + +// MARK: - MoyaProvider + +/// Internal extension to keep the inner-workings outside the main Moya.swift file. +public extension MoyaProvider { + /// Performs normal requests. + func requestNormal(_ target: Target, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> Cancellable { + let endpoint = self.endpoint(target) + let stubBehavior = self.stubClosure(target) + let cancellableToken = CancellableWrapper() + + // Allow plugins to modify response + let pluginsWithCompletion: Moya.Completion = { result in + let processedResult = self.plugins.reduce(result) { $1.process($0, target: target) } + completion(processedResult) + } + + if trackInflights { + objc_sync_enter(self) + var inflightCompletionBlocks = self.inflightRequests[endpoint] + inflightCompletionBlocks?.append(pluginsWithCompletion) + self.inflightRequests[endpoint] = inflightCompletionBlocks + objc_sync_exit(self) + + if inflightCompletionBlocks != nil { + return cancellableToken + } else { + objc_sync_enter(self) + self.inflightRequests[endpoint] = [pluginsWithCompletion] + objc_sync_exit(self) + } + } + + let performNetworking = { (requestResult: Result) in + if cancellableToken.isCancelled { + self.cancelCompletion(pluginsWithCompletion, target: target) + return + } + + var request: URLRequest! + + switch requestResult { + case .success(let urlRequest): + request = urlRequest + case .failure(let error): + pluginsWithCompletion(.failure(error)) + return + } + + // Allow plugins to modify request + let preparedRequest = self.plugins.reduce(request) { $1.prepare($0, target: target) } + + let networkCompletion: Moya.Completion = { result in + if self.trackInflights { + self.inflightRequests[endpoint]?.forEach { $0(result) } + + objc_sync_enter(self) + self.inflightRequests.removeValue(forKey: endpoint) + objc_sync_exit(self) + } else { + pluginsWithCompletion(result) + } + } + + cancellableToken.innerCancellable = self.performRequest(target, request: preparedRequest, callbackQueue: callbackQueue, progress: progress, completion: networkCompletion, endpoint: endpoint, stubBehavior: stubBehavior) + } + + requestClosure(endpoint, performNetworking) + + return cancellableToken + } + + // swiftlint:disable:next function_parameter_count + private func performRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion, endpoint: Endpoint, stubBehavior: Moya.StubBehavior) -> Cancellable { + switch stubBehavior { + case .never: + switch endpoint.task { + case .requestPlain, .requestData, .requestJSONEncodable, .requestCustomJSONEncodable, .requestParameters, .requestCompositeData, .requestCompositeParameters: + return self.sendRequest(target, request: request, callbackQueue: callbackQueue, progress: progress, completion: completion) + case .uploadFile(let file): + return self.sendUploadFile(target, request: request, callbackQueue: callbackQueue, file: file, progress: progress, completion: completion) + case .uploadMultipart(let multipartBody), .uploadCompositeMultipart(let multipartBody, _): + guard !multipartBody.isEmpty && endpoint.method.supportsMultipart else { + fatalError("\(target) is not a multipart upload target.") + } + return self.sendUploadMultipart(target, request: request, callbackQueue: callbackQueue, multipartBody: multipartBody, progress: progress, completion: completion) + case .downloadDestination(let destination), .downloadParameters(_, _, let destination): + return self.sendDownloadRequest(target, request: request, callbackQueue: callbackQueue, destination: destination, progress: progress, completion: completion) + } + default: + return self.stubRequest(target, request: request, callbackQueue: callbackQueue, completion: completion, endpoint: endpoint, stubBehavior: stubBehavior) + } + } + + func cancelCompletion(_ completion: Moya.Completion, target: Target) { + let error = MoyaError.underlying(NSError(domain: NSURLErrorDomain, code: NSURLErrorCancelled, userInfo: nil), nil) + plugins.forEach { $0.didReceive(.failure(error), target: target) } + completion(.failure(error)) + } + + /// Creates a function which, when called, executes the appropriate stubbing behavior for the given parameters. + public final func createStubFunction(_ token: CancellableToken, forTarget target: Target, withCompletion completion: @escaping Moya.Completion, endpoint: Endpoint, plugins: [PluginType], request: URLRequest) -> (() -> Void) { // swiftlint:disable:this function_parameter_count + return { + if token.isCancelled { + self.cancelCompletion(completion, target: target) + return + } + + let validate = { (response: Moya.Response) -> Result in + let validCodes = target.validationType.statusCodes + guard !validCodes.isEmpty else { return .success(response) } + if validCodes.contains(response.statusCode) { + return .success(response) + } else { + let statusError = MoyaError.statusCode(response) + let error = MoyaError.underlying(statusError, response) + return .failure(error) + } + } + + switch endpoint.sampleResponseClosure() { + case .networkResponse(let statusCode, let data): + let response = Moya.Response(statusCode: statusCode, data: data, request: request, response: nil) + let result = validate(response) + plugins.forEach { $0.didReceive(result, target: target) } + completion(result) + case .response(let customResponse, let data): + let response = Moya.Response(statusCode: customResponse.statusCode, data: data, request: request, response: customResponse) + let result = validate(response) + plugins.forEach { $0.didReceive(result, target: target) } + completion(result) + case .networkError(let error): + let error = MoyaError.underlying(error, nil) + plugins.forEach { $0.didReceive(.failure(error), target: target) } + completion(.failure(error)) + } + } + } + + /// Notify all plugins that a stub is about to be performed. You must call this if overriding `stubRequest`. + final func notifyPluginsOfImpendingStub(for request: URLRequest, target: Target) { + let alamoRequest = manager.request(request as URLRequestConvertible) + plugins.forEach { $0.willSend(alamoRequest, target: target) } + alamoRequest.cancel() + } +} + +private extension MoyaProvider { + func sendUploadMultipart(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, multipartBody: [MultipartFormData], progress: Moya.ProgressBlock? = nil, completion: @escaping Moya.Completion) -> CancellableWrapper { + let cancellable = CancellableWrapper() + + let multipartFormData: (RequestMultipartFormData) -> Void = { form in + form.applyMoyaMultipartFormData(multipartBody) + } + + manager.upload(multipartFormData: multipartFormData, with: request) { result in + switch result { + case .success(let alamoRequest, _, _): + if cancellable.isCancelled { + self.cancelCompletion(completion, target: target) + return + } + let validationCodes = target.validationType.statusCodes + let validatedRequest = validationCodes.isEmpty ? alamoRequest : alamoRequest.validate(statusCode: validationCodes) + cancellable.innerCancellable = self.sendAlamofireRequest(validatedRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) + case .failure(let error): + completion(.failure(MoyaError.underlying(error as NSError, nil))) + } + } + + return cancellable + } + + func sendUploadFile(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, file: URL, progress: ProgressBlock? = nil, completion: @escaping Completion) -> CancellableToken { + let uploadRequest = manager.upload(file, with: request) + let validationCodes = target.validationType.statusCodes + let alamoRequest = validationCodes.isEmpty ? uploadRequest : uploadRequest.validate(statusCode: validationCodes) + return self.sendAlamofireRequest(alamoRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) + } + + func sendDownloadRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, destination: @escaping DownloadDestination, progress: ProgressBlock? = nil, completion: @escaping Completion) -> CancellableToken { + let downloadRequest = manager.download(request, to: destination) + let validationCodes = target.validationType.statusCodes + let alamoRequest = validationCodes.isEmpty ? downloadRequest : downloadRequest.validate(statusCode: validationCodes) + return self.sendAlamofireRequest(alamoRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) + } + + func sendRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> CancellableToken { + let initialRequest = manager.request(request as URLRequestConvertible) + let validationCodes = target.validationType.statusCodes + let alamoRequest = validationCodes.isEmpty ? initialRequest : initialRequest.validate(statusCode: validationCodes) + return sendAlamofireRequest(alamoRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) + } + + // swiftlint:disable:next cyclomatic_complexity + func sendAlamofireRequest(_ alamoRequest: T, target: Target, callbackQueue: DispatchQueue?, progress progressCompletion: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> CancellableToken where T: Requestable, T: Request { + // Give plugins the chance to alter the outgoing request + let plugins = self.plugins + plugins.forEach { $0.willSend(alamoRequest, target: target) } + + var progressAlamoRequest = alamoRequest + let progressClosure: (Progress) -> Void = { progress in + let sendProgress: () -> Void = { + progressCompletion?(ProgressResponse(progress: progress)) + } + + if let callbackQueue = callbackQueue { + callbackQueue.async(execute: sendProgress) + } else { + sendProgress() + } + } + + // Perform the actual request + if progressCompletion != nil { + switch progressAlamoRequest { + case let downloadRequest as DownloadRequest: + if let downloadRequest = downloadRequest.downloadProgress(closure: progressClosure) as? T { + progressAlamoRequest = downloadRequest + } + case let uploadRequest as UploadRequest: + if let uploadRequest = uploadRequest.uploadProgress(closure: progressClosure) as? T { + progressAlamoRequest = uploadRequest + } + case let dataRequest as DataRequest: + if let dataRequest = dataRequest.downloadProgress(closure: progressClosure) as? T { + progressAlamoRequest = dataRequest + } + default: break + } + } + + let completionHandler: RequestableCompletion = { response, request, data, error in + let result = convertResponseToResult(response, request: request, data: data, error: error) + // Inform all plugins about the response + plugins.forEach { $0.didReceive(result, target: target) } + if let progressCompletion = progressCompletion { + switch progressAlamoRequest { + case let downloadRequest as DownloadRequest: + progressCompletion(ProgressResponse(progress: downloadRequest.progress, response: result.value)) + case let uploadRequest as UploadRequest: + progressCompletion(ProgressResponse(progress: uploadRequest.uploadProgress, response: result.value)) + case let dataRequest as DataRequest: + progressCompletion(ProgressResponse(progress: dataRequest.progress, response: result.value)) + default: + progressCompletion(ProgressResponse(response: result.value)) + } + } + completion(result) + } + + progressAlamoRequest = progressAlamoRequest.response(callbackQueue: callbackQueue, completionHandler: completionHandler) + + progressAlamoRequest.resume() + + return CancellableToken(request: progressAlamoRequest) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider.swift new file mode 100755 index 0000000..bc5e870 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MoyaProvider.swift @@ -0,0 +1,206 @@ +import Foundation +import Result + +/// Closure to be executed when a request has completed. +public typealias Completion = (_ result: Result) -> Void + +/// Closure to be executed when progress changes. +public typealias ProgressBlock = (_ progress: ProgressResponse) -> Void + +/// A type representing the progress of a request. +public struct ProgressResponse { + + /// The optional response of the request. + public let response: Response? + + /// An object that conveys ongoing progress for a given request. + public let progressObject: Progress? + + /// Initializes a `ProgressResponse`. + public init(progress: Progress? = nil, response: Response? = nil) { + self.progressObject = progress + self.response = response + } + + /// The fraction of the overall work completed by the progress object. + public var progress: Double { + return progressObject?.fractionCompleted ?? 1.0 + } + + /// A Boolean value stating whether the request is completed. + public var completed: Bool { + return progress == 1.0 && response != nil + } +} + +/// A protocol representing a minimal interface for a MoyaProvider. +/// Used by the reactive provider extensions. +public protocol MoyaProviderType: AnyObject { + + associatedtype Target: TargetType + + /// Designated request-making method. Returns a `Cancellable` token to cancel the request later. + func request(_ target: Target, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> Cancellable +} + +/// Request provider class. Requests should be made through this class only. +open class MoyaProvider: MoyaProviderType { + + /// Closure that defines the endpoints for the provider. + public typealias EndpointClosure = (Target) -> Endpoint + + /// Closure that decides if and what request should be performed. + public typealias RequestResultClosure = (Result) -> Void + + /// Closure that resolves an `Endpoint` into a `RequestResult`. + public typealias RequestClosure = (Endpoint, @escaping RequestResultClosure) -> Void + + /// Closure that decides if/how a request should be stubbed. + public typealias StubClosure = (Target) -> Moya.StubBehavior + + /// A closure responsible for mapping a `TargetType` to an `EndPoint`. + open let endpointClosure: EndpointClosure + + /// A closure deciding if and what request should be performed. + open let requestClosure: RequestClosure + + /// A closure responsible for determining the stubbing behavior + /// of a request for a given `TargetType`. + open let stubClosure: StubClosure + + /// The manager for the session. + open let manager: Manager + + /// A list of plugins. + /// e.g. for logging, network activity indicator or credentials. + open let plugins: [PluginType] + + open let trackInflights: Bool + + open internal(set) var inflightRequests: [Endpoint: [Moya.Completion]] = [:] + + /// Propagated to Alamofire as callback queue. If nil - the Alamofire default (as of their API in 2017 - the main queue) will be used. + let callbackQueue: DispatchQueue? + + /// Initializes a provider. + public init(endpointClosure: @escaping EndpointClosure = MoyaProvider.defaultEndpointMapping, + requestClosure: @escaping RequestClosure = MoyaProvider.defaultRequestMapping, + stubClosure: @escaping StubClosure = MoyaProvider.neverStub, + callbackQueue: DispatchQueue? = nil, + manager: Manager = MoyaProvider.defaultAlamofireManager(), + plugins: [PluginType] = [], + trackInflights: Bool = false) { + + self.endpointClosure = endpointClosure + self.requestClosure = requestClosure + self.stubClosure = stubClosure + self.manager = manager + self.plugins = plugins + self.trackInflights = trackInflights + self.callbackQueue = callbackQueue + } + + /// Returns an `Endpoint` based on the token, method, and parameters by invoking the `endpointClosure`. + open func endpoint(_ token: Target) -> Endpoint { + return endpointClosure(token) + } + + /// Designated request-making method. Returns a `Cancellable` token to cancel the request later. + @discardableResult + open func request(_ target: Target, + callbackQueue: DispatchQueue? = .none, + progress: ProgressBlock? = .none, + completion: @escaping Completion) -> Cancellable { + + let callbackQueue = callbackQueue ?? self.callbackQueue + return requestNormal(target, callbackQueue: callbackQueue, progress: progress, completion: completion) + } + + // swiftlint:disable function_parameter_count + /// When overriding this method, take care to `notifyPluginsOfImpendingStub` and to perform the stub using the `createStubFunction` method. + /// Note: this was previously in an extension, however it must be in the original class declaration to allow subclasses to override. + @discardableResult + open func stubRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, completion: @escaping Moya.Completion, endpoint: Endpoint, stubBehavior: Moya.StubBehavior) -> CancellableToken { + let callbackQueue = callbackQueue ?? self.callbackQueue + let cancellableToken = CancellableToken { } + notifyPluginsOfImpendingStub(for: request, target: target) + let plugins = self.plugins + let stub: () -> Void = createStubFunction(cancellableToken, forTarget: target, withCompletion: completion, endpoint: endpoint, plugins: plugins, request: request) + switch stubBehavior { + case .immediate: + switch callbackQueue { + case .none: + stub() + case .some(let callbackQueue): + callbackQueue.async(execute: stub) + } + case .delayed(let delay): + let killTimeOffset = Int64(CDouble(delay) * CDouble(NSEC_PER_SEC)) + let killTime = DispatchTime.now() + Double(killTimeOffset) / Double(NSEC_PER_SEC) + (callbackQueue ?? DispatchQueue.main).asyncAfter(deadline: killTime) { + stub() + } + case .never: + fatalError("Method called to stub request when stubbing is disabled.") + } + + return cancellableToken + } + // swiftlint:enable function_parameter_count +} + +/// Mark: Stubbing + +/// Controls how stub responses are returned. +public enum StubBehavior { + + /// Do not stub. + case never + + /// Return a response immediately. + case immediate + + /// Return a response after a delay. + case delayed(seconds: TimeInterval) +} + +public extension MoyaProvider { + + // Swift won't let us put the StubBehavior enum inside the provider class, so we'll + // at least add some class functions to allow easy access to common stubbing closures. + + /// Do not stub. + public final class func neverStub(_: Target) -> Moya.StubBehavior { + return .never + } + + /// Return a response immediately. + public final class func immediatelyStub(_: Target) -> Moya.StubBehavior { + return .immediate + } + + /// Return a response after a delay. + public final class func delayedStub(_ seconds: TimeInterval) -> (Target) -> Moya.StubBehavior { + return { _ in return .delayed(seconds: seconds) } + } +} + +/// A public function responsible for converting the result of a `URLRequest` to a Result. +public func convertResponseToResult(_ response: HTTPURLResponse?, request: URLRequest?, data: Data?, error: Swift.Error?) -> + Result { + switch (response, data, error) { + case let (.some(response), data, .none): + let response = Moya.Response(statusCode: response.statusCode, data: data ?? Data(), request: request, response: response) + return .success(response) + case let (.some(response), _, .some(error)): + let response = Moya.Response(statusCode: response.statusCode, data: data ?? Data(), request: request, response: response) + let error = MoyaError.underlying(error, response) + return .failure(error) + case let (_, _, .some(error)): + let error = MoyaError.underlying(error, nil) + return .failure(error) + default: + let error = MoyaError.underlying(NSError(domain: NSURLErrorDomain, code: NSURLErrorUnknown, userInfo: nil), nil) + return .failure(error) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultiTarget.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultiTarget.swift new file mode 100644 index 0000000..7b813e4 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultiTarget.swift @@ -0,0 +1,54 @@ +import Foundation + +/// A `TargetType` used to enable `MoyaProvider` to process multiple `TargetType`s. +public enum MultiTarget: TargetType { + /// The embedded `TargetType`. + case target(TargetType) + + /// Initializes a `MultiTarget`. + public init(_ target: TargetType) { + self = MultiTarget.target(target) + } + + /// The embedded target's base `URL`. + public var path: String { + return target.path + } + + /// The baseURL of the embedded target. + public var baseURL: URL { + return target.baseURL + } + + /// The HTTP method of the embedded target. + public var method: Moya.Method { + return target.method + } + + /// The sampleData of the embedded target. + public var sampleData: Data { + return target.sampleData + } + + /// The `Task` of the embedded target. + public var task: Task { + return target.task + } + + /// The `ValidationType` of the embedded target. + public var validationType: ValidationType { + return target.validationType + } + + /// The headers of the embedded target. + public var headers: [String: String]? { + return target.headers + } + + /// The embedded `TargetType`. + public var target: TargetType { + switch self { + case .target(let target): return target + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultipartFormData.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultipartFormData.swift new file mode 100644 index 0000000..418cae2 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/MultipartFormData.swift @@ -0,0 +1,73 @@ +import Foundation +import Alamofire + +/// Represents "multipart/form-data" for an upload. +public struct MultipartFormData { + + /// Method to provide the form data. + public enum FormDataProvider { + case data(Foundation.Data) + case file(URL) + case stream(InputStream, UInt64) + } + + public init(provider: FormDataProvider, name: String, fileName: String? = nil, mimeType: String? = nil) { + self.provider = provider + self.name = name + self.fileName = fileName + self.mimeType = mimeType + } + + /// The method being used for providing form data. + public let provider: FormDataProvider + + /// The name. + public let name: String + + /// The file name. + public let fileName: String? + + /// The MIME type + public let mimeType: String? + +} + +// MARK: RequestMultipartFormData appending +internal extension RequestMultipartFormData { + func append(data: Data, bodyPart: MultipartFormData) { + if let mimeType = bodyPart.mimeType { + if let fileName = bodyPart.fileName { + append(data, withName: bodyPart.name, fileName: fileName, mimeType: mimeType) + } else { + append(data, withName: bodyPart.name, mimeType: mimeType) + } + } else { + append(data, withName: bodyPart.name) + } + } + + func append(fileURL url: URL, bodyPart: MultipartFormData) { + if let fileName = bodyPart.fileName, let mimeType = bodyPart.mimeType { + append(url, withName: bodyPart.name, fileName: fileName, mimeType: mimeType) + } else { + append(url, withName: bodyPart.name) + } + } + + func append(stream: InputStream, length: UInt64, bodyPart: MultipartFormData) { + append(stream, withLength: length, name: bodyPart.name, fileName: bodyPart.fileName ?? "", mimeType: bodyPart.mimeType ?? "") + } + + func applyMoyaMultipartFormData(_ multipartBody: [Moya.MultipartFormData]) { + for bodyPart in multipartBody { + switch bodyPart.provider { + case .data(let data): + append(data: data, bodyPart: bodyPart) + case .file(let url): + append(fileURL: url, bodyPart: bodyPart) + case .stream(let stream, let length): + append(stream: stream, length: length, bodyPart: bodyPart) + } + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugin.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugin.swift new file mode 100644 index 0000000..3f5bd6c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugin.swift @@ -0,0 +1,47 @@ +import Foundation +import Result + +/// A Moya Plugin receives callbacks to perform side effects wherever a request is sent or received. +/// +/// for example, a plugin may be used to +/// - log network requests +/// - hide and show a network activity indicator +/// - inject additional information into a request +public protocol PluginType { + /// Called to modify a request before sending. + func prepare(_ request: URLRequest, target: TargetType) -> URLRequest + + /// Called immediately before a request is sent over the network (or stubbed). + func willSend(_ request: RequestType, target: TargetType) + + /// Called after a response has been received, but before the MoyaProvider has invoked its completion handler. + func didReceive(_ result: Result, target: TargetType) + + /// Called to modify a result before completion. + func process(_ result: Result, target: TargetType) -> Result +} + +public extension PluginType { + func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { return request } + func willSend(_ request: RequestType, target: TargetType) { } + func didReceive(_ result: Result, target: TargetType) { } + func process(_ result: Result, target: TargetType) -> Result { return result } +} + +/// Request type used by `willSend` plugin function. +public protocol RequestType { + + // Note: + // + // We use this protocol instead of the Alamofire request to avoid leaking that abstraction. + // A plugin should not know about Alamofire at all. + + /// Retrieve an `NSURLRequest` representation. + var request: URLRequest? { get } + + /// Authenticates the request with a username and password. + func authenticate(user: String, password: String, persistence: URLCredential.Persistence) -> Self + + /// Authenticates the request with an `NSURLCredential` instance. + func authenticate(usingCredential credential: URLCredential) -> Self +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/AccessTokenPlugin.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/AccessTokenPlugin.swift new file mode 100644 index 0000000..65ba520 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/AccessTokenPlugin.swift @@ -0,0 +1,78 @@ +import Foundation +import Result + +// MARK: - AccessTokenAuthorizable + +/// A protocol for controlling the behavior of `AccessTokenPlugin`. +public protocol AccessTokenAuthorizable { + + /// Represents the authorization header to use for requests. + var authorizationType: AuthorizationType { get } +} + +// MARK: - AuthorizationType + +/// An enum representing the header to use with an `AccessTokenPlugin` +public enum AuthorizationType: String { + /// No header. + case none + + /// The `"Basic"` header. + case basic = "Basic" + + /// The `"Bearer"` header. + case bearer = "Bearer" +} + +// MARK: - AccessTokenPlugin + +/** + A plugin for adding basic or bearer-type authorization headers to requests. Example: + + ``` + Authorization: Bearer + Authorization: Basic + ``` + +*/ +public struct AccessTokenPlugin: PluginType { + + /// A closure returning the access token to be applied in the header. + public let tokenClosure: () -> String + + /** + Initialize a new `AccessTokenPlugin`. + + - parameters: + - tokenClosure: A closure returning the token to be applied in the pattern `Authorization: ` + */ + public init(tokenClosure: @escaping @autoclosure () -> String) { + self.tokenClosure = tokenClosure + } + + /** + Prepare a request by adding an authorization header if necessary. + + - parameters: + - request: The request to modify. + - target: The target of the request. + - returns: The modified `URLRequest`. + */ + public func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { + guard let authorizable = target as? AccessTokenAuthorizable else { return request } + + let authorizationType = authorizable.authorizationType + + var request = request + + switch authorizationType { + case .basic, .bearer: + let authValue = authorizationType.rawValue + " " + tokenClosure() + request.addValue(authValue, forHTTPHeaderField: "Authorization") + case .none: + break + } + + return request + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/CredentialsPlugin.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/CredentialsPlugin.swift new file mode 100644 index 0000000..5f22aab --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/CredentialsPlugin.swift @@ -0,0 +1,22 @@ +import Foundation +import Result + +/// Provides each request with optional URLCredentials. +public final class CredentialsPlugin: PluginType { + + public typealias CredentialClosure = (TargetType) -> URLCredential? + let credentialsClosure: CredentialClosure + + /// Initializes a CredentialsPlugin. + public init(credentialsClosure: @escaping CredentialClosure) { + self.credentialsClosure = credentialsClosure + } + + // MARK: Plugin + + public func willSend(_ request: RequestType, target: TargetType) { + if let credentials = credentialsClosure(target) { + _ = request.authenticate(usingCredential: credentials) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkActivityPlugin.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkActivityPlugin.swift new file mode 100644 index 0000000..c900105 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkActivityPlugin.swift @@ -0,0 +1,31 @@ +import Foundation +import Result + +/// Network activity change notification type. +public enum NetworkActivityChangeType { + case began, ended +} + +/// Notify a request's network activity changes (request begins or ends). +public final class NetworkActivityPlugin: PluginType { + + public typealias NetworkActivityClosure = (_ change: NetworkActivityChangeType, _ target: TargetType) -> Void + let networkActivityClosure: NetworkActivityClosure + + /// Initializes a NetworkActivityPlugin. + public init(networkActivityClosure: @escaping NetworkActivityClosure) { + self.networkActivityClosure = networkActivityClosure + } + + // MARK: Plugin + + /// Called by the provider as soon as the request is about to start + public func willSend(_ request: RequestType, target: TargetType) { + networkActivityClosure(.began, target) + } + + /// Called by the provider as soon as a response arrives, even if the request is canceled. + public func didReceive(_ result: Result, target: TargetType) { + networkActivityClosure(.ended, target) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkLoggerPlugin.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkLoggerPlugin.swift new file mode 100644 index 0000000..cc91afe --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Plugins/NetworkLoggerPlugin.swift @@ -0,0 +1,114 @@ +import Foundation +import Result + +/// Logs network activity (outgoing requests and incoming responses). +public final class NetworkLoggerPlugin: PluginType { + fileprivate let loggerId = "Moya_Logger" + fileprivate let dateFormatString = "dd/MM/yyyy HH:mm:ss" + fileprivate let dateFormatter = DateFormatter() + fileprivate let separator = ", " + fileprivate let terminator = "\n" + fileprivate let cURLTerminator = "\\\n" + fileprivate let output: (_ separator: String, _ terminator: String, _ items: Any...) -> Void + fileprivate let requestDataFormatter: ((Data) -> (String))? + fileprivate let responseDataFormatter: ((Data) -> (Data))? + + /// A Boolean value determing whether response body data should be logged. + public let isVerbose: Bool + public let cURL: Bool + + /// Initializes a NetworkLoggerPlugin. + public init(verbose: Bool = false, cURL: Bool = false, output: ((_ separator: String, _ terminator: String, _ items: Any...) -> Void)? = nil, requestDataFormatter: ((Data) -> (String))? = nil, responseDataFormatter: ((Data) -> (Data))? = nil) { + self.cURL = cURL + self.isVerbose = verbose + self.output = output ?? NetworkLoggerPlugin.reversedPrint + self.requestDataFormatter = requestDataFormatter + self.responseDataFormatter = responseDataFormatter + } + + public func willSend(_ request: RequestType, target: TargetType) { + if let request = request as? CustomDebugStringConvertible, cURL { + output(separator, terminator, request.debugDescription) + return + } + outputItems(logNetworkRequest(request.request as URLRequest?)) + } + + public func didReceive(_ result: Result, target: TargetType) { + if case .success(let response) = result { + outputItems(logNetworkResponse(response.response, data: response.data, target: target)) + } else { + outputItems(logNetworkResponse(nil, data: nil, target: target)) + } + } + + fileprivate func outputItems(_ items: [String]) { + if isVerbose { + items.forEach { output(separator, terminator, $0) } + } else { + output(separator, terminator, items) + } + } +} + +private extension NetworkLoggerPlugin { + + var date: String { + dateFormatter.dateFormat = dateFormatString + dateFormatter.locale = Locale(identifier: "en_US_POSIX") + return dateFormatter.string(from: Date()) + } + + func format(_ loggerId: String, date: String, identifier: String, message: String) -> String { + return "\(loggerId): [\(date)] \(identifier): \(message)" + } + + func logNetworkRequest(_ request: URLRequest?) -> [String] { + + var output = [String]() + + output += [format(loggerId, date: date, identifier: "Request", message: request?.description ?? "(invalid request)")] + + if let headers = request?.allHTTPHeaderFields { + output += [format(loggerId, date: date, identifier: "Request Headers", message: headers.description)] + } + + if let bodyStream = request?.httpBodyStream { + output += [format(loggerId, date: date, identifier: "Request Body Stream", message: bodyStream.description)] + } + + if let httpMethod = request?.httpMethod { + output += [format(loggerId, date: date, identifier: "HTTP Request Method", message: httpMethod)] + } + + if let body = request?.httpBody, let stringOutput = requestDataFormatter?(body) ?? String(data: body, encoding: .utf8), isVerbose { + output += [format(loggerId, date: date, identifier: "Request Body", message: stringOutput)] + } + + return output + } + + func logNetworkResponse(_ response: HTTPURLResponse?, data: Data?, target: TargetType) -> [String] { + guard let response = response else { + return [format(loggerId, date: date, identifier: "Response", message: "Received empty network response for \(target).")] + } + + var output = [String]() + + output += [format(loggerId, date: date, identifier: "Response", message: response.description)] + + if let data = data, let stringData = String(data: responseDataFormatter?(data) ?? data, encoding: String.Encoding.utf8), isVerbose { + output += [stringData] + } + + return output + } +} + +fileprivate extension NetworkLoggerPlugin { + static func reversedPrint(_ separator: String, terminator: String, items: Any...) { + for item in items { + print(item, separator: separator, terminator: terminator) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Response.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Response.swift new file mode 100644 index 0000000..ee0b259 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Response.swift @@ -0,0 +1,192 @@ +import Foundation + +/// Represents a response to a `MoyaProvider.request`. +public final class Response: CustomDebugStringConvertible, Equatable { + + /// The status code of the response. + public let statusCode: Int + + /// The response data. + public let data: Data + + /// The original URLRequest for the response. + public let request: URLRequest? + + /// The HTTPURLResponse object. + public let response: HTTPURLResponse? + + public init(statusCode: Int, data: Data, request: URLRequest? = nil, response: HTTPURLResponse? = nil) { + self.statusCode = statusCode + self.data = data + self.request = request + self.response = response + } + + /// A text description of the `Response`. + public var description: String { + return "Status Code: \(statusCode), Data Length: \(data.count)" + } + + /// A text description of the `Response`. Suitable for debugging. + public var debugDescription: String { + return description + } + + public static func == (lhs: Response, rhs: Response) -> Bool { + return lhs.statusCode == rhs.statusCode + && lhs.data == rhs.data + && lhs.response == rhs.response + } +} + +public extension Response { + + /** + Returns the `Response` if the `statusCode` falls within the specified range. + + - parameters: + - statusCodes: The range of acceptable status codes. + - throws: `MoyaError.statusCode` when others are encountered. + */ + public func filter(statusCodes: ClosedRange) throws -> Response { + guard statusCodes.contains(statusCode) else { + throw MoyaError.statusCode(self) + } + return self + } + + /** + Returns the `Response` if it has the specified `statusCode`. + + - parameters: + - statusCode: The acceptable status code. + - throws: `MoyaError.statusCode` when others are encountered. + */ + public func filter(statusCode: Int) throws -> Response { + return try filter(statusCodes: statusCode...statusCode) + } + + /** + Returns the `Response` if the `statusCode` falls within the range 200 - 299. + + - throws: `MoyaError.statusCode` when others are encountered. + */ + public func filterSuccessfulStatusCodes() throws -> Response { + return try filter(statusCodes: 200...299) + } + + /** + Returns the `Response` if the `statusCode` falls within the range 200 - 399. + + - throws: `MoyaError.statusCode` when others are encountered. + */ + public func filterSuccessfulStatusAndRedirectCodes() throws -> Response { + return try filter(statusCodes: 200...399) + } + + /// Maps data received from the signal into a UIImage. + func mapImage() throws -> Image { + guard let image = Image(data: data) else { + throw MoyaError.imageMapping(self) + } + return image + } + + /// Maps data received from the signal into a JSON object. + /// + /// - parameter failsOnEmptyData: A Boolean value determining + /// whether the mapping should fail if the data is empty. + func mapJSON(failsOnEmptyData: Bool = true) throws -> Any { + do { + return try JSONSerialization.jsonObject(with: data, options: .allowFragments) + } catch { + if data.count < 1 && !failsOnEmptyData { + return NSNull() + } + throw MoyaError.jsonMapping(self) + } + } + + /// Maps data received from the signal into a String. + /// + /// - parameter atKeyPath: Optional key path at which to parse string. + public func mapString(atKeyPath keyPath: String? = nil) throws -> String { + if let keyPath = keyPath { + // Key path was provided, try to parse string at key path + guard let jsonDictionary = try mapJSON() as? NSDictionary, + let string = jsonDictionary.value(forKeyPath: keyPath) as? String else { + throw MoyaError.stringMapping(self) + } + return string + } else { + // Key path was not provided, parse entire response as string + guard let string = String(data: data, encoding: .utf8) else { + throw MoyaError.stringMapping(self) + } + return string + } + } + + /// Maps data received from the signal into a Decodable object. + /// + /// - parameter atKeyPath: Optional key path at which to parse object. + /// - parameter using: A `JSONDecoder` instance which is used to decode data to an object. + func map(_ type: D.Type, atKeyPath keyPath: String? = nil, using decoder: JSONDecoder = JSONDecoder(), failsOnEmptyData: Bool = true) throws -> D { + let serializeToData: (Any) throws -> Data? = { (jsonObject) in + guard JSONSerialization.isValidJSONObject(jsonObject) else { + return nil + } + do { + return try JSONSerialization.data(withJSONObject: jsonObject) + } catch { + throw MoyaError.jsonMapping(self) + } + } + let jsonData: Data + keyPathCheck: if let keyPath = keyPath { + guard let jsonObject = (try mapJSON(failsOnEmptyData: failsOnEmptyData) as? NSDictionary)?.value(forKeyPath: keyPath) else { + if failsOnEmptyData { + throw MoyaError.jsonMapping(self) + } else { + jsonData = data + break keyPathCheck + } + } + + if let data = try serializeToData(jsonObject) { + jsonData = data + } else { + let wrappedJsonObject = ["value": jsonObject] + let wrappedJsonData: Data + if let data = try serializeToData(wrappedJsonObject) { + wrappedJsonData = data + } else { + throw MoyaError.jsonMapping(self) + } + do { + return try decoder.decode(DecodableWrapper.self, from: wrappedJsonData).value + } catch let error { + throw MoyaError.objectMapping(error, self) + } + } + } else { + jsonData = data + } + do { + if jsonData.count < 1 && !failsOnEmptyData { + if let emptyJSONObjectData = "{}".data(using: .utf8), let emptyDecodableValue = try? decoder.decode(D.self, from: emptyJSONObjectData) { + return emptyDecodableValue + } else if let emptyJSONArrayData = "[{}]".data(using: .utf8), let emptyDecodableValue = try? decoder.decode(D.self, from: emptyJSONArrayData) { + return emptyDecodableValue + } + } + return try decoder.decode(D.self, from: jsonData) + } catch let error { + throw MoyaError.objectMapping(error, self) + } + } +} + +private struct DecodableWrapper: Decodable { + let value: T +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/TargetType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/TargetType.swift new file mode 100644 index 0000000..48c77a0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/TargetType.swift @@ -0,0 +1,44 @@ +import Foundation + +/// The protocol used to define the specifications necessary for a `MoyaProvider`. +public protocol TargetType { + + /// The target's base `URL`. + var baseURL: URL { get } + + /// The path to be appended to `baseURL` to form the full `URL`. + var path: String { get } + + /// The HTTP method used in the request. + var method: Moya.Method { get } + + /// Provides stub data for use in testing. + var sampleData: Data { get } + + /// The type of HTTP task to be performed. + var task: Task { get } + + /// The type of validation to perform on the request. Default is `.none`. + var validationType: ValidationType { get } + + /// The headers to be used in the request. + var headers: [String: String]? { get } +} + +public extension TargetType { + + /// The type of validation to perform on the request. Default is `.none`. + var validationType: ValidationType { + return .none + } +} + +// MARK: - Deprecated + +extension TargetType { + @available(*, deprecated: 11.0, message: + "TargetType's validate property has been deprecated in 11.0. Please use validationType: ValidationType.") + var validate: Bool { + return false + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Task.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Task.swift new file mode 100644 index 0000000..191e259 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/Task.swift @@ -0,0 +1,41 @@ +import Foundation + +/// Represents an HTTP task. +public enum Task { + + /// A request with no additional data. + case requestPlain + + /// A requests body set with data. + case requestData(Data) + + /// A request body set with `Encodable` type + case requestJSONEncodable(Encodable) + + /// A request body set with `Encodable` type and custom encoder + case requestCustomJSONEncodable(Encodable, encoder: JSONEncoder) + + /// A requests body set with encoded parameters. + case requestParameters(parameters: [String: Any], encoding: ParameterEncoding) + + /// A requests body set with data, combined with url parameters. + case requestCompositeData(bodyData: Data, urlParameters: [String: Any]) + + /// A requests body set with encoded parameters combined with url parameters. + case requestCompositeParameters(bodyParameters: [String: Any], bodyEncoding: ParameterEncoding, urlParameters: [String: Any]) + + /// A file upload task. + case uploadFile(URL) + + /// A "multipart/form-data" upload task. + case uploadMultipart([MultipartFormData]) + + /// A "multipart/form-data" upload task combined with url parameters. + case uploadCompositeMultipart([MultipartFormData], urlParameters: [String: Any]) + + /// A file download task to a destination. + case downloadDestination(DownloadDestination) + + /// A file download task to a destination with extra parameters using the given encoding. + case downloadParameters(parameters: [String: Any], encoding: ParameterEncoding, destination: DownloadDestination) +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URL+Moya.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URL+Moya.swift new file mode 100644 index 0000000..9351fa4 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URL+Moya.swift @@ -0,0 +1,16 @@ +import Foundation + +public extension URL { + + /// Initialize URL from Moya's `TargetType`. + init(target: T) { + // When a TargetType's path is empty, URL.appendingPathComponent may introduce trailing /, which may not be wanted in some cases + // See: https://github.com/Moya/Moya/pull/1053 + // And: https://github.com/Moya/Moya/issues/1049 + if target.path.isEmpty { + self = target.baseURL + } else { + self = target.baseURL.appendingPathComponent(target.path) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URLRequest+Encoding.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URLRequest+Encoding.swift new file mode 100644 index 0000000..232d86d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/URLRequest+Encoding.swift @@ -0,0 +1,28 @@ +import Foundation + +internal extension URLRequest { + + mutating func encoded(encodable: Encodable, encoder: JSONEncoder = JSONEncoder()) throws -> URLRequest { + do { + let encodable = AnyEncodable(encodable) + httpBody = try encoder.encode(encodable) + + let contentTypeHeaderName = "Content-Type" + if value(forHTTPHeaderField: contentTypeHeaderName) == nil { + setValue("application/json", forHTTPHeaderField: contentTypeHeaderName) + } + + return self + } catch { + throw MoyaError.encodableMapping(error) + } + } + + func encoded(parameters: [String: Any], parameterEncoding: ParameterEncoding) throws -> URLRequest { + do { + return try parameterEncoding.encode(self, with: parameters) + } catch { + throw MoyaError.parameterEncoding(error) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/ValidationType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/ValidationType.swift new file mode 100644 index 0000000..ffc8d8f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Moya/Sources/Moya/ValidationType.swift @@ -0,0 +1,47 @@ +import Foundation + +/// Represents the status codes to validate through Alamofire. +public enum ValidationType { + + /// No validation. + case none + + /// Validate success codes (only 2xx). + case successCodes + + /// Validate success codes and redirection codes (only 2xx and 3xx). + case successAndRedirectCodes + + /// Validate only the given status codes. + case customCodes([Int]) + + /// The list of HTTP status codes to validate. + var statusCodes: [Int] { + switch self { + case .successCodes: + return Array(200..<300) + case .successAndRedirectCodes: + return Array(200..<400) + case .customCodes(let codes): + return codes + case .none: + return [] + } + } +} + +extension ValidationType: Equatable { + + public static func == (lhs: ValidationType, rhs: ValidationType) -> Bool { + switch (lhs, rhs) { + case (.none, .none), + (.successCodes, .successCodes), + (.successAndRedirectCodes, .successAndRedirectCodes): + return true + case (.customCodes(let code1), .customCodes(let code2)): + return code1 == code2 + default: + return false + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Pods.xcodeproj/project.pbxproj b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..fe80a35 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,2502 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 000A8017FF3356FA7C1B2F2B23E9EDB4 /* SynchronizedDisposeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 774AF70E891E715450119AEDC5A537A2 /* SynchronizedDisposeType.swift */; }; + 0175B3A4CDF1C9964EB838D2516F7C90 /* RxScrollViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59080A080A83F4394CEC1BC6F87B7FE4 /* RxScrollViewDelegateProxy.swift */; }; + 02241CBDA92574A53DBD0C3DA0B53AF7 /* SchedulerType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607AC4043EFA92A1C37C7B0FF04835BA /* SchedulerType+SharedSequence.swift */; }; + 02587A4A0F961A916CAF246B17D6A815 /* SwitchIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAF4C9D855A69FA6F113003C58F29148 /* SwitchIfEmpty.swift */; }; + 066325239A5C0DC607579EB4F8189E47 /* UIWebView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96821D683BE0FF75B881D048E588C30E /* UIWebView+Rx.swift */; }; + 0693D86EE4783C141B0E257E53129D7B /* UITabBarController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D868DC4C87344BF959CFFF2A928CE6D7 /* UITabBarController+Rx.swift */; }; + 07EE6A505094B00C5D57A159B9D32428 /* SubjectType.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA98C69CB0C9501BCA8A4AB039F2824D /* SubjectType.swift */; }; + 0854786C4D7576C430B06DE909AD3CE3 /* UIBarButtonItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031C703FE7B201355E8C75B76373E579 /* UIBarButtonItem+Rx.swift */; }; + 085858319690723532BD50AA79EB83F6 /* UIProgressView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6A5E6EE275526AEA54A17B5A2B56A52 /* UIProgressView+Rx.swift */; }; + 0890EDCE51F0899E5914F4420A9BA9FF /* AnonymousDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B867794384DA37C32085606F2A140199 /* AnonymousDisposable.swift */; }; + 091BADAC74B78879CD3AA0DEBB69B1A8 /* TargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9625C54AC195BBF4C7118EBDDC4AF043 /* TargetType.swift */; }; + 094C8FFC27C8C66B18DF62A8CB388E29 /* Pods-Poc.Mauro.Bianchelli-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = AAB667BE339E4195C5BD1DBE7F6FAF43 /* Pods-Poc.Mauro.Bianchelli-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0B11400C008ED98FF8963BC7398E1230 /* Merge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4638A5ABD2B559A29D94B9C108728BC6 /* Merge.swift */; }; + 0BE9259CAC1FAF5D367A831F4146B6D8 /* Amb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1488A38DA06FBC8A80142EF2A1017676 /* Amb.swift */; }; + 0CA7DED55A6027B53A4C8A5D8FB7F454 /* Reduce.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CA66B278E9A8D2C51380274158FEBB /* Reduce.swift */; }; + 0D9B392CEF40CE0E1BBBE511A4EC9526 /* SchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 126CF4FF0F2157D76678DD3D27AB700E /* SchedulerType.swift */; }; + 0DFE3F9F43EBD27380E1E59C604A387B /* AnyEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C640391EF698C824BF9DF5D13A4FA127 /* AnyEncodable.swift */; }; + 0FE44514580FFBCDFC3EE682EE6B283B /* _RXKVOObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C0A2583510F1719C581F3137B2B5197 /* _RXKVOObserver.m */; }; + 103378BE00E012044221E598D63C45FB /* RxTextStorageDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBE15DFC999316ED709283962519DCA /* RxTextStorageDelegateProxy.swift */; }; + 109F83F4BA3BE6E4674D6A0CE5E1DBFE /* Skip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75E45F5E492E89EE174C289EA17D4A7F /* Skip.swift */; }; + 10EB23E9ECC4B33E16933BB1EA560B6A /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8399FF9576895D4359B691F1F7885E09 /* Timeline.swift */; }; + 11ACC2B798A2DDFCCEE4C4EEEBD6ED12 /* KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B844E0FD0C49C635CA0CB7D766E3EA /* KVORepresentable.swift */; }; + 1289C65EE989828CC266BAB61066498F /* Catch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61BE001A85266456E641ECE7192B419 /* Catch.swift */; }; + 1374976ED9AE4CBF2472F0C721DDE53C /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2934D2F44A1D42C5D171431371F1D39 /* Errors.swift */; }; + 143A7A95D23A8E9BD2C9A3F8599321B8 /* DeprecationWarner.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFEAF907AEFF3F8CF0B1195A13EA77EA /* DeprecationWarner.swift */; }; + 155AFFEBD1F4C7D54BA3FEAAB957BE0E /* UIView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4D9D3C3E536BD2D82B5233BC4450765 /* UIView+Rx.swift */; }; + 164FB522D6B9930C2E0F5C52466DC536 /* SubscriptionDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B8E0C86672F5FD96DE920115D82E698 /* SubscriptionDisposable.swift */; }; + 17A5709C47999CBD43C4F6C945647272 /* NetworkLoggerPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1774FD7A455D0D4B1AA20B07564694 /* NetworkLoggerPlugin.swift */; }; + 18D1B764EA398E541BBD192E6D4CE5BA /* TakeUntil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C980F350FAE5E6F867DE4B64AE4E04F /* TakeUntil.swift */; }; + 19A41D9307D707BD56C34EF1973D2B64 /* Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DA345409B9DF10675071C6647A89300 /* Create.swift */; }; + 1B8D06E4CF4B6DA96A7B0A8E65846AED /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFA065D2E5496BD3D9E25A146F91B8EB /* Result.framework */; }; + 1B9EDEDC964E6B08F78920B4F4B9DB84 /* Alamofire-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE626B9BEA59A5134637C7852BA16BE /* Alamofire-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1BCB2FD54CC63F224B536E2FA59FC8A0 /* UISegmentedControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4321013709DF675B2B94B625AAC5E18 /* UISegmentedControl+Rx.swift */; }; + 1C0E34AFDB83CBA07DE26CF93D691A71 /* Range.swift in Sources */ = {isa = PBXBuildFile; fileRef = 543A7B496237BA1A98B7EA7FE9006AF8 /* Range.swift */; }; + 1C2593F670B3D86D51F00D790E05D6BD /* DefaultIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CFE087DED2DEE466A2DE1A17F0CDA2 /* DefaultIfEmpty.swift */; }; + 1C7255CF13F7BDB579D5618C26026C92 /* Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 796FD019EAA141224530DBCF7375B6AF /* Image.swift */; }; + 1E01D7F20FC6C4AF974B16CDA3A51C10 /* Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E21A07F75DDDA851DA9568942C30EE8 /* Reactive.swift */; }; + 1E6AE526831F47E23B1660595828C710 /* OperationQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF5459778E928DD19ADE18538F9534A1 /* OperationQueueScheduler.swift */; }; + 1E8314961D2FF6FF987F9890E18EF3E6 /* RxNavigationControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5921E0F02283F8F2BE28CB10320C49E1 /* RxNavigationControllerDelegateProxy.swift */; }; + 1F98B100A0AFB1B804DB4F918F8B38F3 /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = B731431F05AEBD8C3FB2D19EF3D59115 /* PriorityQueue.swift */; }; + 2037C6377B7890259A4923A146A09D34 /* UISwitch+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A13F41975A89C69518C03C25F7CAEF /* UISwitch+Rx.swift */; }; + 207EEB2259CD719B437CB2ABB0510629 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91203ED96AE0DA8EAED80DC1DFD13873 /* Platform.Linux.swift */; }; + 221F58FF06EA301286BE0B88C7B7B91D /* _RXObjCRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = 47B04D5FEBA64034BF6C77D866BEB7EF /* _RXObjCRuntime.m */; }; + 2315A9A695D53355F7A19C9E6294C4F9 /* ObserverBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 072722AE0F76D559AE7E7BAC7079CAD7 /* ObserverBase.swift */; }; + 251A612E9DE6ABD2E113075FC1686624 /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B66DA208B51638831DE765AC3492CFB /* Bag.swift */; }; + 25C902E034F3D7BC2A55F2C0D5E19C80 /* RxCocoaRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 6769E6211B0D47A7886C11D399D35912 /* RxCocoaRuntime.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2664C6F83FEA93B82B402D12B514B1EE /* Single.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50580E90EF5132F86256B5B520F7B8D6 /* Single.swift */; }; + 270217A1042AC1D5F33E7B321A8044A2 /* ControlEvent+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C01791CEC250AAD98A37727EBE791A4 /* ControlEvent+Driver.swift */; }; + 28135C947B4FF1A5A310F92E3791A2AE /* Zip+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D85CF21DBFBCE45817453C4866D94246 /* Zip+Collection.swift */; }; + 28272B59F03E9531724031C6E85DA56F /* RxTabBarControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2531EC9939C55935FDD7A8C7CC2DE146 /* RxTabBarControllerDelegateProxy.swift */; }; + 2A2A82B0362A354B25BFBA5C2BC6EBD1 /* CombineLatest+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = F407C292F09F6ECA5B5DBBB2EACC1BD9 /* CombineLatest+Collection.swift */; }; + 2ADA53BF4A7E47395977A59C21056053 /* MultiTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4E50A46C50C6B1FA668554EEAC67CCF /* MultiTarget.swift */; }; + 2BBA8E70B5DA276A62B14107A366EA39 /* Debounce.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9695323F5DFAE23631CCAC62A53B86E1 /* Debounce.swift */; }; + 2F60557C6DA60653BBB90254825A38DB /* PrimitiveSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABD74BA342E0CC9F587AC2B9067456B /* PrimitiveSequence.swift */; }; + 2FC4D356CC0C4E37C23459662FD31D7F /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57BE569C7246AEF3765FDF8172FB982C /* Task.swift */; }; + 2FEDE68EC554E8DAA6037DB226992917 /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E4E0B61B4F8DF1FDE16A909BAFE90F /* DisposeBag.swift */; }; + 3019DBCF835EF2736DA9971D58D0B84A /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F4CE9C1B14FE8D15892E0DE59E12AFE /* PriorityQueue.swift */; }; + 304C5A765FDEDD0CE68D21A4BDC7FC06 /* SwiftSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD0EC1C6F08620977DA1F2ED022C468 /* SwiftSupport.swift */; }; + 305489B9935616AA7E66348CFE4890BB /* ControlEvent+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5F5D4B37F37629DFC8E520AB591890 /* ControlEvent+Signal.swift */; }; + 30B34D197CAD6A1639769001DF348F3B /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFEFC8C35A5CF0F852CEC6EE3F0DFDE4 /* Disposables.swift */; }; + 31DEFF2B9258A81A3B6DB01DAB2FA933 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27870041DC364397664491D846A9EFD /* ResultProtocol.swift */; }; + 3312AE1EE5B469B986070A6E5843786F /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 482517258D68F540FF31653E71390AAF /* Bag.swift */; }; + 33E8999DF40BC521BC859BA8832E3DF0 /* CurrentThreadScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 588316120F5FBD5BFED973F65332ACB9 /* CurrentThreadScheduler.swift */; }; + 3406A8CA1AC8FD73E38C9A271F852E92 /* MainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97B45AC05EAE59EEADCE1E1E08EF040C /* MainScheduler.swift */; }; + 340DE081545E2C20E8F3ADE262BAA628 /* Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A664F256195F23B71E7BD0220BBDA1 /* Signal.swift */; }; + 3569237AE073516C01B76A7A585579CA /* BooleanDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F872318BFC72E833B7D7AB9FAC1057B9 /* BooleanDisposable.swift */; }; + 3590898A53AC87047F05B77BEFA75B12 /* _RXDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 566A6AF19885E377BB111BB9A92D2555 /* _RXDelegateProxy.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3626B94094672CB1C9DEA32B9F9502E1 /* TaskDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80979A93A9ABBA4DD416EBF55D6AD0BA /* TaskDelegate.swift */; }; + 37B63A84F47731EEC9BD4DDD3DC6C898 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05E421C982469B43A2C044CDE44A34E2 /* Platform.Darwin.swift */; }; + 38C342ADE62C54BE680239464AAB3145 /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7EC14CC9B4A5C029C17054A3B5A4363 /* Logging.swift */; }; + 3B2F39A4473DC4E0C96FDF1C3C877D2E /* AccessTokenPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE0E93B27128F5FFE7CADB7709D62F6 /* AccessTokenPlugin.swift */; }; + 3B4F902DE7B68C7DBF695795F74616D3 /* URL+Moya.swift in Sources */ = {isa = PBXBuildFile; fileRef = 367D2757BD0C44A07937A31912865ACD /* URL+Moya.swift */; }; + 3B5A8B281FEBD017BA0DF1868A4951A0 /* _RXDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C57014AD1B91147CC308902EBDC42457 /* _RXDelegateProxy.m */; }; + 3BCBD72B43C7998CCAAE0920CB87A30F /* Buffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452908585F08A1F9621403AD22855934 /* Buffer.swift */; }; + 3DE06E00536801CBCAC54C39297EF604 /* HistoricalScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBC53213A1B2F0913700CAB16F72C7DD /* HistoricalScheduler.swift */; }; + 3FBA9A2D57CEEE30D90DD08D0BFD61B2 /* RxTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5055A5322FDE0117989B7F7A4CA6617 /* RxTarget.swift */; }; + 40B9FD0005FDDAD86FD03C91468054F5 /* SkipUntil.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7247E8663426C4B17D6E86344DB7833 /* SkipUntil.swift */; }; + 40CF2438E0818521960EB72249F861A0 /* ObserverType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EDBD85DDA140F788E2724DFC57B4585 /* ObserverType.swift */; }; + 412D6F9DBEDDFD46D6E4E9E4DAC1EE50 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C8DE7E068369708CD2739C86ECF5AA7 /* RecursiveLock.swift */; }; + 420095F843A14BB58823A79E5801EB0B /* Completable+AndThen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5AC3610EE3E3CB896F26A42A63B275 /* Completable+AndThen.swift */; }; + 428C7CDFD406008C75DE9C2A360C92F0 /* Enumerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E5DE85AE4BE6A2C025475C352AC25A5 /* Enumerated.swift */; }; + 42C0F1AC53A1A0DD41ED270ACF7BAF16 /* Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23B01ED867851B413594E189DE57EBAD /* Zip+arity.swift */; }; + 42D6B03ED6BA9523C62F2D5F79B65D63 /* ObservableConvertibleType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC464909496E823EBDABFCADB36BC522 /* ObservableConvertibleType+SharedSequence.swift */; }; + 4357B53E5207FF151DF2FEB16F39CE72 /* Never.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EC049AD72EE52F4609AC267F8A785FB /* Never.swift */; }; + 437A6C3B03C733C9197AF8759B6E141B /* BinaryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AA267981C48BA3BBFBF4049C2422164 /* BinaryDisposable.swift */; }; + 443C578F5BA109930907345F9E356E8B /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E4D1ACEB0107F0325AC0426B93F21E /* Map.swift */; }; + 44CA755E75CB674560AF114D75D22E9F /* Result-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CC70243B9EB031333B4CE77988A16C55 /* Result-dummy.m */; }; + 4586D253943D8A82FCF3474D0AE9F8B4 /* SerialDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34663D66290FB4BE00D67B3BF8E2C825 /* SerialDispatchQueueScheduler.swift */; }; + 479527081A5900C9328EA619AD9B7537 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A681140FE2CFCB815EA30D76B692E0D /* RecursiveLock.swift */; }; + 4829633EF052760F15E1DD1F55FC51A4 /* SubscribeOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D6D1FE84D7DD184E5B59BD076EB300 /* SubscribeOn.swift */; }; + 497DC05933D352F374A90E81599754E2 /* GroupedObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D649314AC46F24696214F859AD59A9D /* GroupedObservable.swift */; }; + 49A2F10185279645CF412CF70FA1648C /* ItemEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB078927DA8D6A4E8AB1E85E8E926A6 /* ItemEvents.swift */; }; + 4A5808E90726DABF41383C69A9670FC2 /* UIActivityIndicatorView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20D68257284C060C5A140CDE9B10DC36 /* UIActivityIndicatorView+Rx.swift */; }; + 4BABB380144AEB29F5F3CB8E887F5340 /* Materialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D0378DA9B65279EDCC7CEAC794B27C1 /* Materialize.swift */; }; + 4CC79B472F4E5D2FDCD205B7384E3A6E /* ObserveOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB26DBC55B21F06A9A67B62DE818A230 /* ObserveOn.swift */; }; + 4DF1F342C996134DDB696D5D53679930 /* _RXObjCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = AB9504B24F136B8EAED6A663A8A09608 /* _RXObjCRuntime.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 517FB7696BDD96249654DE21D8B36F6D /* String+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE0DB93C053911EC706E22C83044BC9 /* String+Rx.swift */; }; + 51A89DC919D205E96C42C8F044A20101 /* First.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2239753C886ED1EB5FBC6FBAF30F3C8 /* First.swift */; }; + 51DBE11F875FBA948FDAF298C649CE27 /* UISearchController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE16E99CFF8A6DD7C51BF8BD6A9EDD78 /* UISearchController+Rx.swift */; }; + 52A6EC9A4A4BECEC18DA2C131BED73E5 /* UINavigationItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21C14B9A0FBBA0CDE96F4824D21B61FA /* UINavigationItem+Rx.swift */; }; + 5305C27BEC0E1FB3182A3E510E92B64D /* NotificationCenter+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAAB9D2E5475B1566BB93E6C594A4DA7 /* NotificationCenter+Rx.swift */; }; + 533068422A10025B848C791BCDC9C351 /* CompositeDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 640E867D1CCC1D055AA289BCB463EEEB /* CompositeDisposable.swift */; }; + 5387216E723A3C68E851CA15573CDD71 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1BE6839ADB84E137FB2549857938BA /* Request.swift */; }; + 546F58650B9678992B1F53880E480128 /* RxCollectionViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F6C98F5F5682F6DB2AF2A397CEA95F /* RxCollectionViewDelegateProxy.swift */; }; + 54D0B1C197E0E97641D1B81DC99BBFE1 /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 700D745D0CDABE65F55A2121022359B9 /* ObservableType+Extensions.swift */; }; + 54E95A5EB6B449A29E189C88B7C76A9D /* ElementAt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53C4E7F010D275B4115783E3F80BCFBF /* ElementAt.swift */; }; + 55A155EBA15BA962C1200A2EAC426B0C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */; }; + 56C0AD19E92FD9F001C7A31A8321C7D7 /* HistoricalSchedulerTimeConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1494F76E364CF3277A9F6A6A43D8BD7 /* HistoricalSchedulerTimeConverter.swift */; }; + 57E0019CEEF83EF2516C5BE7EA9492A2 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 456A0DD62FFBE70830DDC9115591A8AA /* Observable.swift */; }; + 59FFBACDB73AE6B085C63522FEAB385F /* SchedulerServices+Emulation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A7D17486CBF27495251EBFCCC8543D /* SchedulerServices+Emulation.swift */; }; + 5B70BB356233D83DA427840BDAB8D472 /* SharedSequence+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F50ACD321A7760524A2EB6C779EC6F5 /* SharedSequence+Operators.swift */; }; + 5C5E9D57A73BBDE09BC4A2980116D785 /* SingleAssignmentDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6C475C5CA3E24037F6F52828299145B /* SingleAssignmentDisposable.swift */; }; + 5EF35B59A24FDAE1B81A7744D9F23F7C /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C56ADE26AFA2C8D1442EB4575EB6628 /* Queue.swift */; }; + 60882349DB959B738A1649C247AF67DA /* RefCountDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E714880E2C211803F0C667D48273780 /* RefCountDisposable.swift */; }; + 60B748FBD37F5C84DB7332AE5F0972FE /* Observable+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7994E0D4606D81619447FD0209170947 /* Observable+Bind.swift */; }; + 61200D01A1855D7920CEF835C8BE00B0 /* DispatchQueue+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = D773213F21CAD426C9115BFE38419953 /* DispatchQueue+Alamofire.swift */; }; + 617A1673022EE19AEDB583424762257E /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 612EE801AF57652D1D80CDD9CE842343 /* Result.swift */; }; + 6287A7EC319EC25FDA91EA27D0CA9EBF /* AsyncLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74779BA54511629925AC2FC20BA09583 /* AsyncLock.swift */; }; + 62F65AD8DC4F0F9610F4B8B4738EC094 /* ServerTrustPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3A369CA6371A53103C298E05EB5ECE8 /* ServerTrustPolicy.swift */; }; + 6338C4D8250F5184E1C1AA052BD04900 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C7F98C3162B3DFF5A5D5693101048B5 /* Event.swift */; }; + 63CB43BF056081720ECE78CA57811166 /* Zip.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC8837CF826D9CB5E69BEF3F824F1BE6 /* Zip.swift */; }; + 6547FA1F9576BDF3DF9AB75293CEA86A /* Scan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85B845BAA6C239BE9D84B54AD6006B98 /* Scan.swift */; }; + 655E26C0E2AB0DC6BBF83FE1DDC50743 /* UITabBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 546E7772402CB4121BE94AD97DFFF271 /* UITabBar+Rx.swift */; }; + 6674DBAECDDA1437ACAE79D1A134578F /* Driver+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F0CCB2A8E8BAFEDEAD73FF19955B169 /* Driver+Subscription.swift */; }; + 669D4DEC41D1E46BA43782BB36F45774 /* RxPickerViewAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B97E0D77B5C3F39997CDC1222BE35A5 /* RxPickerViewAdapter.swift */; }; + 673F2C11C351D2688DDE98A40763876D /* GroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 593B2CE76D2737CD5145381E76BF5C2A /* GroupBy.swift */; }; + 6933EEF86AFE5164BE38E47185586E23 /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41D4147CD2B926EC29E2122E551F766F /* Sequence.swift */; }; + 69408281D2781F80B439688633628A94 /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDB334D0F464423D7C81479B22CA5018 /* InfiniteSequence.swift */; }; + 69C940908E4276DB32B9F0705C00A03A /* NSLayoutConstraint+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AB02911F47F316AD83FE1550A06C131 /* NSLayoutConstraint+Rx.swift */; }; + 6AB516D9B8F720FEF702BD3C2EEB179A /* UIPageControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF56272040561BCE263BF06EDF92BBD3 /* UIPageControl+Rx.swift */; }; + 6AED84F84763320B649AFC935D002F6C /* DisposeBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABB70736140BC8025F42722FD820F22 /* DisposeBase.swift */; }; + 6BCCE0541AFAA5B4366F8017B7B75622 /* VirtualTimeConverterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59D9FBE6E9DEF159A1CCD446EF950852 /* VirtualTimeConverterType.swift */; }; + 6C47D7273A08C240526ECF4B8AB952E4 /* Cancelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 402DC7F94F1F47F189C288E5F3F4CC4B /* Cancelable.swift */; }; + 6C5B293A3FCED9BE7F6C05F5DFE78885 /* ShareReplayScope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F0E3FAFC24CF83A9A82A76C82D8177A /* ShareReplayScope.swift */; }; + 6D3AAA620FE7EA6D09428EBB7C175C7C /* BehaviorRelay+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE42CE52A64E58545308EA066786D4DF /* BehaviorRelay+Driver.swift */; }; + 6DDF4D5EB23B3589031F7415BED2CA9B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */; }; + 6E03346BC079E51D918717820CDF21C0 /* UILabel+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EF0680539EE535CA45EA1C1E6095CB /* UILabel+Rx.swift */; }; + 6E2074A97A3CA6179FDC46A820CDA1F4 /* VirtualTimeScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45AA92A46E259A85655C112E0E77B7B6 /* VirtualTimeScheduler.swift */; }; + 6FE769FBAB286B6F4B390AC2DFB78B41 /* Maybe.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3C6A1403A2AAF6E6B99863948C28638 /* Maybe.swift */; }; + 70678FFE16E573F6622DD7CA73985F4A /* KVORepresentable+CoreGraphics.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5527DC3974AD3DD254937E1F8BCCB45 /* KVORepresentable+CoreGraphics.swift */; }; + 70E36EE2B03973F63BD040A239A3FF58 /* Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50CA2A06DCA4FEA885269BCB33EA14EE /* Timeout.swift */; }; + 71A571C901D475603299018F5A7EA333 /* _RX.m in Sources */ = {isa = PBXBuildFile; fileRef = A4DD9D47B3FAE3BF12A4B641EF0DFE61 /* _RX.m */; }; + 72D86827CF51B514920370F8B6654995 /* Cancellable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8054C525C6F7710840E4E57278D6051 /* Cancellable.swift */; }; + 733D554A6D487270BC063147413E6959 /* MoyaProvider+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A289D58F734EC791EDD5928AEFA84C4 /* MoyaProvider+Internal.swift */; }; + 73B9C996AED49ED7CF8EC2A6F1738059 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */; }; + 747BC26E36A5D6557BE6FFE7CBF1F2F8 /* WithLatestFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E6923DB4C37558D6C91C69FEF2EF4AE /* WithLatestFrom.swift */; }; + 74A24C3536C983D35776329B69D6A849 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = A43B3F7B831E1F817AFFCDB73117896F /* Error.swift */; }; + 74A69B9C225C9F0CA753D8CBE15749F1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */; }; + 75B81D3260F630052B2F74E0308A5A16 /* RxCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E058EEB5DC15659451FC01CAD78B163 /* RxCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 766638E7274644EDF7C167C4571B7B27 /* UITableView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2D7B33197C29FC082C71D4840B2838 /* UITableView+Rx.swift */; }; + 76AC4E25D7F59CFFD475DE62566A2EF4 /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = E13573CBB4C8E7CC110E95C5C637B59D /* Queue.swift */; }; + 776B0E60660233C224F1C4CA855AB084 /* ToArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15784E70845C7E8D7FC753712D229E77 /* ToArray.swift */; }; + 7778F187C5561D5FFF1E412E1EA7859A /* Disposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAEF10E0BAF6F62367D1848748CD9309 /* Disposable.swift */; }; + 77D6C138FB22E83D64D3B1B611F87F6A /* PublishRelay+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF9AB10A500D81E92FC3873C13DBE0CD /* PublishRelay+Signal.swift */; }; + 77E842DB9997B2D482F0D3F393127E12 /* Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE2510EFEB56DB6A88E0013A0B28FA3E /* Driver.swift */; }; + 7851E4601B599C94303F2900F5CFDCB0 /* InvocableScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69A195F0185289042EA6E224BF6BC79E /* InvocableScheduledItem.swift */; }; + 78735196D0FC6D3F47994881A6273642 /* ReplaySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55571D0FF3333DB6AE5AF229B01CE3AB /* ReplaySubject.swift */; }; + 7A01CC43F715B97D1627A6C077F775EE /* ObservableConvertibleType+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D5923D903D541803FED1EF6F48C6268 /* ObservableConvertibleType+Signal.swift */; }; + 7A1309FA462B6E34E71B40649AFC4E7D /* Binder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B91F4646916D6A782AA0EED33187B1 /* Binder.swift */; }; + 7A39B9CC16708A51D5336784EBA32F5F /* ControlProperty+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE225E5DBA6F249DBDD06855E52145FD /* ControlProperty+Driver.swift */; }; + 7B5FE28C7EA4122B0598738E54DBEBD8 /* SessionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 268C5409B669425DBEF85C03AD995BD8 /* SessionDelegate.swift */; }; + 7BF91EFE1C91A72443F2B955639F1341 /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EE223A45590605141523FEE50493B8F /* Lock.swift */; }; + 7CA7EA3FC527569A03340983822B5036 /* SynchronizedUnsubscribeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F389AC3C5DD1FBD6FB4D0C2C538EBB3 /* SynchronizedUnsubscribeType.swift */; }; + 7D8CC01E8C9EFFF9F4D65406CDE0AB66 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3825144D0C59C2E639CB03334D8CAB5 /* Result.swift */; }; + 7E2D32F8FB32BC0C7DD6D4B2A5D1ADD1 /* RxTableViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9F7A75834490D17E4285AFD177AE13D /* RxTableViewDataSourceType.swift */; }; + 7E3A6752A4F48232337166E95AA15F77 /* UIGestureRecognizer+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2EC4195474D86421CC14E7322769BDA /* UIGestureRecognizer+Rx.swift */; }; + 7F5884C838DBB9E3D71FE9430F015461 /* Completable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D06069B6D7763560D8E99829E3E3E65 /* Completable.swift */; }; + 8211FA7C9D42AD2CAFD1C8398879BCB4 /* AsSingle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C5AF960581BFEF8E9F37E2731FB95E1 /* AsSingle.swift */; }; + 8260939F92206F44568AC5233BC300CF /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58E2A05DB14D236E253A137CAB792635 /* Just.swift */; }; + 835BBB8F770CB690E73D4A31E7862F9A /* DeprecationWarner.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3E16172AC6C01829E10440000F8EA6B /* DeprecationWarner.swift */; }; + 849E2A36D80137B520B8DFE10B689431 /* Plugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48F87F3285C364F21F0CB151DDC5BA96 /* Plugin.swift */; }; + 84F1F6E8F1C7E89C7C3A22AA241A4EDE /* Delay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 209040F5132FFDA7172A17E1DFB22D84 /* Delay.swift */; }; + 852DEF14EDECFB4BE7DFA35C44F9483F /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 775CFC09CF2F4097E89E32CCCA2C7E08 /* Filter.swift */; }; + 85672ABB5C7DE227086838EA460DC3EF /* Using.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E0CC0E8E36F49E2F3064FE14C20F560 /* Using.swift */; }; + 86899AF43F20864B9946FEC14F04B87D /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC6B868DD994A90BFD87A2A4950D3D0 /* Switch.swift */; }; + 86D9208E2EF36ED82F41C0B3E9819F32 /* SectionedViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828094CD2704890A837308AD5C80BF7B /* SectionedViewDataSourceType.swift */; }; + 88266709E863D97525D5AE933FB1789F /* RetryWhen.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A369265F3BE803B3BCBEE1DB26D417 /* RetryWhen.swift */; }; + 88CE2219BD1B351C2FD501F5DCE5A31C /* UISearchBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21717E28EE7AF567169A038CC4D921A2 /* UISearchBar+Rx.swift */; }; + 895922FCA5A044E1FEC24F7778F34609 /* SharedSequence+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 783BC92943FC3531B681F396D4B475C2 /* SharedSequence+Operators+arity.swift */; }; + 8A0C5C2BF6EF1B3AA74A9BAFBAEDE935 /* StartWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98AB7AC096AAC5ADC179F51C2F4169C7 /* StartWith.swift */; }; + 8A6D0A4E0B17DCE172EAC3A33C612CC1 /* SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1490BEB0DEF77D6DB06DA821F60F9370 /* SharedSequence.swift */; }; + 8BB940090BD4AC49E2187908173813D6 /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 454B2C997B03C9E8D16918A7ECEA70A1 /* DispatchQueueConfiguration.swift */; }; + 8D9753B7E4DA0D837DF72E2A0E93B103 /* UIViewController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEFB87CE3C5495DA860EA0AE612F0B62 /* UIViewController+Rx.swift */; }; + 8E03D001CDC220D92860A362733A30A1 /* Signal+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = C76C505AD2031353B886FD15B765DBF8 /* Signal+Subscription.swift */; }; + 8F4120A1CF3DBA200117E2C92F3CEAFC /* SingleAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7675B0B6BF59467059B34FE3C407FC9E /* SingleAsync.swift */; }; + 8F55848C9DF65CFEF5605CB269EB7F33 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EEBFE033BA859D1724816180BD8528E /* Response.swift */; }; + 904E661E9D8FE6E5D3803A57DFA55373 /* Sample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 529047766DF9A80426E56FAA7574F2B2 /* Sample.swift */; }; + 911EA75B9A7616EB23CB7F2E84672DAF /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43759EC65F1EA7F5A1A7E2DCF48943B9 /* DispatchQueue+Extensions.swift */; }; + 91B94995F1D8BF90D1590458DB5F874D /* LockOwnerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8F3BB28666A6DF531063E714D97F9A /* LockOwnerType.swift */; }; + 9243FB41DC1B8EAF14491B231BCC4A1B /* NSObject+Rx+RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44F516FF55DA384413B5F90F99556630 /* NSObject+Rx+RawRepresentable.swift */; }; + 9279B6DE101166E3F2DEE018689659FC /* RxPickerViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B27D4E686A569CCF9490CD92CD36C77 /* RxPickerViewDataSourceProxy.swift */; }; + 9358DFE1074A13C364E8C2AC19C00160 /* RxWebViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4937CB9A960506A77BDF07CF0D4781E5 /* RxWebViewDelegateProxy.swift */; }; + 9456B079225B7A362B8DD31E525CF72C /* ControlTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 066F2C2E7FC2D6700C6E70045D2C2E50 /* ControlTarget.swift */; }; + 956657F28CB29B1D4CE983FC1D383822 /* RxPickerViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D944C59E1C48892EDBE5DD0B8E2BFA4D /* RxPickerViewDelegateProxy.swift */; }; + 96AAAA907C7D402D2805DE5362E0A6CE /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 685800254A834332919F7C7CF8BF6F33 /* Alamofire.framework */; }; + 972C6C6DD0540CCE1CB1F2E131B20DEC /* ScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA70EA8331CA7FAF3D5D45E3A388CAF /* ScheduledItem.swift */; }; + 97FA9D1BAAD7FE1646FC0C6D101CDA2C /* UINavigationController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A05CE41D35E11C7EE368237E963F349B /* UINavigationController+Rx.swift */; }; + 99948FAFD54292DE1D552DBE82076E43 /* UIStepper+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4478C5779DD458CDC0B31A8EBB06496F /* UIStepper+Rx.swift */; }; + 9A01EBC104202199D6AFB7E590393849 /* RxSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F7EE24D6EFA41154E753FEEA215D9B3 /* RxSwift-dummy.m */; }; + 9A35DC1B34182C765DFEEAA3EB853A21 /* Take.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45B2F1CB65A9B0CC514826E0BF93C740 /* Take.swift */; }; + 9A8267CFB5923400C3361517F6646B7F /* UIImageView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = B73B900362DBE72A151E48EB4D28D1EE /* UIImageView+Rx.swift */; }; + 9ABB5EA8C222A20AB4BA717A55FB4B79 /* ObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91AC578E9FAF5BF8333326D4FC8ACFE7 /* ObservableType.swift */; }; + 9B922A50D8CEC3EF84E506132FD2D928 /* Endpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66A85CA52BF9A3FF8DF11D2EC535B59B /* Endpoint.swift */; }; + 9BB20922BCB8B42683C8A746BBF15517 /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47B03B86FB941A0F683C249DBB71747D /* SerialDisposable.swift */; }; + 9C134B7FAC00A7B2680EA3DEFC1E7ABB /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = F249B9A39E7C62A0FECDD4801AB03D5C /* TextInput.swift */; }; + 9C6C4BFE414DFF89C177F78E4C9999E8 /* RxSearchControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 640D17250242556388043CFC3350478A /* RxSearchControllerDelegateProxy.swift */; }; + 9D5EC3416D38D758479AE89689738581 /* SynchronizedOnType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2612536C4888CC8672AE737D361CF933 /* SynchronizedOnType.swift */; }; + 9DC3AF14BE2092534EA43DFF82F8D2A4 /* UICollectionView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DD4042DADF04EC09D8FB581DDE6153E /* UICollectionView+Rx.swift */; }; + 9ED2BB2981896E0A39EFA365503F58CE /* AFError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 056F251D8604EF9227E1909621708A0D /* AFError.swift */; }; + 9F5205F25BB331032CD9EBF3542F00E7 /* Concat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FDC256DFFD39EEE1A8D67BA91892551 /* Concat.swift */; }; + A0DBB80FB8DAA0A092D2867E8B20B9F5 /* RxSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 44FB42F65DE8F8EA681FA2EC07049396 /* RxSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A1E94E6BA07A9918CCD742316E995263 /* UIPickerView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E9B3AD3B29D698C66BD2F9C284C5425 /* UIPickerView+Rx.swift */; }; + A2A6F71B727312BD45CC7A4AAD7B0AB7 /* NetworkReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCB9672E276F2443F8E92F726CF960A5 /* NetworkReachabilityManager.swift */; }; + A2D18C2842F4D3B194BCFEDFF17A4590 /* Pods-Poc.Mauro.Bianchelli-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = DA6C66FAD642C5F74BDB4DBC244AE83A /* Pods-Poc.Mauro.Bianchelli-dummy.m */; }; + A2E6D91056689F41D8392004B1D4A065 /* NetworkActivityPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72775411F33D867EF5F31CD775B47F55 /* NetworkActivityPlugin.swift */; }; + A37D44D94478073247C5464BAF6466A1 /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B68269B27D96A653AF5542C1CDE3466B /* TakeLast.swift */; }; + A79E00DF1396FFF2A503AE97613D0613 /* _RX.h in Headers */ = {isa = PBXBuildFile; fileRef = F8732CC36F8A87A0DF79400B56958F90 /* _RX.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A7B69E8602F07EA9BD2560F410AA3E79 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102CA46215647FB9B8C5C46AD43B98B6 /* RxCocoaObjCRuntimeError+Extensions.swift */; }; + A9EEEA7477981DEEBC72432DE9990A4B /* Alamofire-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 28DEA50E3805B80FFDFD92B3C116053A /* Alamofire-dummy.m */; }; + AACCF0D896D1F1A345FAF9909B499DCB /* RxCocoa.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B59C4F0FF9A6C2F08C6D13F83511E4F /* RxCocoa.swift */; }; + AAFC1C4EB46DE503C5751ED8436E0C8B /* Bag+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EF8E8D3A2B58E8B8E5E7D51CD8EB43 /* Bag+Rx.swift */; }; + AC46F3F2B0054D6CFB01D290B3AF247C /* PrimitiveSequence+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C1DBF477920959017AFBB3BCC882190 /* PrimitiveSequence+Zip+arity.swift */; }; + ACAA02F8901B03BA08C506F751B9C037 /* UIAlertAction+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CABC264C3610237A8CD26CD938198F /* UIAlertAction+Rx.swift */; }; + ACE403E64E267B0E31A3318BEE4F8E87 /* RxTableViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A944575E67D83FD486735403EBA6CBB /* RxTableViewDataSourceProxy.swift */; }; + ACFE7A82EC9067970DF17D8B58E2874C /* MoyaProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD04E408D96BDEBF601870F02E2523B /* MoyaProvider.swift */; }; + AD50E8B8CD90A33A9EFF354A96FC06D5 /* RxSearchBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E9C769A16ED82FC37183B9CDBE67CAF /* RxSearchBarDelegateProxy.swift */; }; + AE1EF48399533730D0066E04B22CA2D6 /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B7EBD5C210FE2AF7127B48AF965550 /* SessionManager.swift */; }; + AEAD02E8EDF23BEA762E365033527930 /* Timer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25FA61B6266AE60861A29416E7251BED /* Timer.swift */; }; + AEB75E3E9FF287713340A15846BDDB50 /* PublishSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F1F349D0C5ED481A088551D5211B93 /* PublishSubject.swift */; }; + AF24A0F39F4A4BA756F1F221015609A3 /* Generate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292D0884C2C698E995736B945B59E108 /* Generate.swift */; }; + AF59C7554E63AA53C5047A000A70DCF1 /* _RXKVOObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 274E67E42D8C2E07DFBC98FD5DF1B617 /* _RXKVOObserver.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AF883C413E84D4B35345374C61CB01B0 /* UIDatePicker+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF856FBA172952B116EA398C72825DE3 /* UIDatePicker+Rx.swift */; }; + AFAB145EE1684FE94767EE37909FB267 /* Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCBFA2A49A5003A48D4AFA82FD76269F /* Empty.swift */; }; + B097B1EB497B99F14D3F6C1D650696C8 /* RecursiveScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D581FC98B27209305B1C96158F164378 /* RecursiveScheduler.swift */; }; + B2AFE915BE7C1CF17069F5B7E55BEE4B /* DelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4F06B12C2AC456AC39D8E1BCB3BFFC6 /* DelegateProxy.swift */; }; + B398E6D727A17EF6E0E5CD77AFBDA20E /* URLRequest+Encoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6713847DA6573386E0E013E4D55DEB1E /* URLRequest+Encoding.swift */; }; + B473100C73ADEC6683F3121BECB9A46D /* UISlider+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97EFCC26A29A6041A7C61BB3D7A1DFC /* UISlider+Rx.swift */; }; + B4EF72242E74A291EA90A482206609B4 /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C825A0EA21D4868284718BFAB6A99BC3 /* InfiniteSequence.swift */; }; + B52D1B997B8988E3E787FE63A40C4D22 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */; }; + B54101903F14A8F38F0BFDFD219EBD12 /* ControlProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAEF284CFA646FBE3227CC442D45D538 /* ControlProperty.swift */; }; + B5B5793BF68C83AFCB8BF753C0B7F32C /* DelaySubscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7CBF07EC12EF7012E71880903CF540D /* DelaySubscription.swift */; }; + B62790B42F097F0589CD4E3764AA0AE6 /* UIApplication+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83279DABB4C6ECF9321ACE104DE4180A /* UIApplication+Rx.swift */; }; + B65E91651AD6419FD686EAA1E1564776 /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEB015928C0D4849D9321765F325C80A /* Deprecated.swift */; }; + B65FCF589DA398C3EFE0128064E510EC /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA6AD912A7B05B9D1B8C209BD247709B /* MultipartFormData.swift */; }; + B74B1FC2016B0F65E5806DDD3FB773C2 /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06780CB2BBCB6A265048A83425FEE252 /* Window.swift */; }; + B8838F0EE35916FE6EA3B4753E4F13F3 /* RxCollectionViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0B734B9AAEE4C0654A15CB6FABD128D /* RxCollectionViewDataSourceType.swift */; }; + BA487C5AC48A97A445351C9E737EF6BC /* RxCocoa-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6016E425CB87C89A57D510F9090E109E /* RxCocoa-dummy.m */; }; + BA65EB96ECE98C167F0551C353295B0F /* ScheduledItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7578897C7F0B66F64E5A0664A80F49 /* ScheduledItemType.swift */; }; + BBEFE2F9CEB73DC7BD97FFA66A0D9D4F /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA3CA0BA6A7D4968608D53E10E6EDCD /* Validation.swift */; }; + BC8E3A8E1213B5A83014D6D39A781676 /* Moya+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 219B9BED6D32D0A6DE60AC5EC4AE22F0 /* Moya+Alamofire.swift */; }; + BD463026D11809C7AB2BDAB2F5FE442D /* UITextField+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 781DF09C92A81430AA39925B9E58DDE8 /* UITextField+Rx.swift */; }; + BD5C07D6ED406F11FA0FEBE58A9F06A6 /* Multicast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13EFFD989ABE0F3D5B00435E3D02C46C /* Multicast.swift */; }; + BE5C67A07E289FE1F9BE27335B159997 /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2113D0F0A914BAC961085988D9E1B4 /* ParameterEncoding.swift */; }; + BEF65FAC7F41DD037C2FA32FF25E5690 /* ObservableConvertibleType+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5405020A34510E9923D449DA9BA5BAA /* ObservableConvertibleType+Driver.swift */; }; + BF0105B0F504945FD2D42BCE816B12C3 /* ObservableConvertibleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDA904E22762BF09A7FD417E6D67FF35 /* ObservableConvertibleType.swift */; }; + C1C75459A934C0A3C5EA74BAE3B74E11 /* RxCollectionViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A01A95E82680EB326BF9FE5E5DC811 /* RxCollectionViewDataSourceProxy.swift */; }; + C24A468DCBCA26F37C9D7376D2A23A4A /* RxTableViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A66F25D7C3265F51558CEDF5580A05B /* RxTableViewReactiveArrayDataSource.swift */; }; + C3B34436062187625B6F8BCFCB541297 /* Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F14CE7AA0B5CA410D91BB1502B672702 /* Rx.swift */; }; + C5895EC31EC8D9A3127BACDE9272B350 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C714B8FEF494857628B8EEA3156D20E /* Platform.Darwin.swift */; }; + C6A5B5C622B60837323A1945142A5243 /* NSObject+Rx+KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331D6C9DEA5919DD6A5A59BBE4DE2D23 /* NSObject+Rx+KVORepresentable.swift */; }; + C776BF38C6B8D242A4B6D860225243AA /* Repeat.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBB1C6A0DB9C167F1DE54BE11AF17D21 /* Repeat.swift */; }; + C869CC7105F48BFFB933AD37380D830E /* ValidationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C282D3F25B4AF64597D341CDF305AD2F /* ValidationType.swift */; }; + C86E216EAC75F76180F7F83B0AE60C6A /* Deferred.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18BC61A7F18B5EE363718022D65D3CC6 /* Deferred.swift */; }; + C91493F899290CEA1E283BD830FB1817 /* MoyaProvider+Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C081688FC6CB1416CBD297F843D68DB /* MoyaProvider+Defaults.swift */; }; + CAFBFD86E431F9CBE6A2EB330F67CFB9 /* UITextView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A918442CA75CD4C996CBC87F75D53DE /* UITextView+Rx.swift */; }; + CB1BB0BF2CA2B1016234F802B60BCC55 /* ConcurrentMainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0809651855756AC5E876371B7AF4AC4 /* ConcurrentMainScheduler.swift */; }; + CB6D60925223897FFA2662667DF83E8A /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = C56C8085EBB1044708D442A7A5BC39BB /* Response.swift */; }; + CB8F0704C8DD69377096EC4DDD90D281 /* MoyaError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B17DCD19CE1575F0459681E500A9058 /* MoyaError.swift */; }; + CBD3CB178ECF729AC451EB78391A89A8 /* AddRef.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F78646ADA03F5B7DB27B6F88B19A9CB /* AddRef.swift */; }; + CE7684C8FA700855275A95900DDF0168 /* NSTextStorage+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6429F8BE97309783363CC2FDF1B5B385 /* NSTextStorage+Rx.swift */; }; + CE780FE88629803F1481F6E512FA47AD /* RxPickerViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 702EC6ED4E55D36C87781B1FD64BD969 /* RxPickerViewDataSourceType.swift */; }; + CEE25C8AC8E8FEE8805AA92D221CC1B1 /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53EB730C9D691442798139E76B032319 /* Optional.swift */; }; + CF4BF25A378CAA50D438D5AC15F349F1 /* ConnectableObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 421FFA23B973E86DA9C4FFC9515480E8 /* ConnectableObservableType.swift */; }; + CFB3067A978A4D6ED538A4B6A213E225 /* CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5ADAE25B289D64EEC037FB3C375CE17 /* CombineLatest+arity.swift */; }; + D109E8252748E7895173A9B336850751 /* UIControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = B89EE0A9FE00AF24678B020F10A1BEA0 /* UIControl+Rx.swift */; }; + D25505EBE70FA8DDDFCCFA52E1EF0A53 /* AsyncSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4032FFF540F1EDEE2007813C98F9AC /* AsyncSubject.swift */; }; + D2589D017835BEB15AD02C126777F5E9 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5C9979D888F70291A4985BD5347FF10 /* MultipartFormData.swift */; }; + D2D37F301B30BC14E6B144D2459F597B /* RxCocoa-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C20A0937437DA521B69B15B19E17EA0 /* RxCocoa-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D30B5819EFB81BCE503D42A93209AE33 /* AnonymousObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB0C1CC5DA2BBD415DECEEE2C84C9660 /* AnonymousObserver.swift */; }; + D39D5EC7102D95A27EE101D994FA35FA /* TakeWhile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71742B2767286FA0B4C28BD82940901F /* TakeWhile.swift */; }; + D58C7D70E2A4BA3E51393BE41CA08717 /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263AE6E8B3A0768596DC732D01FC4A35 /* Deprecated.swift */; }; + D6D01FBB89514E3829D16F284F8BDDE1 /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = D748811B7842BF9A2379F03F3B19BBB5 /* Debug.swift */; }; + D80510277B184ADA255F01A3CD32FC0C /* RxCollectionViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF0B6FCBFA60F4C6B7AC1EEFB82D18AD /* RxCollectionViewReactiveArrayDataSource.swift */; }; + D80848BEBB4EDFD7A9B1D12DDD03B34D /* ObservableType+PrimitiveSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E9A4BA5E4AC230680603D1B8E9D867 /* ObservableType+PrimitiveSequence.swift */; }; + D9070CB5EB5B2C8D74B04C9EB7045D4A /* UIScrollView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 480458214E0283DAA8936924B7A44398 /* UIScrollView+Rx.swift */; }; + DA0A7AA050B27E3C2971E758D0C2545F /* DistinctUntilChanged.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F064D99A764700AADE9113F1B15FBF4 /* DistinctUntilChanged.swift */; }; + DAB6E49D49A21392A602A5D0AB0C97F2 /* RxTextViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 393ADB8B05768317A3DED73DCD502A83 /* RxTextViewDelegateProxy.swift */; }; + DB5CE1B747E696D5F92DB01B52B9D16E /* ScheduledDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F7D58BC1B2F6C7BCB1ABC8230AF015 /* ScheduledDisposable.swift */; }; + DBE89E6C6D1994D78DBF1411BC339286 /* Dematerialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64C517E1C9CEF76715540048EE6344EA /* Dematerialize.swift */; }; + DC1958CD06D74DD973C6703AEBCA2763 /* InvocableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83C5CC9272FBB8DB46160F6519F0A197 /* InvocableType.swift */; }; + DC1DEAB0B7EF5950B44833BC42AE0628 /* URLSession+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32E878B2C6502D31C0B0DC736C6E71A8 /* URLSession+Rx.swift */; }; + DCAD342946F1F8006C814F04D08F54A6 /* Result-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = EFEAAF7C33E8F5920B6C0B460CC8020C /* Result-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DD63741EE675BECE1743175832464C1E /* Moya-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AD4FB36DE721649513449EC9FB8752 /* Moya-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DE0F3103F5C869B69B5F3F92EE9A73B5 /* PublishRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EF61F08EBC7757DF18820F146E94F1 /* PublishRelay.swift */; }; + DE61C3854A6A5F65B3C8FC11BA3AB0A8 /* DelegateProxyType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2825D34C8364C9F4BDD346ED63515CA3 /* DelegateProxyType.swift */; }; + DE634FBE0CCAF019E917573E7DB31CD3 /* RxMutableBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030A2D2C9021B3028CEDB3BBF9C3B7CC /* RxMutableBox.swift */; }; + DF318D77490D37CCE34DE86EE7065E3C /* KVORepresentable+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 629C3A929E3AD468B2687470753B7813 /* KVORepresentable+Swift.swift */; }; + DFCE8A2525CEE19980B772E8969940CF /* ConcurrentDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2EDC55840F3B96D77F55037A8D43C91 /* ConcurrentDispatchQueueScheduler.swift */; }; + E18D144EFC6355080F1AC1CDEB956B12 /* ControlEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A64D24463D26D541FBEA35572B8409 /* ControlEvent.swift */; }; + E28A0DD1C4F8EDA2C903EEEEECD2C140 /* ImmediateSchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37072FB7EB8858C113CF03ACFE7FB695 /* ImmediateSchedulerType.swift */; }; + E58D57682FBCB4600AF4168DAC47C6E6 /* TailRecursiveSink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CC8116639B8B142E7EEC0ED489F61CA /* TailRecursiveSink.swift */; }; + E5F47523A6525AA6030593D8EA8E4001 /* RxTableViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE3D79F6E5CE43A5FCAED188650CE980 /* RxTableViewDelegateProxy.swift */; }; + E6E5FB31464EC9F106C445F632B44F21 /* Throttle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B0B2270620835CF5E57A87ED9F6C06 /* Throttle.swift */; }; + E70F0BB99BB35D66E961E22E04BEFEED /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68F8F14748B1923D2480039D5A7B10B3 /* RxSwift.framework */; }; + E811733E4FC26A957D93877B360C6407 /* RxTabBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB2567842FE11C11B5DF733998B36A7 /* RxTabBarDelegateProxy.swift */; }; + E86BAEF1E35223A2E759A5BB14C5165E /* CombineLatest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CFC1C39C2ED4B422FB78FE044364428 /* CombineLatest.swift */; }; + E8A78FCAF79791783FB84FC88E5776BC /* SkipWhile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251E6FC332DBC1111B6D6B3BCFE3DD2 /* SkipWhile.swift */; }; + EB65F7D7294E09F5DF13851C94785B98 /* UITabBarItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A44B5CDDC52038185A35939CF523C09F /* UITabBarItem+Rx.swift */; }; + EE3D945EE3CE23EEA6793851EA28CA8A /* BehaviorRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84EA7E3B6A5185FFDACC90C31402E30C /* BehaviorRelay.swift */; }; + EEE9104C35DE7868AC29E87204E2E801 /* Do.swift in Sources */ = {isa = PBXBuildFile; fileRef = A189F2971F0DD59D62871BC6A3FF6D92 /* Do.swift */; }; + EFD264FC408EBF3BA2528E70B08DDD94 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F05119035F8ED2589F1BB6BA8EF5BFE /* Notifications.swift */; }; + F065A0CD146D6C1430B1C29CDD28DC73 /* CredentialsPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CFBBE2B7FD71F1C9B0903D9E7B3582 /* CredentialsPlugin.swift */; }; + F424CCBF8A91F15ADDC29F5FD06C2584 /* Sink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E75FD9798D5B0383CBACD6C76D8214A /* Sink.swift */; }; + F4DD1EA2FDCA1DB3878A4FC7AD082D30 /* AsMaybe.swift in Sources */ = {isa = PBXBuildFile; fileRef = E43105A74FB572DFDB35777CF2BD99D4 /* AsMaybe.swift */; }; + F5E10BEBC50162299906F13DEC9247AB /* AnyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A485D5677352C7345F2C90D61A5C05 /* AnyObserver.swift */; }; + F66F50794418A33BF370393474D466B5 /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E7A3E6F4FA3713D40398CA98BF6B592 /* UIRefreshControl+Rx.swift */; }; + F697C622AEB525A7B4D890DD2D1DC62D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */; }; + F6A28D8E616C3EE202E184E40D280D08 /* NopDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6164C37F5C64B2C7909B891B7BD396A0 /* NopDisposable.swift */; }; + F6BECD98B97CBFEBE2C96F0E9E72A6C0 /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 212C92E080650BEAD55DB24EED777863 /* ResponseSerialization.swift */; }; + F84308B06D5B3124E4CF3C2CB1AAA0AF /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5543D307A0C69B9BFC688465CDCE4F98 /* DispatchQueue+Extensions.swift */; }; + F8B3D3092ED0417E8CDF32033F6122F5 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C0A5F09C82ED6DDF9E9206EAB3B39B5 /* Alamofire.swift */; }; + F914E4B001C49D64CDE76577A10A0B79 /* UIButton+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5501E6C767A876EFFBBBA069B6476B6 /* UIButton+Rx.swift */; }; + F9512C7E99ED6D7869BE5AEFC9B1E2DC /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17040BE249A9119977247A25D904AD4A /* Platform.Linux.swift */; }; + FA65245C2BB03501465E33CE66B03403 /* NSObject+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F557DBB453F7244671E6AE884116693D /* NSObject+Rx.swift */; }; + FCBACB830D53EB424B11A2455F2B8D31 /* Producer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70AE227D3C54F5A1C9877041B8FECDE4 /* Producer.swift */; }; + FF1066368629FE0FAA324726ADA67EEF /* Moya-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 04DBEE5E7E2379F0ABDBCC35A4E70B99 /* Moya-dummy.m */; }; + FFC0ADCC3EF947E8D9CCA3B3CC05B17C /* BehaviorSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3D021DB3292DB0E7D8C5E08F48C0131 /* BehaviorSubject.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 078116908A5DD3F54C87A7686B128E2F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 88E9EC28B8B46C3631E6B242B50F4442; + remoteInfo = Alamofire; + }; + 401CDAA32DE4D9A57173DCFE2EA3B2D4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 9749FEC86D945A13F98E7FCD33DB54AB; + remoteInfo = Moya; + }; + 478F54170C3A7980D842C158DB803D92 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 46F960D6F4D1364D9AC46EA5C3156681; + remoteInfo = Result; + }; + 5A94C66747B145D6325EC896CA0A31FA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 00B6F181E4BA99DE08FCECA77BDDE7F6; + remoteInfo = RxSwift; + }; + 8FD7970B6A0A8F5E04CC3F5A29F0B40C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 00B6F181E4BA99DE08FCECA77BDDE7F6; + remoteInfo = RxSwift; + }; + CC984604E83EAF152B83792B810E60F7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 46F960D6F4D1364D9AC46EA5C3156681; + remoteInfo = Result; + }; + DBB19EEFE78638394C134035356C241E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 88E9EC28B8B46C3631E6B242B50F4442; + remoteInfo = Alamofire; + }; + EFF2AD30305F33EBB46244C5D59D9FED /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = B406736ABC06D6F77F8ED7ED0FCC4184; + remoteInfo = RxCocoa; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 00B91F4646916D6A782AA0EED33187B1 /* Binder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Binder.swift; path = RxCocoa/Common/Binder.swift; sourceTree = ""; }; + 028A906B81200D4170A91E86C2CFEC1F /* Result.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Result.modulemap; sourceTree = ""; }; + 030A2D2C9021B3028CEDB3BBF9C3B7CC /* RxMutableBox.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxMutableBox.swift; path = RxSwift/RxMutableBox.swift; sourceTree = ""; }; + 031C703FE7B201355E8C75B76373E579 /* UIBarButtonItem+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIBarButtonItem+Rx.swift"; path = "RxCocoa/iOS/UIBarButtonItem+Rx.swift"; sourceTree = ""; }; + 036A9A8DF2BE5708519F38BC83A58D7C /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Alamofire.framework; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 04DBEE5E7E2379F0ABDBCC35A4E70B99 /* Moya-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Moya-dummy.m"; sourceTree = ""; }; + 056F251D8604EF9227E1909621708A0D /* AFError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AFError.swift; path = Source/AFError.swift; sourceTree = ""; }; + 05E421C982469B43A2C044CDE44A34E2 /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = ""; }; + 066F2C2E7FC2D6700C6E70045D2C2E50 /* ControlTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlTarget.swift; path = RxCocoa/Common/ControlTarget.swift; sourceTree = ""; }; + 06780CB2BBCB6A265048A83425FEE252 /* Window.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Window.swift; path = RxSwift/Observables/Window.swift; sourceTree = ""; }; + 072722AE0F76D559AE7E7BAC7079CAD7 /* ObserverBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserverBase.swift; path = RxSwift/Observers/ObserverBase.swift; sourceTree = ""; }; + 09CB284FDFB836FEE826F9E732378CB5 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0A918442CA75CD4C996CBC87F75D53DE /* UITextView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITextView+Rx.swift"; path = "RxCocoa/iOS/UITextView+Rx.swift"; sourceTree = ""; }; + 0B27D4E686A569CCF9490CD92CD36C77 /* RxPickerViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift; sourceTree = ""; }; + 0C0A2583510F1719C581F3137B2B5197 /* _RXKVOObserver.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXKVOObserver.m; path = RxCocoa/Runtime/_RXKVOObserver.m; sourceTree = ""; }; + 0C0A5F09C82ED6DDF9E9206EAB3B39B5 /* Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alamofire.swift; path = Source/Alamofire.swift; sourceTree = ""; }; + 0C1DBF477920959017AFBB3BCC882190 /* PrimitiveSequence+Zip+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "PrimitiveSequence+Zip+arity.swift"; path = "RxSwift/Traits/PrimitiveSequence+Zip+arity.swift"; sourceTree = ""; }; + 0CFC1C39C2ED4B422FB78FE044364428 /* CombineLatest.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombineLatest.swift; path = RxSwift/Observables/CombineLatest.swift; sourceTree = ""; }; + 0DD4042DADF04EC09D8FB581DDE6153E /* UICollectionView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UICollectionView+Rx.swift"; path = "RxCocoa/iOS/UICollectionView+Rx.swift"; sourceTree = ""; }; + 0E7A3E6F4FA3713D40398CA98BF6B592 /* UIRefreshControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIRefreshControl+Rx.swift"; path = "RxCocoa/iOS/UIRefreshControl+Rx.swift"; sourceTree = ""; }; + 0EA3CA0BA6A7D4968608D53E10E6EDCD /* Validation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Source/Validation.swift; sourceTree = ""; }; + 0F389AC3C5DD1FBD6FB4D0C2C538EBB3 /* SynchronizedUnsubscribeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedUnsubscribeType.swift; path = RxSwift/Concurrency/SynchronizedUnsubscribeType.swift; sourceTree = ""; }; + 102CA46215647FB9B8C5C46AD43B98B6 /* RxCocoaObjCRuntimeError+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "RxCocoaObjCRuntimeError+Extensions.swift"; path = "RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift"; sourceTree = ""; }; + 126CF4FF0F2157D76678DD3D27AB700E /* SchedulerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SchedulerType.swift; path = RxSwift/SchedulerType.swift; sourceTree = ""; }; + 13EFFD989ABE0F3D5B00435E3D02C46C /* Multicast.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Multicast.swift; path = RxSwift/Observables/Multicast.swift; sourceTree = ""; }; + 1488A38DA06FBC8A80142EF2A1017676 /* Amb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Amb.swift; path = RxSwift/Observables/Amb.swift; sourceTree = ""; }; + 1490BEB0DEF77D6DB06DA821F60F9370 /* SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SharedSequence.swift; path = RxCocoa/Traits/SharedSequence/SharedSequence.swift; sourceTree = ""; }; + 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 15784E70845C7E8D7FC753712D229E77 /* ToArray.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ToArray.swift; path = RxSwift/Observables/ToArray.swift; sourceTree = ""; }; + 17040BE249A9119977247A25D904AD4A /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = ""; }; + 18BC61A7F18B5EE363718022D65D3CC6 /* Deferred.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Deferred.swift; path = RxSwift/Observables/Deferred.swift; sourceTree = ""; }; + 19E4D1ACEB0107F0325AC0426B93F21E /* Map.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Map.swift; path = RxSwift/Observables/Map.swift; sourceTree = ""; }; + 19F7D58BC1B2F6C7BCB1ABC8230AF015 /* ScheduledDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledDisposable.swift; path = RxSwift/Disposables/ScheduledDisposable.swift; sourceTree = ""; }; + 1A289D58F734EC791EDD5928AEFA84C4 /* MoyaProvider+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "MoyaProvider+Internal.swift"; path = "Sources/Moya/MoyaProvider+Internal.swift"; sourceTree = ""; }; + 1A681140FE2CFCB815EA30D76B692E0D /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = ""; }; + 1AB078927DA8D6A4E8AB1E85E8E926A6 /* ItemEvents.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ItemEvents.swift; path = RxCocoa/iOS/Events/ItemEvents.swift; sourceTree = ""; }; + 1B17DCD19CE1575F0459681E500A9058 /* MoyaError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MoyaError.swift; path = Sources/Moya/MoyaError.swift; sourceTree = ""; }; + 1C56ADE26AFA2C8D1442EB4575EB6628 /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = ""; }; + 1C8DE7E068369708CD2739C86ECF5AA7 /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = ""; }; + 1D0378DA9B65279EDCC7CEAC794B27C1 /* Materialize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Materialize.swift; path = RxSwift/Observables/Materialize.swift; sourceTree = ""; }; + 1D06069B6D7763560D8E99829E3E3E65 /* Completable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Completable.swift; path = RxSwift/Traits/Completable.swift; sourceTree = ""; }; + 1DA06656FEF7B6101D88CFFBDCE4A92B /* Pods-Poc.Mauro.Bianchelli-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Poc.Mauro.Bianchelli-acknowledgements.markdown"; sourceTree = ""; }; + 1DA345409B9DF10675071C6647A89300 /* Create.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Create.swift; path = RxSwift/Observables/Create.swift; sourceTree = ""; }; + 1E058EEB5DC15659451FC01CAD78B163 /* RxCocoa.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RxCocoa.h; path = RxCocoa/RxCocoa.h; sourceTree = ""; }; + 209040F5132FFDA7172A17E1DFB22D84 /* Delay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Delay.swift; path = RxSwift/Observables/Delay.swift; sourceTree = ""; }; + 20D68257284C060C5A140CDE9B10DC36 /* UIActivityIndicatorView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIActivityIndicatorView+Rx.swift"; path = "RxCocoa/iOS/UIActivityIndicatorView+Rx.swift"; sourceTree = ""; }; + 20DFE55F77423C545051BDD712E6F10E /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 212C92E080650BEAD55DB24EED777863 /* ResponseSerialization.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResponseSerialization.swift; path = Source/ResponseSerialization.swift; sourceTree = ""; }; + 21717E28EE7AF567169A038CC4D921A2 /* UISearchBar+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISearchBar+Rx.swift"; path = "RxCocoa/iOS/UISearchBar+Rx.swift"; sourceTree = ""; }; + 219B9BED6D32D0A6DE60AC5EC4AE22F0 /* Moya+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Moya+Alamofire.swift"; path = "Sources/Moya/Moya+Alamofire.swift"; sourceTree = ""; }; + 21C14B9A0FBBA0CDE96F4824D21B61FA /* UINavigationItem+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UINavigationItem+Rx.swift"; path = "RxCocoa/iOS/UINavigationItem+Rx.swift"; sourceTree = ""; }; + 21E9A4BA5E4AC230680603D1B8E9D867 /* ObservableType+PrimitiveSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableType+PrimitiveSequence.swift"; path = "RxSwift/Traits/ObservableType+PrimitiveSequence.swift"; sourceTree = ""; }; + 23B01ED867851B413594E189DE57EBAD /* Zip+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Zip+arity.swift"; path = "RxSwift/Observables/Zip+arity.swift"; sourceTree = ""; }; + 24CFE087DED2DEE466A2DE1A17F0CDA2 /* DefaultIfEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DefaultIfEmpty.swift; path = RxSwift/Observables/DefaultIfEmpty.swift; sourceTree = ""; }; + 2531EC9939C55935FDD7A8C7CC2DE146 /* RxTabBarControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTabBarControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift; sourceTree = ""; }; + 25D344FD92F800B6FCE9074106CB8975 /* Pods-Poc.Mauro.Bianchelli.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Poc.Mauro.Bianchelli.release.xcconfig"; sourceTree = ""; }; + 25FA61B6266AE60861A29416E7251BED /* Timer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timer.swift; path = RxSwift/Observables/Timer.swift; sourceTree = ""; }; + 2612536C4888CC8672AE737D361CF933 /* SynchronizedOnType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedOnType.swift; path = RxSwift/Concurrency/SynchronizedOnType.swift; sourceTree = ""; }; + 263AE6E8B3A0768596DC732D01FC4A35 /* Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Deprecated.swift; path = RxCocoa/Deprecated.swift; sourceTree = ""; }; + 268C5409B669425DBEF85C03AD995BD8 /* SessionDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionDelegate.swift; path = Source/SessionDelegate.swift; sourceTree = ""; }; + 274E67E42D8C2E07DFBC98FD5DF1B617 /* _RXKVOObserver.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXKVOObserver.h; path = RxCocoa/Runtime/include/_RXKVOObserver.h; sourceTree = ""; }; + 2825D34C8364C9F4BDD346ED63515CA3 /* DelegateProxyType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelegateProxyType.swift; path = RxCocoa/Common/DelegateProxyType.swift; sourceTree = ""; }; + 28DEA50E3805B80FFDFD92B3C116053A /* Alamofire-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Alamofire-dummy.m"; sourceTree = ""; }; + 292D0884C2C698E995736B945B59E108 /* Generate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Generate.swift; path = RxSwift/Observables/Generate.swift; sourceTree = ""; }; + 29F1F349D0C5ED481A088551D5211B93 /* PublishSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PublishSubject.swift; path = RxSwift/Subjects/PublishSubject.swift; sourceTree = ""; }; + 2A944575E67D83FD486735403EBA6CBB /* RxTableViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift; sourceTree = ""; }; + 2B59C4F0FF9A6C2F08C6D13F83511E4F /* RxCocoa.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCocoa.swift; path = RxCocoa/RxCocoa.swift; sourceTree = ""; }; + 2C5AF960581BFEF8E9F37E2731FB95E1 /* AsSingle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsSingle.swift; path = RxSwift/Observables/AsSingle.swift; sourceTree = ""; }; + 2C714B8FEF494857628B8EEA3156D20E /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = ""; }; + 2CE0E93B27128F5FFE7CADB7709D62F6 /* AccessTokenPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AccessTokenPlugin.swift; path = Sources/Moya/Plugins/AccessTokenPlugin.swift; sourceTree = ""; }; + 2DE626B9BEA59A5134637C7852BA16BE /* Alamofire-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-umbrella.h"; sourceTree = ""; }; + 2F8F3BB28666A6DF531063E714D97F9A /* LockOwnerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LockOwnerType.swift; path = RxSwift/Concurrency/LockOwnerType.swift; sourceTree = ""; }; + 30E2744E1D40C1EC07A5FD088ADD3102 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3251E6FC332DBC1111B6D6B3BCFE3DD2 /* SkipWhile.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SkipWhile.swift; path = RxSwift/Observables/SkipWhile.swift; sourceTree = ""; }; + 32E878B2C6502D31C0B0DC736C6E71A8 /* URLSession+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URLSession+Rx.swift"; path = "RxCocoa/Foundation/URLSession+Rx.swift"; sourceTree = ""; }; + 331D6C9DEA5919DD6A5A59BBE4DE2D23 /* NSObject+Rx+KVORepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSObject+Rx+KVORepresentable.swift"; path = "RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift"; sourceTree = ""; }; + 34663D66290FB4BE00D67B3BF8E2C825 /* SerialDispatchQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SerialDispatchQueueScheduler.swift; path = RxSwift/Schedulers/SerialDispatchQueueScheduler.swift; sourceTree = ""; }; + 367D2757BD0C44A07937A31912865ACD /* URL+Moya.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URL+Moya.swift"; path = "Sources/Moya/URL+Moya.swift"; sourceTree = ""; }; + 37072FB7EB8858C113CF03ACFE7FB695 /* ImmediateSchedulerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImmediateSchedulerType.swift; path = RxSwift/ImmediateSchedulerType.swift; sourceTree = ""; }; + 38BDC75E9EAFD591E8C4DFC5FE4694B5 /* Pods-Poc.Mauro.Bianchelli.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Poc.Mauro.Bianchelli.debug.xcconfig"; sourceTree = ""; }; + 393ADB8B05768317A3DED73DCD502A83 /* RxTextViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTextViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift; sourceTree = ""; }; + 3A66F25D7C3265F51558CEDF5580A05B /* RxTableViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewReactiveArrayDataSource.swift; path = RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift; sourceTree = ""; }; + 3AA267981C48BA3BBFBF4049C2422164 /* BinaryDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryDisposable.swift; path = RxSwift/Disposables/BinaryDisposable.swift; sourceTree = ""; }; + 3B8E0C86672F5FD96DE920115D82E698 /* SubscriptionDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubscriptionDisposable.swift; path = RxSwift/Disposables/SubscriptionDisposable.swift; sourceTree = ""; }; + 3D649314AC46F24696214F859AD59A9D /* GroupedObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GroupedObservable.swift; path = RxSwift/GroupedObservable.swift; sourceTree = ""; }; + 3E0CC0E8E36F49E2F3064FE14C20F560 /* Using.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Using.swift; path = RxSwift/Observables/Using.swift; sourceTree = ""; }; + 3E714880E2C211803F0C667D48273780 /* RefCountDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RefCountDisposable.swift; path = RxSwift/Disposables/RefCountDisposable.swift; sourceTree = ""; }; + 3F0E3FAFC24CF83A9A82A76C82D8177A /* ShareReplayScope.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ShareReplayScope.swift; path = RxSwift/Observables/ShareReplayScope.swift; sourceTree = ""; }; + 3F4CE9C1B14FE8D15892E0DE59E12AFE /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = ""; }; + 402DC7F94F1F47F189C288E5F3F4CC4B /* Cancelable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Cancelable.swift; path = RxSwift/Cancelable.swift; sourceTree = ""; }; + 4145DAB62FDA2C51BD03D1B2A96BA085 /* Moya.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Moya.xcconfig; sourceTree = ""; }; + 41D4147CD2B926EC29E2122E551F766F /* Sequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sequence.swift; path = RxSwift/Observables/Sequence.swift; sourceTree = ""; }; + 421FFA23B973E86DA9C4FFC9515480E8 /* ConnectableObservableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConnectableObservableType.swift; path = RxSwift/ConnectableObservableType.swift; sourceTree = ""; }; + 43759EC65F1EA7F5A1A7E2DCF48943B9 /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = ""; }; + 4478C5779DD458CDC0B31A8EBB06496F /* UIStepper+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIStepper+Rx.swift"; path = "RxCocoa/iOS/UIStepper+Rx.swift"; sourceTree = ""; }; + 44F516FF55DA384413B5F90F99556630 /* NSObject+Rx+RawRepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSObject+Rx+RawRepresentable.swift"; path = "RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift"; sourceTree = ""; }; + 44FB42F65DE8F8EA681FA2EC07049396 /* RxSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxSwift-umbrella.h"; sourceTree = ""; }; + 452908585F08A1F9621403AD22855934 /* Buffer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Buffer.swift; path = RxSwift/Observables/Buffer.swift; sourceTree = ""; }; + 454B2C997B03C9E8D16918A7ECEA70A1 /* DispatchQueueConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DispatchQueueConfiguration.swift; path = RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift; sourceTree = ""; }; + 456A0DD62FFBE70830DDC9115591A8AA /* Observable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Observable.swift; path = RxSwift/Observable.swift; sourceTree = ""; }; + 45AA92A46E259A85655C112E0E77B7B6 /* VirtualTimeScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VirtualTimeScheduler.swift; path = RxSwift/Schedulers/VirtualTimeScheduler.swift; sourceTree = ""; }; + 45B2F1CB65A9B0CC514826E0BF93C740 /* Take.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Take.swift; path = RxSwift/Observables/Take.swift; sourceTree = ""; }; + 45CA66B278E9A8D2C51380274158FEBB /* Reduce.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Reduce.swift; path = RxSwift/Observables/Reduce.swift; sourceTree = ""; }; + 4638A5ABD2B559A29D94B9C108728BC6 /* Merge.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Merge.swift; path = RxSwift/Observables/Merge.swift; sourceTree = ""; }; + 47B03B86FB941A0F683C249DBB71747D /* SerialDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SerialDisposable.swift; path = RxSwift/Disposables/SerialDisposable.swift; sourceTree = ""; }; + 47B04D5FEBA64034BF6C77D866BEB7EF /* _RXObjCRuntime.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXObjCRuntime.m; path = RxCocoa/Runtime/_RXObjCRuntime.m; sourceTree = ""; }; + 480458214E0283DAA8936924B7A44398 /* UIScrollView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIScrollView+Rx.swift"; path = "RxCocoa/iOS/UIScrollView+Rx.swift"; sourceTree = ""; }; + 482517258D68F540FF31653E71390AAF /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = ""; }; + 48F87F3285C364F21F0CB151DDC5BA96 /* Plugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Plugin.swift; path = Sources/Moya/Plugin.swift; sourceTree = ""; }; + 4937CB9A960506A77BDF07CF0D4781E5 /* RxWebViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxWebViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxWebViewDelegateProxy.swift; sourceTree = ""; }; + 4A4032FFF540F1EDEE2007813C98F9AC /* AsyncSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncSubject.swift; path = RxSwift/Subjects/AsyncSubject.swift; sourceTree = ""; }; + 4C081688FC6CB1416CBD297F843D68DB /* MoyaProvider+Defaults.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "MoyaProvider+Defaults.swift"; path = "Sources/Moya/MoyaProvider+Defaults.swift"; sourceTree = ""; }; + 4C20A0937437DA521B69B15B19E17EA0 /* RxCocoa-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxCocoa-umbrella.h"; sourceTree = ""; }; + 4EB2567842FE11C11B5DF733998B36A7 /* RxTabBarDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTabBarDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift; sourceTree = ""; }; + 4EEBFE033BA859D1724816180BD8528E /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Sources/Moya/Response.swift; sourceTree = ""; }; + 50580E90EF5132F86256B5B520F7B8D6 /* Single.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Single.swift; path = RxSwift/Traits/Single.swift; sourceTree = ""; }; + 50CA2A06DCA4FEA885269BCB33EA14EE /* Timeout.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timeout.swift; path = RxSwift/Observables/Timeout.swift; sourceTree = ""; }; + 51A64D24463D26D541FBEA35572B8409 /* ControlEvent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlEvent.swift; path = RxCocoa/Traits/ControlEvent.swift; sourceTree = ""; }; + 529047766DF9A80426E56FAA7574F2B2 /* Sample.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sample.swift; path = RxSwift/Observables/Sample.swift; sourceTree = ""; }; + 52CFBBE2B7FD71F1C9B0903D9E7B3582 /* CredentialsPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CredentialsPlugin.swift; path = Sources/Moya/Plugins/CredentialsPlugin.swift; sourceTree = ""; }; + 53C4E7F010D275B4115783E3F80BCFBF /* ElementAt.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ElementAt.swift; path = RxSwift/Observables/ElementAt.swift; sourceTree = ""; }; + 53EB730C9D691442798139E76B032319 /* Optional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Optional.swift; path = RxSwift/Observables/Optional.swift; sourceTree = ""; }; + 543A7B496237BA1A98B7EA7FE9006AF8 /* Range.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Range.swift; path = RxSwift/Observables/Range.swift; sourceTree = ""; }; + 546E7772402CB4121BE94AD97DFFF271 /* UITabBar+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITabBar+Rx.swift"; path = "RxCocoa/iOS/UITabBar+Rx.swift"; sourceTree = ""; }; + 5543D307A0C69B9BFC688465CDCE4F98 /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = ""; }; + 55571D0FF3333DB6AE5AF229B01CE3AB /* ReplaySubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReplaySubject.swift; path = RxSwift/Subjects/ReplaySubject.swift; sourceTree = ""; }; + 55E4E0B61B4F8DF1FDE16A909BAFE90F /* DisposeBag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DisposeBag.swift; path = RxSwift/Disposables/DisposeBag.swift; sourceTree = ""; }; + 566A6AF19885E377BB111BB9A92D2555 /* _RXDelegateProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXDelegateProxy.h; path = RxCocoa/Runtime/include/_RXDelegateProxy.h; sourceTree = ""; }; + 57A01A95E82680EB326BF9FE5E5DC811 /* RxCollectionViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift; sourceTree = ""; }; + 57BE569C7246AEF3765FDF8172FB982C /* Task.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Task.swift; path = Sources/Moya/Task.swift; sourceTree = ""; }; + 588316120F5FBD5BFED973F65332ACB9 /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CurrentThreadScheduler.swift; path = RxSwift/Schedulers/CurrentThreadScheduler.swift; sourceTree = ""; }; + 58E2A05DB14D236E253A137CAB792635 /* Just.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Just.swift; path = RxSwift/Observables/Just.swift; sourceTree = ""; }; + 59080A080A83F4394CEC1BC6F87B7FE4 /* RxScrollViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxScrollViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift; sourceTree = ""; }; + 5921E0F02283F8F2BE28CB10320C49E1 /* RxNavigationControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxNavigationControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift; sourceTree = ""; }; + 593B2CE76D2737CD5145381E76BF5C2A /* GroupBy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GroupBy.swift; path = RxSwift/Observables/GroupBy.swift; sourceTree = ""; }; + 59D9FBE6E9DEF159A1CCD446EF950852 /* VirtualTimeConverterType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VirtualTimeConverterType.swift; path = RxSwift/Schedulers/VirtualTimeConverterType.swift; sourceTree = ""; }; + 5C7578897C7F0B66F64E5A0664A80F49 /* ScheduledItemType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledItemType.swift; path = RxSwift/Schedulers/Internal/ScheduledItemType.swift; sourceTree = ""; }; + 5DDB922C9E928088F7869B4C8C7AD13D /* Pods_Poc_Mauro_Bianchelli.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_Poc_Mauro_Bianchelli.framework; path = "Pods-Poc.Mauro.Bianchelli.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 5F78646ADA03F5B7DB27B6F88B19A9CB /* AddRef.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AddRef.swift; path = RxSwift/Observables/AddRef.swift; sourceTree = ""; }; + 6016E425CB87C89A57D510F9090E109E /* RxCocoa-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RxCocoa-dummy.m"; sourceTree = ""; }; + 607AC4043EFA92A1C37C7B0FF04835BA /* SchedulerType+SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SchedulerType+SharedSequence.swift"; path = "RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift"; sourceTree = ""; }; + 612EE801AF57652D1D80CDD9CE842343 /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Result/Result.swift; sourceTree = ""; }; + 6164C37F5C64B2C7909B891B7BD396A0 /* NopDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NopDisposable.swift; path = RxSwift/Disposables/NopDisposable.swift; sourceTree = ""; }; + 61B844E0FD0C49C635CA0CB7D766E3EA /* KVORepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KVORepresentable.swift; path = RxCocoa/Foundation/KVORepresentable.swift; sourceTree = ""; }; + 6221D612FB759E2BFACA6A910DC1E1BE /* RxCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxCocoa.framework; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 629C3A929E3AD468B2687470753B7813 /* KVORepresentable+Swift.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "KVORepresentable+Swift.swift"; path = "RxCocoa/Foundation/KVORepresentable+Swift.swift"; sourceTree = ""; }; + 640D17250242556388043CFC3350478A /* RxSearchControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxSearchControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift; sourceTree = ""; }; + 640E867D1CCC1D055AA289BCB463EEEB /* CompositeDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CompositeDisposable.swift; path = RxSwift/Disposables/CompositeDisposable.swift; sourceTree = ""; }; + 6429F8BE97309783363CC2FDF1B5B385 /* NSTextStorage+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSTextStorage+Rx.swift"; path = "RxCocoa/iOS/NSTextStorage+Rx.swift"; sourceTree = ""; }; + 643A4248FE9FD963E67827E59CA3806F /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 648060596A91B66BBD0C45B3463988D3 /* Pods-Poc.Mauro.Bianchelli-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Poc.Mauro.Bianchelli-frameworks.sh"; sourceTree = ""; }; + 64C517E1C9CEF76715540048EE6344EA /* Dematerialize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Dematerialize.swift; path = RxSwift/Observables/Dematerialize.swift; sourceTree = ""; }; + 66A85CA52BF9A3FF8DF11D2EC535B59B /* Endpoint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Endpoint.swift; path = Sources/Moya/Endpoint.swift; sourceTree = ""; }; + 6713847DA6573386E0E013E4D55DEB1E /* URLRequest+Encoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URLRequest+Encoding.swift"; path = "Sources/Moya/URLRequest+Encoding.swift"; sourceTree = ""; }; + 6769E6211B0D47A7886C11D399D35912 /* RxCocoaRuntime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RxCocoaRuntime.h; path = RxCocoa/Runtime/include/RxCocoaRuntime.h; sourceTree = ""; }; + 685800254A834332919F7C7CF8BF6F33 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 68F8F14748B1923D2480039D5A7B10B3 /* RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 696C375EE86778D5C55502F19F1ACBF0 /* Result.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Result.xcconfig; sourceTree = ""; }; + 69A195F0185289042EA6E224BF6BC79E /* InvocableScheduledItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InvocableScheduledItem.swift; path = RxSwift/Schedulers/Internal/InvocableScheduledItem.swift; sourceTree = ""; }; + 6AB02911F47F316AD83FE1550A06C131 /* NSLayoutConstraint+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSLayoutConstraint+Rx.swift"; path = "RxCocoa/Common/NSLayoutConstraint+Rx.swift"; sourceTree = ""; }; + 6C01791CEC250AAD98A37727EBE791A4 /* ControlEvent+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ControlEvent+Driver.swift"; path = "RxCocoa/Traits/Driver/ControlEvent+Driver.swift"; sourceTree = ""; }; + 6C2D6664A968198179A1C07402527332 /* RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxSwift.framework; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6C7F98C3162B3DFF5A5D5693101048B5 /* Event.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Event.swift; path = RxSwift/Event.swift; sourceTree = ""; }; + 6E5F5D4B37F37629DFC8E520AB591890 /* ControlEvent+Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ControlEvent+Signal.swift"; path = "RxCocoa/Traits/Signal/ControlEvent+Signal.swift"; sourceTree = ""; }; + 6E9B3AD3B29D698C66BD2F9C284C5425 /* UIPickerView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIPickerView+Rx.swift"; path = "RxCocoa/iOS/UIPickerView+Rx.swift"; sourceTree = ""; }; + 6F064D99A764700AADE9113F1B15FBF4 /* DistinctUntilChanged.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DistinctUntilChanged.swift; path = RxSwift/Observables/DistinctUntilChanged.swift; sourceTree = ""; }; + 6F0CCB2A8E8BAFEDEAD73FF19955B169 /* Driver+Subscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Driver+Subscription.swift"; path = "RxCocoa/Traits/Driver/Driver+Subscription.swift"; sourceTree = ""; }; + 6F5DF094146264707AE1C9F927500064 /* Moya.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Moya.modulemap; sourceTree = ""; }; + 6F7EE24D6EFA41154E753FEEA215D9B3 /* RxSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RxSwift-dummy.m"; sourceTree = ""; }; + 700D745D0CDABE65F55A2121022359B9 /* ObservableType+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableType+Extensions.swift"; path = "RxSwift/ObservableType+Extensions.swift"; sourceTree = ""; }; + 702EC6ED4E55D36C87781B1FD64BD969 /* RxPickerViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift; sourceTree = ""; }; + 70AE227D3C54F5A1C9877041B8FECDE4 /* Producer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Producer.swift; path = RxSwift/Observables/Producer.swift; sourceTree = ""; }; + 71742B2767286FA0B4C28BD82940901F /* TakeWhile.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeWhile.swift; path = RxSwift/Observables/TakeWhile.swift; sourceTree = ""; }; + 72775411F33D867EF5F31CD775B47F55 /* NetworkActivityPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkActivityPlugin.swift; path = Sources/Moya/Plugins/NetworkActivityPlugin.swift; sourceTree = ""; }; + 74779BA54511629925AC2FC20BA09583 /* AsyncLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncLock.swift; path = RxSwift/Concurrency/AsyncLock.swift; sourceTree = ""; }; + 75E45F5E492E89EE174C289EA17D4A7F /* Skip.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Skip.swift; path = RxSwift/Observables/Skip.swift; sourceTree = ""; }; + 75EF0680539EE535CA45EA1C1E6095CB /* UILabel+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UILabel+Rx.swift"; path = "RxCocoa/iOS/UILabel+Rx.swift"; sourceTree = ""; }; + 7675B0B6BF59467059B34FE3C407FC9E /* SingleAsync.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SingleAsync.swift; path = RxSwift/Observables/SingleAsync.swift; sourceTree = ""; }; + 774AF70E891E715450119AEDC5A537A2 /* SynchronizedDisposeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedDisposeType.swift; path = RxSwift/Concurrency/SynchronizedDisposeType.swift; sourceTree = ""; }; + 775CFC09CF2F4097E89E32CCCA2C7E08 /* Filter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = RxSwift/Observables/Filter.swift; sourceTree = ""; }; + 781DF09C92A81430AA39925B9E58DDE8 /* UITextField+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITextField+Rx.swift"; path = "RxCocoa/iOS/UITextField+Rx.swift"; sourceTree = ""; }; + 783BC92943FC3531B681F396D4B475C2 /* SharedSequence+Operators+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SharedSequence+Operators+arity.swift"; path = "RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift"; sourceTree = ""; }; + 796FD019EAA141224530DBCF7375B6AF /* Image.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Image.swift; path = Sources/Moya/Image.swift; sourceTree = ""; }; + 7994E0D4606D81619447FD0209170947 /* Observable+Bind.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Bind.swift"; path = "RxCocoa/Common/Observable+Bind.swift"; sourceTree = ""; }; + 7B97E0D77B5C3F39997CDC1222BE35A5 /* RxPickerViewAdapter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewAdapter.swift; path = RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift; sourceTree = ""; }; + 7C595CAA1979AE19878BB45482D7C78A /* Moya.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Moya.framework; path = Moya.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7E9C769A16ED82FC37183B9CDBE67CAF /* RxSearchBarDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxSearchBarDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift; sourceTree = ""; }; + 7EC049AD72EE52F4609AC267F8A785FB /* Never.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Never.swift; path = RxSwift/Observables/Never.swift; sourceTree = ""; }; + 7EE223A45590605141523FEE50493B8F /* Lock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Lock.swift; path = RxSwift/Concurrency/Lock.swift; sourceTree = ""; }; + 7F50ACD321A7760524A2EB6C779EC6F5 /* SharedSequence+Operators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SharedSequence+Operators.swift"; path = "RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift"; sourceTree = ""; }; + 7FDC256DFFD39EEE1A8D67BA91892551 /* Concat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Concat.swift; path = RxSwift/Observables/Concat.swift; sourceTree = ""; }; + 80979A93A9ABBA4DD416EBF55D6AD0BA /* TaskDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TaskDelegate.swift; path = Source/TaskDelegate.swift; sourceTree = ""; }; + 828094CD2704890A837308AD5C80BF7B /* SectionedViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SectionedViewDataSourceType.swift; path = RxCocoa/Common/SectionedViewDataSourceType.swift; sourceTree = ""; }; + 83279DABB4C6ECF9321ACE104DE4180A /* UIApplication+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIApplication+Rx.swift"; path = "RxCocoa/iOS/UIApplication+Rx.swift"; sourceTree = ""; }; + 8399FF9576895D4359B691F1F7885E09 /* Timeline.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timeline.swift; path = Source/Timeline.swift; sourceTree = ""; }; + 83C5CC9272FBB8DB46160F6519F0A197 /* InvocableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InvocableType.swift; path = RxSwift/Schedulers/Internal/InvocableType.swift; sourceTree = ""; }; + 84EA7E3B6A5185FFDACC90C31402E30C /* BehaviorRelay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BehaviorRelay.swift; path = RxCocoa/Traits/BehaviorRelay.swift; sourceTree = ""; }; + 85B845BAA6C239BE9D84B54AD6006B98 /* Scan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Scan.swift; path = RxSwift/Observables/Scan.swift; sourceTree = ""; }; + 89EF61F08EBC7757DF18820F146E94F1 /* PublishRelay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PublishRelay.swift; path = RxCocoa/Traits/PublishRelay.swift; sourceTree = ""; }; + 8C980F350FAE5E6F867DE4B64AE4E04F /* TakeUntil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeUntil.swift; path = RxSwift/Observables/TakeUntil.swift; sourceTree = ""; }; + 8E21A07F75DDDA851DA9568942C30EE8 /* Reactive.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Reactive.swift; path = RxSwift/Reactive.swift; sourceTree = ""; }; + 8E6923DB4C37558D6C91C69FEF2EF4AE /* WithLatestFrom.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = WithLatestFrom.swift; path = RxSwift/Observables/WithLatestFrom.swift; sourceTree = ""; }; + 8E75FD9798D5B0383CBACD6C76D8214A /* Sink.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sink.swift; path = RxSwift/Observables/Sink.swift; sourceTree = ""; }; + 8EDBD85DDA140F788E2724DFC57B4585 /* ObserverType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserverType.swift; path = RxSwift/ObserverType.swift; sourceTree = ""; }; + 91203ED96AE0DA8EAED80DC1DFD13873 /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = ""; }; + 91A664F256195F23B71E7BD0220BBDA1 /* Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Signal.swift; path = RxCocoa/Traits/Signal/Signal.swift; sourceTree = ""; }; + 91AC578E9FAF5BF8333326D4FC8ACFE7 /* ObservableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObservableType.swift; path = RxSwift/ObservableType.swift; sourceTree = ""; }; + 9218C32FA9BDEE97C7FBAF0BDDBD9358 /* Pods-Poc.Mauro.Bianchelli.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-Poc.Mauro.Bianchelli.modulemap"; sourceTree = ""; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 9625C54AC195BBF4C7118EBDDC4AF043 /* TargetType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TargetType.swift; path = Sources/Moya/TargetType.swift; sourceTree = ""; }; + 96821D683BE0FF75B881D048E588C30E /* UIWebView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIWebView+Rx.swift"; path = "RxCocoa/iOS/UIWebView+Rx.swift"; sourceTree = ""; }; + 9695323F5DFAE23631CCAC62A53B86E1 /* Debounce.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debounce.swift; path = RxSwift/Observables/Debounce.swift; sourceTree = ""; }; + 97A7D17486CBF27495251EBFCCC8543D /* SchedulerServices+Emulation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SchedulerServices+Emulation.swift"; path = "RxSwift/Schedulers/SchedulerServices+Emulation.swift"; sourceTree = ""; }; + 97B45AC05EAE59EEADCE1E1E08EF040C /* MainScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MainScheduler.swift; path = RxSwift/Schedulers/MainScheduler.swift; sourceTree = ""; }; + 98AB7AC096AAC5ADC179F51C2F4169C7 /* StartWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StartWith.swift; path = RxSwift/Observables/StartWith.swift; sourceTree = ""; }; + 9A5AC3610EE3E3CB896F26A42A63B275 /* Completable+AndThen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Completable+AndThen.swift"; path = "RxSwift/Traits/Completable+AndThen.swift"; sourceTree = ""; }; + 9ABB70736140BC8025F42722FD820F22 /* DisposeBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DisposeBase.swift; path = RxSwift/Disposables/DisposeBase.swift; sourceTree = ""; }; + 9B66DA208B51638831DE765AC3492CFB /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = ""; }; + 9CC8116639B8B142E7EEC0ED489F61CA /* TailRecursiveSink.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TailRecursiveSink.swift; path = RxSwift/Observers/TailRecursiveSink.swift; sourceTree = ""; }; + 9D5923D903D541803FED1EF6F48C6268 /* ObservableConvertibleType+Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableConvertibleType+Signal.swift"; path = "RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift"; sourceTree = ""; }; + 9E5DE85AE4BE6A2C025475C352AC25A5 /* Enumerated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Enumerated.swift; path = RxSwift/Observables/Enumerated.swift; sourceTree = ""; }; + 9F05119035F8ED2589F1BB6BA8EF5BFE /* Notifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Notifications.swift; path = Source/Notifications.swift; sourceTree = ""; }; + A05CE41D35E11C7EE368237E963F349B /* UINavigationController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UINavigationController+Rx.swift"; path = "RxCocoa/iOS/UINavigationController+Rx.swift"; sourceTree = ""; }; + A189F2971F0DD59D62871BC6A3FF6D92 /* Do.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Do.swift; path = RxSwift/Observables/Do.swift; sourceTree = ""; }; + A3A369CA6371A53103C298E05EB5ECE8 /* ServerTrustPolicy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ServerTrustPolicy.swift; path = Source/ServerTrustPolicy.swift; sourceTree = ""; }; + A3E16172AC6C01829E10440000F8EA6B /* DeprecationWarner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DeprecationWarner.swift; path = Platform/DeprecationWarner.swift; sourceTree = ""; }; + A43B3F7B831E1F817AFFCDB73117896F /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = RxSwift/Observables/Error.swift; sourceTree = ""; }; + A44B5CDDC52038185A35939CF523C09F /* UITabBarItem+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITabBarItem+Rx.swift"; path = "RxCocoa/iOS/UITabBarItem+Rx.swift"; sourceTree = ""; }; + A4D9D3C3E536BD2D82B5233BC4450765 /* UIView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Rx.swift"; path = "RxCocoa/iOS/UIView+Rx.swift"; sourceTree = ""; }; + A4DD9D47B3FAE3BF12A4B641EF0DFE61 /* _RX.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RX.m; path = RxCocoa/Runtime/_RX.m; sourceTree = ""; }; + A5405020A34510E9923D449DA9BA5BAA /* ObservableConvertibleType+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableConvertibleType+Driver.swift"; path = "RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift"; sourceTree = ""; }; + A57988C7E5CFDF16C75F8A2A8D58849E /* Alamofire-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-prefix.pch"; sourceTree = ""; }; + A835B86A03364B11B2FF212D66F98C68 /* Pods-Poc.Mauro.Bianchelli-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Poc.Mauro.Bianchelli-resources.sh"; sourceTree = ""; }; + A9EFF32F40B01097039E104CCA97428B /* RxSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = RxSwift.modulemap; sourceTree = ""; }; + AA6AD912A7B05B9D1B8C209BD247709B /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Source/MultipartFormData.swift; sourceTree = ""; }; + AAB667BE339E4195C5BD1DBE7F6FAF43 /* Pods-Poc.Mauro.Bianchelli-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Poc.Mauro.Bianchelli-umbrella.h"; sourceTree = ""; }; + AAE0DB93C053911EC706E22C83044BC9 /* String+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String+Rx.swift"; path = "RxSwift/Extensions/String+Rx.swift"; sourceTree = ""; }; + AAEF10E0BAF6F62367D1848748CD9309 /* Disposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Disposable.swift; path = RxSwift/Disposable.swift; sourceTree = ""; }; + AB26DBC55B21F06A9A67B62DE818A230 /* ObserveOn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserveOn.swift; path = RxSwift/Observables/ObserveOn.swift; sourceTree = ""; }; + AB9504B24F136B8EAED6A663A8A09608 /* _RXObjCRuntime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXObjCRuntime.h; path = RxCocoa/Runtime/include/_RXObjCRuntime.h; sourceTree = ""; }; + AC8837CF826D9CB5E69BEF3F824F1BE6 /* Zip.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Zip.swift; path = RxSwift/Observables/Zip.swift; sourceTree = ""; }; + ADD0EC1C6F08620977DA1F2ED022C468 /* SwiftSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftSupport.swift; path = RxSwift/SwiftSupport/SwiftSupport.swift; sourceTree = ""; }; + B5527DC3974AD3DD254937E1F8BCCB45 /* KVORepresentable+CoreGraphics.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "KVORepresentable+CoreGraphics.swift"; path = "RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift"; sourceTree = ""; }; + B68269B27D96A653AF5542C1CDE3466B /* TakeLast.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeLast.swift; path = RxSwift/Observables/TakeLast.swift; sourceTree = ""; }; + B731431F05AEBD8C3FB2D19EF3D59115 /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = ""; }; + B73B900362DBE72A151E48EB4D28D1EE /* UIImageView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIImageView+Rx.swift"; path = "RxCocoa/iOS/UIImageView+Rx.swift"; sourceTree = ""; }; + B867794384DA37C32085606F2A140199 /* AnonymousDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousDisposable.swift; path = RxSwift/Disposables/AnonymousDisposable.swift; sourceTree = ""; }; + B89EE0A9FE00AF24678B020F10A1BEA0 /* UIControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIControl+Rx.swift"; path = "RxCocoa/iOS/UIControl+Rx.swift"; sourceTree = ""; }; + BCBFA2A49A5003A48D4AFA82FD76269F /* Empty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Empty.swift; path = RxSwift/Observables/Empty.swift; sourceTree = ""; }; + BD1BE6839ADB84E137FB2549857938BA /* Request.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Request.swift; path = Source/Request.swift; sourceTree = ""; }; + BD47675CC810207A444063F778B766E1 /* Moya-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Moya-prefix.pch"; sourceTree = ""; }; + BE2113D0F0A914BAC961085988D9E1B4 /* ParameterEncoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoding.swift; path = Source/ParameterEncoding.swift; sourceTree = ""; }; + BE3D79F6E5CE43A5FCAED188650CE980 /* RxTableViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift; sourceTree = ""; }; + BED1BC90C4B37D8AD94D5013247607AC /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BF0B6FCBFA60F4C6B7AC1EEFB82D18AD /* RxCollectionViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewReactiveArrayDataSource.swift; path = RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift; sourceTree = ""; }; + BFA065D2E5496BD3D9E25A146F91B8EB /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BFEAF907AEFF3F8CF0B1195A13EA77EA /* DeprecationWarner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DeprecationWarner.swift; path = Platform/DeprecationWarner.swift; sourceTree = ""; }; + BFEFC8C35A5CF0F852CEC6EE3F0DFDE4 /* Disposables.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Disposables.swift; path = RxSwift/Disposables/Disposables.swift; sourceTree = ""; }; + C0B734B9AAEE4C0654A15CB6FABD128D /* RxCollectionViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift; sourceTree = ""; }; + C282D3F25B4AF64597D341CDF305AD2F /* ValidationType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ValidationType.swift; path = Sources/Moya/ValidationType.swift; sourceTree = ""; }; + C2934D2F44A1D42C5D171431371F1D39 /* Errors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = RxSwift/Errors.swift; sourceTree = ""; }; + C2CABC264C3610237A8CD26CD938198F /* UIAlertAction+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIAlertAction+Rx.swift"; path = "RxCocoa/iOS/UIAlertAction+Rx.swift"; sourceTree = ""; }; + C2EDC55840F3B96D77F55037A8D43C91 /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConcurrentDispatchQueueScheduler.swift; path = RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift; sourceTree = ""; }; + C56C8085EBB1044708D442A7A5BC39BB /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Source/Response.swift; sourceTree = ""; }; + C57014AD1B91147CC308902EBDC42457 /* _RXDelegateProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXDelegateProxy.m; path = RxCocoa/Runtime/_RXDelegateProxy.m; sourceTree = ""; }; + C640391EF698C824BF9DF5D13A4FA127 /* AnyEncodable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyEncodable.swift; path = Sources/Moya/AnyEncodable.swift; sourceTree = ""; }; + C6E7C0FF6558AE25D3D8D34C1D694829 /* Alamofire.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Alamofire.modulemap; sourceTree = ""; }; + C7247E8663426C4B17D6E86344DB7833 /* SkipUntil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SkipUntil.swift; path = RxSwift/Observables/SkipUntil.swift; sourceTree = ""; }; + C76C505AD2031353B886FD15B765DBF8 /* Signal+Subscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Signal+Subscription.swift"; path = "RxCocoa/Traits/Signal/Signal+Subscription.swift"; sourceTree = ""; }; + C7EC14CC9B4A5C029C17054A3B5A4363 /* Logging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Logging.swift; path = RxCocoa/Foundation/Logging.swift; sourceTree = ""; }; + C825A0EA21D4868284718BFAB6A99BC3 /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = ""; }; + C97EFCC26A29A6041A7C61BB3D7A1DFC /* UISlider+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISlider+Rx.swift"; path = "RxCocoa/iOS/UISlider+Rx.swift"; sourceTree = ""; }; + C9B7EBD5C210FE2AF7127B48AF965550 /* SessionManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionManager.swift; path = Source/SessionManager.swift; sourceTree = ""; }; + CAAB9D2E5475B1566BB93E6C594A4DA7 /* NotificationCenter+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NotificationCenter+Rx.swift"; path = "RxCocoa/Foundation/NotificationCenter+Rx.swift"; sourceTree = ""; }; + CAF4C9D855A69FA6F113003C58F29148 /* SwitchIfEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwitchIfEmpty.swift; path = RxSwift/Observables/SwitchIfEmpty.swift; sourceTree = ""; }; + CC2000693DBE622B31D4E816B38CD333 /* Pods-Poc.Mauro.Bianchelli-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Poc.Mauro.Bianchelli-acknowledgements.plist"; sourceTree = ""; }; + CC70243B9EB031333B4CE77988A16C55 /* Result-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Result-dummy.m"; sourceTree = ""; }; + CDBE15DFC999316ED709283962519DCA /* RxTextStorageDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTextStorageDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift; sourceTree = ""; }; + CEA70EA8331CA7FAF3D5D45E3A388CAF /* ScheduledItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledItem.swift; path = RxSwift/Schedulers/Internal/ScheduledItem.swift; sourceTree = ""; }; + CEC6B868DD994A90BFD87A2A4950D3D0 /* Switch.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Switch.swift; path = RxSwift/Observables/Switch.swift; sourceTree = ""; }; + CEFB87CE3C5495DA860EA0AE612F0B62 /* UIViewController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIViewController+Rx.swift"; path = "RxCocoa/iOS/UIViewController+Rx.swift"; sourceTree = ""; }; + CF1774FD7A455D0D4B1AA20B07564694 /* NetworkLoggerPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkLoggerPlugin.swift; path = Sources/Moya/Plugins/NetworkLoggerPlugin.swift; sourceTree = ""; }; + D3C6A1403A2AAF6E6B99863948C28638 /* Maybe.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Maybe.swift; path = RxSwift/Traits/Maybe.swift; sourceTree = ""; }; + D4EF8E8D3A2B58E8B8E5E7D51CD8EB43 /* Bag+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Bag+Rx.swift"; path = "RxSwift/Extensions/Bag+Rx.swift"; sourceTree = ""; }; + D581FC98B27209305B1C96158F164378 /* RecursiveScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveScheduler.swift; path = RxSwift/Schedulers/RecursiveScheduler.swift; sourceTree = ""; }; + D5BE453EE31C29863E35599FA30A7C33 /* RxCocoa.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = RxCocoa.modulemap; sourceTree = ""; }; + D61BE001A85266456E641ECE7192B419 /* Catch.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Catch.swift; path = RxSwift/Observables/Catch.swift; sourceTree = ""; }; + D65F636F1577B6136BB848F3405EFA17 /* Alamofire.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Alamofire.xcconfig; sourceTree = ""; }; + D6A369265F3BE803B3BCBEE1DB26D417 /* RetryWhen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RetryWhen.swift; path = RxSwift/Observables/RetryWhen.swift; sourceTree = ""; }; + D6B0B2270620835CF5E57A87ED9F6C06 /* Throttle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Throttle.swift; path = RxSwift/Observables/Throttle.swift; sourceTree = ""; }; + D748811B7842BF9A2379F03F3B19BBB5 /* Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debug.swift; path = RxSwift/Observables/Debug.swift; sourceTree = ""; }; + D773213F21CAD426C9115BFE38419953 /* DispatchQueue+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Alamofire.swift"; path = "Source/DispatchQueue+Alamofire.swift"; sourceTree = ""; }; + D8054C525C6F7710840E4E57278D6051 /* Cancellable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Cancellable.swift; path = Sources/Moya/Cancellable.swift; sourceTree = ""; }; + D85CF21DBFBCE45817453C4866D94246 /* Zip+Collection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Zip+Collection.swift"; path = "RxSwift/Observables/Zip+Collection.swift"; sourceTree = ""; }; + D868DC4C87344BF959CFFF2A928CE6D7 /* UITabBarController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITabBarController+Rx.swift"; path = "RxCocoa/iOS/UITabBarController+Rx.swift"; sourceTree = ""; }; + D8A13F41975A89C69518C03C25F7CAEF /* UISwitch+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISwitch+Rx.swift"; path = "RxCocoa/iOS/UISwitch+Rx.swift"; sourceTree = ""; }; + D8A485D5677352C7345F2C90D61A5C05 /* AnyObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyObserver.swift; path = RxSwift/AnyObserver.swift; sourceTree = ""; }; + D8D6D1FE84D7DD184E5B59BD076EB300 /* SubscribeOn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubscribeOn.swift; path = RxSwift/Observables/SubscribeOn.swift; sourceTree = ""; }; + D944C59E1C48892EDBE5DD0B8E2BFA4D /* RxPickerViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift; sourceTree = ""; }; + DA6C66FAD642C5F74BDB4DBC244AE83A /* Pods-Poc.Mauro.Bianchelli-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Poc.Mauro.Bianchelli-dummy.m"; sourceTree = ""; }; + DAEF284CFA646FBE3227CC442D45D538 /* ControlProperty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlProperty.swift; path = RxCocoa/Traits/ControlProperty.swift; sourceTree = ""; }; + DF5459778E928DD19ADE18538F9534A1 /* OperationQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = OperationQueueScheduler.swift; path = RxSwift/Schedulers/OperationQueueScheduler.swift; sourceTree = ""; }; + DF856FBA172952B116EA398C72825DE3 /* UIDatePicker+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIDatePicker+Rx.swift"; path = "RxCocoa/iOS/UIDatePicker+Rx.swift"; sourceTree = ""; }; + DF9AB10A500D81E92FC3873C13DBE0CD /* PublishRelay+Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "PublishRelay+Signal.swift"; path = "RxCocoa/Traits/Signal/PublishRelay+Signal.swift"; sourceTree = ""; }; + E0809651855756AC5E876371B7AF4AC4 /* ConcurrentMainScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConcurrentMainScheduler.swift; path = RxSwift/Schedulers/ConcurrentMainScheduler.swift; sourceTree = ""; }; + E13573CBB4C8E7CC110E95C5C637B59D /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = ""; }; + E1494F76E364CF3277A9F6A6A43D8BD7 /* HistoricalSchedulerTimeConverter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HistoricalSchedulerTimeConverter.swift; path = RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift; sourceTree = ""; }; + E27870041DC364397664491D846A9EFD /* ResultProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResultProtocol.swift; path = Result/ResultProtocol.swift; sourceTree = ""; }; + E2EC4195474D86421CC14E7322769BDA /* UIGestureRecognizer+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIGestureRecognizer+Rx.swift"; path = "RxCocoa/iOS/UIGestureRecognizer+Rx.swift"; sourceTree = ""; }; + E426253FE54399EAEA272DE16A45FC49 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E43105A74FB572DFDB35777CF2BD99D4 /* AsMaybe.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsMaybe.swift; path = RxSwift/Observables/AsMaybe.swift; sourceTree = ""; }; + E4F06B12C2AC456AC39D8E1BCB3BFFC6 /* DelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelegateProxy.swift; path = RxCocoa/Common/DelegateProxy.swift; sourceTree = ""; }; + E5501E6C767A876EFFBBBA069B6476B6 /* UIButton+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIButton+Rx.swift"; path = "RxCocoa/iOS/UIButton+Rx.swift"; sourceTree = ""; }; + E7CBF07EC12EF7012E71880903CF540D /* DelaySubscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelaySubscription.swift; path = RxSwift/Observables/DelaySubscription.swift; sourceTree = ""; }; + E8AD4FB36DE721649513449EC9FB8752 /* Moya-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Moya-umbrella.h"; sourceTree = ""; }; + EA98C69CB0C9501BCA8A4AB039F2824D /* SubjectType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubjectType.swift; path = RxSwift/Subjects/SubjectType.swift; sourceTree = ""; }; + EABD74BA342E0CC9F587AC2B9067456B /* PrimitiveSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PrimitiveSequence.swift; path = RxSwift/Traits/PrimitiveSequence.swift; sourceTree = ""; }; + EB0C1CC5DA2BBD415DECEEE2C84C9660 /* AnonymousObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousObserver.swift; path = RxSwift/Observers/AnonymousObserver.swift; sourceTree = ""; }; + EB215AE0959BBD69D629C0D4C02E6A22 /* RxSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxSwift-prefix.pch"; sourceTree = ""; }; + EC2D7B33197C29FC082C71D4840B2838 /* UITableView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITableView+Rx.swift"; path = "RxCocoa/iOS/UITableView+Rx.swift"; sourceTree = ""; }; + ED10933036716F1C711DF9304FE7ED99 /* RxCocoa-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxCocoa-prefix.pch"; sourceTree = ""; }; + EDA904E22762BF09A7FD417E6D67FF35 /* ObservableConvertibleType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObservableConvertibleType.swift; path = RxSwift/ObservableConvertibleType.swift; sourceTree = ""; }; + EDB334D0F464423D7C81479B22CA5018 /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = ""; }; + EE16E99CFF8A6DD7C51BF8BD6A9EDD78 /* UISearchController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISearchController+Rx.swift"; path = "RxCocoa/iOS/UISearchController+Rx.swift"; sourceTree = ""; }; + EE225E5DBA6F249DBDD06855E52145FD /* ControlProperty+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ControlProperty+Driver.swift"; path = "RxCocoa/Traits/Driver/ControlProperty+Driver.swift"; sourceTree = ""; }; + EE2510EFEB56DB6A88E0013A0B28FA3E /* Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Driver.swift; path = RxCocoa/Traits/Driver/Driver.swift; sourceTree = ""; }; + EEB015928C0D4849D9321765F325C80A /* Deprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Deprecated.swift; path = RxSwift/Deprecated.swift; sourceTree = ""; }; + EF56272040561BCE263BF06EDF92BBD3 /* UIPageControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIPageControl+Rx.swift"; path = "RxCocoa/iOS/UIPageControl+Rx.swift"; sourceTree = ""; }; + EFEAAF7C33E8F5920B6C0B460CC8020C /* Result-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Result-umbrella.h"; sourceTree = ""; }; + F14CE7AA0B5CA410D91BB1502B672702 /* Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Rx.swift; path = RxSwift/Rx.swift; sourceTree = ""; }; + F2239753C886ED1EB5FBC6FBAF30F3C8 /* First.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = First.swift; path = RxSwift/Observables/First.swift; sourceTree = ""; }; + F249B9A39E7C62A0FECDD4801AB03D5C /* TextInput.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextInput.swift; path = RxCocoa/Common/TextInput.swift; sourceTree = ""; }; + F3825144D0C59C2E639CB03334D8CAB5 /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Source/Result.swift; sourceTree = ""; }; + F3D021DB3292DB0E7D8C5E08F48C0131 /* BehaviorSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BehaviorSubject.swift; path = RxSwift/Subjects/BehaviorSubject.swift; sourceTree = ""; }; + F407C292F09F6ECA5B5DBBB2EACC1BD9 /* CombineLatest+Collection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "CombineLatest+Collection.swift"; path = "RxSwift/Observables/CombineLatest+Collection.swift"; sourceTree = ""; }; + F4321013709DF675B2B94B625AAC5E18 /* UISegmentedControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISegmentedControl+Rx.swift"; path = "RxCocoa/iOS/UISegmentedControl+Rx.swift"; sourceTree = ""; }; + F4E50A46C50C6B1FA668554EEAC67CCF /* MultiTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultiTarget.swift; path = Sources/Moya/MultiTarget.swift; sourceTree = ""; }; + F4F6C98F5F5682F6DB2AF2A397CEA95F /* RxCollectionViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift; sourceTree = ""; }; + F5055A5322FDE0117989B7F7A4CA6617 /* RxTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTarget.swift; path = RxCocoa/Common/RxTarget.swift; sourceTree = ""; }; + F53399B1F10F86EC85543CFB23246BBD /* Result-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Result-prefix.pch"; sourceTree = ""; }; + F557DBB453F7244671E6AE884116693D /* NSObject+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSObject+Rx.swift"; path = "RxCocoa/Foundation/NSObject+Rx.swift"; sourceTree = ""; }; + F5ADAE25B289D64EEC037FB3C375CE17 /* CombineLatest+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "CombineLatest+arity.swift"; path = "RxSwift/Observables/CombineLatest+arity.swift"; sourceTree = ""; }; + F5C9979D888F70291A4985BD5347FF10 /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Sources/Moya/MultipartFormData.swift; sourceTree = ""; }; + F670D7E2FF83795225B7ED1EFECEDD6A /* RxCocoa.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxCocoa.xcconfig; sourceTree = ""; }; + F68A927D1039131907238AD788B98664 /* RxSwift.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxSwift.xcconfig; sourceTree = ""; }; + F6A5E6EE275526AEA54A17B5A2B56A52 /* UIProgressView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIProgressView+Rx.swift"; path = "RxCocoa/iOS/UIProgressView+Rx.swift"; sourceTree = ""; }; + F6C475C5CA3E24037F6F52828299145B /* SingleAssignmentDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SingleAssignmentDisposable.swift; path = RxSwift/Disposables/SingleAssignmentDisposable.swift; sourceTree = ""; }; + F872318BFC72E833B7D7AB9FAC1057B9 /* BooleanDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BooleanDisposable.swift; path = RxSwift/Disposables/BooleanDisposable.swift; sourceTree = ""; }; + F8732CC36F8A87A0DF79400B56958F90 /* _RX.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RX.h; path = RxCocoa/Runtime/include/_RX.h; sourceTree = ""; }; + F9F7A75834490D17E4285AFD177AE13D /* RxTableViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift; sourceTree = ""; }; + FBB1C6A0DB9C167F1DE54BE11AF17D21 /* Repeat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Repeat.swift; path = RxSwift/Observables/Repeat.swift; sourceTree = ""; }; + FBC53213A1B2F0913700CAB16F72C7DD /* HistoricalScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HistoricalScheduler.swift; path = RxSwift/Schedulers/HistoricalScheduler.swift; sourceTree = ""; }; + FBD04E408D96BDEBF601870F02E2523B /* MoyaProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MoyaProvider.swift; path = Sources/Moya/MoyaProvider.swift; sourceTree = ""; }; + FC464909496E823EBDABFCADB36BC522 /* ObservableConvertibleType+SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableConvertibleType+SharedSequence.swift"; path = "RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift"; sourceTree = ""; }; + FCB9672E276F2443F8E92F726CF960A5 /* NetworkReachabilityManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkReachabilityManager.swift; path = Source/NetworkReachabilityManager.swift; sourceTree = ""; }; + FD9406C39C588EEB7600F62E288A4D74 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Result.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FE42CE52A64E58545308EA066786D4DF /* BehaviorRelay+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "BehaviorRelay+Driver.swift"; path = "RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5E58B04B7406F03AF70F6A16EC470030 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 96AAAA907C7D402D2805DE5362E0A6CE /* Alamofire.framework in Frameworks */, + 6DDF4D5EB23B3589031F7415BED2CA9B /* Foundation.framework in Frameworks */, + 1B8D06E4CF4B6DA96A7B0A8E65846AED /* Result.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6315BD979CEDE373C7F67D62BE002C8C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B52D1B997B8988E3E787FE63A40C4D22 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8EA06E8387DD2E3720394AB668C17891 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55A155EBA15BA962C1200A2EAC426B0C /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 99195E4207764744AEC07ECCBCD550EB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 73B9C996AED49ED7CF8EC2A6F1738059 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B244DBC1DC39A98F76FD482BE2211B9D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F697C622AEB525A7B4D890DD2D1DC62D /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F92A9E0A93B6E3DD4E68F5329ECC52A2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 74A69B9C225C9F0CA753D8CBE15749F1 /* Foundation.framework in Frameworks */, + E70F0BB99BB35D66E961E22E04BEFEED /* RxSwift.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 07AC742EE72966C0A1CA4E0F33DD26A1 /* RxCocoa */ = { + isa = PBXGroup; + children = ( + F8732CC36F8A87A0DF79400B56958F90 /* _RX.h */, + A4DD9D47B3FAE3BF12A4B641EF0DFE61 /* _RX.m */, + 566A6AF19885E377BB111BB9A92D2555 /* _RXDelegateProxy.h */, + C57014AD1B91147CC308902EBDC42457 /* _RXDelegateProxy.m */, + 274E67E42D8C2E07DFBC98FD5DF1B617 /* _RXKVOObserver.h */, + 0C0A2583510F1719C581F3137B2B5197 /* _RXKVOObserver.m */, + AB9504B24F136B8EAED6A663A8A09608 /* _RXObjCRuntime.h */, + 47B04D5FEBA64034BF6C77D866BEB7EF /* _RXObjCRuntime.m */, + 9B66DA208B51638831DE765AC3492CFB /* Bag.swift */, + 84EA7E3B6A5185FFDACC90C31402E30C /* BehaviorRelay.swift */, + FE42CE52A64E58545308EA066786D4DF /* BehaviorRelay+Driver.swift */, + 00B91F4646916D6A782AA0EED33187B1 /* Binder.swift */, + 51A64D24463D26D541FBEA35572B8409 /* ControlEvent.swift */, + 6C01791CEC250AAD98A37727EBE791A4 /* ControlEvent+Driver.swift */, + 6E5F5D4B37F37629DFC8E520AB591890 /* ControlEvent+Signal.swift */, + DAEF284CFA646FBE3227CC442D45D538 /* ControlProperty.swift */, + EE225E5DBA6F249DBDD06855E52145FD /* ControlProperty+Driver.swift */, + 066F2C2E7FC2D6700C6E70045D2C2E50 /* ControlTarget.swift */, + E4F06B12C2AC456AC39D8E1BCB3BFFC6 /* DelegateProxy.swift */, + 2825D34C8364C9F4BDD346ED63515CA3 /* DelegateProxyType.swift */, + 263AE6E8B3A0768596DC732D01FC4A35 /* Deprecated.swift */, + A3E16172AC6C01829E10440000F8EA6B /* DeprecationWarner.swift */, + 5543D307A0C69B9BFC688465CDCE4F98 /* DispatchQueue+Extensions.swift */, + EE2510EFEB56DB6A88E0013A0B28FA3E /* Driver.swift */, + 6F0CCB2A8E8BAFEDEAD73FF19955B169 /* Driver+Subscription.swift */, + EDB334D0F464423D7C81479B22CA5018 /* InfiniteSequence.swift */, + 1AB078927DA8D6A4E8AB1E85E8E926A6 /* ItemEvents.swift */, + 61B844E0FD0C49C635CA0CB7D766E3EA /* KVORepresentable.swift */, + B5527DC3974AD3DD254937E1F8BCCB45 /* KVORepresentable+CoreGraphics.swift */, + 629C3A929E3AD468B2687470753B7813 /* KVORepresentable+Swift.swift */, + C7EC14CC9B4A5C029C17054A3B5A4363 /* Logging.swift */, + CAAB9D2E5475B1566BB93E6C594A4DA7 /* NotificationCenter+Rx.swift */, + 6AB02911F47F316AD83FE1550A06C131 /* NSLayoutConstraint+Rx.swift */, + F557DBB453F7244671E6AE884116693D /* NSObject+Rx.swift */, + 331D6C9DEA5919DD6A5A59BBE4DE2D23 /* NSObject+Rx+KVORepresentable.swift */, + 44F516FF55DA384413B5F90F99556630 /* NSObject+Rx+RawRepresentable.swift */, + 6429F8BE97309783363CC2FDF1B5B385 /* NSTextStorage+Rx.swift */, + 7994E0D4606D81619447FD0209170947 /* Observable+Bind.swift */, + A5405020A34510E9923D449DA9BA5BAA /* ObservableConvertibleType+Driver.swift */, + FC464909496E823EBDABFCADB36BC522 /* ObservableConvertibleType+SharedSequence.swift */, + 9D5923D903D541803FED1EF6F48C6268 /* ObservableConvertibleType+Signal.swift */, + 2C714B8FEF494857628B8EEA3156D20E /* Platform.Darwin.swift */, + 91203ED96AE0DA8EAED80DC1DFD13873 /* Platform.Linux.swift */, + 3F4CE9C1B14FE8D15892E0DE59E12AFE /* PriorityQueue.swift */, + 89EF61F08EBC7757DF18820F146E94F1 /* PublishRelay.swift */, + DF9AB10A500D81E92FC3873C13DBE0CD /* PublishRelay+Signal.swift */, + E13573CBB4C8E7CC110E95C5C637B59D /* Queue.swift */, + 1A681140FE2CFCB815EA30D76B692E0D /* RecursiveLock.swift */, + 1E058EEB5DC15659451FC01CAD78B163 /* RxCocoa.h */, + 2B59C4F0FF9A6C2F08C6D13F83511E4F /* RxCocoa.swift */, + 102CA46215647FB9B8C5C46AD43B98B6 /* RxCocoaObjCRuntimeError+Extensions.swift */, + 6769E6211B0D47A7886C11D399D35912 /* RxCocoaRuntime.h */, + 57A01A95E82680EB326BF9FE5E5DC811 /* RxCollectionViewDataSourceProxy.swift */, + C0B734B9AAEE4C0654A15CB6FABD128D /* RxCollectionViewDataSourceType.swift */, + F4F6C98F5F5682F6DB2AF2A397CEA95F /* RxCollectionViewDelegateProxy.swift */, + BF0B6FCBFA60F4C6B7AC1EEFB82D18AD /* RxCollectionViewReactiveArrayDataSource.swift */, + 5921E0F02283F8F2BE28CB10320C49E1 /* RxNavigationControllerDelegateProxy.swift */, + 7B97E0D77B5C3F39997CDC1222BE35A5 /* RxPickerViewAdapter.swift */, + 0B27D4E686A569CCF9490CD92CD36C77 /* RxPickerViewDataSourceProxy.swift */, + 702EC6ED4E55D36C87781B1FD64BD969 /* RxPickerViewDataSourceType.swift */, + D944C59E1C48892EDBE5DD0B8E2BFA4D /* RxPickerViewDelegateProxy.swift */, + 59080A080A83F4394CEC1BC6F87B7FE4 /* RxScrollViewDelegateProxy.swift */, + 7E9C769A16ED82FC37183B9CDBE67CAF /* RxSearchBarDelegateProxy.swift */, + 640D17250242556388043CFC3350478A /* RxSearchControllerDelegateProxy.swift */, + 2531EC9939C55935FDD7A8C7CC2DE146 /* RxTabBarControllerDelegateProxy.swift */, + 4EB2567842FE11C11B5DF733998B36A7 /* RxTabBarDelegateProxy.swift */, + 2A944575E67D83FD486735403EBA6CBB /* RxTableViewDataSourceProxy.swift */, + F9F7A75834490D17E4285AFD177AE13D /* RxTableViewDataSourceType.swift */, + BE3D79F6E5CE43A5FCAED188650CE980 /* RxTableViewDelegateProxy.swift */, + 3A66F25D7C3265F51558CEDF5580A05B /* RxTableViewReactiveArrayDataSource.swift */, + F5055A5322FDE0117989B7F7A4CA6617 /* RxTarget.swift */, + CDBE15DFC999316ED709283962519DCA /* RxTextStorageDelegateProxy.swift */, + 393ADB8B05768317A3DED73DCD502A83 /* RxTextViewDelegateProxy.swift */, + 4937CB9A960506A77BDF07CF0D4781E5 /* RxWebViewDelegateProxy.swift */, + 607AC4043EFA92A1C37C7B0FF04835BA /* SchedulerType+SharedSequence.swift */, + 828094CD2704890A837308AD5C80BF7B /* SectionedViewDataSourceType.swift */, + 1490BEB0DEF77D6DB06DA821F60F9370 /* SharedSequence.swift */, + 7F50ACD321A7760524A2EB6C779EC6F5 /* SharedSequence+Operators.swift */, + 783BC92943FC3531B681F396D4B475C2 /* SharedSequence+Operators+arity.swift */, + 91A664F256195F23B71E7BD0220BBDA1 /* Signal.swift */, + C76C505AD2031353B886FD15B765DBF8 /* Signal+Subscription.swift */, + F249B9A39E7C62A0FECDD4801AB03D5C /* TextInput.swift */, + 20D68257284C060C5A140CDE9B10DC36 /* UIActivityIndicatorView+Rx.swift */, + C2CABC264C3610237A8CD26CD938198F /* UIAlertAction+Rx.swift */, + 83279DABB4C6ECF9321ACE104DE4180A /* UIApplication+Rx.swift */, + 031C703FE7B201355E8C75B76373E579 /* UIBarButtonItem+Rx.swift */, + E5501E6C767A876EFFBBBA069B6476B6 /* UIButton+Rx.swift */, + 0DD4042DADF04EC09D8FB581DDE6153E /* UICollectionView+Rx.swift */, + B89EE0A9FE00AF24678B020F10A1BEA0 /* UIControl+Rx.swift */, + DF856FBA172952B116EA398C72825DE3 /* UIDatePicker+Rx.swift */, + E2EC4195474D86421CC14E7322769BDA /* UIGestureRecognizer+Rx.swift */, + B73B900362DBE72A151E48EB4D28D1EE /* UIImageView+Rx.swift */, + 75EF0680539EE535CA45EA1C1E6095CB /* UILabel+Rx.swift */, + A05CE41D35E11C7EE368237E963F349B /* UINavigationController+Rx.swift */, + 21C14B9A0FBBA0CDE96F4824D21B61FA /* UINavigationItem+Rx.swift */, + EF56272040561BCE263BF06EDF92BBD3 /* UIPageControl+Rx.swift */, + 6E9B3AD3B29D698C66BD2F9C284C5425 /* UIPickerView+Rx.swift */, + F6A5E6EE275526AEA54A17B5A2B56A52 /* UIProgressView+Rx.swift */, + 0E7A3E6F4FA3713D40398CA98BF6B592 /* UIRefreshControl+Rx.swift */, + 480458214E0283DAA8936924B7A44398 /* UIScrollView+Rx.swift */, + 21717E28EE7AF567169A038CC4D921A2 /* UISearchBar+Rx.swift */, + EE16E99CFF8A6DD7C51BF8BD6A9EDD78 /* UISearchController+Rx.swift */, + F4321013709DF675B2B94B625AAC5E18 /* UISegmentedControl+Rx.swift */, + C97EFCC26A29A6041A7C61BB3D7A1DFC /* UISlider+Rx.swift */, + 4478C5779DD458CDC0B31A8EBB06496F /* UIStepper+Rx.swift */, + D8A13F41975A89C69518C03C25F7CAEF /* UISwitch+Rx.swift */, + 546E7772402CB4121BE94AD97DFFF271 /* UITabBar+Rx.swift */, + D868DC4C87344BF959CFFF2A928CE6D7 /* UITabBarController+Rx.swift */, + A44B5CDDC52038185A35939CF523C09F /* UITabBarItem+Rx.swift */, + EC2D7B33197C29FC082C71D4840B2838 /* UITableView+Rx.swift */, + 781DF09C92A81430AA39925B9E58DDE8 /* UITextField+Rx.swift */, + 0A918442CA75CD4C996CBC87F75D53DE /* UITextView+Rx.swift */, + A4D9D3C3E536BD2D82B5233BC4450765 /* UIView+Rx.swift */, + CEFB87CE3C5495DA860EA0AE612F0B62 /* UIViewController+Rx.swift */, + 96821D683BE0FF75B881D048E588C30E /* UIWebView+Rx.swift */, + 32E878B2C6502D31C0B0DC736C6E71A8 /* URLSession+Rx.swift */, + 29132C88EC6CEDCA057F255F3C19A0C1 /* Support Files */, + ); + name = RxCocoa; + path = RxCocoa; + sourceTree = ""; + }; + 1437F7EEA6B6C0A50DD18AE9954AC752 /* Support Files */ = { + isa = PBXGroup; + children = ( + 30E2744E1D40C1EC07A5FD088ADD3102 /* Info.plist */, + 6F5DF094146264707AE1C9F927500064 /* Moya.modulemap */, + 4145DAB62FDA2C51BD03D1B2A96BA085 /* Moya.xcconfig */, + 04DBEE5E7E2379F0ABDBCC35A4E70B99 /* Moya-dummy.m */, + BD47675CC810207A444063F778B766E1 /* Moya-prefix.pch */, + E8AD4FB36DE721649513449EC9FB8752 /* Moya-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/Moya"; + sourceTree = ""; + }; + 2549348D5F67C26374C508A2FFB7D176 /* Products */ = { + isa = PBXGroup; + children = ( + 036A9A8DF2BE5708519F38BC83A58D7C /* Alamofire.framework */, + 7C595CAA1979AE19878BB45482D7C78A /* Moya.framework */, + 5DDB922C9E928088F7869B4C8C7AD13D /* Pods_Poc_Mauro_Bianchelli.framework */, + FD9406C39C588EEB7600F62E288A4D74 /* Result.framework */, + 6221D612FB759E2BFACA6A910DC1E1BE /* RxCocoa.framework */, + 6C2D6664A968198179A1C07402527332 /* RxSwift.framework */, + ); + name = Products; + sourceTree = ""; + }; + 29132C88EC6CEDCA057F255F3C19A0C1 /* Support Files */ = { + isa = PBXGroup; + children = ( + 643A4248FE9FD963E67827E59CA3806F /* Info.plist */, + D5BE453EE31C29863E35599FA30A7C33 /* RxCocoa.modulemap */, + F670D7E2FF83795225B7ED1EFECEDD6A /* RxCocoa.xcconfig */, + 6016E425CB87C89A57D510F9090E109E /* RxCocoa-dummy.m */, + ED10933036716F1C711DF9304FE7ED99 /* RxCocoa-prefix.pch */, + 4C20A0937437DA521B69B15B19E17EA0 /* RxCocoa-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/RxCocoa"; + sourceTree = ""; + }; + 390A4DA85FC0AA2752C69F91371509DC /* Alamofire */ = { + isa = PBXGroup; + children = ( + 056F251D8604EF9227E1909621708A0D /* AFError.swift */, + 0C0A5F09C82ED6DDF9E9206EAB3B39B5 /* Alamofire.swift */, + D773213F21CAD426C9115BFE38419953 /* DispatchQueue+Alamofire.swift */, + AA6AD912A7B05B9D1B8C209BD247709B /* MultipartFormData.swift */, + FCB9672E276F2443F8E92F726CF960A5 /* NetworkReachabilityManager.swift */, + 9F05119035F8ED2589F1BB6BA8EF5BFE /* Notifications.swift */, + BE2113D0F0A914BAC961085988D9E1B4 /* ParameterEncoding.swift */, + BD1BE6839ADB84E137FB2549857938BA /* Request.swift */, + C56C8085EBB1044708D442A7A5BC39BB /* Response.swift */, + 212C92E080650BEAD55DB24EED777863 /* ResponseSerialization.swift */, + F3825144D0C59C2E639CB03334D8CAB5 /* Result.swift */, + A3A369CA6371A53103C298E05EB5ECE8 /* ServerTrustPolicy.swift */, + 268C5409B669425DBEF85C03AD995BD8 /* SessionDelegate.swift */, + C9B7EBD5C210FE2AF7127B48AF965550 /* SessionManager.swift */, + 80979A93A9ABBA4DD416EBF55D6AD0BA /* TaskDelegate.swift */, + 8399FF9576895D4359B691F1F7885E09 /* Timeline.swift */, + 0EA3CA0BA6A7D4968608D53E10E6EDCD /* Validation.swift */, + ED48CB14E0C99960791957A989626D00 /* Support Files */, + ); + name = Alamofire; + path = Alamofire; + sourceTree = ""; + }; + 472123F72790185C07BED348C50190B9 /* Core */ = { + isa = PBXGroup; + children = ( + 2CE0E93B27128F5FFE7CADB7709D62F6 /* AccessTokenPlugin.swift */, + C640391EF698C824BF9DF5D13A4FA127 /* AnyEncodable.swift */, + D8054C525C6F7710840E4E57278D6051 /* Cancellable.swift */, + 52CFBBE2B7FD71F1C9B0903D9E7B3582 /* CredentialsPlugin.swift */, + 66A85CA52BF9A3FF8DF11D2EC535B59B /* Endpoint.swift */, + 796FD019EAA141224530DBCF7375B6AF /* Image.swift */, + 219B9BED6D32D0A6DE60AC5EC4AE22F0 /* Moya+Alamofire.swift */, + 1B17DCD19CE1575F0459681E500A9058 /* MoyaError.swift */, + FBD04E408D96BDEBF601870F02E2523B /* MoyaProvider.swift */, + 4C081688FC6CB1416CBD297F843D68DB /* MoyaProvider+Defaults.swift */, + 1A289D58F734EC791EDD5928AEFA84C4 /* MoyaProvider+Internal.swift */, + F5C9979D888F70291A4985BD5347FF10 /* MultipartFormData.swift */, + F4E50A46C50C6B1FA668554EEAC67CCF /* MultiTarget.swift */, + 72775411F33D867EF5F31CD775B47F55 /* NetworkActivityPlugin.swift */, + CF1774FD7A455D0D4B1AA20B07564694 /* NetworkLoggerPlugin.swift */, + 48F87F3285C364F21F0CB151DDC5BA96 /* Plugin.swift */, + 4EEBFE033BA859D1724816180BD8528E /* Response.swift */, + 9625C54AC195BBF4C7118EBDDC4AF043 /* TargetType.swift */, + 57BE569C7246AEF3765FDF8172FB982C /* Task.swift */, + 367D2757BD0C44A07937A31912865ACD /* URL+Moya.swift */, + 6713847DA6573386E0E013E4D55DEB1E /* URLRequest+Encoding.swift */, + C282D3F25B4AF64597D341CDF305AD2F /* ValidationType.swift */, + ); + name = Core; + sourceTree = ""; + }; + 4ABA38C1F3117F2C1811DF6F90191303 /* Support Files */ = { + isa = PBXGroup; + children = ( + BED1BC90C4B37D8AD94D5013247607AC /* Info.plist */, + 028A906B81200D4170A91E86C2CFEC1F /* Result.modulemap */, + 696C375EE86778D5C55502F19F1ACBF0 /* Result.xcconfig */, + CC70243B9EB031333B4CE77988A16C55 /* Result-dummy.m */, + F53399B1F10F86EC85543CFB23246BBD /* Result-prefix.pch */, + EFEAAF7C33E8F5920B6C0B460CC8020C /* Result-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/Result"; + sourceTree = ""; + }; + 5A461BC3C9BA3B1868B101EAB65CCE29 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + DE72494F814AA4278EA9CD583BFD585A /* Pods-Poc.Mauro.Bianchelli */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + 7DB346D0F39D3F0E887471402A8071AB = { + isa = PBXGroup; + children = ( + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, + 82438C4E3A207BAFC0353E01563B8F43 /* Frameworks */, + CB5A5E8F512B6A3215DC67CEA3A2F880 /* Pods */, + 2549348D5F67C26374C508A2FFB7D176 /* Products */, + 5A461BC3C9BA3B1868B101EAB65CCE29 /* Targets Support Files */, + ); + sourceTree = ""; + }; + 82438C4E3A207BAFC0353E01563B8F43 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 685800254A834332919F7C7CF8BF6F33 /* Alamofire.framework */, + BFA065D2E5496BD3D9E25A146F91B8EB /* Result.framework */, + 68F8F14748B1923D2480039D5A7B10B3 /* RxSwift.framework */, + 8D1997E0BB2A6E84E037CC4E7CF5A547 /* iOS */, + ); + name = Frameworks; + sourceTree = ""; + }; + 8D1997E0BB2A6E84E037CC4E7CF5A547 /* iOS */ = { + isa = PBXGroup; + children = ( + 1537ECA632276EF93708BF6C3AE96207 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; + 988D9E515DE8AD7A7AE4FE85DF937F39 /* RxSwift */ = { + isa = PBXGroup; + children = ( + 5F78646ADA03F5B7DB27B6F88B19A9CB /* AddRef.swift */, + 1488A38DA06FBC8A80142EF2A1017676 /* Amb.swift */, + B867794384DA37C32085606F2A140199 /* AnonymousDisposable.swift */, + EB0C1CC5DA2BBD415DECEEE2C84C9660 /* AnonymousObserver.swift */, + D8A485D5677352C7345F2C90D61A5C05 /* AnyObserver.swift */, + E43105A74FB572DFDB35777CF2BD99D4 /* AsMaybe.swift */, + 2C5AF960581BFEF8E9F37E2731FB95E1 /* AsSingle.swift */, + 74779BA54511629925AC2FC20BA09583 /* AsyncLock.swift */, + 4A4032FFF540F1EDEE2007813C98F9AC /* AsyncSubject.swift */, + 482517258D68F540FF31653E71390AAF /* Bag.swift */, + D4EF8E8D3A2B58E8B8E5E7D51CD8EB43 /* Bag+Rx.swift */, + F3D021DB3292DB0E7D8C5E08F48C0131 /* BehaviorSubject.swift */, + 3AA267981C48BA3BBFBF4049C2422164 /* BinaryDisposable.swift */, + F872318BFC72E833B7D7AB9FAC1057B9 /* BooleanDisposable.swift */, + 452908585F08A1F9621403AD22855934 /* Buffer.swift */, + 402DC7F94F1F47F189C288E5F3F4CC4B /* Cancelable.swift */, + D61BE001A85266456E641ECE7192B419 /* Catch.swift */, + 0CFC1C39C2ED4B422FB78FE044364428 /* CombineLatest.swift */, + F5ADAE25B289D64EEC037FB3C375CE17 /* CombineLatest+arity.swift */, + F407C292F09F6ECA5B5DBBB2EACC1BD9 /* CombineLatest+Collection.swift */, + 1D06069B6D7763560D8E99829E3E3E65 /* Completable.swift */, + 9A5AC3610EE3E3CB896F26A42A63B275 /* Completable+AndThen.swift */, + 640E867D1CCC1D055AA289BCB463EEEB /* CompositeDisposable.swift */, + 7FDC256DFFD39EEE1A8D67BA91892551 /* Concat.swift */, + C2EDC55840F3B96D77F55037A8D43C91 /* ConcurrentDispatchQueueScheduler.swift */, + E0809651855756AC5E876371B7AF4AC4 /* ConcurrentMainScheduler.swift */, + 421FFA23B973E86DA9C4FFC9515480E8 /* ConnectableObservableType.swift */, + 1DA345409B9DF10675071C6647A89300 /* Create.swift */, + 588316120F5FBD5BFED973F65332ACB9 /* CurrentThreadScheduler.swift */, + 9695323F5DFAE23631CCAC62A53B86E1 /* Debounce.swift */, + D748811B7842BF9A2379F03F3B19BBB5 /* Debug.swift */, + 24CFE087DED2DEE466A2DE1A17F0CDA2 /* DefaultIfEmpty.swift */, + 18BC61A7F18B5EE363718022D65D3CC6 /* Deferred.swift */, + 209040F5132FFDA7172A17E1DFB22D84 /* Delay.swift */, + E7CBF07EC12EF7012E71880903CF540D /* DelaySubscription.swift */, + 64C517E1C9CEF76715540048EE6344EA /* Dematerialize.swift */, + EEB015928C0D4849D9321765F325C80A /* Deprecated.swift */, + BFEAF907AEFF3F8CF0B1195A13EA77EA /* DeprecationWarner.swift */, + 43759EC65F1EA7F5A1A7E2DCF48943B9 /* DispatchQueue+Extensions.swift */, + 454B2C997B03C9E8D16918A7ECEA70A1 /* DispatchQueueConfiguration.swift */, + AAEF10E0BAF6F62367D1848748CD9309 /* Disposable.swift */, + BFEFC8C35A5CF0F852CEC6EE3F0DFDE4 /* Disposables.swift */, + 55E4E0B61B4F8DF1FDE16A909BAFE90F /* DisposeBag.swift */, + 9ABB70736140BC8025F42722FD820F22 /* DisposeBase.swift */, + 6F064D99A764700AADE9113F1B15FBF4 /* DistinctUntilChanged.swift */, + A189F2971F0DD59D62871BC6A3FF6D92 /* Do.swift */, + 53C4E7F010D275B4115783E3F80BCFBF /* ElementAt.swift */, + BCBFA2A49A5003A48D4AFA82FD76269F /* Empty.swift */, + 9E5DE85AE4BE6A2C025475C352AC25A5 /* Enumerated.swift */, + A43B3F7B831E1F817AFFCDB73117896F /* Error.swift */, + C2934D2F44A1D42C5D171431371F1D39 /* Errors.swift */, + 6C7F98C3162B3DFF5A5D5693101048B5 /* Event.swift */, + 775CFC09CF2F4097E89E32CCCA2C7E08 /* Filter.swift */, + F2239753C886ED1EB5FBC6FBAF30F3C8 /* First.swift */, + 292D0884C2C698E995736B945B59E108 /* Generate.swift */, + 593B2CE76D2737CD5145381E76BF5C2A /* GroupBy.swift */, + 3D649314AC46F24696214F859AD59A9D /* GroupedObservable.swift */, + FBC53213A1B2F0913700CAB16F72C7DD /* HistoricalScheduler.swift */, + E1494F76E364CF3277A9F6A6A43D8BD7 /* HistoricalSchedulerTimeConverter.swift */, + 37072FB7EB8858C113CF03ACFE7FB695 /* ImmediateSchedulerType.swift */, + C825A0EA21D4868284718BFAB6A99BC3 /* InfiniteSequence.swift */, + 69A195F0185289042EA6E224BF6BC79E /* InvocableScheduledItem.swift */, + 83C5CC9272FBB8DB46160F6519F0A197 /* InvocableType.swift */, + 58E2A05DB14D236E253A137CAB792635 /* Just.swift */, + 7EE223A45590605141523FEE50493B8F /* Lock.swift */, + 2F8F3BB28666A6DF531063E714D97F9A /* LockOwnerType.swift */, + 97B45AC05EAE59EEADCE1E1E08EF040C /* MainScheduler.swift */, + 19E4D1ACEB0107F0325AC0426B93F21E /* Map.swift */, + 1D0378DA9B65279EDCC7CEAC794B27C1 /* Materialize.swift */, + D3C6A1403A2AAF6E6B99863948C28638 /* Maybe.swift */, + 4638A5ABD2B559A29D94B9C108728BC6 /* Merge.swift */, + 13EFFD989ABE0F3D5B00435E3D02C46C /* Multicast.swift */, + 7EC049AD72EE52F4609AC267F8A785FB /* Never.swift */, + 6164C37F5C64B2C7909B891B7BD396A0 /* NopDisposable.swift */, + 456A0DD62FFBE70830DDC9115591A8AA /* Observable.swift */, + EDA904E22762BF09A7FD417E6D67FF35 /* ObservableConvertibleType.swift */, + 91AC578E9FAF5BF8333326D4FC8ACFE7 /* ObservableType.swift */, + 700D745D0CDABE65F55A2121022359B9 /* ObservableType+Extensions.swift */, + 21E9A4BA5E4AC230680603D1B8E9D867 /* ObservableType+PrimitiveSequence.swift */, + AB26DBC55B21F06A9A67B62DE818A230 /* ObserveOn.swift */, + 072722AE0F76D559AE7E7BAC7079CAD7 /* ObserverBase.swift */, + 8EDBD85DDA140F788E2724DFC57B4585 /* ObserverType.swift */, + DF5459778E928DD19ADE18538F9534A1 /* OperationQueueScheduler.swift */, + 53EB730C9D691442798139E76B032319 /* Optional.swift */, + 05E421C982469B43A2C044CDE44A34E2 /* Platform.Darwin.swift */, + 17040BE249A9119977247A25D904AD4A /* Platform.Linux.swift */, + EABD74BA342E0CC9F587AC2B9067456B /* PrimitiveSequence.swift */, + 0C1DBF477920959017AFBB3BCC882190 /* PrimitiveSequence+Zip+arity.swift */, + B731431F05AEBD8C3FB2D19EF3D59115 /* PriorityQueue.swift */, + 70AE227D3C54F5A1C9877041B8FECDE4 /* Producer.swift */, + 29F1F349D0C5ED481A088551D5211B93 /* PublishSubject.swift */, + 1C56ADE26AFA2C8D1442EB4575EB6628 /* Queue.swift */, + 543A7B496237BA1A98B7EA7FE9006AF8 /* Range.swift */, + 8E21A07F75DDDA851DA9568942C30EE8 /* Reactive.swift */, + 1C8DE7E068369708CD2739C86ECF5AA7 /* RecursiveLock.swift */, + D581FC98B27209305B1C96158F164378 /* RecursiveScheduler.swift */, + 45CA66B278E9A8D2C51380274158FEBB /* Reduce.swift */, + 3E714880E2C211803F0C667D48273780 /* RefCountDisposable.swift */, + FBB1C6A0DB9C167F1DE54BE11AF17D21 /* Repeat.swift */, + 55571D0FF3333DB6AE5AF229B01CE3AB /* ReplaySubject.swift */, + D6A369265F3BE803B3BCBEE1DB26D417 /* RetryWhen.swift */, + F14CE7AA0B5CA410D91BB1502B672702 /* Rx.swift */, + 030A2D2C9021B3028CEDB3BBF9C3B7CC /* RxMutableBox.swift */, + 529047766DF9A80426E56FAA7574F2B2 /* Sample.swift */, + 85B845BAA6C239BE9D84B54AD6006B98 /* Scan.swift */, + 19F7D58BC1B2F6C7BCB1ABC8230AF015 /* ScheduledDisposable.swift */, + CEA70EA8331CA7FAF3D5D45E3A388CAF /* ScheduledItem.swift */, + 5C7578897C7F0B66F64E5A0664A80F49 /* ScheduledItemType.swift */, + 97A7D17486CBF27495251EBFCCC8543D /* SchedulerServices+Emulation.swift */, + 126CF4FF0F2157D76678DD3D27AB700E /* SchedulerType.swift */, + 41D4147CD2B926EC29E2122E551F766F /* Sequence.swift */, + 34663D66290FB4BE00D67B3BF8E2C825 /* SerialDispatchQueueScheduler.swift */, + 47B03B86FB941A0F683C249DBB71747D /* SerialDisposable.swift */, + 3F0E3FAFC24CF83A9A82A76C82D8177A /* ShareReplayScope.swift */, + 50580E90EF5132F86256B5B520F7B8D6 /* Single.swift */, + F6C475C5CA3E24037F6F52828299145B /* SingleAssignmentDisposable.swift */, + 7675B0B6BF59467059B34FE3C407FC9E /* SingleAsync.swift */, + 8E75FD9798D5B0383CBACD6C76D8214A /* Sink.swift */, + 75E45F5E492E89EE174C289EA17D4A7F /* Skip.swift */, + C7247E8663426C4B17D6E86344DB7833 /* SkipUntil.swift */, + 3251E6FC332DBC1111B6D6B3BCFE3DD2 /* SkipWhile.swift */, + 98AB7AC096AAC5ADC179F51C2F4169C7 /* StartWith.swift */, + AAE0DB93C053911EC706E22C83044BC9 /* String+Rx.swift */, + EA98C69CB0C9501BCA8A4AB039F2824D /* SubjectType.swift */, + D8D6D1FE84D7DD184E5B59BD076EB300 /* SubscribeOn.swift */, + 3B8E0C86672F5FD96DE920115D82E698 /* SubscriptionDisposable.swift */, + ADD0EC1C6F08620977DA1F2ED022C468 /* SwiftSupport.swift */, + CEC6B868DD994A90BFD87A2A4950D3D0 /* Switch.swift */, + CAF4C9D855A69FA6F113003C58F29148 /* SwitchIfEmpty.swift */, + 774AF70E891E715450119AEDC5A537A2 /* SynchronizedDisposeType.swift */, + 2612536C4888CC8672AE737D361CF933 /* SynchronizedOnType.swift */, + 0F389AC3C5DD1FBD6FB4D0C2C538EBB3 /* SynchronizedUnsubscribeType.swift */, + 9CC8116639B8B142E7EEC0ED489F61CA /* TailRecursiveSink.swift */, + 45B2F1CB65A9B0CC514826E0BF93C740 /* Take.swift */, + B68269B27D96A653AF5542C1CDE3466B /* TakeLast.swift */, + 8C980F350FAE5E6F867DE4B64AE4E04F /* TakeUntil.swift */, + 71742B2767286FA0B4C28BD82940901F /* TakeWhile.swift */, + D6B0B2270620835CF5E57A87ED9F6C06 /* Throttle.swift */, + 50CA2A06DCA4FEA885269BCB33EA14EE /* Timeout.swift */, + 25FA61B6266AE60861A29416E7251BED /* Timer.swift */, + 15784E70845C7E8D7FC753712D229E77 /* ToArray.swift */, + 3E0CC0E8E36F49E2F3064FE14C20F560 /* Using.swift */, + 59D9FBE6E9DEF159A1CCD446EF950852 /* VirtualTimeConverterType.swift */, + 45AA92A46E259A85655C112E0E77B7B6 /* VirtualTimeScheduler.swift */, + 06780CB2BBCB6A265048A83425FEE252 /* Window.swift */, + 8E6923DB4C37558D6C91C69FEF2EF4AE /* WithLatestFrom.swift */, + AC8837CF826D9CB5E69BEF3F824F1BE6 /* Zip.swift */, + 23B01ED867851B413594E189DE57EBAD /* Zip+arity.swift */, + D85CF21DBFBCE45817453C4866D94246 /* Zip+Collection.swift */, + E5DD6C1F1FC00DE655A391538B912018 /* Support Files */, + ); + name = RxSwift; + path = RxSwift; + sourceTree = ""; + }; + BFA1B7BE0C065FD5DB8CAA0B9A6C6CE1 /* Moya */ = { + isa = PBXGroup; + children = ( + 472123F72790185C07BED348C50190B9 /* Core */, + 1437F7EEA6B6C0A50DD18AE9954AC752 /* Support Files */, + ); + name = Moya; + path = Moya; + sourceTree = ""; + }; + CB5A5E8F512B6A3215DC67CEA3A2F880 /* Pods */ = { + isa = PBXGroup; + children = ( + 390A4DA85FC0AA2752C69F91371509DC /* Alamofire */, + BFA1B7BE0C065FD5DB8CAA0B9A6C6CE1 /* Moya */, + D3A70EA5CF355CC76B23351E59CF00A9 /* Result */, + 07AC742EE72966C0A1CA4E0F33DD26A1 /* RxCocoa */, + 988D9E515DE8AD7A7AE4FE85DF937F39 /* RxSwift */, + ); + name = Pods; + sourceTree = ""; + }; + D3A70EA5CF355CC76B23351E59CF00A9 /* Result */ = { + isa = PBXGroup; + children = ( + 612EE801AF57652D1D80CDD9CE842343 /* Result.swift */, + E27870041DC364397664491D846A9EFD /* ResultProtocol.swift */, + 4ABA38C1F3117F2C1811DF6F90191303 /* Support Files */, + ); + name = Result; + path = Result; + sourceTree = ""; + }; + DE72494F814AA4278EA9CD583BFD585A /* Pods-Poc.Mauro.Bianchelli */ = { + isa = PBXGroup; + children = ( + 20DFE55F77423C545051BDD712E6F10E /* Info.plist */, + 9218C32FA9BDEE97C7FBAF0BDDBD9358 /* Pods-Poc.Mauro.Bianchelli.modulemap */, + 1DA06656FEF7B6101D88CFFBDCE4A92B /* Pods-Poc.Mauro.Bianchelli-acknowledgements.markdown */, + CC2000693DBE622B31D4E816B38CD333 /* Pods-Poc.Mauro.Bianchelli-acknowledgements.plist */, + DA6C66FAD642C5F74BDB4DBC244AE83A /* Pods-Poc.Mauro.Bianchelli-dummy.m */, + 648060596A91B66BBD0C45B3463988D3 /* Pods-Poc.Mauro.Bianchelli-frameworks.sh */, + A835B86A03364B11B2FF212D66F98C68 /* Pods-Poc.Mauro.Bianchelli-resources.sh */, + AAB667BE339E4195C5BD1DBE7F6FAF43 /* Pods-Poc.Mauro.Bianchelli-umbrella.h */, + 38BDC75E9EAFD591E8C4DFC5FE4694B5 /* Pods-Poc.Mauro.Bianchelli.debug.xcconfig */, + 25D344FD92F800B6FCE9074106CB8975 /* Pods-Poc.Mauro.Bianchelli.release.xcconfig */, + ); + name = "Pods-Poc.Mauro.Bianchelli"; + path = "Target Support Files/Pods-Poc.Mauro.Bianchelli"; + sourceTree = ""; + }; + E5DD6C1F1FC00DE655A391538B912018 /* Support Files */ = { + isa = PBXGroup; + children = ( + E426253FE54399EAEA272DE16A45FC49 /* Info.plist */, + A9EFF32F40B01097039E104CCA97428B /* RxSwift.modulemap */, + F68A927D1039131907238AD788B98664 /* RxSwift.xcconfig */, + 6F7EE24D6EFA41154E753FEEA215D9B3 /* RxSwift-dummy.m */, + EB215AE0959BBD69D629C0D4C02E6A22 /* RxSwift-prefix.pch */, + 44FB42F65DE8F8EA681FA2EC07049396 /* RxSwift-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/RxSwift"; + sourceTree = ""; + }; + ED48CB14E0C99960791957A989626D00 /* Support Files */ = { + isa = PBXGroup; + children = ( + C6E7C0FF6558AE25D3D8D34C1D694829 /* Alamofire.modulemap */, + D65F636F1577B6136BB848F3405EFA17 /* Alamofire.xcconfig */, + 28DEA50E3805B80FFDFD92B3C116053A /* Alamofire-dummy.m */, + A57988C7E5CFDF16C75F8A2A8D58849E /* Alamofire-prefix.pch */, + 2DE626B9BEA59A5134637C7852BA16BE /* Alamofire-umbrella.h */, + 09CB284FDFB836FEE826F9E732378CB5 /* Info.plist */, + ); + name = "Support Files"; + path = "../Target Support Files/Alamofire"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 4000CFBF75E39A555C8339894A0309A8 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A0DBB80FB8DAA0A092D2867E8B20B9F5 /* RxSwift-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4D83CB741529E76239504FF9465C058D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + DCAD342946F1F8006C814F04D08F54A6 /* Result-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5D87A96602F682E544BF023A3B3E3A5F /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A79E00DF1396FFF2A503AE97613D0613 /* _RX.h in Headers */, + 3590898A53AC87047F05B77BEFA75B12 /* _RXDelegateProxy.h in Headers */, + AF59C7554E63AA53C5047A000A70DCF1 /* _RXKVOObserver.h in Headers */, + 4DF1F342C996134DDB696D5D53679930 /* _RXObjCRuntime.h in Headers */, + D2D37F301B30BC14E6B144D2459F597B /* RxCocoa-umbrella.h in Headers */, + 75B81D3260F630052B2F74E0308A5A16 /* RxCocoa.h in Headers */, + 25C902E034F3D7BC2A55F2C0D5E19C80 /* RxCocoaRuntime.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7701F9B1BB1BA2F051F46B03B975C8BB /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + DD63741EE675BECE1743175832464C1E /* Moya-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B33A43500EEC1CD0F3C0BBDBFCED40E1 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 094C8FFC27C8C66B18DF62A8CB388E29 /* Pods-Poc.Mauro.Bianchelli-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B4002B6E97835FDCCAA5963EFE09A3E0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1B9EDEDC964E6B08F78920B4F4B9DB84 /* Alamofire-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 00B6F181E4BA99DE08FCECA77BDDE7F6 /* RxSwift */ = { + isa = PBXNativeTarget; + buildConfigurationList = 66E1E474F17B6F364F955A03A4C5B9E5 /* Build configuration list for PBXNativeTarget "RxSwift" */; + buildPhases = ( + B2739A14C21F763800BE3BB03D169ECF /* Sources */, + 8EA06E8387DD2E3720394AB668C17891 /* Frameworks */, + 4000CFBF75E39A555C8339894A0309A8 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RxSwift; + productName = RxSwift; + productReference = 6C2D6664A968198179A1C07402527332 /* RxSwift.framework */; + productType = "com.apple.product-type.framework"; + }; + 46F960D6F4D1364D9AC46EA5C3156681 /* Result */ = { + isa = PBXNativeTarget; + buildConfigurationList = 42BAB9C1AE4A0F34E6FF62ECC2CE6F76 /* Build configuration list for PBXNativeTarget "Result" */; + buildPhases = ( + B9A82370DAD2E2FF7C42C7BEC6877FA7 /* Sources */, + B244DBC1DC39A98F76FD482BE2211B9D /* Frameworks */, + 4D83CB741529E76239504FF9465C058D /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Result; + productName = Result; + productReference = FD9406C39C588EEB7600F62E288A4D74 /* Result.framework */; + productType = "com.apple.product-type.framework"; + }; + 88E9EC28B8B46C3631E6B242B50F4442 /* Alamofire */ = { + isa = PBXNativeTarget; + buildConfigurationList = 419E5D95491847CD79841B971A8A3277 /* Build configuration list for PBXNativeTarget "Alamofire" */; + buildPhases = ( + 32B9974868188C4803318E36329C87FE /* Sources */, + 99195E4207764744AEC07ECCBCD550EB /* Frameworks */, + B4002B6E97835FDCCAA5963EFE09A3E0 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Alamofire; + productName = Alamofire; + productReference = 036A9A8DF2BE5708519F38BC83A58D7C /* Alamofire.framework */; + productType = "com.apple.product-type.framework"; + }; + 8E531745AE6F64533D84CEEBFFCC53E8 /* Pods-Poc.Mauro.Bianchelli */ = { + isa = PBXNativeTarget; + buildConfigurationList = C97EAC1710B526CDCE7758E2F3DD536C /* Build configuration list for PBXNativeTarget "Pods-Poc.Mauro.Bianchelli" */; + buildPhases = ( + D45790FEACF48EABD2573652A8AC3B26 /* Sources */, + 6315BD979CEDE373C7F67D62BE002C8C /* Frameworks */, + B33A43500EEC1CD0F3C0BBDBFCED40E1 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + CA726B7FA2F528FFC9AB3E5C7EAA167D /* PBXTargetDependency */, + A6EA0EC40A42CE399B4377212ECFFA95 /* PBXTargetDependency */, + 1AD13D7A3C346DE2E33E7127E437151F /* PBXTargetDependency */, + FDA446DC25B68336FC31EF5CBD817F53 /* PBXTargetDependency */, + CDC8FABC7EFE7BE3FE70A3E882D351EF /* PBXTargetDependency */, + ); + name = "Pods-Poc.Mauro.Bianchelli"; + productName = "Pods-Poc.Mauro.Bianchelli"; + productReference = 5DDB922C9E928088F7869B4C8C7AD13D /* Pods_Poc_Mauro_Bianchelli.framework */; + productType = "com.apple.product-type.framework"; + }; + 9749FEC86D945A13F98E7FCD33DB54AB /* Moya */ = { + isa = PBXNativeTarget; + buildConfigurationList = 36C0BCD45B94F26CB3A1DAFF3DC20939 /* Build configuration list for PBXNativeTarget "Moya" */; + buildPhases = ( + 892E960F1DEA07224B953B7C59C9FAC5 /* Sources */, + 5E58B04B7406F03AF70F6A16EC470030 /* Frameworks */, + 7701F9B1BB1BA2F051F46B03B975C8BB /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + 1C0F18898200F38C6568DEF3C8D15F87 /* PBXTargetDependency */, + C89F2A9D39577D0FA94AE4377F2E2BD1 /* PBXTargetDependency */, + ); + name = Moya; + productName = Moya; + productReference = 7C595CAA1979AE19878BB45482D7C78A /* Moya.framework */; + productType = "com.apple.product-type.framework"; + }; + B406736ABC06D6F77F8ED7ED0FCC4184 /* RxCocoa */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2A9CF851017BF1716BCA5216D49D2596 /* Build configuration list for PBXNativeTarget "RxCocoa" */; + buildPhases = ( + 4298CD4C50284BADBEE97516B32E3C31 /* Sources */, + F92A9E0A93B6E3DD4E68F5329ECC52A2 /* Frameworks */, + 5D87A96602F682E544BF023A3B3E3A5F /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + F6F75608AFA560B3CA5F32BD2FE1C35B /* PBXTargetDependency */, + ); + name = RxCocoa; + productName = RxCocoa; + productReference = 6221D612FB759E2BFACA6A910DC1E1BE /* RxCocoa.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0930; + LastUpgradeCheck = 0930; + }; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 7DB346D0F39D3F0E887471402A8071AB; + productRefGroup = 2549348D5F67C26374C508A2FFB7D176 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 88E9EC28B8B46C3631E6B242B50F4442 /* Alamofire */, + 9749FEC86D945A13F98E7FCD33DB54AB /* Moya */, + 8E531745AE6F64533D84CEEBFFCC53E8 /* Pods-Poc.Mauro.Bianchelli */, + 46F960D6F4D1364D9AC46EA5C3156681 /* Result */, + B406736ABC06D6F77F8ED7ED0FCC4184 /* RxCocoa */, + 00B6F181E4BA99DE08FCECA77BDDE7F6 /* RxSwift */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 32B9974868188C4803318E36329C87FE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9ED2BB2981896E0A39EFA365503F58CE /* AFError.swift in Sources */, + A9EEEA7477981DEEBC72432DE9990A4B /* Alamofire-dummy.m in Sources */, + F8B3D3092ED0417E8CDF32033F6122F5 /* Alamofire.swift in Sources */, + 61200D01A1855D7920CEF835C8BE00B0 /* DispatchQueue+Alamofire.swift in Sources */, + B65FCF589DA398C3EFE0128064E510EC /* MultipartFormData.swift in Sources */, + A2A6F71B727312BD45CC7A4AAD7B0AB7 /* NetworkReachabilityManager.swift in Sources */, + EFD264FC408EBF3BA2528E70B08DDD94 /* Notifications.swift in Sources */, + BE5C67A07E289FE1F9BE27335B159997 /* ParameterEncoding.swift in Sources */, + 5387216E723A3C68E851CA15573CDD71 /* Request.swift in Sources */, + CB6D60925223897FFA2662667DF83E8A /* Response.swift in Sources */, + F6BECD98B97CBFEBE2C96F0E9E72A6C0 /* ResponseSerialization.swift in Sources */, + 7D8CC01E8C9EFFF9F4D65406CDE0AB66 /* Result.swift in Sources */, + 62F65AD8DC4F0F9610F4B8B4738EC094 /* ServerTrustPolicy.swift in Sources */, + 7B5FE28C7EA4122B0598738E54DBEBD8 /* SessionDelegate.swift in Sources */, + AE1EF48399533730D0066E04B22CA2D6 /* SessionManager.swift in Sources */, + 3626B94094672CB1C9DEA32B9F9502E1 /* TaskDelegate.swift in Sources */, + 10EB23E9ECC4B33E16933BB1EA560B6A /* Timeline.swift in Sources */, + BBEFE2F9CEB73DC7BD97FFA66A0D9D4F /* Validation.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4298CD4C50284BADBEE97516B32E3C31 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 71A571C901D475603299018F5A7EA333 /* _RX.m in Sources */, + 3B5A8B281FEBD017BA0DF1868A4951A0 /* _RXDelegateProxy.m in Sources */, + 0FE44514580FFBCDFC3EE682EE6B283B /* _RXKVOObserver.m in Sources */, + 221F58FF06EA301286BE0B88C7B7B91D /* _RXObjCRuntime.m in Sources */, + 251A612E9DE6ABD2E113075FC1686624 /* Bag.swift in Sources */, + 6D3AAA620FE7EA6D09428EBB7C175C7C /* BehaviorRelay+Driver.swift in Sources */, + EE3D945EE3CE23EEA6793851EA28CA8A /* BehaviorRelay.swift in Sources */, + 7A1309FA462B6E34E71B40649AFC4E7D /* Binder.swift in Sources */, + 270217A1042AC1D5F33E7B321A8044A2 /* ControlEvent+Driver.swift in Sources */, + 305489B9935616AA7E66348CFE4890BB /* ControlEvent+Signal.swift in Sources */, + E18D144EFC6355080F1AC1CDEB956B12 /* ControlEvent.swift in Sources */, + 7A39B9CC16708A51D5336784EBA32F5F /* ControlProperty+Driver.swift in Sources */, + B54101903F14A8F38F0BFDFD219EBD12 /* ControlProperty.swift in Sources */, + 9456B079225B7A362B8DD31E525CF72C /* ControlTarget.swift in Sources */, + B2AFE915BE7C1CF17069F5B7E55BEE4B /* DelegateProxy.swift in Sources */, + DE61C3854A6A5F65B3C8FC11BA3AB0A8 /* DelegateProxyType.swift in Sources */, + D58C7D70E2A4BA3E51393BE41CA08717 /* Deprecated.swift in Sources */, + 835BBB8F770CB690E73D4A31E7862F9A /* DeprecationWarner.swift in Sources */, + F84308B06D5B3124E4CF3C2CB1AAA0AF /* DispatchQueue+Extensions.swift in Sources */, + 6674DBAECDDA1437ACAE79D1A134578F /* Driver+Subscription.swift in Sources */, + 77E842DB9997B2D482F0D3F393127E12 /* Driver.swift in Sources */, + 69408281D2781F80B439688633628A94 /* InfiniteSequence.swift in Sources */, + 49A2F10185279645CF412CF70FA1648C /* ItemEvents.swift in Sources */, + 70678FFE16E573F6622DD7CA73985F4A /* KVORepresentable+CoreGraphics.swift in Sources */, + DF318D77490D37CCE34DE86EE7065E3C /* KVORepresentable+Swift.swift in Sources */, + 11ACC2B798A2DDFCCEE4C4EEEBD6ED12 /* KVORepresentable.swift in Sources */, + 38C342ADE62C54BE680239464AAB3145 /* Logging.swift in Sources */, + 5305C27BEC0E1FB3182A3E510E92B64D /* NotificationCenter+Rx.swift in Sources */, + 69C940908E4276DB32B9F0705C00A03A /* NSLayoutConstraint+Rx.swift in Sources */, + C6A5B5C622B60837323A1945142A5243 /* NSObject+Rx+KVORepresentable.swift in Sources */, + 9243FB41DC1B8EAF14491B231BCC4A1B /* NSObject+Rx+RawRepresentable.swift in Sources */, + FA65245C2BB03501465E33CE66B03403 /* NSObject+Rx.swift in Sources */, + CE7684C8FA700855275A95900DDF0168 /* NSTextStorage+Rx.swift in Sources */, + 60B748FBD37F5C84DB7332AE5F0972FE /* Observable+Bind.swift in Sources */, + BEF65FAC7F41DD037C2FA32FF25E5690 /* ObservableConvertibleType+Driver.swift in Sources */, + 42D6B03ED6BA9523C62F2D5F79B65D63 /* ObservableConvertibleType+SharedSequence.swift in Sources */, + 7A01CC43F715B97D1627A6C077F775EE /* ObservableConvertibleType+Signal.swift in Sources */, + C5895EC31EC8D9A3127BACDE9272B350 /* Platform.Darwin.swift in Sources */, + 207EEB2259CD719B437CB2ABB0510629 /* Platform.Linux.swift in Sources */, + 3019DBCF835EF2736DA9971D58D0B84A /* PriorityQueue.swift in Sources */, + 77D6C138FB22E83D64D3B1B611F87F6A /* PublishRelay+Signal.swift in Sources */, + DE0F3103F5C869B69B5F3F92EE9A73B5 /* PublishRelay.swift in Sources */, + 76AC4E25D7F59CFFD475DE62566A2EF4 /* Queue.swift in Sources */, + 479527081A5900C9328EA619AD9B7537 /* RecursiveLock.swift in Sources */, + BA487C5AC48A97A445351C9E737EF6BC /* RxCocoa-dummy.m in Sources */, + AACCF0D896D1F1A345FAF9909B499DCB /* RxCocoa.swift in Sources */, + A7B69E8602F07EA9BD2560F410AA3E79 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */, + C1C75459A934C0A3C5EA74BAE3B74E11 /* RxCollectionViewDataSourceProxy.swift in Sources */, + B8838F0EE35916FE6EA3B4753E4F13F3 /* RxCollectionViewDataSourceType.swift in Sources */, + 546F58650B9678992B1F53880E480128 /* RxCollectionViewDelegateProxy.swift in Sources */, + D80510277B184ADA255F01A3CD32FC0C /* RxCollectionViewReactiveArrayDataSource.swift in Sources */, + 1E8314961D2FF6FF987F9890E18EF3E6 /* RxNavigationControllerDelegateProxy.swift in Sources */, + 669D4DEC41D1E46BA43782BB36F45774 /* RxPickerViewAdapter.swift in Sources */, + 9279B6DE101166E3F2DEE018689659FC /* RxPickerViewDataSourceProxy.swift in Sources */, + CE780FE88629803F1481F6E512FA47AD /* RxPickerViewDataSourceType.swift in Sources */, + 956657F28CB29B1D4CE983FC1D383822 /* RxPickerViewDelegateProxy.swift in Sources */, + 0175B3A4CDF1C9964EB838D2516F7C90 /* RxScrollViewDelegateProxy.swift in Sources */, + AD50E8B8CD90A33A9EFF354A96FC06D5 /* RxSearchBarDelegateProxy.swift in Sources */, + 9C6C4BFE414DFF89C177F78E4C9999E8 /* RxSearchControllerDelegateProxy.swift in Sources */, + 28272B59F03E9531724031C6E85DA56F /* RxTabBarControllerDelegateProxy.swift in Sources */, + E811733E4FC26A957D93877B360C6407 /* RxTabBarDelegateProxy.swift in Sources */, + ACE403E64E267B0E31A3318BEE4F8E87 /* RxTableViewDataSourceProxy.swift in Sources */, + 7E2D32F8FB32BC0C7DD6D4B2A5D1ADD1 /* RxTableViewDataSourceType.swift in Sources */, + E5F47523A6525AA6030593D8EA8E4001 /* RxTableViewDelegateProxy.swift in Sources */, + C24A468DCBCA26F37C9D7376D2A23A4A /* RxTableViewReactiveArrayDataSource.swift in Sources */, + 3FBA9A2D57CEEE30D90DD08D0BFD61B2 /* RxTarget.swift in Sources */, + 103378BE00E012044221E598D63C45FB /* RxTextStorageDelegateProxy.swift in Sources */, + DAB6E49D49A21392A602A5D0AB0C97F2 /* RxTextViewDelegateProxy.swift in Sources */, + 9358DFE1074A13C364E8C2AC19C00160 /* RxWebViewDelegateProxy.swift in Sources */, + 02241CBDA92574A53DBD0C3DA0B53AF7 /* SchedulerType+SharedSequence.swift in Sources */, + 86D9208E2EF36ED82F41C0B3E9819F32 /* SectionedViewDataSourceType.swift in Sources */, + 895922FCA5A044E1FEC24F7778F34609 /* SharedSequence+Operators+arity.swift in Sources */, + 5B70BB356233D83DA427840BDAB8D472 /* SharedSequence+Operators.swift in Sources */, + 8A6D0A4E0B17DCE172EAC3A33C612CC1 /* SharedSequence.swift in Sources */, + 8E03D001CDC220D92860A362733A30A1 /* Signal+Subscription.swift in Sources */, + 340DE081545E2C20E8F3ADE262BAA628 /* Signal.swift in Sources */, + 9C134B7FAC00A7B2680EA3DEFC1E7ABB /* TextInput.swift in Sources */, + 4A5808E90726DABF41383C69A9670FC2 /* UIActivityIndicatorView+Rx.swift in Sources */, + ACAA02F8901B03BA08C506F751B9C037 /* UIAlertAction+Rx.swift in Sources */, + B62790B42F097F0589CD4E3764AA0AE6 /* UIApplication+Rx.swift in Sources */, + 0854786C4D7576C430B06DE909AD3CE3 /* UIBarButtonItem+Rx.swift in Sources */, + F914E4B001C49D64CDE76577A10A0B79 /* UIButton+Rx.swift in Sources */, + 9DC3AF14BE2092534EA43DFF82F8D2A4 /* UICollectionView+Rx.swift in Sources */, + D109E8252748E7895173A9B336850751 /* UIControl+Rx.swift in Sources */, + AF883C413E84D4B35345374C61CB01B0 /* UIDatePicker+Rx.swift in Sources */, + 7E3A6752A4F48232337166E95AA15F77 /* UIGestureRecognizer+Rx.swift in Sources */, + 9A8267CFB5923400C3361517F6646B7F /* UIImageView+Rx.swift in Sources */, + 6E03346BC079E51D918717820CDF21C0 /* UILabel+Rx.swift in Sources */, + 97FA9D1BAAD7FE1646FC0C6D101CDA2C /* UINavigationController+Rx.swift in Sources */, + 52A6EC9A4A4BECEC18DA2C131BED73E5 /* UINavigationItem+Rx.swift in Sources */, + 6AB516D9B8F720FEF702BD3C2EEB179A /* UIPageControl+Rx.swift in Sources */, + A1E94E6BA07A9918CCD742316E995263 /* UIPickerView+Rx.swift in Sources */, + 085858319690723532BD50AA79EB83F6 /* UIProgressView+Rx.swift in Sources */, + F66F50794418A33BF370393474D466B5 /* UIRefreshControl+Rx.swift in Sources */, + D9070CB5EB5B2C8D74B04C9EB7045D4A /* UIScrollView+Rx.swift in Sources */, + 88CE2219BD1B351C2FD501F5DCE5A31C /* UISearchBar+Rx.swift in Sources */, + 51DBE11F875FBA948FDAF298C649CE27 /* UISearchController+Rx.swift in Sources */, + 1BCB2FD54CC63F224B536E2FA59FC8A0 /* UISegmentedControl+Rx.swift in Sources */, + B473100C73ADEC6683F3121BECB9A46D /* UISlider+Rx.swift in Sources */, + 99948FAFD54292DE1D552DBE82076E43 /* UIStepper+Rx.swift in Sources */, + 2037C6377B7890259A4923A146A09D34 /* UISwitch+Rx.swift in Sources */, + 655E26C0E2AB0DC6BBF83FE1DDC50743 /* UITabBar+Rx.swift in Sources */, + 0693D86EE4783C141B0E257E53129D7B /* UITabBarController+Rx.swift in Sources */, + EB65F7D7294E09F5DF13851C94785B98 /* UITabBarItem+Rx.swift in Sources */, + 766638E7274644EDF7C167C4571B7B27 /* UITableView+Rx.swift in Sources */, + BD463026D11809C7AB2BDAB2F5FE442D /* UITextField+Rx.swift in Sources */, + CAFBFD86E431F9CBE6A2EB330F67CFB9 /* UITextView+Rx.swift in Sources */, + 155AFFEBD1F4C7D54BA3FEAAB957BE0E /* UIView+Rx.swift in Sources */, + 8D9753B7E4DA0D837DF72E2A0E93B103 /* UIViewController+Rx.swift in Sources */, + 066325239A5C0DC607579EB4F8189E47 /* UIWebView+Rx.swift in Sources */, + DC1DEAB0B7EF5950B44833BC42AE0628 /* URLSession+Rx.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 892E960F1DEA07224B953B7C59C9FAC5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3B2F39A4473DC4E0C96FDF1C3C877D2E /* AccessTokenPlugin.swift in Sources */, + 0DFE3F9F43EBD27380E1E59C604A387B /* AnyEncodable.swift in Sources */, + 72D86827CF51B514920370F8B6654995 /* Cancellable.swift in Sources */, + F065A0CD146D6C1430B1C29CDD28DC73 /* CredentialsPlugin.swift in Sources */, + 9B922A50D8CEC3EF84E506132FD2D928 /* Endpoint.swift in Sources */, + 1C7255CF13F7BDB579D5618C26026C92 /* Image.swift in Sources */, + BC8E3A8E1213B5A83014D6D39A781676 /* Moya+Alamofire.swift in Sources */, + FF1066368629FE0FAA324726ADA67EEF /* Moya-dummy.m in Sources */, + CB8F0704C8DD69377096EC4DDD90D281 /* MoyaError.swift in Sources */, + C91493F899290CEA1E283BD830FB1817 /* MoyaProvider+Defaults.swift in Sources */, + 733D554A6D487270BC063147413E6959 /* MoyaProvider+Internal.swift in Sources */, + ACFE7A82EC9067970DF17D8B58E2874C /* MoyaProvider.swift in Sources */, + D2589D017835BEB15AD02C126777F5E9 /* MultipartFormData.swift in Sources */, + 2ADA53BF4A7E47395977A59C21056053 /* MultiTarget.swift in Sources */, + A2E6D91056689F41D8392004B1D4A065 /* NetworkActivityPlugin.swift in Sources */, + 17A5709C47999CBD43C4F6C945647272 /* NetworkLoggerPlugin.swift in Sources */, + 849E2A36D80137B520B8DFE10B689431 /* Plugin.swift in Sources */, + 8F55848C9DF65CFEF5605CB269EB7F33 /* Response.swift in Sources */, + 091BADAC74B78879CD3AA0DEBB69B1A8 /* TargetType.swift in Sources */, + 2FC4D356CC0C4E37C23459662FD31D7F /* Task.swift in Sources */, + 3B4F902DE7B68C7DBF695795F74616D3 /* URL+Moya.swift in Sources */, + B398E6D727A17EF6E0E5CD77AFBDA20E /* URLRequest+Encoding.swift in Sources */, + C869CC7105F48BFFB933AD37380D830E /* ValidationType.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B2739A14C21F763800BE3BB03D169ECF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CBD3CB178ECF729AC451EB78391A89A8 /* AddRef.swift in Sources */, + 0BE9259CAC1FAF5D367A831F4146B6D8 /* Amb.swift in Sources */, + 0890EDCE51F0899E5914F4420A9BA9FF /* AnonymousDisposable.swift in Sources */, + D30B5819EFB81BCE503D42A93209AE33 /* AnonymousObserver.swift in Sources */, + F5E10BEBC50162299906F13DEC9247AB /* AnyObserver.swift in Sources */, + F4DD1EA2FDCA1DB3878A4FC7AD082D30 /* AsMaybe.swift in Sources */, + 8211FA7C9D42AD2CAFD1C8398879BCB4 /* AsSingle.swift in Sources */, + 6287A7EC319EC25FDA91EA27D0CA9EBF /* AsyncLock.swift in Sources */, + D25505EBE70FA8DDDFCCFA52E1EF0A53 /* AsyncSubject.swift in Sources */, + AAFC1C4EB46DE503C5751ED8436E0C8B /* Bag+Rx.swift in Sources */, + 3312AE1EE5B469B986070A6E5843786F /* Bag.swift in Sources */, + FFC0ADCC3EF947E8D9CCA3B3CC05B17C /* BehaviorSubject.swift in Sources */, + 437A6C3B03C733C9197AF8759B6E141B /* BinaryDisposable.swift in Sources */, + 3569237AE073516C01B76A7A585579CA /* BooleanDisposable.swift in Sources */, + 3BCBD72B43C7998CCAAE0920CB87A30F /* Buffer.swift in Sources */, + 6C47D7273A08C240526ECF4B8AB952E4 /* Cancelable.swift in Sources */, + 1289C65EE989828CC266BAB61066498F /* Catch.swift in Sources */, + CFB3067A978A4D6ED538A4B6A213E225 /* CombineLatest+arity.swift in Sources */, + 2A2A82B0362A354B25BFBA5C2BC6EBD1 /* CombineLatest+Collection.swift in Sources */, + E86BAEF1E35223A2E759A5BB14C5165E /* CombineLatest.swift in Sources */, + 420095F843A14BB58823A79E5801EB0B /* Completable+AndThen.swift in Sources */, + 7F5884C838DBB9E3D71FE9430F015461 /* Completable.swift in Sources */, + 533068422A10025B848C791BCDC9C351 /* CompositeDisposable.swift in Sources */, + 9F5205F25BB331032CD9EBF3542F00E7 /* Concat.swift in Sources */, + DFCE8A2525CEE19980B772E8969940CF /* ConcurrentDispatchQueueScheduler.swift in Sources */, + CB1BB0BF2CA2B1016234F802B60BCC55 /* ConcurrentMainScheduler.swift in Sources */, + CF4BF25A378CAA50D438D5AC15F349F1 /* ConnectableObservableType.swift in Sources */, + 19A41D9307D707BD56C34EF1973D2B64 /* Create.swift in Sources */, + 33E8999DF40BC521BC859BA8832E3DF0 /* CurrentThreadScheduler.swift in Sources */, + 2BBA8E70B5DA276A62B14107A366EA39 /* Debounce.swift in Sources */, + D6D01FBB89514E3829D16F284F8BDDE1 /* Debug.swift in Sources */, + 1C2593F670B3D86D51F00D790E05D6BD /* DefaultIfEmpty.swift in Sources */, + C86E216EAC75F76180F7F83B0AE60C6A /* Deferred.swift in Sources */, + 84F1F6E8F1C7E89C7C3A22AA241A4EDE /* Delay.swift in Sources */, + B5B5793BF68C83AFCB8BF753C0B7F32C /* DelaySubscription.swift in Sources */, + DBE89E6C6D1994D78DBF1411BC339286 /* Dematerialize.swift in Sources */, + B65E91651AD6419FD686EAA1E1564776 /* Deprecated.swift in Sources */, + 143A7A95D23A8E9BD2C9A3F8599321B8 /* DeprecationWarner.swift in Sources */, + 911EA75B9A7616EB23CB7F2E84672DAF /* DispatchQueue+Extensions.swift in Sources */, + 8BB940090BD4AC49E2187908173813D6 /* DispatchQueueConfiguration.swift in Sources */, + 7778F187C5561D5FFF1E412E1EA7859A /* Disposable.swift in Sources */, + 30B34D197CAD6A1639769001DF348F3B /* Disposables.swift in Sources */, + 2FEDE68EC554E8DAA6037DB226992917 /* DisposeBag.swift in Sources */, + 6AED84F84763320B649AFC935D002F6C /* DisposeBase.swift in Sources */, + DA0A7AA050B27E3C2971E758D0C2545F /* DistinctUntilChanged.swift in Sources */, + EEE9104C35DE7868AC29E87204E2E801 /* Do.swift in Sources */, + 54E95A5EB6B449A29E189C88B7C76A9D /* ElementAt.swift in Sources */, + AFAB145EE1684FE94767EE37909FB267 /* Empty.swift in Sources */, + 428C7CDFD406008C75DE9C2A360C92F0 /* Enumerated.swift in Sources */, + 74A24C3536C983D35776329B69D6A849 /* Error.swift in Sources */, + 1374976ED9AE4CBF2472F0C721DDE53C /* Errors.swift in Sources */, + 6338C4D8250F5184E1C1AA052BD04900 /* Event.swift in Sources */, + 852DEF14EDECFB4BE7DFA35C44F9483F /* Filter.swift in Sources */, + 51A89DC919D205E96C42C8F044A20101 /* First.swift in Sources */, + AF24A0F39F4A4BA756F1F221015609A3 /* Generate.swift in Sources */, + 673F2C11C351D2688DDE98A40763876D /* GroupBy.swift in Sources */, + 497DC05933D352F374A90E81599754E2 /* GroupedObservable.swift in Sources */, + 3DE06E00536801CBCAC54C39297EF604 /* HistoricalScheduler.swift in Sources */, + 56C0AD19E92FD9F001C7A31A8321C7D7 /* HistoricalSchedulerTimeConverter.swift in Sources */, + E28A0DD1C4F8EDA2C903EEEEECD2C140 /* ImmediateSchedulerType.swift in Sources */, + B4EF72242E74A291EA90A482206609B4 /* InfiniteSequence.swift in Sources */, + 7851E4601B599C94303F2900F5CFDCB0 /* InvocableScheduledItem.swift in Sources */, + DC1958CD06D74DD973C6703AEBCA2763 /* InvocableType.swift in Sources */, + 8260939F92206F44568AC5233BC300CF /* Just.swift in Sources */, + 7BF91EFE1C91A72443F2B955639F1341 /* Lock.swift in Sources */, + 91B94995F1D8BF90D1590458DB5F874D /* LockOwnerType.swift in Sources */, + 3406A8CA1AC8FD73E38C9A271F852E92 /* MainScheduler.swift in Sources */, + 443C578F5BA109930907345F9E356E8B /* Map.swift in Sources */, + 4BABB380144AEB29F5F3CB8E887F5340 /* Materialize.swift in Sources */, + 6FE769FBAB286B6F4B390AC2DFB78B41 /* Maybe.swift in Sources */, + 0B11400C008ED98FF8963BC7398E1230 /* Merge.swift in Sources */, + BD5C07D6ED406F11FA0FEBE58A9F06A6 /* Multicast.swift in Sources */, + 4357B53E5207FF151DF2FEB16F39CE72 /* Never.swift in Sources */, + F6A28D8E616C3EE202E184E40D280D08 /* NopDisposable.swift in Sources */, + 57E0019CEEF83EF2516C5BE7EA9492A2 /* Observable.swift in Sources */, + BF0105B0F504945FD2D42BCE816B12C3 /* ObservableConvertibleType.swift in Sources */, + 54D0B1C197E0E97641D1B81DC99BBFE1 /* ObservableType+Extensions.swift in Sources */, + D80848BEBB4EDFD7A9B1D12DDD03B34D /* ObservableType+PrimitiveSequence.swift in Sources */, + 9ABB5EA8C222A20AB4BA717A55FB4B79 /* ObservableType.swift in Sources */, + 4CC79B472F4E5D2FDCD205B7384E3A6E /* ObserveOn.swift in Sources */, + 2315A9A695D53355F7A19C9E6294C4F9 /* ObserverBase.swift in Sources */, + 40CF2438E0818521960EB72249F861A0 /* ObserverType.swift in Sources */, + 1E6AE526831F47E23B1660595828C710 /* OperationQueueScheduler.swift in Sources */, + CEE25C8AC8E8FEE8805AA92D221CC1B1 /* Optional.swift in Sources */, + 37B63A84F47731EEC9BD4DDD3DC6C898 /* Platform.Darwin.swift in Sources */, + F9512C7E99ED6D7869BE5AEFC9B1E2DC /* Platform.Linux.swift in Sources */, + AC46F3F2B0054D6CFB01D290B3AF247C /* PrimitiveSequence+Zip+arity.swift in Sources */, + 2F60557C6DA60653BBB90254825A38DB /* PrimitiveSequence.swift in Sources */, + 1F98B100A0AFB1B804DB4F918F8B38F3 /* PriorityQueue.swift in Sources */, + FCBACB830D53EB424B11A2455F2B8D31 /* Producer.swift in Sources */, + AEB75E3E9FF287713340A15846BDDB50 /* PublishSubject.swift in Sources */, + 5EF35B59A24FDAE1B81A7744D9F23F7C /* Queue.swift in Sources */, + 1C0E34AFDB83CBA07DE26CF93D691A71 /* Range.swift in Sources */, + 1E01D7F20FC6C4AF974B16CDA3A51C10 /* Reactive.swift in Sources */, + 412D6F9DBEDDFD46D6E4E9E4DAC1EE50 /* RecursiveLock.swift in Sources */, + B097B1EB497B99F14D3F6C1D650696C8 /* RecursiveScheduler.swift in Sources */, + 0CA7DED55A6027B53A4C8A5D8FB7F454 /* Reduce.swift in Sources */, + 60882349DB959B738A1649C247AF67DA /* RefCountDisposable.swift in Sources */, + C776BF38C6B8D242A4B6D860225243AA /* Repeat.swift in Sources */, + 78735196D0FC6D3F47994881A6273642 /* ReplaySubject.swift in Sources */, + 88266709E863D97525D5AE933FB1789F /* RetryWhen.swift in Sources */, + C3B34436062187625B6F8BCFCB541297 /* Rx.swift in Sources */, + DE634FBE0CCAF019E917573E7DB31CD3 /* RxMutableBox.swift in Sources */, + 9A01EBC104202199D6AFB7E590393849 /* RxSwift-dummy.m in Sources */, + 904E661E9D8FE6E5D3803A57DFA55373 /* Sample.swift in Sources */, + 6547FA1F9576BDF3DF9AB75293CEA86A /* Scan.swift in Sources */, + DB5CE1B747E696D5F92DB01B52B9D16E /* ScheduledDisposable.swift in Sources */, + 972C6C6DD0540CCE1CB1F2E131B20DEC /* ScheduledItem.swift in Sources */, + BA65EB96ECE98C167F0551C353295B0F /* ScheduledItemType.swift in Sources */, + 59FFBACDB73AE6B085C63522FEAB385F /* SchedulerServices+Emulation.swift in Sources */, + 0D9B392CEF40CE0E1BBBE511A4EC9526 /* SchedulerType.swift in Sources */, + 6933EEF86AFE5164BE38E47185586E23 /* Sequence.swift in Sources */, + 4586D253943D8A82FCF3474D0AE9F8B4 /* SerialDispatchQueueScheduler.swift in Sources */, + 9BB20922BCB8B42683C8A746BBF15517 /* SerialDisposable.swift in Sources */, + 6C5B293A3FCED9BE7F6C05F5DFE78885 /* ShareReplayScope.swift in Sources */, + 2664C6F83FEA93B82B402D12B514B1EE /* Single.swift in Sources */, + 5C5E9D57A73BBDE09BC4A2980116D785 /* SingleAssignmentDisposable.swift in Sources */, + 8F4120A1CF3DBA200117E2C92F3CEAFC /* SingleAsync.swift in Sources */, + F424CCBF8A91F15ADDC29F5FD06C2584 /* Sink.swift in Sources */, + 109F83F4BA3BE6E4674D6A0CE5E1DBFE /* Skip.swift in Sources */, + 40B9FD0005FDDAD86FD03C91468054F5 /* SkipUntil.swift in Sources */, + E8A78FCAF79791783FB84FC88E5776BC /* SkipWhile.swift in Sources */, + 8A0C5C2BF6EF1B3AA74A9BAFBAEDE935 /* StartWith.swift in Sources */, + 517FB7696BDD96249654DE21D8B36F6D /* String+Rx.swift in Sources */, + 07EE6A505094B00C5D57A159B9D32428 /* SubjectType.swift in Sources */, + 4829633EF052760F15E1DD1F55FC51A4 /* SubscribeOn.swift in Sources */, + 164FB522D6B9930C2E0F5C52466DC536 /* SubscriptionDisposable.swift in Sources */, + 304C5A765FDEDD0CE68D21A4BDC7FC06 /* SwiftSupport.swift in Sources */, + 86899AF43F20864B9946FEC14F04B87D /* Switch.swift in Sources */, + 02587A4A0F961A916CAF246B17D6A815 /* SwitchIfEmpty.swift in Sources */, + 000A8017FF3356FA7C1B2F2B23E9EDB4 /* SynchronizedDisposeType.swift in Sources */, + 9D5EC3416D38D758479AE89689738581 /* SynchronizedOnType.swift in Sources */, + 7CA7EA3FC527569A03340983822B5036 /* SynchronizedUnsubscribeType.swift in Sources */, + E58D57682FBCB4600AF4168DAC47C6E6 /* TailRecursiveSink.swift in Sources */, + 9A35DC1B34182C765DFEEAA3EB853A21 /* Take.swift in Sources */, + A37D44D94478073247C5464BAF6466A1 /* TakeLast.swift in Sources */, + 18D1B764EA398E541BBD192E6D4CE5BA /* TakeUntil.swift in Sources */, + D39D5EC7102D95A27EE101D994FA35FA /* TakeWhile.swift in Sources */, + E6E5FB31464EC9F106C445F632B44F21 /* Throttle.swift in Sources */, + 70E36EE2B03973F63BD040A239A3FF58 /* Timeout.swift in Sources */, + AEAD02E8EDF23BEA762E365033527930 /* Timer.swift in Sources */, + 776B0E60660233C224F1C4CA855AB084 /* ToArray.swift in Sources */, + 85672ABB5C7DE227086838EA460DC3EF /* Using.swift in Sources */, + 6BCCE0541AFAA5B4366F8017B7B75622 /* VirtualTimeConverterType.swift in Sources */, + 6E2074A97A3CA6179FDC46A820CDA1F4 /* VirtualTimeScheduler.swift in Sources */, + B74B1FC2016B0F65E5806DDD3FB773C2 /* Window.swift in Sources */, + 747BC26E36A5D6557BE6FFE7CBF1F2F8 /* WithLatestFrom.swift in Sources */, + 42C0F1AC53A1A0DD41ED270ACF7BAF16 /* Zip+arity.swift in Sources */, + 28135C947B4FF1A5A310F92E3791A2AE /* Zip+Collection.swift in Sources */, + 63CB43BF056081720ECE78CA57811166 /* Zip.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B9A82370DAD2E2FF7C42C7BEC6877FA7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 44CA755E75CB674560AF114D75D22E9F /* Result-dummy.m in Sources */, + 617A1673022EE19AEDB583424762257E /* Result.swift in Sources */, + 31DEFF2B9258A81A3B6DB01DAB2FA933 /* ResultProtocol.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D45790FEACF48EABD2573652A8AC3B26 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A2D18C2842F4D3B194BCFEDFF17A4590 /* Pods-Poc.Mauro.Bianchelli-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1AD13D7A3C346DE2E33E7127E437151F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Result; + target = 46F960D6F4D1364D9AC46EA5C3156681 /* Result */; + targetProxy = 478F54170C3A7980D842C158DB803D92 /* PBXContainerItemProxy */; + }; + 1C0F18898200F38C6568DEF3C8D15F87 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Alamofire; + target = 88E9EC28B8B46C3631E6B242B50F4442 /* Alamofire */; + targetProxy = 078116908A5DD3F54C87A7686B128E2F /* PBXContainerItemProxy */; + }; + A6EA0EC40A42CE399B4377212ECFFA95 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Moya; + target = 9749FEC86D945A13F98E7FCD33DB54AB /* Moya */; + targetProxy = 401CDAA32DE4D9A57173DCFE2EA3B2D4 /* PBXContainerItemProxy */; + }; + C89F2A9D39577D0FA94AE4377F2E2BD1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Result; + target = 46F960D6F4D1364D9AC46EA5C3156681 /* Result */; + targetProxy = CC984604E83EAF152B83792B810E60F7 /* PBXContainerItemProxy */; + }; + CA726B7FA2F528FFC9AB3E5C7EAA167D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Alamofire; + target = 88E9EC28B8B46C3631E6B242B50F4442 /* Alamofire */; + targetProxy = DBB19EEFE78638394C134035356C241E /* PBXContainerItemProxy */; + }; + CDC8FABC7EFE7BE3FE70A3E882D351EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = RxSwift; + target = 00B6F181E4BA99DE08FCECA77BDDE7F6 /* RxSwift */; + targetProxy = 5A94C66747B145D6325EC896CA0A31FA /* PBXContainerItemProxy */; + }; + F6F75608AFA560B3CA5F32BD2FE1C35B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = RxSwift; + target = 00B6F181E4BA99DE08FCECA77BDDE7F6 /* RxSwift */; + targetProxy = 8FD7970B6A0A8F5E04CC3F5A29F0B40C /* PBXContainerItemProxy */; + }; + FDA446DC25B68336FC31EF5CBD817F53 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = RxCocoa; + target = B406736ABC06D6F77F8ED7ED0FCC4184 /* RxCocoa */; + targetProxy = EFF2AD30305F33EBB46244C5D59D9FED /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 00BC153EA8D4FA8F0EB8C96151FEC480 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 38BDC75E9EAFD591E8C4DFC5FE4694B5 /* Pods-Poc.Mauro.Bianchelli.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-Poc.Mauro.Bianchelli/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Poc_Mauro_Bianchelli; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 078E8559F86BABB12E2290E3D76C9DA1 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 696C375EE86778D5C55502F19F1ACBF0 /* Result.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Result/Result-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Result/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Result/Result.modulemap"; + PRODUCT_NAME = Result; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 0C109D0A0156B8152C59EAA2676A814C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F670D7E2FF83795225B7ED1EFECEDD6A /* RxCocoa.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/RxCocoa/RxCocoa-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/RxCocoa/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/RxCocoa/RxCocoa.modulemap"; + PRODUCT_NAME = RxCocoa; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 0CAFCB7F96699A999CD32A6EBD71B7B9 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 696C375EE86778D5C55502F19F1ACBF0 /* Result.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Result/Result-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Result/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Result/Result.modulemap"; + PRODUCT_NAME = Result; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 2BBC58500DE155860E1B68ED30FC6ADC /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4145DAB62FDA2C51BD03D1B2A96BA085 /* Moya.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Moya/Moya-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Moya/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Moya/Moya.modulemap"; + PRODUCT_NAME = Moya; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 49B5A78DBE571998053070754D3695E8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_REQUIRED = NO; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_RELEASE=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Release; + }; + 6A10B10669947B9803E703CFD9073EF1 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F68A927D1039131907238AD788B98664 /* RxSwift.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/RxSwift/RxSwift-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/RxSwift/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/RxSwift/RxSwift.modulemap"; + PRODUCT_NAME = RxSwift; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 87038B730A89224ABD04CE31DEA39BED /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4145DAB62FDA2C51BD03D1B2A96BA085 /* Moya.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Moya/Moya-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Moya/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Moya/Moya.modulemap"; + PRODUCT_NAME = Moya; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + A95B5FCF1771A27F67781107DF89C9F1 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F68A927D1039131907238AD788B98664 /* RxSwift.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/RxSwift/RxSwift-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/RxSwift/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/RxSwift/RxSwift.modulemap"; + PRODUCT_NAME = RxSwift; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + B0F5F1530D3F4E518BE2B1A52F98487A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D65F636F1577B6136BB848F3405EFA17 /* Alamofire.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Alamofire/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; + PRODUCT_NAME = Alamofire; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + B8CA02655A4B738D82484691EE8CA58F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D65F636F1577B6136BB848F3405EFA17 /* Alamofire.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Alamofire/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; + PRODUCT_NAME = Alamofire; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + CF8DA9F1C120CEC80E4CC3B793FFEC30 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F670D7E2FF83795225B7ED1EFECEDD6A /* RxCocoa.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/RxCocoa/RxCocoa-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/RxCocoa/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/RxCocoa/RxCocoa.modulemap"; + PRODUCT_NAME = RxCocoa; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + DD369323FD85CB26347C0D75C75D837F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_REQUIRED = NO; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + ED02D58CF8971C8CBE2A70F35656CB3B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 25D344FD92F800B6FCE9074106CB8975 /* Pods-Poc.Mauro.Bianchelli.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-Poc.Mauro.Bianchelli/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-Poc.Mauro.Bianchelli/Pods-Poc.Mauro.Bianchelli.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Poc_Mauro_Bianchelli; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2A9CF851017BF1716BCA5216D49D2596 /* Build configuration list for PBXNativeTarget "RxCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CF8DA9F1C120CEC80E4CC3B793FFEC30 /* Debug */, + 0C109D0A0156B8152C59EAA2676A814C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DD369323FD85CB26347C0D75C75D837F /* Debug */, + 49B5A78DBE571998053070754D3695E8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 36C0BCD45B94F26CB3A1DAFF3DC20939 /* Build configuration list for PBXNativeTarget "Moya" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 87038B730A89224ABD04CE31DEA39BED /* Debug */, + 2BBC58500DE155860E1B68ED30FC6ADC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 419E5D95491847CD79841B971A8A3277 /* Build configuration list for PBXNativeTarget "Alamofire" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B0F5F1530D3F4E518BE2B1A52F98487A /* Debug */, + B8CA02655A4B738D82484691EE8CA58F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 42BAB9C1AE4A0F34E6FF62ECC2CE6F76 /* Build configuration list for PBXNativeTarget "Result" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 078E8559F86BABB12E2290E3D76C9DA1 /* Debug */, + 0CAFCB7F96699A999CD32A6EBD71B7B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 66E1E474F17B6F364F955A03A4C5B9E5 /* Build configuration list for PBXNativeTarget "RxSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A95B5FCF1771A27F67781107DF89C9F1 /* Debug */, + 6A10B10669947B9803E703CFD9073EF1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C97EAC1710B526CDCE7758E2F3DD536C /* Build configuration list for PBXNativeTarget "Pods-Poc.Mauro.Bianchelli" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 00BC153EA8D4FA8F0EB8C96151FEC480 /* Debug */, + ED02D58CF8971C8CBE2A70F35656CB3B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/LICENSE b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/LICENSE new file mode 100644 index 0000000..3026ee1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Rob Rix + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/README.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/README.md new file mode 100644 index 0000000..7343ade --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/README.md @@ -0,0 +1,113 @@ +# Result + +[![Build Status](https://travis-ci.org/antitypical/Result.svg?branch=master)](https://travis-ci.org/antitypical/Result) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![CocoaPods](https://img.shields.io/cocoapods/v/Result.svg)](https://cocoapods.org/) +[![Reference Status](https://www.versioneye.com/objective-c/result/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/result/references) + +This is a Swift µframework providing `Result`. + +`Result` values are either successful (wrapping `Value`) or failed (wrapping `Error`). This is similar to Swift’s native `Optional` type: `success` is like `some`, and `failure` is like `none` except with an associated `Error` value. The addition of an associated `Error` allows errors to be passed along for logging or displaying to the user. + +Using this µframework instead of rolling your own `Result` type allows you to easily interface with other frameworks that also use `Result`. + +## Use + +Use `Result` whenever an operation has the possibility of failure. Consider the following example of a function that tries to extract a `String` for a given key from a JSON `Dictionary`. + +```swift +typealias JSONObject = [String: Any] + +enum JSONError: Error { + case noSuchKey(String) + case typeMismatch +} + +func stringForKey(json: JSONObject, key: String) -> Result { + guard let value = json[key] else { + return .failure(.noSuchKey(key)) + } + + if let value = value as? String { + return .success(value) + } + else { + return .failure(.typeMismatch) + } +} +``` + +This function provides a more robust wrapper around the default subscripting provided by `Dictionary`. Rather than return `Any?`, it returns a `Result` that either contains the `String` value for the given key, or an `ErrorType` detailing what went wrong. + +One simple way to handle a `Result` is to deconstruct it using a `switch` statement. + +```swift +switch stringForKey(json, key: "email") { + +case let .success(email): + print("The email is \(email)") + +case let .failure(.noSuchKey(key)): + print("\(key) is not a valid key") + +case .failure(.typeMismatch): + print("Didn't have the right type") +} +``` + +Using a `switch` statement allows powerful pattern matching, and ensures all possible results are covered. Swift 2.0 offers new ways to deconstruct enums like the `if-case` statement, but be wary as such methods do not ensure errors are handled. + +Other methods available for processing `Result` are detailed in the [API documentation](http://cocoadocs.org/docsets/Result/). + +## Result vs. Throws + +Swift 2.0 introduces error handling via throwing and catching `Error`. `Result` accomplishes the same goal by encapsulating the result instead of hijacking control flow. The `Result` abstraction enables powerful functionality such as `map` and `flatMap`, making `Result` more composable than `throw`. + +Since dealing with APIs that throw is common, you can convert such functions into a `Result` by using the `materialize` method. Conversely, a `Result` can be used to throw an error by calling `dematerialize`. + +## Higher Order Functions + +`map` and `flatMap` operate the same as `Optional.map` and `Optional.flatMap` except they apply to `Result`. + +`map` transforms a `Result` into a `Result` of a new type. It does this by taking a function that transforms the `Value` type into a new value. This transformation is only applied in the case of a `success`. In the case of a `failure`, the associated error is re-wrapped in the new `Result`. + +```swift +// transforms a Result to a Result +let idResult = intForKey(json, key:"id").map { id in String(id) } +``` + +Here, the final result is either the id as a `String`, or carries over the `failure` from the previous result. + +`flatMap` is similar to `map` in that in transforms the `Result` into another `Result`. However, the function passed into `flatMap` must return a `Result`. + +An in depth discussion of `map` and `flatMap` is beyond the scope of this documentation. If you would like a deeper understanding, read about functors and monads. This article is a good place to [start](http://www.javiersoto.me/post/106875422394). + +## Integration + +### Carthage + +1. Add this repository as a submodule and/or [add it to your Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile) if you’re using [carthage](https://github.com/Carthage/Carthage/) to manage your dependencies. +2. Drag `Result.xcodeproj` into your project or workspace. +3. Link your target against `Result.framework`. +4. Application targets should ensure that the framework gets copied into their application bundle. (Framework targets should instead require the application linking them to include Result.) + +### Cocoapods + +```ruby +pod 'Result', '~> 3.0.0' +``` + +### Swift Package Manager + +```swift +import PackageDescription + +let package = Package( + name: "MyProject", + targets: [], + dependencies: [ + .Package(url: "https://github.com/antitypical/Result.git", + majorVersion: 3) + ] +) +``` diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/Result.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/Result.swift new file mode 100644 index 0000000..c92524d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/Result.swift @@ -0,0 +1,276 @@ +// Copyright (c) 2015 Rob Rix. All rights reserved. + +/// An enum representing either a failure with an explanatory error, or a success with a result value. +public enum Result: ResultProtocol, CustomStringConvertible, CustomDebugStringConvertible { + case success(T) + case failure(Error) + + // MARK: Constructors + + /// Constructs a success wrapping a `value`. + public init(value: T) { + self = .success(value) + } + + /// Constructs a failure wrapping an `error`. + public init(error: Error) { + self = .failure(error) + } + + /// Constructs a result from an `Optional`, failing with `Error` if `nil`. + public init(_ value: T?, failWith: @autoclosure () -> Error) { + self = value.map(Result.success) ?? .failure(failWith()) + } + + /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. + public init(_ f: @autoclosure () throws -> T) { + self.init(attempt: f) + } + + /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. + public init(attempt f: () throws -> T) { + do { + self = .success(try f()) + } catch var error { + if Error.self == AnyError.self { + error = AnyError(error) + } + self = .failure(error as! Error) + } + } + + // MARK: Deconstruction + + /// Returns the value from `success` Results or `throw`s the error. + public func dematerialize() throws -> T { + switch self { + case let .success(value): + return value + case let .failure(error): + throw error + } + } + + /// Case analysis for Result. + /// + /// Returns the value produced by applying `ifFailure` to `failure` Results, or `ifSuccess` to `success` Results. + public func analysis(ifSuccess: (T) -> Result, ifFailure: (Error) -> Result) -> Result { + switch self { + case let .success(value): + return ifSuccess(value) + case let .failure(value): + return ifFailure(value) + } + } + + // MARK: Errors + + /// The domain for errors constructed by Result. + public static var errorDomain: String { return "com.antitypical.Result" } + + /// The userInfo key for source functions in errors constructed by Result. + public static var functionKey: String { return "\(errorDomain).function" } + + /// The userInfo key for source file paths in errors constructed by Result. + public static var fileKey: String { return "\(errorDomain).file" } + + /// The userInfo key for source file line numbers in errors constructed by Result. + public static var lineKey: String { return "\(errorDomain).line" } + + /// Constructs an error. + public static func error(_ message: String? = nil, function: String = #function, file: String = #file, line: Int = #line) -> NSError { + var userInfo: [String: Any] = [ + functionKey: function, + fileKey: file, + lineKey: line, + ] + + if let message = message { + userInfo[NSLocalizedDescriptionKey] = message + } + + return NSError(domain: errorDomain, code: 0, userInfo: userInfo) + } + + + // MARK: CustomStringConvertible + + public var description: String { + return analysis( + ifSuccess: { ".success(\($0))" }, + ifFailure: { ".failure(\($0))" }) + } + + + // MARK: CustomDebugStringConvertible + + public var debugDescription: String { + return description + } +} + +// MARK: - Derive result from failable closure + +public func materialize(_ f: () throws -> T) -> Result { + return materialize(try f()) +} + +public func materialize(_ f: @autoclosure () throws -> T) -> Result { + do { + return .success(try f()) + } catch { + return .failure(AnyError(error)) + } +} + +@available(*, deprecated, message: "Use the overload which returns `Result` instead") +public func materialize(_ f: () throws -> T) -> Result { + return materialize(try f()) +} + +@available(*, deprecated, message: "Use the overload which returns `Result` instead") +public func materialize(_ f: @autoclosure () throws -> T) -> Result { + do { + return .success(try f()) + } catch { +// This isn't great, but it lets us maintain compatibility until this deprecated +// method can be removed. +#if _runtime(_ObjC) + return .failure(error as NSError) +#else + // https://github.com/apple/swift-corelibs-foundation/blob/swift-3.0.2-RELEASE/Foundation/NSError.swift#L314 + let userInfo = _swift_Foundation_getErrorDefaultUserInfo(error) as? [String: Any] + let nsError = NSError(domain: error._domain, code: error._code, userInfo: userInfo) + return .failure(nsError) +#endif + } +} + +// MARK: - Cocoa API conveniences + +#if !os(Linux) + +/// Constructs a `Result` with the result of calling `try` with an error pointer. +/// +/// This is convenient for wrapping Cocoa API which returns an object or `nil` + an error, by reference. e.g.: +/// +/// Result.try { NSData(contentsOfURL: URL, options: .dataReadingMapped, error: $0) } +@available(*, deprecated, message: "This will be removed in Result 4.0. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.") +public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> T?) -> Result { + var error: NSError? + return `try`(&error).map(Result.success) ?? .failure(error ?? Result.error(function: function, file: file, line: line)) +} + +/// Constructs a `Result` with the result of calling `try` with an error pointer. +/// +/// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.: +/// +/// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) } +@available(*, deprecated, message: "This will be removed in Result 4.0. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.") +public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> Bool) -> Result<(), NSError> { + var error: NSError? + return `try`(&error) ? + .success(()) + : .failure(error ?? Result<(), NSError>.error(function: function, file: file, line: line)) +} + +#endif + +// MARK: - ErrorConvertible conformance + +extension NSError: ErrorConvertible { + public static func error(from error: Swift.Error) -> Self { + func cast(_ error: Swift.Error) -> T { + return error as! T + } + + return cast(error) + } +} + +// MARK: - Errors + +/// An “error” that is impossible to construct. +/// +/// This can be used to describe `Result`s where failures will never +/// be generated. For example, `Result` describes a result that +/// contains an `Int`eger and is guaranteed never to be a `failure`. +public enum NoError: Swift.Error, Equatable { + public static func ==(lhs: NoError, rhs: NoError) -> Bool { + return true + } +} + +/// A type-erased error which wraps an arbitrary error instance. This should be +/// useful for generic contexts. +public struct AnyError: Swift.Error { + /// The underlying error. + public let error: Swift.Error + + public init(_ error: Swift.Error) { + if let anyError = error as? AnyError { + self = anyError + } else { + self.error = error + } + } +} + +extension AnyError: ErrorConvertible { + public static func error(from error: Error) -> AnyError { + return AnyError(error) + } +} + +extension AnyError: CustomStringConvertible { + public var description: String { + return String(describing: error) + } +} + +// There appears to be a bug in Foundation on Linux which prevents this from working: +// https://bugs.swift.org/browse/SR-3565 +// Don't forget to comment the tests back in when removing this check when it's fixed! +#if !os(Linux) + +extension AnyError: LocalizedError { + public var errorDescription: String? { + return error.localizedDescription + } + + public var failureReason: String? { + return (error as? LocalizedError)?.failureReason + } + + public var helpAnchor: String? { + return (error as? LocalizedError)?.helpAnchor + } + + public var recoverySuggestion: String? { + return (error as? LocalizedError)?.recoverySuggestion + } +} + +#endif + +// MARK: - migration support +extension Result { + @available(*, unavailable, renamed: "success") + public static func Success(_: T) -> Result { + fatalError() + } + + @available(*, unavailable, renamed: "failure") + public static func Failure(_: Error) -> Result { + fatalError() + } +} + +extension NSError { + @available(*, unavailable, renamed: "error(from:)") + public static func errorFromErrorType(_ error: Swift.Error) -> Self { + fatalError() + } +} + +import Foundation diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/ResultProtocol.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/ResultProtocol.swift new file mode 100644 index 0000000..678f294 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/Result/Result/ResultProtocol.swift @@ -0,0 +1,203 @@ +// Copyright (c) 2015 Rob Rix. All rights reserved. + +/// A type that can represent either failure with an error or success with a result value. +public protocol ResultProtocol { + associatedtype Value + associatedtype Error: Swift.Error + + /// Constructs a successful result wrapping a `value`. + init(value: Value) + + /// Constructs a failed result wrapping an `error`. + init(error: Error) + + /// Case analysis for ResultProtocol. + /// + /// Returns the value produced by appliying `ifFailure` to the error if self represents a failure, or `ifSuccess` to the result value if self represents a success. + func analysis(ifSuccess: (Value) -> U, ifFailure: (Error) -> U) -> U + + /// Returns the value if self represents a success, `nil` otherwise. + /// + /// A default implementation is provided by a protocol extension. Conforming types may specialize it. + var value: Value? { get } + + /// Returns the error if self represents a failure, `nil` otherwise. + /// + /// A default implementation is provided by a protocol extension. Conforming types may specialize it. + var error: Error? { get } +} + +public extension ResultProtocol { + + /// Returns the value if self represents a success, `nil` otherwise. + public var value: Value? { + return analysis(ifSuccess: { $0 }, ifFailure: { _ in nil }) + } + + /// Returns the error if self represents a failure, `nil` otherwise. + public var error: Error? { + return analysis(ifSuccess: { _ in nil }, ifFailure: { $0 }) + } + + /// Returns a new Result by mapping `Success`es’ values using `transform`, or re-wrapping `Failure`s’ errors. + public func map(_ transform: (Value) -> U) -> Result { + return flatMap { .success(transform($0)) } + } + + /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. + public func flatMap(_ transform: (Value) -> Result) -> Result { + return analysis( + ifSuccess: transform, + ifFailure: Result.failure) + } + + /// Returns a Result with a tuple of the receiver and `other` values if both + /// are `Success`es, or re-wrapping the error of the earlier `Failure`. + public func fanout(_ other: @autoclosure () -> R) -> Result<(Value, R.Value), Error> + where Error == R.Error + { + return self.flatMap { left in other().map { right in (left, right) } } + } + + /// Returns a new Result by mapping `Failure`'s values using `transform`, or re-wrapping `Success`es’ values. + public func mapError(_ transform: (Error) -> Error2) -> Result { + return flatMapError { .failure(transform($0)) } + } + + /// Returns the result of applying `transform` to `Failure`’s errors, or re-wrapping `Success`es’ values. + public func flatMapError(_ transform: (Error) -> Result) -> Result { + return analysis( + ifSuccess: Result.success, + ifFailure: transform) + } + + /// Returns a new Result by mapping `Success`es’ values using `success`, and by mapping `Failure`'s values using `failure`. + public func bimap(success: (Value) -> U, failure: (Error) -> Error2) -> Result { + return analysis( + ifSuccess: { .success(success($0)) }, + ifFailure: { .failure(failure($0)) } + ) + } +} + +public extension ResultProtocol { + + // MARK: Higher-order functions + + /// Returns `self.value` if this result is a .Success, or the given value otherwise. Equivalent with `??` + public func recover(_ value: @autoclosure () -> Value) -> Value { + return self.value ?? value() + } + + /// Returns this result if it is a .Success, or the given result otherwise. Equivalent with `??` + public func recover(with result: @autoclosure () -> Self) -> Self { + return analysis( + ifSuccess: { _ in self }, + ifFailure: { _ in result() }) + } +} + +/// Protocol used to constrain `tryMap` to `Result`s with compatible `Error`s. +public protocol ErrorConvertible: Swift.Error { + static func error(from error: Swift.Error) -> Self +} + +public extension ResultProtocol where Error: ErrorConvertible { + + /// Returns the result of applying `transform` to `Success`es’ values, or wrapping thrown errors. + public func tryMap(_ transform: (Value) throws -> U) -> Result { + return flatMap { value in + do { + return .success(try transform(value)) + } + catch { + let convertedError = Error.error(from: error) + // Revisit this in a future version of Swift. https://twitter.com/jckarter/status/672931114944696321 + return .failure(convertedError) + } + } + } +} + +// MARK: - Operators + +infix operator &&& : LogicalConjunctionPrecedence + +/// Returns a Result with a tuple of `left` and `right` values if both are `Success`es, or re-wrapping the error of the earlier `Failure`. +@available(*, deprecated, renamed: "ResultProtocol.fanout(self:_:)") +public func &&& (left: L, right: @autoclosure () -> R) -> Result<(L.Value, R.Value), L.Error> + where L.Error == R.Error +{ + return left.fanout(right) +} + +precedencegroup ChainingPrecedence { + associativity: left + higherThan: TernaryPrecedence +} + +infix operator >>- : ChainingPrecedence + +/// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. +/// +/// This is a synonym for `flatMap`. +@available(*, deprecated, renamed: "ResultProtocol.flatMap(self:_:)") +public func >>- (result: T, transform: (T.Value) -> Result) -> Result { + return result.flatMap(transform) +} + +/// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal. +public func == (left: T, right: T) -> Bool + where T.Value: Equatable, T.Error: Equatable +{ + if let left = left.value, let right = right.value { + return left == right + } else if let left = left.error, let right = right.error { + return left == right + } + return false +} + +/// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values. +public func != (left: T, right: T) -> Bool + where T.Value: Equatable, T.Error: Equatable +{ + return !(left == right) +} + +/// Returns the value of `left` if it is a `Success`, or `right` otherwise. Short-circuits. +public func ?? (left: T, right: @autoclosure () -> T.Value) -> T.Value { + return left.recover(right()) +} + +/// Returns `left` if it is a `Success`es, or `right` otherwise. Short-circuits. +public func ?? (left: T, right: @autoclosure () -> T) -> T { + return left.recover(with: right()) +} + +// MARK: - migration support +@available(*, unavailable, renamed: "ResultProtocol") +public typealias ResultType = ResultProtocol + +@available(*, unavailable, renamed: "Error") +public typealias ResultErrorType = Swift.Error + +@available(*, unavailable, renamed: "ErrorConvertible") +public typealias ErrorTypeConvertible = ErrorConvertible + +@available(*, deprecated, renamed: "ErrorConvertible") +public protocol ErrorProtocolConvertible: ErrorConvertible {} + +extension ResultProtocol { + @available(*, unavailable, renamed: "recover(with:)") + public func recoverWith(_ result: @autoclosure () -> Self) -> Self { + fatalError() + } +} + +extension ErrorConvertible { + @available(*, unavailable, renamed: "error(from:)") + public static func errorFromErrorType(_ error: Swift.Error) -> Self { + fatalError() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/LICENSE.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/LICENSE.md new file mode 100644 index 0000000..d6765d9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/LICENSE.md @@ -0,0 +1,9 @@ +**The MIT License** +**Copyright © 2015 Krunoslav Zaher** +**All rights reserved.** + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Bag.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Bag.swift new file mode 100644 index 0000000..002c3a6 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Bag.swift @@ -0,0 +1,183 @@ +// +// Bag.swift +// Platform +// +// Created by Krunoslav Zaher on 2/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Swift + +let arrayDictionaryMaxSize = 30 + +struct BagKey { + /** + Unique identifier for object added to `Bag`. + + It's underlying type is UInt64. If we assume there in an idealized CPU that works at 4GHz, + it would take ~150 years of continuous running time for it to overflow. + */ + fileprivate let rawValue: UInt64 +} + +/** +Data structure that represents a bag of elements typed `T`. + +Single element can be stored multiple times. + +Time and space complexity of insertion an deletion is O(n). + +It is suitable for storing small number of elements. +*/ +struct Bag : CustomDebugStringConvertible { + /// Type of identifier for inserted elements. + typealias KeyType = BagKey + + typealias Entry = (key: BagKey, value: T) + + fileprivate var _nextKey: BagKey = BagKey(rawValue: 0) + + // data + + // first fill inline variables + var _key0: BagKey? = nil + var _value0: T? = nil + + // then fill "array dictionary" + var _pairs = ContiguousArray() + + // last is sparse dictionary + var _dictionary: [BagKey : T]? = nil + + var _onlyFastPath = true + + /// Creates new empty `Bag`. + init() { + } + + /** + Inserts `value` into bag. + + - parameter element: Element to insert. + - returns: Key that can be used to remove element from bag. + */ + mutating func insert(_ element: T) -> BagKey { + let key = _nextKey + + _nextKey = BagKey(rawValue: _nextKey.rawValue &+ 1) + + if _key0 == nil { + _key0 = key + _value0 = element + return key + } + + _onlyFastPath = false + + if _dictionary != nil { + _dictionary![key] = element + return key + } + + if _pairs.count < arrayDictionaryMaxSize { + _pairs.append((key: key, value: element)) + return key + } + + _dictionary = [key: element] + + return key + } + + /// - returns: Number of elements in bag. + var count: Int { + let dictionaryCount: Int = _dictionary?.count ?? 0 + return (_value0 != nil ? 1 : 0) + _pairs.count + dictionaryCount + } + + /// Removes all elements from bag and clears capacity. + mutating func removeAll() { + _key0 = nil + _value0 = nil + + _pairs.removeAll(keepingCapacity: false) + _dictionary?.removeAll(keepingCapacity: false) + } + + /** + Removes element with a specific `key` from bag. + + - parameter key: Key that identifies element to remove from bag. + - returns: Element that bag contained, or nil in case element was already removed. + */ + mutating func removeKey(_ key: BagKey) -> T? { + if _key0 == key { + _key0 = nil + let value = _value0! + _value0 = nil + return value + } + + if let existingObject = _dictionary?.removeValue(forKey: key) { + return existingObject + } + + for i in 0 ..< _pairs.count { + if _pairs[i].key == key { + let value = _pairs[i].value + _pairs.remove(at: i) + return value + } + } + + return nil + } +} + +extension Bag { + /// A textual representation of `self`, suitable for debugging. + var debugDescription : String { + return "\(self.count) elements in Bag" + } +} + +extension Bag { + /// Enumerates elements inside the bag. + /// + /// - parameter action: Enumeration closure. + func forEach(_ action: (T) -> Void) { + if _onlyFastPath { + if let value0 = _value0 { + action(value0) + } + return + } + + let value0 = _value0 + let dictionary = _dictionary + + if let value0 = value0 { + action(value0) + } + + for i in 0 ..< _pairs.count { + action(_pairs[i].value) + } + + if dictionary?.count ?? 0 > 0 { + for element in dictionary!.values { + action(element) + } + } + } +} + +extension BagKey: Hashable { + var hashValue: Int { + return rawValue.hashValue + } +} + +func ==(lhs: BagKey, rhs: BagKey) -> Bool { + return lhs.rawValue == rhs.rawValue +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/InfiniteSequence.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/InfiniteSequence.swift new file mode 100644 index 0000000..5a573a0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/InfiniteSequence.swift @@ -0,0 +1,26 @@ +// +// InfiniteSequence.swift +// Platform +// +// Created by Krunoslav Zaher on 6/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Sequence that repeats `repeatedValue` infinite number of times. +struct InfiniteSequence : Sequence { + typealias Element = E + typealias Iterator = AnyIterator + + private let _repeatedValue: E + + init(repeatedValue: E) { + _repeatedValue = repeatedValue + } + + func makeIterator() -> Iterator { + let repeatedValue = _repeatedValue + return AnyIterator { + return repeatedValue + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/PriorityQueue.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/PriorityQueue.swift new file mode 100644 index 0000000..9b2c370 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/PriorityQueue.swift @@ -0,0 +1,123 @@ +// +// PriorityQueue.swift +// Platform +// +// Created by Krunoslav Zaher on 12/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +struct PriorityQueue { + private let _hasHigherPriority: (Element, Element) -> Bool + private let _isEqual: (Element, Element) -> Bool + + fileprivate var _elements = [Element]() + + init(hasHigherPriority: @escaping (Element, Element) -> Bool, isEqual: @escaping (Element, Element) -> Bool) { + _hasHigherPriority = hasHigherPriority + _isEqual = isEqual + } + + mutating func enqueue(_ element: Element) { + _elements.append(element) + bubbleToHigherPriority(_elements.count - 1) + } + + func peek() -> Element? { + return _elements.first + } + + var isEmpty: Bool { + return _elements.count == 0 + } + + mutating func dequeue() -> Element? { + guard let front = peek() else { + return nil + } + + removeAt(0) + + return front + } + + mutating func remove(_ element: Element) { + for i in 0 ..< _elements.count { + if _isEqual(_elements[i], element) { + removeAt(i) + return + } + } + } + + private mutating func removeAt(_ index: Int) { + let removingLast = index == _elements.count - 1 + if !removingLast { + #if swift(>=3.2) + _elements.swapAt(index, _elements.count - 1) + #else + swap(&_elements[index], &_elements[_elements.count - 1]) + #endif + } + + _ = _elements.popLast() + + if !removingLast { + bubbleToHigherPriority(index) + bubbleToLowerPriority(index) + } + } + + private mutating func bubbleToHigherPriority(_ initialUnbalancedIndex: Int) { + precondition(initialUnbalancedIndex >= 0) + precondition(initialUnbalancedIndex < _elements.count) + + var unbalancedIndex = initialUnbalancedIndex + + while unbalancedIndex > 0 { + let parentIndex = (unbalancedIndex - 1) / 2 + guard _hasHigherPriority(_elements[unbalancedIndex], _elements[parentIndex]) else { break } + #if swift(>=3.2) + _elements.swapAt(unbalancedIndex, parentIndex) + #else + swap(&_elements[unbalancedIndex], &_elements[parentIndex]) + #endif + unbalancedIndex = parentIndex + } + } + + private mutating func bubbleToLowerPriority(_ initialUnbalancedIndex: Int) { + precondition(initialUnbalancedIndex >= 0) + precondition(initialUnbalancedIndex < _elements.count) + + var unbalancedIndex = initialUnbalancedIndex + while true { + let leftChildIndex = unbalancedIndex * 2 + 1 + let rightChildIndex = unbalancedIndex * 2 + 2 + + var highestPriorityIndex = unbalancedIndex + + if leftChildIndex < _elements.count && _hasHigherPriority(_elements[leftChildIndex], _elements[highestPriorityIndex]) { + highestPriorityIndex = leftChildIndex + } + + if rightChildIndex < _elements.count && _hasHigherPriority(_elements[rightChildIndex], _elements[highestPriorityIndex]) { + highestPriorityIndex = rightChildIndex + } + + guard highestPriorityIndex != unbalancedIndex else { break } + + #if swift(>=3.2) + _elements.swapAt(highestPriorityIndex, unbalancedIndex) + #else + swap(&_elements[highestPriorityIndex], &_elements[unbalancedIndex]) + #endif + unbalancedIndex = highestPriorityIndex + } + } +} + +extension PriorityQueue : CustomDebugStringConvertible { + var debugDescription: String { + return _elements.debugDescription + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Queue.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Queue.swift new file mode 100644 index 0000000..d05726c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DataStructures/Queue.swift @@ -0,0 +1,152 @@ +// +// Queue.swift +// Platform +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/** +Data structure that represents queue. + +Complexity of `enqueue`, `dequeue` is O(1) when number of operations is +averaged over N operations. + +Complexity of `peek` is O(1). +*/ +struct Queue: Sequence { + /// Type of generator. + typealias Generator = AnyIterator + + private let _resizeFactor = 2 + + private var _storage: ContiguousArray + private var _count = 0 + private var _pushNextIndex = 0 + private let _initialCapacity: Int + + /** + Creates new queue. + + - parameter capacity: Capacity of newly created queue. + */ + init(capacity: Int) { + _initialCapacity = capacity + + _storage = ContiguousArray(repeating: nil, count: capacity) + } + + private var dequeueIndex: Int { + let index = _pushNextIndex - count + return index < 0 ? index + _storage.count : index + } + + /// - returns: Is queue empty. + var isEmpty: Bool { + return count == 0 + } + + /// - returns: Number of elements inside queue. + var count: Int { + return _count + } + + /// - returns: Element in front of a list of elements to `dequeue`. + func peek() -> T { + precondition(count > 0) + + return _storage[dequeueIndex]! + } + + mutating private func resizeTo(_ size: Int) { + var newStorage = ContiguousArray(repeating: nil, count: size) + + let count = _count + + let dequeueIndex = self.dequeueIndex + let spaceToEndOfQueue = _storage.count - dequeueIndex + + // first batch is from dequeue index to end of array + let countElementsInFirstBatch = Swift.min(count, spaceToEndOfQueue) + // second batch is wrapped from start of array to end of queue + let numberOfElementsInSecondBatch = count - countElementsInFirstBatch + + newStorage[0 ..< countElementsInFirstBatch] = _storage[dequeueIndex ..< (dequeueIndex + countElementsInFirstBatch)] + newStorage[countElementsInFirstBatch ..< (countElementsInFirstBatch + numberOfElementsInSecondBatch)] = _storage[0 ..< numberOfElementsInSecondBatch] + + _count = count + _pushNextIndex = count + _storage = newStorage + } + + /// Enqueues `element`. + /// + /// - parameter element: Element to enqueue. + mutating func enqueue(_ element: T) { + if count == _storage.count { + resizeTo(Swift.max(_storage.count, 1) * _resizeFactor) + } + + _storage[_pushNextIndex] = element + _pushNextIndex += 1 + _count += 1 + + if _pushNextIndex >= _storage.count { + _pushNextIndex -= _storage.count + } + } + + private mutating func dequeueElementOnly() -> T { + precondition(count > 0) + + let index = dequeueIndex + + defer { + _storage[index] = nil + _count -= 1 + } + + return _storage[index]! + } + + /// Dequeues element or throws an exception in case queue is empty. + /// + /// - returns: Dequeued element. + mutating func dequeue() -> T? { + if self.count == 0 { + return nil + } + + defer { + let downsizeLimit = _storage.count / (_resizeFactor * _resizeFactor) + if _count < downsizeLimit && downsizeLimit >= _initialCapacity { + resizeTo(_storage.count / _resizeFactor) + } + } + + return dequeueElementOnly() + } + + /// - returns: Generator of contained elements. + func makeIterator() -> AnyIterator { + var i = dequeueIndex + var count = _count + + return AnyIterator { + if count == 0 { + return nil + } + + defer { + count -= 1 + i += 1 + } + + if i >= self._storage.count { + i -= self._storage.count + } + + return self._storage[i] + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DeprecationWarner.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DeprecationWarner.swift new file mode 100644 index 0000000..863636b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DeprecationWarner.swift @@ -0,0 +1,43 @@ +// +// DeprecationWarner.swift +// Platform +// +// Created by Shai Mishali on 1/9/18. +// Copyright © 2018 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if DEBUG + class DeprecationWarner { + private static var warned = Set() + private static var _lock = NSRecursiveLock() + + static func warnIfNeeded(_ kind: Kind) { + _lock.lock(); defer { _lock.unlock() } + guard !warned.contains(kind) else { return } + + warned.insert(kind) + print("ℹ️ [DEPRECATED] \(kind.message)") + } + } + + extension DeprecationWarner { + enum Kind { + case variable + case globalTestFunctionNext + case globalTestFunctionError + case globalTestFunctionCompleted + + var message: String { + switch self { + case .variable: return "`Variable` is planned for future deprecation. Please consider `BehaviorRelay` as a replacement. Read more at: https://git.io/vNqvx" + case .globalTestFunctionNext: return "The `next()` global function is planned for future deprecation. Please use `Recorded.next()` instead." + case .globalTestFunctionError: return "The `error()` global function is planned for future deprecation. Please use `Recorded.error()` instead." + case .globalTestFunctionCompleted: return "The `completed()` global function is planned for future deprecation. Please use `Recorded.completed()` instead." + } + } + } + } +#endif + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DispatchQueue+Extensions.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DispatchQueue+Extensions.swift new file mode 100644 index 0000000..552314a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/DispatchQueue+Extensions.swift @@ -0,0 +1,21 @@ +// +// DispatchQueue+Extensions.swift +// Platform +// +// Created by Krunoslav Zaher on 10/22/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Dispatch + +extension DispatchQueue { + private static var token: DispatchSpecificKey<()> = { + let key = DispatchSpecificKey<()>() + DispatchQueue.main.setSpecific(key: key, value: ()) + return key + }() + + static var isMain: Bool { + return DispatchQueue.getSpecific(key: token) != nil + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Darwin.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Darwin.swift new file mode 100644 index 0000000..d9e744f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Darwin.swift @@ -0,0 +1,66 @@ +// +// Platform.Darwin.swift +// Platform +// +// Created by Krunoslav Zaher on 12/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + + import Darwin + import class Foundation.Thread + import func Foundation.OSAtomicCompareAndSwap32Barrier + import func Foundation.OSAtomicIncrement32Barrier + import func Foundation.OSAtomicDecrement32Barrier + import protocol Foundation.NSCopying + + typealias AtomicInt = Int32 + + fileprivate func castToUInt32Pointer(_ pointer: UnsafeMutablePointer) -> UnsafeMutablePointer { + let raw = UnsafeMutableRawPointer(pointer) + return raw.assumingMemoryBound(to: UInt32.self) + } + + let AtomicCompareAndSwap = OSAtomicCompareAndSwap32Barrier + let AtomicIncrement = OSAtomicIncrement32Barrier + let AtomicDecrement = OSAtomicDecrement32Barrier + func AtomicOr(_ mask: UInt32, _ theValue : UnsafeMutablePointer) -> Int32 { + return OSAtomicOr32OrigBarrier(mask, castToUInt32Pointer(theValue)) + } + func AtomicFlagSet(_ mask: UInt32, _ theValue : UnsafeMutablePointer) -> Bool { + // just used to create a barrier + OSAtomicXor32OrigBarrier(0, castToUInt32Pointer(theValue)) + return (theValue.pointee & Int32(mask)) != 0 + } + + extension Thread { + + static func setThreadLocalStorageValue(_ value: T?, forKey key: NSCopying + ) { + let currentThread = Thread.current + let threadDictionary = currentThread.threadDictionary + + if let newValue = value { + threadDictionary[key] = newValue + } + else { + threadDictionary[key] = nil + } + + } + static func getThreadLocalStorageValueForKey(_ key: NSCopying) -> T? { + let currentThread = Thread.current + let threadDictionary = currentThread.threadDictionary + + return threadDictionary[key] as? T + } + } + + extension AtomicInt { + func valueSnapshot() -> Int32 { + return self + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Linux.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Linux.swift new file mode 100644 index 0000000..5cd07e2 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/Platform.Linux.swift @@ -0,0 +1,105 @@ +// +// Platform.Linux.swift +// Platform +// +// Created by Krunoslav Zaher on 12/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(Linux) + + import XCTest + import Glibc + import SwiftShims + import class Foundation.Thread + + final class AtomicInt { + typealias IntegerLiteralType = Int + fileprivate var value: Int32 = 0 + fileprivate var _lock = RecursiveLock() + + func lock() { + _lock.lock() + } + func unlock() { + _lock.unlock() + } + + func valueSnapshot() -> Int32 { + return value + } + } + + extension AtomicInt: ExpressibleByIntegerLiteral { + convenience init(integerLiteral value: Int) { + self.init() + self.value = Int32(value) + } + } + + func >(lhs: AtomicInt, rhs: Int32) -> Bool { + return lhs.value > rhs + } + func ==(lhs: AtomicInt, rhs: Int32) -> Bool { + return lhs.value == rhs + } + + func AtomicFlagSet(_ mask: UInt32, _ atomic: inout AtomicInt) -> Bool { + atomic.lock(); defer { atomic.unlock() } + return (atomic.value & Int32(mask)) != 0 + } + + func AtomicOr(_ mask: UInt32, _ atomic: inout AtomicInt) -> Int32 { + atomic.lock(); defer { atomic.unlock() } + let value = atomic.value + atomic.value |= Int32(mask) + return value + } + + func AtomicIncrement(_ atomic: inout AtomicInt) -> Int32 { + atomic.lock(); defer { atomic.unlock() } + atomic.value += 1 + return atomic.value + } + + func AtomicDecrement(_ atomic: inout AtomicInt) -> Int32 { + atomic.lock(); defer { atomic.unlock() } + atomic.value -= 1 + return atomic.value + } + + func AtomicCompareAndSwap(_ l: Int32, _ r: Int32, _ atomic: inout AtomicInt) -> Bool { + atomic.lock(); defer { atomic.unlock() } + if atomic.value == l { + atomic.value = r + return true + } + + return false + } + + extension Thread { + + static func setThreadLocalStorageValue(_ value: T?, forKey key: String) { + let currentThread = Thread.current + var threadDictionary = currentThread.threadDictionary + + if let newValue = value { + threadDictionary[key] = newValue + } + else { + threadDictionary[key] = nil + } + + currentThread.threadDictionary = threadDictionary + } + + static func getThreadLocalStorageValueForKey(_ key: String) -> T? { + let currentThread = Thread.current + let threadDictionary = currentThread.threadDictionary + + return threadDictionary[key] as? T + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/RecursiveLock.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/RecursiveLock.swift new file mode 100644 index 0000000..c03471d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/Platform/RecursiveLock.swift @@ -0,0 +1,34 @@ +// +// RecursiveLock.swift +// Platform +// +// Created by Krunoslav Zaher on 12/18/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.NSRecursiveLock + +#if TRACE_RESOURCES + class RecursiveLock: NSRecursiveLock { + override init() { + _ = Resources.incrementTotal() + super.init() + } + + override func lock() { + super.lock() + _ = Resources.incrementTotal() + } + + override func unlock() { + super.unlock() + _ = Resources.decrementTotal() + } + + deinit { + _ = Resources.decrementTotal() + } + } +#else + typealias RecursiveLock = NSRecursiveLock +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/README.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/README.md new file mode 100644 index 0000000..a423675 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/README.md @@ -0,0 +1,217 @@ +Miss Electric Eel 2016 RxSwift: ReactiveX for Swift +====================================== + +[![Travis CI](https://travis-ci.org/ReactiveX/RxSwift.svg?branch=master)](https://travis-ci.org/ReactiveX/RxSwift) ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg) ![pod](https://img.shields.io/cocoapods/v/RxSwift.svg) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) + +* RxSwift 3.x / Swift 3.x can be found in [**rxswift-3.0** branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-3.0). + +Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable` interface. + +This is a Swift version of [Rx](https://github.com/Reactive-Extensions/Rx.NET). + +It tries to port as many concepts from the original version as possible, but some concepts were adapted for more pleasant and performant integration with iOS/macOS environment. + +Cross platform documentation can be found on [ReactiveX.io](http://reactivex.io/). + +Like the original Rx, its intention is to enable easy composition of asynchronous operations and event/data streams. + +KVO observing, async operations and streams are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful. + +## I came here because I want to ... + +###### ... understand + +* [why use rx?](Documentation/Why.md) +* [the basics, getting started with RxSwift](Documentation/GettingStarted.md) +* [traits](Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, `ControlProperty`, and `Variable` ... and why do they exist? +* [testing](Documentation/UnitTests.md) +* [tips and common errors](Documentation/Tips.md) +* [debugging](Documentation/GettingStarted.md#debugging) +* [the math behind Rx](Documentation/MathBehindRx.md) +* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md) + +###### ... install + +* Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation) + +###### ... hack around + +* with the example app. [Running Example App](Documentation/ExampleApp.md) +* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md) + +###### ... interact + +* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences.
[![Slack channel](http://rxswift-slack.herokuapp.com/badge.svg)](http://bit.ly/rxslack) [Join Slack Channel](http://bit.ly/rxslack) +* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md) +* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md) +* Help out [Check out contribution guide](CONTRIBUTING.md) + +###### ... compare + +* [with other libraries](Documentation/ComparisonWithOtherLibraries.md). + + +###### ... find compatible + +* libraries from [RxSwiftCommunity](https://github.com/RxSwiftCommunity). +* [Pods using RxSwift](https://cocoapods.org/?q=uses%3Arxswift). + +###### ... see the broader vision + +* Does this exist for Android? [RxJava](https://github.com/ReactiveX/RxJava) +* Where is all of this going, what is the future, what about reactive architectures, how do you design entire apps this way? [Cycle.js](https://github.com/cyclejs/cycle-core) - this is javascript, but [RxJS](https://github.com/Reactive-Extensions/RxJS) is javascript version of Rx. + +## Usage + + + + + + + + + + + + + + + + + + + +
Here's an exampleIn Action
Define search for GitHub repositories ...
+let searchResults = searchBar.rx.text.orEmpty
+    .throttle(0.3, scheduler: MainScheduler.instance)
+    .distinctUntilChanged()
+    .flatMapLatest { query -> Observable<[Repository]> in
+        if query.isEmpty {
+            return .just([])
+        }
+        return searchGitHub(query)
+            .catchErrorJustReturn([])
+    }
+    .observeOn(MainScheduler.instance)
... then bind the results to your tableview
+searchResults
+    .bind(to: tableView.rx.items(cellIdentifier: "Cell")) {
+        (index, repository: Repository, cell) in
+        cell.textLabel?.text = repository.name
+        cell.detailTextLabel?.text = repository.url
+    }
+    .disposed(by: disposeBag)
+ + +## Requirements + +* Xcode 9.0 +* Swift 4.0 +* Swift 3.x ([use `rxswift-3.0` branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-3.0) instead) +* Swift 2.3 ([use `rxswift-2.0` branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-2.0) instead) + +## Installation + +Rx doesn't contain any external dependencies. + +These are currently the supported options: + +### Manual + +Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app + +### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) + +**Tested with `pod --version`: `1.3.1`** + +```ruby +# Podfile +use_frameworks! + +target 'YOUR_TARGET_NAME' do + pod 'RxSwift', '~> 4.0' + pod 'RxCocoa', '~> 4.0' +end + +# RxTests and RxBlocking make the most sense in the context of unit/integration tests +target 'YOUR_TESTING_TARGET' do + pod 'RxBlocking', '~> 4.0' + pod 'RxTest', '~> 4.0' +end +``` + +Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type: + +```bash +$ pod install +``` + +### [Carthage](https://github.com/Carthage/Carthage) + +**Tested with `carthage version`: `0.26.2`** + +Add this to `Cartfile` + +``` +github "ReactiveX/RxSwift" ~> 4.0 +``` + +```bash +$ carthage update +``` + +### [Swift Package Manager](https://github.com/apple/swift-package-manager) + +**Tested with `swift build --version`: `Swift 4.0.0-dev (swiftpm-13126)`** + +Create a `Package.swift` file. + +```swift +// swift-tools-version:4.0 + +import PackageDescription + +let package = Package( + name: "RxTestProject", + dependencies: [ + .package(url: "https://github.com/ReactiveX/RxSwift.git", "4.0.0" ..< "5.0.0") + ], + targets: [ + .target(name: "RxTestProject", dependencies: ["RxSwift", "RxCocoa"]) + ] +) +``` + +```bash +$ swift build +``` + +To build or test a module with RxTest dependency, set `TEST=1`. ([RxSwift >= 3.4.2](https://github.com/ReactiveX/RxSwift/releases/tag/3.4.2)) + +```bash +$ TEST=1 swift test +``` + +### Manually using git submodules + +* Add RxSwift as a submodule + +```bash +$ git submodule add git@github.com:ReactiveX/RxSwift.git +``` + +* Drag `Rx.xcodeproj` into Project Navigator +* Go to `Project > Targets > Build Phases > Link Binary With Libraries`, click `+` and select `RxSwift-[Platform]` and `RxCocoa-[Platform]` targets + + +## References + +* [http://reactivex.io/](http://reactivex.io/) +* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions) +* [RxSwift RayWenderlich.com Book](https://store.raywenderlich.com/products/rxswift) +* [Boxue.io RxSwift Online Course](https://boxueio.com/series/rxswift-101) (Chinese 🇨🇳) +* [Erik Meijer (Wikipedia)](http://en.wikipedia.org/wiki/Erik_Meijer_%28computer_scientist%29) +* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY) +* [Reactive Programming Overview (Jafar Husain from Netflix)](https://www.youtube.com/watch?v=dwP1TNXE6fc) +* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf) +* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/) +* [Haskell](https://www.haskell.org/) diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Binder.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Binder.swift new file mode 100644 index 0000000..129af56 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Binder.swift @@ -0,0 +1,61 @@ +// +// Binder.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/17/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/** + Observer that enforces interface binding rules: + * can't bind errors (in debug builds binding of errors causes `fatalError` in release builds errors are being logged) + * ensures binding is performed on a specific scheduler + + `Binder` doesn't retain target and in case target is released, element isn't bound. + + By default it binds elements on main scheduler. + */ +public struct Binder: ObserverType { + public typealias E = Value + + private let _binding: (Event) -> () + + /// Initializes `Binder` + /// + /// - parameter target: Target object. + /// - parameter scheduler: Scheduler used to bind the events. + /// - parameter binding: Binding logic. + public init(_ target: Target, scheduler: ImmediateSchedulerType = MainScheduler(), binding: @escaping (Target, Value) -> ()) { + weak var weakTarget = target + + _binding = { event in + switch event { + case .next(let element): + _ = scheduler.schedule(element) { element in + if let target = weakTarget { + binding(target, element) + } + return Disposables.create() + } + case .error(let error): + bindingError(error) + case .completed: + break + } + } + } + + /// Binds next element to owner view as described in `binding`. + public func on(_ event: Event) { + _binding(event) + } + + /// Erases type of observer. + /// + /// - returns: type erased observer. + public func asObserver() -> AnyObserver { + return AnyObserver(eventHandler: on) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/ControlTarget.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/ControlTarget.swift new file mode 100644 index 0000000..24ace8e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/ControlTarget.swift @@ -0,0 +1,89 @@ +// +// ControlTarget.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) || os(macOS) + +import RxSwift + +#if os(iOS) || os(tvOS) + import UIKit + + typealias Control = UIKit.UIControl + typealias ControlEvents = UIKit.UIControlEvents +#elseif os(macOS) + import Cocoa + + typealias Control = Cocoa.NSControl +#endif + +// This should be only used from `MainScheduler` +final class ControlTarget: RxTarget { + typealias Callback = (Control) -> Void + + let selector: Selector = #selector(ControlTarget.eventHandler(_:)) + + weak var control: Control? +#if os(iOS) || os(tvOS) + let controlEvents: UIControlEvents +#endif + var callback: Callback? + #if os(iOS) || os(tvOS) + init(control: Control, controlEvents: UIControlEvents, callback: @escaping Callback) { + MainScheduler.ensureExecutingOnScheduler() + + self.control = control + self.controlEvents = controlEvents + self.callback = callback + + super.init() + + control.addTarget(self, action: selector, for: controlEvents) + + let method = self.method(for: selector) + if method == nil { + rxFatalError("Can't find method") + } + } +#elseif os(macOS) + init(control: Control, callback: @escaping Callback) { + MainScheduler.ensureExecutingOnScheduler() + + self.control = control + self.callback = callback + + super.init() + + control.target = self + control.action = selector + + let method = self.method(for: selector) + if method == nil { + rxFatalError("Can't find method") + } + } +#endif + + @objc func eventHandler(_ sender: Control!) { + if let callback = self.callback, let control = self.control { + callback(control) + } + } + + override func dispose() { + super.dispose() +#if os(iOS) || os(tvOS) + self.control?.removeTarget(self, action: self.selector, for: self.controlEvents) +#elseif os(macOS) + self.control?.target = nil + self.control?.action = nil +#endif + self.callback = nil + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift new file mode 100644 index 0000000..979a67e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift @@ -0,0 +1,293 @@ +// +// DelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if !os(Linux) + + import RxSwift + #if SWIFT_PACKAGE && !os(Linux) + import RxCocoaRuntime + #endif + + /// Base class for `DelegateProxyType` protocol. + /// + /// This implementation is not thread safe and can be used only from one thread (Main thread). + open class DelegateProxy: _RXDelegateProxy { + public typealias ParentObject = P + public typealias Delegate = D + + private var _sentMessageForSelector = [Selector: MessageDispatcher]() + private var _methodInvokedForSelector = [Selector: MessageDispatcher]() + + /// Parent object associated with delegate proxy. + private weak private(set) var _parentObject: ParentObject? + + fileprivate let _currentDelegateFor: (ParentObject) -> AnyObject? + fileprivate let _setCurrentDelegateTo: (AnyObject?, ParentObject) -> () + + /// Initializes new instance. + /// + /// - parameter parentObject: Optional parent object that owns `DelegateProxy` as associated object. + public init(parentObject: ParentObject, delegateProxy: Proxy.Type) + where Proxy: DelegateProxy, Proxy.ParentObject == ParentObject, Proxy.Delegate == Delegate { + self._parentObject = parentObject + self._currentDelegateFor = delegateProxy._currentDelegate + self._setCurrentDelegateTo = delegateProxy._setCurrentDelegate + + MainScheduler.ensureExecutingOnScheduler() + #if TRACE_RESOURCES + _ = Resources.incrementTotal() + #endif + super.init() + } + + /** + Returns observable sequence of invocations of delegate methods. Elements are sent *before method is invoked*. + + Only methods that have `void` return value can be observed using this method because + those methods are used as a notification mechanism. It doesn't matter if they are optional + or not. Observing is performed by installing a hidden associated `PublishSubject` that is + used to dispatch messages to observers. + + Delegate methods that have non `void` return value can't be observed directly using this method + because: + * those methods are not intended to be used as a notification mechanism, but as a behavior customization mechanism + * there is no sensible automatic way to determine a default return value + + In case observing of delegate methods that have return type is required, it can be done by + manually installing a `PublishSubject` or `BehaviorSubject` and implementing delegate method. + + e.g. + + // delegate proxy part (RxScrollViewDelegateProxy) + + let internalSubject = PublishSubject + + public func requiredDelegateMethod(scrollView: UIScrollView, arg1: CGPoint) -> Bool { + internalSubject.on(.next(arg1)) + return self._forwardToDelegate?.requiredDelegateMethod?(scrollView, arg1: arg1) ?? defaultReturnValue + } + + .... + + // reactive property implementation in a real class (`UIScrollView`) + public var property: Observable { + let proxy = RxScrollViewDelegateProxy.proxy(for: base) + return proxy.internalSubject.asObservable() + } + + **In case calling this method prints "Delegate proxy is already implementing `\(selector)`, + a more performant way of registering might exist.", that means that manual observing method + is required analog to the example above because delegate method has already been implemented.** + + - parameter selector: Selector used to filter observed invocations of delegate methods. + - returns: Observable sequence of arguments passed to `selector` method. + */ + open func sentMessage(_ selector: Selector) -> Observable<[Any]> { + MainScheduler.ensureExecutingOnScheduler() + + let subject = _sentMessageForSelector[selector] + + if let subject = subject { + return subject.asObservable() + } + else { + let subject = MessageDispatcher(selector: selector, delegateProxy: self) + _sentMessageForSelector[selector] = subject + return subject.asObservable() + } + } + + /** + Returns observable sequence of invoked delegate methods. Elements are sent *after method is invoked*. + + Only methods that have `void` return value can be observed using this method because + those methods are used as a notification mechanism. It doesn't matter if they are optional + or not. Observing is performed by installing a hidden associated `PublishSubject` that is + used to dispatch messages to observers. + + Delegate methods that have non `void` return value can't be observed directly using this method + because: + * those methods are not intended to be used as a notification mechanism, but as a behavior customization mechanism + * there is no sensible automatic way to determine a default return value + + In case observing of delegate methods that have return type is required, it can be done by + manually installing a `PublishSubject` or `BehaviorSubject` and implementing delegate method. + + e.g. + + // delegate proxy part (RxScrollViewDelegateProxy) + + let internalSubject = PublishSubject + + public func requiredDelegateMethod(scrollView: UIScrollView, arg1: CGPoint) -> Bool { + internalSubject.on(.next(arg1)) + return self._forwardToDelegate?.requiredDelegateMethod?(scrollView, arg1: arg1) ?? defaultReturnValue + } + + .... + + // reactive property implementation in a real class (`UIScrollView`) + public var property: Observable { + let proxy = RxScrollViewDelegateProxy.proxy(for: base) + return proxy.internalSubject.asObservable() + } + + **In case calling this method prints "Delegate proxy is already implementing `\(selector)`, + a more performant way of registering might exist.", that means that manual observing method + is required analog to the example above because delegate method has already been implemented.** + + - parameter selector: Selector used to filter observed invocations of delegate methods. + - returns: Observable sequence of arguments passed to `selector` method. + */ + open func methodInvoked(_ selector: Selector) -> Observable<[Any]> { + MainScheduler.ensureExecutingOnScheduler() + + let subject = _methodInvokedForSelector[selector] + + if let subject = subject { + return subject.asObservable() + } + else { + let subject = MessageDispatcher(selector: selector, delegateProxy: self) + _methodInvokedForSelector[selector] = subject + return subject.asObservable() + } + } + + fileprivate func checkSelectorIsObservable(_ selector: Selector) { + MainScheduler.ensureExecutingOnScheduler() + + if hasWiredImplementation(for: selector) { + print("⚠️ Delegate proxy is already implementing `\(selector)`, a more performant way of registering might exist.") + return + } + + if voidDelegateMethodsContain(selector) { + return + } + + // In case `_forwardToDelegate` is `nil`, it is assumed the check is being done prematurely. + if !(self._forwardToDelegate?.responds(to: selector) ?? true) { + print("⚠️ Using delegate proxy dynamic interception method but the target delegate object doesn't respond to the requested selector. " + + "In case pure Swift delegate proxy is being used please use manual observing method by using`PublishSubject`s. " + + " (selector: `\(selector)`, forwardToDelegate: `\(_forwardToDelegate ?? self)`)") + } + } + + // proxy + + open override func _sentMessage(_ selector: Selector, withArguments arguments: [Any]) { + _sentMessageForSelector[selector]?.on(.next(arguments)) + } + + open override func _methodInvoked(_ selector: Selector, withArguments arguments: [Any]) { + _methodInvokedForSelector[selector]?.on(.next(arguments)) + } + + /// Returns reference of normal delegate that receives all forwarded messages + /// through `self`. + /// + /// - returns: Value of reference if set or nil. + open func forwardToDelegate() -> Delegate? { + return castOptionalOrFatalError(self._forwardToDelegate) + } + + /// Sets reference of normal delegate that receives all forwarded messages + /// through `self`. + /// + /// - parameter forwardToDelegate: Reference of delegate that receives all messages through `self`. + /// - parameter retainDelegate: Should `self` retain `forwardToDelegate`. + open func setForwardToDelegate(_ delegate: Delegate?, retainDelegate: Bool) { + #if DEBUG // 4.0 all configurations + MainScheduler.ensureExecutingOnScheduler() + #endif + self._setForwardToDelegate(delegate, retainDelegate: retainDelegate) + + let sentSelectors: [Selector] = self._sentMessageForSelector.values.filter { $0.hasObservers }.map { $0.selector } + let invokedSelectors: [Selector] = self._methodInvokedForSelector.values.filter { $0.hasObservers }.map { $0.selector } + let allUsedSelectors = sentSelectors + invokedSelectors + + for selector in Set(allUsedSelectors) { + checkSelectorIsObservable(selector) + } + + self.reset() + } + + private func hasObservers(selector: Selector) -> Bool { + return (_sentMessageForSelector[selector]?.hasObservers ?? false) + || (_methodInvokedForSelector[selector]?.hasObservers ?? false) + } + + override open func responds(to aSelector: Selector!) -> Bool { + return super.responds(to: aSelector) + || (self._forwardToDelegate?.responds(to: aSelector) ?? false) + || (self.voidDelegateMethodsContain(aSelector) && self.hasObservers(selector: aSelector)) + } + + fileprivate func reset() { + guard let parentObject = self._parentObject else { return } + + let maybeCurrentDelegate = _currentDelegateFor(parentObject) + + if maybeCurrentDelegate === self { + _setCurrentDelegateTo(nil, parentObject) + _setCurrentDelegateTo(castOrFatalError(self), parentObject) + } + } + + deinit { + for v in _sentMessageForSelector.values { + v.on(.completed) + } + for v in _methodInvokedForSelector.values { + v.on(.completed) + } + #if TRACE_RESOURCES + _ = Resources.decrementTotal() + #endif + } + + + } + + fileprivate let mainScheduler = MainScheduler() + + fileprivate final class MessageDispatcher { + private let dispatcher: PublishSubject<[Any]> + private let result: Observable<[Any]> + + fileprivate let selector: Selector + + init(selector: Selector, delegateProxy _delegateProxy: DelegateProxy) { + weak var weakDelegateProxy = _delegateProxy + + let dispatcher = PublishSubject<[Any]>() + self.dispatcher = dispatcher + self.selector = selector + + self.result = dispatcher + .do(onSubscribed: { weakDelegateProxy?.checkSelectorIsObservable(selector); weakDelegateProxy?.reset() }, onDispose: { weakDelegateProxy?.reset() }) + .share() + .subscribeOn(mainScheduler) + } + + var on: (Event<[Any]>) -> () { + return self.dispatcher.on + } + + var hasObservers: Bool { + return self.dispatcher.hasObservers + } + + func asObservable() -> Observable<[Any]> { + return self.result + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift new file mode 100644 index 0000000..51a0d56 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift @@ -0,0 +1,408 @@ +// +// DelegateProxyType.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if !os(Linux) + + import func Foundation.objc_getAssociatedObject + import func Foundation.objc_setAssociatedObject + + import RxSwift + +/** +`DelegateProxyType` protocol enables using both normal delegates and Rx observable sequences with +views that can have only one delegate/datasource registered. + +`Proxies` store information about observers, subscriptions and delegates +for specific views. + +Type implementing `DelegateProxyType` should never be initialized directly. + +To fetch initialized instance of type implementing `DelegateProxyType`, `proxy` method +should be used. + +This is more or less how it works. + + + + +-------------------------------------------+ + | | + | UIView subclass (UIScrollView) | + | | + +-----------+-------------------------------+ + | + | Delegate + | + | + +-----------v-------------------------------+ + | | + | Delegate proxy : DelegateProxyType +-----+----> Observable + | , UIScrollViewDelegate | | + +-----------+-------------------------------+ +----> Observable + | | + | +----> Observable + | | + | forwards events | + | to custom delegate | + | v + +-----------v-------------------------------+ + | | + | Custom delegate (UIScrollViewDelegate) | + | | + +-------------------------------------------+ + + +Since RxCocoa needs to automagically create those Proxys and because views that have delegates can be hierarchical + + UITableView : UIScrollView : UIView + +.. and corresponding delegates are also hierarchical + + UITableViewDelegate : UIScrollViewDelegate : NSObject + +... this mechanism can be extended by using the following snippet in `registerKnownImplementations` or in some other + part of your app that executes before using `rx.*` (e.g. appDidFinishLaunching). + + RxScrollViewDelegateProxy.register { RxTableViewDelegateProxy(parentObject: $0) } + +*/ +public protocol DelegateProxyType: class { + associatedtype ParentObject: AnyObject + associatedtype Delegate + + /// It is require that enumerate call `register` of the extended DelegateProxy subclasses here. + static func registerKnownImplementations() + + /// Unique identifier for delegate + static var identifier: UnsafeRawPointer { get } + + /// Returns designated delegate property for object. + /// + /// Objects can have multiple delegate properties. + /// + /// Each delegate property needs to have it's own type implementing `DelegateProxyType`. + /// + /// It's abstract method. + /// + /// - parameter object: Object that has delegate property. + /// - returns: Value of delegate property. + static func currentDelegate(for object: ParentObject) -> Delegate? + + /// Sets designated delegate property for object. + /// + /// Objects can have multiple delegate properties. + /// + /// Each delegate property needs to have it's own type implementing `DelegateProxyType`. + /// + /// It's abstract method. + /// + /// - parameter toObject: Object that has delegate property. + /// - parameter delegate: Delegate value. + static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) + + /// Returns reference of normal delegate that receives all forwarded messages + /// through `self`. + /// + /// - returns: Value of reference if set or nil. + func forwardToDelegate() -> Delegate? + + /// Sets reference of normal delegate that receives all forwarded messages + /// through `self`. + /// + /// - parameter forwardToDelegate: Reference of delegate that receives all messages through `self`. + /// - parameter retainDelegate: Should `self` retain `forwardToDelegate`. + func setForwardToDelegate(_ forwardToDelegate: Delegate?, retainDelegate: Bool) +} + +// default implementations +extension DelegateProxyType { + /// Unique identifier for delegate + public static var identifier: UnsafeRawPointer { + let delegateIdentifier = ObjectIdentifier(Delegate.self) + let integerIdentifier = Int(bitPattern: delegateIdentifier) + return UnsafeRawPointer(bitPattern: integerIdentifier)! + } +} + +// workaround of Delegate: class +extension DelegateProxyType { + static func _currentDelegate(for object: ParentObject) -> AnyObject? { + return currentDelegate(for: object).map { $0 as AnyObject } + } + + static func _setCurrentDelegate(_ delegate: AnyObject?, to object: ParentObject) { + return setCurrentDelegate(castOptionalOrFatalError(delegate), to: object) + } + + func _forwardToDelegate() -> AnyObject? { + return forwardToDelegate().map { $0 as AnyObject } + } + + func _setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) { + return setForwardToDelegate(castOptionalOrFatalError(forwardToDelegate), retainDelegate: retainDelegate) + } +} + +extension DelegateProxyType { + + /// Store DelegateProxy subclass to factory. + /// When make 'Rx*DelegateProxy' subclass, call 'Rx*DelegateProxySubclass.register(for:_)' 1 time, or use it in DelegateProxyFactory + /// 'Rx*DelegateProxy' can have one subclass implementation per concrete ParentObject type. + /// Should call it from concrete DelegateProxy type, not generic. + public static func register(make: @escaping (Parent) -> Self) { + self.factory.extend(make: make) + } + + /// Creates new proxy for target object. + /// Should not call this function directory, use 'DelegateProxy.proxy(for:)' + public static func createProxy(for object: AnyObject) -> Self { + return castOrFatalError(factory.createProxy(for: object)) + } + + /// Returns existing proxy for object or installs new instance of delegate proxy. + /// + /// - parameter object: Target object on which to install delegate proxy. + /// - returns: Installed instance of delegate proxy. + /// + /// + /// extension Reactive where Base: UISearchBar { + /// + /// public var delegate: DelegateProxy { + /// return RxSearchBarDelegateProxy.proxy(for: base) + /// } + /// + /// public var text: ControlProperty { + /// let source: Observable = self.delegate.observe(#selector(UISearchBarDelegate.searchBar(_:textDidChange:))) + /// ... + /// } + /// } + public static func proxy(for object: ParentObject) -> Self { + MainScheduler.ensureExecutingOnScheduler() + + let maybeProxy = self.assignedProxy(for: object) + + let proxy: AnyObject + if let existingProxy = maybeProxy { + proxy = existingProxy + } + else { + proxy = castOrFatalError(self.createProxy(for: object)) + self.assignProxy(proxy, toObject: object) + assert(self.assignedProxy(for: object) === proxy) + } + let currentDelegate = self._currentDelegate(for: object) + let delegateProxy: Self = castOrFatalError(proxy) + + if currentDelegate !== delegateProxy { + delegateProxy._setForwardToDelegate(currentDelegate, retainDelegate: false) + assert(delegateProxy._forwardToDelegate() === currentDelegate) + self._setCurrentDelegate(proxy, to: object) + assert(self._currentDelegate(for: object) === proxy) + assert(delegateProxy._forwardToDelegate() === currentDelegate) + } + + return delegateProxy + } + + /// Sets forward delegate for `DelegateProxyType` associated with a specific object and return disposable that can be used to unset the forward to delegate. + /// Using this method will also make sure that potential original object cached selectors are cleared and will report any accidental forward delegate mutations. + /// + /// - parameter forwardDelegate: Delegate object to set. + /// - parameter retainDelegate: Retain `forwardDelegate` while it's being set. + /// - parameter onProxyForObject: Object that has `delegate` property. + /// - returns: Disposable object that can be used to clear forward delegate. + public static func installForwardDelegate(_ forwardDelegate: Delegate, retainDelegate: Bool, onProxyForObject object: ParentObject) -> Disposable { + weak var weakForwardDelegate: AnyObject? = forwardDelegate as AnyObject + let proxy = self.proxy(for: object) + + assert(proxy._forwardToDelegate() === nil, "This is a feature to warn you that there is already a delegate (or data source) set somewhere previously. The action you are trying to perform will clear that delegate (data source) and that means that some of your features that depend on that delegate (data source) being set will likely stop working.\n" + + "If you are ok with this, try to set delegate (data source) to `nil` in front of this operation.\n" + + " This is the source object value: \(object)\n" + + " This this the original delegate (data source) value: \(proxy.forwardToDelegate()!)\n" + + "Hint: Maybe delegate was already set in xib or storyboard and now it's being overwritten in code.\n") + + proxy.setForwardToDelegate(forwardDelegate, retainDelegate: retainDelegate) + + return Disposables.create { + MainScheduler.ensureExecutingOnScheduler() + + let delegate: AnyObject? = weakForwardDelegate + + assert(delegate == nil || proxy._forwardToDelegate() === delegate, "Delegate was changed from time it was first set. Current \(String(describing: proxy.forwardToDelegate())), and it should have been \(proxy)") + + proxy.setForwardToDelegate(nil, retainDelegate: retainDelegate) + } + } +} + + +// fileprivate extensions +extension DelegateProxyType { + fileprivate static var factory: DelegateProxyFactory { + return DelegateProxyFactory.sharedFactory(for: self) + } + + fileprivate static func assignedProxy(for object: ParentObject) -> AnyObject? { + let maybeDelegate = objc_getAssociatedObject(object, self.identifier) + return castOptionalOrFatalError(maybeDelegate) + } + + fileprivate static func assignProxy(_ proxy: AnyObject, toObject object: ParentObject) { + objc_setAssociatedObject(object, self.identifier, proxy, .OBJC_ASSOCIATION_RETAIN) + } +} + +/// Describes an object that has a delegate. +public protocol HasDelegate: AnyObject { + /// Delegate type + associatedtype Delegate + + /// Delegate + var delegate: Delegate? { get set } +} + +extension DelegateProxyType where ParentObject: HasDelegate, Self.Delegate == ParentObject.Delegate { + public static func currentDelegate(for object: ParentObject) -> Delegate? { + return object.delegate + } + + public static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) { + object.delegate = delegate + } +} + +/// Describes an object that has a data source. +public protocol HasDataSource: AnyObject { + /// Data source type + associatedtype DataSource + + /// Data source + var dataSource: DataSource? { get set } +} + +extension DelegateProxyType where ParentObject: HasDataSource, Self.Delegate == ParentObject.DataSource { + public static func currentDelegate(for object: ParentObject) -> Delegate? { + return object.dataSource + } + + public static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) { + object.dataSource = delegate + } +} + + #if os(iOS) || os(tvOS) + import UIKit + + extension ObservableType { + func subscribeProxyDataSource(ofObject object: DelegateProxy.ParentObject, dataSource: DelegateProxy.Delegate, retainDataSource: Bool, binding: @escaping (DelegateProxy, Event) -> Void) + -> Disposable + where DelegateProxy.ParentObject: UIView + , DelegateProxy.Delegate: AnyObject { + let proxy = DelegateProxy.proxy(for: object) + let unregisterDelegate = DelegateProxy.installForwardDelegate(dataSource, retainDelegate: retainDataSource, onProxyForObject: object) + // this is needed to flush any delayed old state (https://github.com/RxSwiftCommunity/RxDataSources/pull/75) + object.layoutIfNeeded() + + let subscription = self.asObservable() + .observeOn(MainScheduler()) + .catchError { error in + bindingError(error) + return Observable.empty() + } + // source can never end, otherwise it would release the subscriber, and deallocate the data source + .concat(Observable.never()) + .takeUntil(object.rx.deallocated) + .subscribe { [weak object] (event: Event) in + + if let object = object { + assert(proxy === DelegateProxy.currentDelegate(for: object), "Proxy changed from the time it was first set.\nOriginal: \(proxy)\nExisting: \(String(describing: DelegateProxy.currentDelegate(for: object)))") + } + + binding(proxy, event) + + switch event { + case .error(let error): + bindingError(error) + unregisterDelegate.dispose() + case .completed: + unregisterDelegate.dispose() + default: + break + } + } + + return Disposables.create { [weak object] in + subscription.dispose() + object?.layoutIfNeeded() + unregisterDelegate.dispose() + } + } + } + + #endif + + /** + + To add delegate proxy subclasses call `DelegateProxySubclass.register()` in `registerKnownImplementations` or in some other + part of your app that executes before using `rx.*` (e.g. appDidFinishLaunching). + + class RxScrollViewDelegateProxy: DelegateProxy { + public static func registerKnownImplementations() { + self.register { RxTableViewDelegateProxy(parentObject: $0) } + } + ... + + + */ + private class DelegateProxyFactory { + private static var _sharedFactories: [UnsafeRawPointer: DelegateProxyFactory] = [:] + + fileprivate static func sharedFactory(for proxyType: DelegateProxy.Type) -> DelegateProxyFactory { + MainScheduler.ensureExecutingOnScheduler() + let identifier = DelegateProxy.identifier + if let factory = _sharedFactories[identifier] { + return factory + } + let factory = DelegateProxyFactory(for: proxyType) + _sharedFactories[identifier] = factory + DelegateProxy.registerKnownImplementations() + return factory + } + + private var _factories: [ObjectIdentifier: ((AnyObject) -> AnyObject)] + private var _delegateProxyType: Any.Type + private var _identifier: UnsafeRawPointer + + private init(for proxyType: DelegateProxy.Type) { + _factories = [:] + _delegateProxyType = proxyType + _identifier = proxyType.identifier + } + + fileprivate func extend(make: @escaping (ParentObject) -> DelegateProxy) { + MainScheduler.ensureExecutingOnScheduler() + precondition(_identifier == DelegateProxy.identifier, "Delegate proxy has inconsistent identifier") + guard _factories[ObjectIdentifier(ParentObject.self)] == nil else { + rxFatalError("The factory of \(ParentObject.self) is duplicated. DelegateProxy is not allowed of duplicated base object type.") + } + _factories[ObjectIdentifier(ParentObject.self)] = { make(castOrFatalError($0)) } + } + + fileprivate func createProxy(for object: AnyObject) -> AnyObject { + MainScheduler.ensureExecutingOnScheduler() + var maybeMirror: Mirror? = Mirror(reflecting: object) + while let mirror = maybeMirror { + if let factory = _factories[ObjectIdentifier(mirror.subjectType)] { + return factory(object) + } + maybeMirror = mirror.superclassMirror + } + rxFatalError("DelegateProxy has no factory of \(object). Implement DelegateProxy subclass for \(object) first.") + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift new file mode 100644 index 0000000..5810fe5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/NSLayoutConstraint+Rx.swift @@ -0,0 +1,39 @@ +// +// NSLayoutConstraint+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 12/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if !os(Linux) + +#if os(macOS) + import Cocoa +#else + import UIKit +#endif + +import RxSwift + +#if os(iOS) || os(macOS) || os(tvOS) +extension Reactive where Base: NSLayoutConstraint { + /// Bindable sink for `constant` property. + public var constant: Binder { + return Binder(self.base) { constraint, constant in + constraint.constant = constant + } + } + + /// Bindable sink for `active` property. + @available(iOS 8, OSX 10.10, *) + public var active: Binder { + return Binder(self.base) { constraint, value in + constraint.isActive = value + } + } +} + +#endif + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift new file mode 100644 index 0000000..4cca12b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift @@ -0,0 +1,151 @@ +// +// Observable+Bind.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 8/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + + +import RxSwift + +extension ObservableType { + + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better, and enables + writing more consistent binding code. + + - parameter to: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to observer: O) -> Disposable where O.E == E { + return self.subscribe(observer) + } + + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better, and enables + writing more consistent binding code. + + - parameter to: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to observer: O) -> Disposable where O.E == E? { + return self.map { $0 }.subscribe(observer) + } + + /** + Creates new subscription and sends elements to publish relay. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter to: Target publish relay for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to relay: PublishRelay) -> Disposable { + return subscribe { e in + switch e { + case let .next(element): + relay.accept(element) + case let .error(error): + rxFatalErrorInDebug("Binding error to publish relay: \(error)") + case .completed: + break + } + } + } + + /** + Creates new subscription and sends elements to publish relay. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter to: Target publish relay for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to relay: PublishRelay) -> Disposable { + return self.map { $0 as E? }.bind(to: relay) + } + + /** + Creates new subscription and sends elements to behavior relay. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter to: Target behavior relay for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to relay: BehaviorRelay) -> Disposable { + return subscribe { e in + switch e { + case let .next(element): + relay.accept(element) + case let .error(error): + rxFatalErrorInDebug("Binding error to behavior relay: \(error)") + case .completed: + break + } + } + } + + /** + Creates new subscription and sends elements to behavior relay. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter to: Target behavior relay for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to relay: BehaviorRelay) -> Disposable { + return self.map { $0 as E? }.bind(to: relay) + } + + /** + Subscribes to observable sequence using custom binder function. + + - parameter to: Function used to bind elements from `self`. + - returns: Object representing subscription. + */ + public func bind(to binder: (Self) -> R) -> R { + return binder(self) + } + + /** + Subscribes to observable sequence using custom binder function and final parameter passed to binder function + after `self` is passed. + + public func bind(to binder: Self -> R1 -> R2, curriedArgument: R1) -> R2 { + return binder(self)(curriedArgument) + } + + - parameter to: Function used to bind elements from `self`. + - parameter curriedArgument: Final argument passed to `binder` to finish binding process. + - returns: Object representing subscription. + */ + public func bind(to binder: (Self) -> (R1) -> R2, curriedArgument: R1) -> R2 { + return binder(self)(curriedArgument) + } + + + /** + Subscribes an element handler to an observable sequence. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter onNext: Action to invoke for each element in the observable sequence. + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + public func bind(onNext: @escaping (E) -> Void) -> Disposable { + return subscribe(onNext: onNext, onError: { error in + rxFatalErrorInDebug("Binding error: \(error)") + }) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift new file mode 100644 index 0000000..5a1af71 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift @@ -0,0 +1,159 @@ +// +// RxCocoaObjCRuntimeError+Extensions.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 10/9/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if SWIFT_PACKAGE && !DISABLE_SWIZZLING && !os(Linux) + import RxCocoaRuntime +#endif + +#if !DISABLE_SWIZZLING && !os(Linux) + /// RxCocoa ObjC runtime interception mechanism. + public enum RxCocoaInterceptionMechanism { + /// Unknown message interception mechanism. + case unknown + /// Key value observing interception mechanism. + case kvo + } + + /// RxCocoa ObjC runtime modification errors. + public enum RxCocoaObjCRuntimeError + : Swift.Error + , CustomDebugStringConvertible { + /// Unknown error has occurred. + case unknown(target: AnyObject) + + /** + If the object is reporting a different class then it's real class, that means that there is probably + already some interception mechanism in place or something weird is happening. + + The most common case when this would happen is when using a combination of KVO (`observe`) and `sentMessage`. + + This error is easily resolved by just using `sentMessage` observing before `observe`. + + The reason why the other way around could create issues is because KVO will unregister it's interceptor + class and restore original class. Unfortunately that will happen no matter was there another interceptor + subclass registered in hierarchy or not. + + Failure scenario: + * KVO sets class to be `__KVO__OriginalClass` (subclass of `OriginalClass`) + * `sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`) + * then unobserving with KVO will restore class to be `OriginalClass` -> failure point (possibly a bug in KVO) + + The reason why changing order of observing works is because any interception method on unregistration + should return object's original real class (if that doesn't happen then it's really easy to argue that's a bug + in that interception mechanism). + + This library won't remove registered interceptor even if there aren't any observers left because + it's highly unlikely it would have any benefit in real world use cases, and it's even more + dangerous. + */ + case objectMessagesAlreadyBeingIntercepted(target: AnyObject, interceptionMechanism: RxCocoaInterceptionMechanism) + + /// Trying to observe messages for selector that isn't implemented. + case selectorNotImplemented(target: AnyObject) + + /// Core Foundation classes are usually toll free bridged. Those classes crash the program in case + /// `object_setClass` is performed on them. + /// + /// There is a possibility to just swizzle methods on original object, but since those won't be usual use + /// cases for this library, then an error will just be reported for now. + case cantInterceptCoreFoundationTollFreeBridgedObjects(target: AnyObject) + + /// Two libraries have simultaneously tried to modify ObjC runtime and that was detected. This can only + /// happen in scenarios where multiple interception libraries are used. + /// + /// To synchronize other libraries intercepting messages for an object, use `synchronized` on target object and + /// it's meta-class. + case threadingCollisionWithOtherInterceptionMechanism(target: AnyObject) + + /// For some reason saving original method implementation under RX namespace failed. + case savingOriginalForwardingMethodFailed(target: AnyObject) + + /// Intercepting a sent message by replacing a method implementation with `_objc_msgForward` failed for some reason. + case replacingMethodWithForwardingImplementation(target: AnyObject) + + /// Attempt to intercept one of the performance sensitive methods: + /// * class + /// * respondsToSelector: + /// * methodSignatureForSelector: + /// * forwardingTargetForSelector: + case observingPerformanceSensitiveMessages(target: AnyObject) + + /// Message implementation has unsupported return type (for example large struct). The reason why this is a error + /// is because in some cases intercepting sent messages requires replacing implementation with `_objc_msgForward_stret` + /// instead of `_objc_msgForward`. + /// + /// The unsupported cases should be fairly uncommon. + case observingMessagesWithUnsupportedReturnType(target: AnyObject) + } + + extension RxCocoaObjCRuntimeError { + /// A textual representation of `self`, suitable for debugging. + public var debugDescription: String { + switch self { + case let .unknown(target): + return "Unknown error occurred.\nTarget: `\(target)`" + case let .objectMessagesAlreadyBeingIntercepted(target, interceptionMechanism): + let interceptionMechanismDescription = interceptionMechanism == .kvo ? "KVO" : "other interception mechanism" + return "Collision between RxCocoa interception mechanism and \(interceptionMechanismDescription)." + + " To resolve this conflict please use this interception mechanism first.\nTarget: \(target)" + case let .selectorNotImplemented(target): + return "Trying to observe messages for selector that isn't implemented.\nTarget: \(target)" + case let .cantInterceptCoreFoundationTollFreeBridgedObjects(target): + return "Interception of messages sent to Core Foundation isn't supported.\nTarget: \(target)" + case let .threadingCollisionWithOtherInterceptionMechanism(target): + return "Detected a conflict while modifying ObjC runtime.\nTarget: \(target)" + case let .savingOriginalForwardingMethodFailed(target): + return "Saving original method implementation failed.\nTarget: \(target)" + case let .replacingMethodWithForwardingImplementation(target): + return "Intercepting a sent message by replacing a method implementation with `_objc_msgForward` failed for some reason.\nTarget: \(target)" + case let .observingPerformanceSensitiveMessages(target): + return "Attempt to intercept one of the performance sensitive methods. \nTarget: \(target)" + case let .observingMessagesWithUnsupportedReturnType(target): + return "Attempt to intercept a method with unsupported return type. \nTarget: \(target)" + } + } + } + + // MARK: Conversions `NSError` > `RxCocoaObjCRuntimeError` + + extension Error { + func rxCocoaErrorForTarget(_ target: AnyObject) -> RxCocoaObjCRuntimeError { + let error = self as NSError + + if error.domain == RXObjCRuntimeErrorDomain { + let errorCode = RXObjCRuntimeError(rawValue: error.code) ?? .unknown + + switch errorCode { + case .unknown: + return .unknown(target: target) + case .objectMessagesAlreadyBeingIntercepted: + let isKVO = (error.userInfo[RXObjCRuntimeErrorIsKVOKey] as? NSNumber)?.boolValue ?? false + return .objectMessagesAlreadyBeingIntercepted(target: target, interceptionMechanism: isKVO ? .kvo : .unknown) + case .selectorNotImplemented: + return .selectorNotImplemented(target: target) + case .cantInterceptCoreFoundationTollFreeBridgedObjects: + return .cantInterceptCoreFoundationTollFreeBridgedObjects(target: target) + case .threadingCollisionWithOtherInterceptionMechanism: + return .threadingCollisionWithOtherInterceptionMechanism(target: target) + case .savingOriginalForwardingMethodFailed: + return .savingOriginalForwardingMethodFailed(target: target) + case .replacingMethodWithForwardingImplementation: + return .replacingMethodWithForwardingImplementation(target: target) + case .observingPerformanceSensitiveMessages: + return .observingPerformanceSensitiveMessages(target: target) + case .observingMessagesWithUnsupportedReturnType: + return .observingMessagesWithUnsupportedReturnType(target: target) + } + } + + return RxCocoaObjCRuntimeError.unknown(target: target) + } + } + +#endif + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift new file mode 100644 index 0000000..94cc1a1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift @@ -0,0 +1,43 @@ +// +// RxTarget.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.NSObject + +import RxSwift + +class RxTarget : NSObject + , Disposable { + + private var retainSelf: RxTarget? + + override init() { + super.init() + self.retainSelf = self + +#if TRACE_RESOURCES + _ = Resources.incrementTotal() +#endif + +#if DEBUG + MainScheduler.ensureExecutingOnScheduler() +#endif + } + + func dispose() { +#if DEBUG + MainScheduler.ensureExecutingOnScheduler() +#endif + self.retainSelf = nil + } + +#if TRACE_RESOURCES + deinit { + _ = Resources.decrementTotal() + } +#endif +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift new file mode 100644 index 0000000..1532baa --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift @@ -0,0 +1,20 @@ +// +// SectionedViewDataSourceType.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 1/10/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.IndexPath + +/// Data source with access to underlying sectioned model. +public protocol SectionedViewDataSourceType { + /// Returns model at index path. + /// + /// In case data source doesn't contain any sections when this method is being called, `RxCocoaError.ItemsNotYetBound(object: self)` is thrown. + + /// - parameter indexPath: Model index path + /// - returns: Model at index path. + func model(at indexPath: IndexPath) throws -> Any +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/TextInput.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/TextInput.swift new file mode 100644 index 0000000..6fc7a29 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Common/TextInput.swift @@ -0,0 +1,78 @@ +// +// TextInput.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 5/12/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +#if os(iOS) || os(tvOS) + import UIKit + + /// Represents text input with reactive extensions. + public struct TextInput { + /// Base text input to extend. + public let base: Base + + /// Reactive wrapper for `text` property. + public let text: ControlProperty + + /// Initializes new text input. + /// + /// - parameter base: Base object. + /// - parameter text: Textual control property. + public init(base: Base, text: ControlProperty) { + self.base = base + self.text = text + } + } + + extension Reactive where Base: UITextField { + /// Reactive text input. + public var textInput: TextInput { + return TextInput(base: base, text: self.text) + } + } + + extension Reactive where Base: UITextView { + /// Reactive text input. + public var textInput: TextInput { + return TextInput(base: base, text: self.text) + } + } + +#endif + +#if os(macOS) + import Cocoa + + /// Represents text input with reactive extensions. + public struct TextInput { + /// Base text input to extend. + public let base: Base + + /// Reactive wrapper for `text` property. + public let text: ControlProperty + + /// Initializes new text input. + /// + /// - parameter base: Base object. + /// - parameter text: Textual control property. + public init(base: Base, text: ControlProperty) { + self.base = base + self.text = text + } + } + + extension Reactive where Base: NSTextField, Base: NSTextInputClient { + /// Reactive text input. + public var textInput: TextInput { + return TextInput(base: base, text: self.text) + } + } + +#endif + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Deprecated.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Deprecated.swift new file mode 100644 index 0000000..fb929c6 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Deprecated.swift @@ -0,0 +1,489 @@ +// +// Deprecated.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/19/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift +import Dispatch + +extension ObservableType { + + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better, and enables + writing more consistent binding code. + + - parameter observer: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + @available(*, deprecated, renamed: "bind(to:)") + public func bindTo(_ observer: O) -> Disposable where O.E == E { + return self.subscribe(observer) + } + + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better, and enables + writing more consistent binding code. + + - parameter observer: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + @available(*, deprecated, renamed: "bind(to:)") + public func bindTo(_ observer: O) -> Disposable where O.E == E? { + return self.map { $0 }.subscribe(observer) + } + + /** + Creates new subscription and sends elements to variable. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter variable: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + @available(*, deprecated, renamed: "bind(to:)") + public func bindTo(_ variable: Variable) -> Disposable { + return subscribe { e in + switch e { + case let .next(element): + variable.value = element + case let .error(error): + let error = "Binding error to variable: \(error)" + #if DEBUG + rxFatalError(error) + #else + print(error) + #endif + case .completed: + break + } + } + } + + /** + Creates new subscription and sends elements to variable. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter variable: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + @available(*, deprecated, renamed: "bind(to:)") + public func bindTo(_ variable: Variable) -> Disposable { + return self.map { $0 as E? }.bindTo(variable) + } + + /** + Subscribes to observable sequence using custom binder function. + + - parameter binder: Function used to bind elements from `self`. + - returns: Object representing subscription. + */ + @available(*, deprecated, renamed: "bind(to:)") + public func bindTo(_ binder: (Self) -> R) -> R { + return binder(self) + } + + /** + Subscribes to observable sequence using custom binder function and final parameter passed to binder function + after `self` is passed. + + public func bindTo(binder: Self -> R1 -> R2, curriedArgument: R1) -> R2 { + return binder(self)(curriedArgument) + } + + - parameter binder: Function used to bind elements from `self`. + - parameter curriedArgument: Final argument passed to `binder` to finish binding process. + - returns: Object representing subscription. + */ + @available(*, deprecated, renamed: "bind(to:)") + public func bindTo(_ binder: (Self) -> (R1) -> R2, curriedArgument: R1) -> R2 { + return binder(self)(curriedArgument) + } + + + /** + Subscribes an element handler to an observable sequence. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter onNext: Action to invoke for each element in the observable sequence. + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + @available(*, deprecated, renamed: "bind(onNext:)") + public func bindNext(_ onNext: @escaping (E) -> Void) -> Disposable { + return subscribe(onNext: onNext, onError: { error in + let error = "Binding error: \(error)" + #if DEBUG + rxFatalError(error) + #else + print(error) + #endif + }) + } +} + +#if os(iOS) || os(tvOS) + import UIKit + + extension NSTextStorage { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxTextStorageDelegateProxy { + fatalError() + } + } + + extension UIScrollView { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxScrollViewDelegateProxy { + fatalError() + } + } + + extension UICollectionView { + @available(*, unavailable, message: "createRxDataSourceProxy is now unavailable, check DelegateProxyFactory") + public func createRxDataSourceProxy() -> RxCollectionViewDataSourceProxy { + fatalError() + } + } + + extension UITableView { + @available(*, unavailable, message: "createRxDataSourceProxy is now unavailable, check DelegateProxyFactory") + public func createRxDataSourceProxy() -> RxTableViewDataSourceProxy { + fatalError() + } + } + + extension UINavigationBar { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxNavigationControllerDelegateProxy { + fatalError() + } + } + + extension UINavigationController { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxNavigationControllerDelegateProxy { + fatalError() + } + } + + extension UITabBar { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxTabBarDelegateProxy { + fatalError() + } + } + + extension UITabBarController { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxTabBarControllerDelegateProxy { + fatalError() + } + } + + extension UISearchBar { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxSearchBarDelegateProxy { + fatalError() + } + } + +#endif + +#if os(iOS) + extension UISearchController { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxSearchControllerDelegateProxy { + fatalError() + } + } + + extension UIPickerView { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxPickerViewDelegateProxy { + fatalError() + } + + @available(*, unavailable, message: "createRxDataSourceProxy is now unavailable, check DelegateProxyFactory") + public func createRxDataSourceProxy() -> RxPickerViewDataSourceProxy { + fatalError() + } + } + extension UIWebView { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxWebViewDelegateProxy { + fatalError() + } + } +#endif + +#if os(macOS) + import Cocoa + + extension NSTextField { + @available(*, unavailable, message: "createRxDelegateProxy is now unavailable, check DelegateProxyFactory") + public func createRxDelegateProxy() -> RxTextFieldDelegateProxy { + fatalError() + } + } +#endif + +/** + This method can be used in unit tests to ensure that driver is using mock schedulers instead of + main schedulers. + + **This shouldn't be used in normal release builds.** + */ +@available(*, deprecated, renamed: "SharingScheduler.mock(scheduler:action:)") +public func driveOnScheduler(_ scheduler: SchedulerType, action: () -> ()) { + SharingScheduler.mock(scheduler: scheduler, action: action) +} + +extension Variable { + /// Converts `Variable` to `SharedSequence` unit. + /// + /// - returns: Observable sequence. + @available(*, deprecated, renamed: "asDriver()") + public func asSharedSequence(strategy: SharingStrategy.Type = SharingStrategy.self) -> SharedSequence { + let source = self.asObservable() + .observeOn(SharingStrategy.scheduler) + return SharedSequence(source) + } +} + +#if !os(Linux) + +extension DelegateProxy { + @available(*, unavailable, renamed: "assignedProxy(for:)") + public static func assignedProxyFor(_ object: ParentObject) -> Delegate? { + fatalError() + } + + @available(*, unavailable, renamed: "currentDelegate(for:)") + public static func currentDelegateFor(_ object: ParentObject) -> Delegate? { + fatalError() + } +} + +#endif + +/** +Observer that enforces interface binding rules: + * can't bind errors (in debug builds binding of errors causes `fatalError` in release builds errors are being logged) + * ensures binding is performed on main thread + +`UIBindingObserver` doesn't retain target interface and in case owned interface element is released, element isn't bound. + + In case event binding is attempted from non main dispatch queue, event binding will be dispatched async to main dispatch + queue. +*/ +@available(*, deprecated, renamed: "Binder") +public final class UIBindingObserver : ObserverType where UIElementType: AnyObject { + public typealias E = Value + + weak var UIElement: UIElementType? + + let binding: (UIElementType, Value) -> Void + + /// Initializes `ViewBindingObserver` using + @available(*, deprecated, renamed: "UIBinder.init(_:scheduler:binding:)") + public init(UIElement: UIElementType, binding: @escaping (UIElementType, Value) -> Void) { + self.UIElement = UIElement + self.binding = binding + } + + /// Binds next element to owner view as described in `binding`. + public func on(_ event: Event) { + if !DispatchQueue.isMain { + DispatchQueue.main.async { + self.on(event) + } + return + } + + switch event { + case .next(let element): + if let view = self.UIElement { + binding(view, element) + } + case .error(let error): + bindingError(error) + case .completed: + break + } + } + + /// Erases type of observer. + /// + /// - returns: type erased observer. + public func asObserver() -> AnyObserver { + return AnyObserver(eventHandler: on) + } +} + + +#if os(iOS) + extension Reactive where Base: UIRefreshControl { + + /// Bindable sink for `beginRefreshing()`, `endRefreshing()` methods. + @available(*, deprecated, renamed: "isRefreshing") + public var refreshing: Binder { + return self.isRefreshing + } + } +#endif + +#if os(iOS) || os(tvOS) +extension Reactive where Base: UIImageView { + + /// Bindable sink for `image` property. + /// - parameter transitionType: Optional transition type while setting the image (kCATransitionFade, kCATransitionMoveIn, ...) + @available(*, deprecated, renamed: "image") + public func image(transitionType: String? = nil) -> Binder { + return Binder(base) { imageView, image in + if let transitionType = transitionType { + if image != nil { + let transition = CATransition() + transition.duration = 0.25 + transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + transition.type = transitionType + imageView.layer.add(transition, forKey: kCATransition) + } + } + else { + imageView.layer.removeAllAnimations() + } + imageView.image = image + } + } +} +#endif + +#if os(macOS) + + extension Reactive where Base: NSImageView { + + /// Bindable sink for `image` property. + /// + /// - parameter transitionType: Optional transition type while setting the image (kCATransitionFade, kCATransitionMoveIn, ...) + @available(*, deprecated, renamed: "image") + public func image(transitionType: String? = nil) -> Binder { + return Binder(self.base) { control, value in + if let transitionType = transitionType { + if value != nil { + let transition = CATransition() + transition.duration = 0.25 + transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + transition.type = transitionType + control.layer?.add(transition, forKey: kCATransition) + } + } + else { + control.layer?.removeAllAnimations() + } + control.image = value + } + } + } +#endif + +import RxSwift + +extension Variable { + /// Converts `Variable` to `Driver` trait. + /// + /// - returns: Driving observable sequence. + public func asDriver() -> Driver { + let source = self.asObservable() + .observeOn(DriverSharingStrategy.scheduler) + return Driver(source) + } +} + + +private let errorMessage = "`drive*` family of methods can be only called from `MainThread`.\n" + +"This is required to ensure that the last replayed `Driver` element is delivered on `MainThread`.\n" + +extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy { + /** + Creates new subscription and sends elements to variable. + This method can be only called from `MainThread`. + + - parameter variable: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer from the variable. + */ + public func drive(_ variable: Variable) -> Disposable { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return drive(onNext: { e in + variable.value = e + }) + } + + /** + Creates new subscription and sends elements to variable. + This method can be only called from `MainThread`. + + - parameter variable: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer from the variable. + */ + public func drive(_ variable: Variable) -> Disposable { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return drive(onNext: { e in + variable.value = e + }) + } +} + +extension ObservableType { + /** + Creates new subscription and sends elements to variable. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter to: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to variable: Variable) -> Disposable { + return subscribe { e in + switch e { + case let .next(element): + variable.value = element + case let .error(error): + let error = "Binding error to variable: \(error)" + #if DEBUG + rxFatalError(error) + #else + print(error) + #endif + case .completed: + break + } + } + } + + /** + Creates new subscription and sends elements to variable. + + In case error occurs in debug mode, `fatalError` will be raised. + In case error occurs in release mode, `error` will be logged. + + - parameter to: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer. + */ + public func bind(to variable: Variable) -> Disposable { + return self.map { $0 as E? }.bind(to: variable) + } +} + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift new file mode 100644 index 0000000..f8746db --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift @@ -0,0 +1,68 @@ +// +// KVORepresentable+CoreGraphics.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if !os(Linux) + +import RxSwift +import CoreGraphics + +import class Foundation.NSValue + +#if arch(x86_64) || arch(arm64) + let CGRectType = "{CGRect={CGPoint=dd}{CGSize=dd}}" + let CGSizeType = "{CGSize=dd}" + let CGPointType = "{CGPoint=dd}" +#elseif arch(i386) || arch(arm) + let CGRectType = "{CGRect={CGPoint=ff}{CGSize=ff}}" + let CGSizeType = "{CGSize=ff}" + let CGPointType = "{CGPoint=ff}" +#endif + +extension CGRect : KVORepresentable { + public typealias KVOType = NSValue + + /// Constructs self from `NSValue`. + public init?(KVOValue: KVOType) { + if strcmp(KVOValue.objCType, CGRectType) != 0 { + return nil + } + var typedValue = CGRect(x: 0, y: 0, width: 0, height: 0) + KVOValue.getValue(&typedValue) + self = typedValue + } +} + +extension CGPoint : KVORepresentable { + public typealias KVOType = NSValue + + /// Constructs self from `NSValue`. + public init?(KVOValue: KVOType) { + if strcmp(KVOValue.objCType, CGPointType) != 0 { + return nil + } + var typedValue = CGPoint(x: 0, y: 0) + KVOValue.getValue(&typedValue) + self = typedValue + } +} + +extension CGSize : KVORepresentable { + public typealias KVOType = NSValue + + /// Constructs self from `NSValue`. + public init?(KVOValue: KVOType) { + if strcmp(KVOValue.objCType, CGSizeType) != 0 { + return nil + } + var typedValue = CGSize(width: 0, height: 0) + KVOValue.getValue(&typedValue) + self = typedValue + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+Swift.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+Swift.swift new file mode 100644 index 0000000..f65a93e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+Swift.swift @@ -0,0 +1,88 @@ +// +// KVORepresentable+Swift.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.NSNumber + +extension Int : KVORepresentable { + public typealias KVOType = NSNumber + + /// Constructs `Self` using KVO value. + public init?(KVOValue: KVOType) { + self.init(KVOValue.int32Value) + } +} + +extension Int32 : KVORepresentable { + public typealias KVOType = NSNumber + + /// Constructs `Self` using KVO value. + public init?(KVOValue: KVOType) { + self.init(KVOValue.int32Value) + } +} + +extension Int64 : KVORepresentable { + public typealias KVOType = NSNumber + + /// Constructs `Self` using KVO value. + public init?(KVOValue: KVOType) { + self.init(KVOValue.int64Value) + } +} + +extension UInt : KVORepresentable { + public typealias KVOType = NSNumber + + /// Constructs `Self` using KVO value. + public init?(KVOValue: KVOType) { + self.init(KVOValue.uintValue) + } +} + +extension UInt32 : KVORepresentable { + public typealias KVOType = NSNumber + + /// Constructs `Self` using KVO value. + public init?(KVOValue: KVOType) { + self.init(KVOValue.uint32Value) + } +} + +extension UInt64 : KVORepresentable { + public typealias KVOType = NSNumber + + /// Constructs `Self` using KVO value. + public init?(KVOValue: KVOType) { + self.init(KVOValue.uint64Value) + } +} + +extension Bool : KVORepresentable { + public typealias KVOType = NSNumber + + /// Constructs `Self` using KVO value. + public init?(KVOValue: KVOType) { + self.init(KVOValue.boolValue) + } +} + + +extension RawRepresentable where RawValue: KVORepresentable { + /// Constructs `Self` using optional KVO value. + init?(KVOValue: RawValue.KVOType?) { + guard let KVOValue = KVOValue else { + return nil + } + + guard let rawValue = RawValue(KVOValue: KVOValue) else { + return nil + } + + self.init(rawValue: rawValue) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable.swift new file mode 100644 index 0000000..be12b33 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable.swift @@ -0,0 +1,28 @@ +// +// KVORepresentable.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Type that is KVO representable (KVO mechanism can be used to observe it). +public protocol KVORepresentable { + /// Associated KVO type. + associatedtype KVOType + + /// Constructs `Self` using KVO value. + init?(KVOValue: KVOType) +} + +extension KVORepresentable { + /// Initializes `KVORepresentable` with optional value. + init?(KVOValue: KVOType?) { + guard let KVOValue = KVOValue else { + return nil + } + + self.init(KVOValue: KVOValue) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/Logging.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/Logging.swift new file mode 100644 index 0000000..0acb9f8 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/Logging.swift @@ -0,0 +1,23 @@ +// +// Logging.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/3/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.URLRequest + +/// Simple logging settings for RxCocoa library. +public struct Logging { + public typealias LogURLRequest = (URLRequest) -> Bool + + /// Log URL requests to standard output in curl format. + public static var URLRequests: LogURLRequest = { _ in + #if DEBUG + return true + #else + return false + #endif + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift new file mode 100644 index 0000000..8fc78c7 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift @@ -0,0 +1,60 @@ +// +// NSObject+Rx+KVORepresentable.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if !os(Linux) + +import Foundation.NSObject +import RxSwift + +/// Key value observing options +public struct KeyValueObservingOptions: OptionSet { + /// Raw value + public let rawValue: UInt + + public init(rawValue: UInt) { + self.rawValue = rawValue + } + + /// Whether a sequence element should be sent to the observer immediately, before the subscribe method even returns. + public static let initial = KeyValueObservingOptions(rawValue: 1 << 0) + /// Whether to send updated values. + public static let new = KeyValueObservingOptions(rawValue: 1 << 1) +} + +extension Reactive where Base: NSObject { + + /** + Specialization of generic `observe` method. + + This is a special overload because to observe values of some type (for example `Int`), first values of KVO type + need to be observed (`NSNumber`), and then converted to result type. + + For more information take a look at `observe` method. + */ + public func observe(_ type: E.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable { + return observe(E.KVOType.self, keyPath, options: options, retainSelf: retainSelf) + .map(E.init) + } +} + +#if !DISABLE_SWIZZLING && !os(Linux) + // KVO + extension Reactive where Base: NSObject { + /** + Specialization of generic `observeWeakly` method. + + For more information take a look at `observeWeakly` method. + */ + public func observeWeakly(_ type: E.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable { + return observeWeakly(E.KVOType.self, keyPath, options: options) + .map(E.init) + } + } +#endif + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift new file mode 100644 index 0000000..7a874bf --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift @@ -0,0 +1,52 @@ +// +// NSObject+Rx+RawRepresentable.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 11/9/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if !os(Linux) + +import RxSwift + +import Foundation.NSObject + +extension Reactive where Base: NSObject { + /** + Specialization of generic `observe` method. + + This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value. + + It is useful for observing bridged ObjC enum values. + + For more information take a look at `observe` method. + */ + public func observe(_ type: E.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable where E.RawValue: KVORepresentable { + return observe(E.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf) + .map(E.init) + } +} + +#if !DISABLE_SWIZZLING + + // observeWeakly + RawRepresentable + extension Reactive where Base: NSObject { + + /** + Specialization of generic `observeWeakly` method. + + This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value. + + It is useful for observing bridged ObjC enum values. + + For more information take a look at `observeWeakly` method. + */ + public func observeWeakly(_ type: E.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable where E.RawValue: KVORepresentable { + return observeWeakly(E.RawValue.KVOType.self, keyPath, options: options) + .map(E.init) + } + } +#endif + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx.swift new file mode 100644 index 0000000..210b2dc --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx.swift @@ -0,0 +1,544 @@ +// +// NSObject+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if !os(Linux) + +import Foundation.NSObject +import RxSwift +#if SWIFT_PACKAGE && !DISABLE_SWIZZLING && !os(Linux) + import RxCocoaRuntime +#endif + +#if !DISABLE_SWIZZLING && !os(Linux) +fileprivate var deallocatingSubjectTriggerContext: UInt8 = 0 +fileprivate var deallocatingSubjectContext: UInt8 = 0 +#endif +fileprivate var deallocatedSubjectTriggerContext: UInt8 = 0 +fileprivate var deallocatedSubjectContext: UInt8 = 0 + +#if !os(Linux) + +/** +KVO is a tricky mechanism. + +When observing child in a ownership hierarchy, usually retaining observing target is wanted behavior. +When observing parent in a ownership hierarchy, usually retaining target isn't wanter behavior. + +KVO with weak references is especially tricky. For it to work, some kind of swizzling is required. +That can be done by + * replacing object class dynamically (like KVO does) + * by swizzling `dealloc` method on all instances for a class. + * some third method ... + +Both approaches can fail in certain scenarios: + * problems arise when swizzlers return original object class (like KVO does when nobody is observing) + * Problems can arise because replacing dealloc method isn't atomic operation (get implementation, + set implementation). + +Second approach is chosen. It can fail in case there are multiple libraries dynamically trying +to replace dealloc method. In case that isn't the case, it should be ok. +*/ +extension Reactive where Base: NSObject { + + + /** + Observes values on `keyPath` starting from `self` with `options` and retains `self` if `retainSelf` is set. + + `observe` is just a simple and performant wrapper around KVO mechanism. + + * it can be used to observe paths starting from `self` or from ancestors in ownership graph (`retainSelf = false`) + * it can be used to observe paths starting from descendants in ownership graph (`retainSelf = true`) + * the paths have to consist only of `strong` properties, otherwise you are risking crashing the system by not unregistering KVO observer before dealloc. + + If support for weak properties is needed or observing arbitrary or unknown relationships in the + ownership tree, `observeWeakly` is the preferred option. + + - parameter keyPath: Key path of property names to observe. + - parameter options: KVO mechanism notification options. + - parameter retainSelf: Retains self during observation if set `true`. + - returns: Observable sequence of objects on `keyPath`. + */ + public func observe(_ type: E.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable { + return KVOObservable(object: base, keyPath: keyPath, options: options, retainTarget: retainSelf).asObservable() + } +} + +#endif + +#if !DISABLE_SWIZZLING && !os(Linux) +// KVO +extension Reactive where Base: NSObject { + /** + Observes values on `keyPath` starting from `self` with `options` and doesn't retain `self`. + + It can be used in all cases where `observe` can be used and additionally + + * because it won't retain observed target, it can be used to observe arbitrary object graph whose ownership relation is unknown + * it can be used to observe `weak` properties + + **Since it needs to intercept object deallocation process it needs to perform swizzling of `dealloc` method on observed object.** + + - parameter keyPath: Key path of property names to observe. + - parameter options: KVO mechanism notification options. + - returns: Observable sequence of objects on `keyPath`. + */ + public func observeWeakly(_ type: E.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable { + return observeWeaklyKeyPathFor(base, keyPath: keyPath, options: options) + .map { n in + return n as? E + } + } +} +#endif + +// Dealloc +extension Reactive where Base: AnyObject { + + /** + Observable sequence of object deallocated events. + + After object is deallocated one `()` element will be produced and sequence will immediately complete. + + - returns: Observable sequence of object deallocated events. + */ + public var deallocated: Observable { + return synchronized { + if let deallocObservable = objc_getAssociatedObject(base, &deallocatedSubjectContext) as? DeallocObservable { + return deallocObservable._subject + } + + let deallocObservable = DeallocObservable() + + objc_setAssociatedObject(base, &deallocatedSubjectContext, deallocObservable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + return deallocObservable._subject + } + } + +#if !DISABLE_SWIZZLING && !os(Linux) + + /** + Observable sequence of message arguments that completes when object is deallocated. + + Each element is produced before message is invoked on target object. `methodInvoked` + exists in case observing of invoked messages is needed. + + In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`. + + In case some argument is `nil`, instance of `NSNull()` will be sent. + + - returns: Observable sequence of arguments passed to `selector` method. + */ + public func sentMessage(_ selector: Selector) -> Observable<[Any]> { + return synchronized { + // in case of dealloc selector replay subject behavior needs to be used + if selector == deallocSelector { + return deallocating.map { _ in [] } + } + + do { + let proxy: MessageSentProxy = try registerMessageInterceptor(selector) + return proxy.messageSent.asObservable() + } + catch let e { + return Observable.error(e) + } + } + } + + /** + Observable sequence of message arguments that completes when object is deallocated. + + Each element is produced after message is invoked on target object. `sentMessage` + exists in case interception of sent messages before they were invoked is needed. + + In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`. + + In case some argument is `nil`, instance of `NSNull()` will be sent. + + - returns: Observable sequence of arguments passed to `selector` method. + */ + public func methodInvoked(_ selector: Selector) -> Observable<[Any]> { + return synchronized { + // in case of dealloc selector replay subject behavior needs to be used + if selector == deallocSelector { + return deallocated.map { _ in [] } + } + + + do { + let proxy: MessageSentProxy = try registerMessageInterceptor(selector) + return proxy.methodInvoked.asObservable() + } + catch let e { + return Observable.error(e) + } + } + } + + /** + Observable sequence of object deallocating events. + + When `dealloc` message is sent to `self` one `()` element will be produced and after object is deallocated sequence + will immediately complete. + + In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`. + + - returns: Observable sequence of object deallocating events. + */ + public var deallocating: Observable<()> { + return synchronized { + do { + let proxy: DeallocatingProxy = try registerMessageInterceptor(deallocSelector) + return proxy.messageSent.asObservable() + } + catch let e { + return Observable.error(e) + } + } + } + + fileprivate func registerMessageInterceptor(_ selector: Selector) throws -> T { + let rxSelector = RX_selector(selector) + let selectorReference = RX_reference_from_selector(rxSelector) + + let subject: T + if let existingSubject = objc_getAssociatedObject(base, selectorReference) as? T { + subject = existingSubject + } + else { + subject = T() + objc_setAssociatedObject( + base, + selectorReference, + subject, + .OBJC_ASSOCIATION_RETAIN_NONATOMIC + ) + } + + if subject.isActive { + return subject + } + + var error: NSError? + let targetImplementation = RX_ensure_observing(base, selector, &error) + if targetImplementation == nil { + throw error?.rxCocoaErrorForTarget(base) ?? RxCocoaError.unknown + } + + subject.targetImplementation = targetImplementation! + + return subject + } +#endif +} + +// MARK: Message interceptors + +#if !DISABLE_SWIZZLING && !os(Linux) + + fileprivate protocol MessageInterceptorSubject: class { + init() + + var isActive: Bool { + get + } + + var targetImplementation: IMP { get set } + } + + fileprivate final class DeallocatingProxy + : MessageInterceptorSubject + , RXDeallocatingObserver { + typealias E = () + + let messageSent = ReplaySubject<()>.create(bufferSize: 1) + + @objc var targetImplementation: IMP = RX_default_target_implementation() + + var isActive: Bool { + return targetImplementation != RX_default_target_implementation() + } + + init() { + } + + @objc func deallocating() -> Void { + messageSent.on(.next(())) + } + + deinit { + messageSent.on(.completed) + } + } + + fileprivate final class MessageSentProxy + : MessageInterceptorSubject + , RXMessageSentObserver { + typealias E = [AnyObject] + + let messageSent = PublishSubject<[Any]>() + let methodInvoked = PublishSubject<[Any]>() + + @objc var targetImplementation: IMP = RX_default_target_implementation() + + var isActive: Bool { + return targetImplementation != RX_default_target_implementation() + } + + init() { + } + + @objc func messageSent(withArguments arguments: [Any]) -> Void { + messageSent.on(.next(arguments)) + } + + @objc func methodInvoked(withArguments arguments: [Any]) -> Void { + methodInvoked.on(.next(arguments)) + } + + deinit { + messageSent.on(.completed) + methodInvoked.on(.completed) + } + } + +#endif + + +fileprivate final class DeallocObservable { + let _subject = ReplaySubject.create(bufferSize:1) + + init() { + } + + deinit { + _subject.on(.next(())) + _subject.on(.completed) + } +} + +// MARK: KVO + +#if !os(Linux) + +fileprivate protocol KVOObservableProtocol { + var target: AnyObject { get } + var keyPath: String { get } + var retainTarget: Bool { get } + var options: KeyValueObservingOptions { get } +} + +fileprivate final class KVOObserver + : _RXKVOObserver + , Disposable { + typealias Callback = (Any?) -> Void + + var retainSelf: KVOObserver? = nil + + init(parent: KVOObservableProtocol, callback: @escaping Callback) { + #if TRACE_RESOURCES + _ = Resources.incrementTotal() + #endif + + super.init(target: parent.target, retainTarget: parent.retainTarget, keyPath: parent.keyPath, options: parent.options.nsOptions, callback: callback) + self.retainSelf = self + } + + override func dispose() { + super.dispose() + self.retainSelf = nil + } + + deinit { + #if TRACE_RESOURCES + _ = Resources.decrementTotal() + #endif + } +} + +fileprivate final class KVOObservable + : ObservableType + , KVOObservableProtocol { + typealias E = Element? + + unowned var target: AnyObject + var strongTarget: AnyObject? + + var keyPath: String + var options: KeyValueObservingOptions + var retainTarget: Bool + + init(object: AnyObject, keyPath: String, options: KeyValueObservingOptions, retainTarget: Bool) { + self.target = object + self.keyPath = keyPath + self.options = options + self.retainTarget = retainTarget + if retainTarget { + self.strongTarget = object + } + } + + func subscribe(_ observer: O) -> Disposable where O.E == Element? { + let observer = KVOObserver(parent: self) { (value) in + if value as? NSNull != nil { + observer.on(.next(nil)) + return + } + observer.on(.next(value as? Element)) + } + + return Disposables.create(with: observer.dispose) + } + +} + +#endif + +#if !DISABLE_SWIZZLING && !os(Linux) + + fileprivate func observeWeaklyKeyPathFor(_ target: NSObject, keyPath: String, options: KeyValueObservingOptions) -> Observable { + let components = keyPath.components(separatedBy: ".").filter { $0 != "self" } + + let observable = observeWeaklyKeyPathFor(target, keyPathSections: components, options: options) + .finishWithNilWhenDealloc(target) + + if !options.intersection(.initial).isEmpty { + return observable + } + else { + return observable + .skip(1) + } + } + + // This should work correctly + // Identifiers can't contain `,`, so the only place where `,` can appear + // is as a delimiter. + // This means there is `W` as element in an array of property attributes. + fileprivate func isWeakProperty(_ properyRuntimeInfo: String) -> Bool { + return properyRuntimeInfo.range(of: ",W,") != nil + } + + fileprivate extension ObservableType where E == AnyObject? { + func finishWithNilWhenDealloc(_ target: NSObject) + -> Observable { + let deallocating = target.rx.deallocating + + return deallocating + .map { _ in + return Observable.just(nil) + } + .startWith(self.asObservable()) + .switchLatest() + } + } + + fileprivate extension KeyValueObservingOptions { + fileprivate var nsOptions: NSKeyValueObservingOptions { + var result: UInt = 0 + if self.contains(.new) { + result |= NSKeyValueObservingOptions.new.rawValue + } + if self.contains(.initial) { + result |= NSKeyValueObservingOptions.initial.rawValue + } + + return NSKeyValueObservingOptions(rawValue: result) + } + } + + fileprivate func observeWeaklyKeyPathFor( + _ target: NSObject, + keyPathSections: [String], + options: KeyValueObservingOptions + ) -> Observable { + + weak var weakTarget: AnyObject? = target + + let propertyName = keyPathSections[0] + let remainingPaths = Array(keyPathSections[1.. + + // KVO recursion for value changes + return propertyObservable + .flatMapLatest { (nextTarget: AnyObject?) -> Observable in + if nextTarget == nil { + return Observable.just(nil) + } + let nextObject = nextTarget! as? NSObject + + let strongTarget: AnyObject? = weakTarget + + if nextObject == nil { + return Observable.error(RxCocoaError.invalidObjectOnKeyPath(object: nextTarget!, sourceObject: strongTarget ?? NSNull(), propertyName: propertyName)) + } + + // if target is alive, then send change + // if it's deallocated, don't send anything + if strongTarget == nil { + return Observable.empty() + } + + let nextElementsObservable = keyPathSections.count == 1 + ? Observable.just(nextTarget) + : observeWeaklyKeyPathFor(nextObject!, keyPathSections: remainingPaths, options: options) + + if isWeak { + return nextElementsObservable + .finishWithNilWhenDealloc(nextObject!) + } + else { + return nextElementsObservable + } + } + } +#endif + +// MARK Constants + +fileprivate let deallocSelector = NSSelectorFromString("dealloc") + +// MARK: AnyObject + Reactive + +extension Reactive where Base: AnyObject { + func synchronized( _ action: () -> T) -> T { + objc_sync_enter(self.base) + let result = action() + objc_sync_exit(self.base) + return result + } +} + +extension Reactive where Base: AnyObject { + /** + Helper to make sure that `Observable` returned from `createCachedObservable` is only created once. + This is important because there is only one `target` and `action` properties on `NSControl` or `UIBarButtonItem`. + */ + func lazyInstanceObservable(_ key: UnsafeRawPointer, createCachedObservable: () -> T) -> T { + if let value = objc_getAssociatedObject(base, key) { + return value as! T + } + + let observable = createCachedObservable() + + objc_setAssociatedObject(base, key, observable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + + return observable + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NotificationCenter+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NotificationCenter+Rx.swift new file mode 100644 index 0000000..f15e718 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/NotificationCenter+Rx.swift @@ -0,0 +1,33 @@ +// +// NotificationCenter+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 5/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.NotificationCenter +import struct Foundation.Notification + +import RxSwift + +extension Reactive where Base: NotificationCenter { + /** + Transforms notifications posted to notification center to observable sequence of notifications. + + - parameter name: Optional name used to filter notifications. + - parameter object: Optional object used to filter notifications. + - returns: Observable sequence of posted notifications. + */ + public func notification(_ name: Notification.Name?, object: AnyObject? = nil) -> Observable { + return Observable.create { [weak object] observer in + let nsObserver = self.base.addObserver(forName: name, object: object, queue: nil) { notification in + observer.on(.next(notification)) + } + + return Disposables.create { + self.base.removeObserver(nsObserver) + } + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/URLSession+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/URLSession+Rx.swift new file mode 100644 index 0000000..26bc61b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Foundation/URLSession+Rx.swift @@ -0,0 +1,243 @@ +// +// URLSession+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.URL +import struct Foundation.URLRequest +import struct Foundation.Data +import struct Foundation.Date +import struct Foundation.TimeInterval +import class Foundation.HTTPURLResponse +import class Foundation.URLSession +import class Foundation.URLResponse +import class Foundation.JSONSerialization +import class Foundation.NSError +import var Foundation.NSURLErrorCancelled +import var Foundation.NSURLErrorDomain + +#if os(Linux) + // don't know why + import Foundation +#endif + +import RxSwift + +/// RxCocoa URL errors. +public enum RxCocoaURLError + : Swift.Error { + /// Unknown error occurred. + case unknown + /// Response is not NSHTTPURLResponse + case nonHTTPResponse(response: URLResponse) + /// Response is not successful. (not in `200 ..< 300` range) + case httpRequestFailed(response: HTTPURLResponse, data: Data?) + /// Deserialization error. + case deserializationError(error: Swift.Error) +} + +extension RxCocoaURLError + : CustomDebugStringConvertible { + /// A textual representation of `self`, suitable for debugging. + public var debugDescription: String { + switch self { + case .unknown: + return "Unknown error has occurred." + case let .nonHTTPResponse(response): + return "Response is not NSHTTPURLResponse `\(response)`." + case let .httpRequestFailed(response, _): + return "HTTP request failed with `\(response.statusCode)`." + case let .deserializationError(error): + return "Error during deserialization of the response: \(error)" + } + } +} + +fileprivate func escapeTerminalString(_ value: String) -> String { + return value.replacingOccurrences(of: "\"", with: "\\\"", options:[], range: nil) +} + +fileprivate func convertURLRequestToCurlCommand(_ request: URLRequest) -> String { + let method = request.httpMethod ?? "GET" + var returnValue = "curl -X \(method) " + + if let httpBody = request.httpBody, request.httpMethod == "POST" { + let maybeBody = String(data: httpBody, encoding: String.Encoding.utf8) + if let body = maybeBody { + returnValue += "-d \"\(escapeTerminalString(body))\" " + } + } + + for (key, value) in request.allHTTPHeaderFields ?? [:] { + let escapedKey = escapeTerminalString(key as String) + let escapedValue = escapeTerminalString(value as String) + returnValue += "\n -H \"\(escapedKey): \(escapedValue)\" " + } + + let URLString = request.url?.absoluteString ?? "" + + returnValue += "\n\"\(escapeTerminalString(URLString))\"" + + returnValue += " -i -v" + + return returnValue +} + +fileprivate func convertResponseToString(_ response: URLResponse?, _ error: NSError?, _ interval: TimeInterval) -> String { + let ms = Int(interval * 1000) + + if let response = response as? HTTPURLResponse { + if 200 ..< 300 ~= response.statusCode { + return "Success (\(ms)ms): Status \(response.statusCode)" + } + else { + return "Failure (\(ms)ms): Status \(response.statusCode)" + } + } + + if let error = error { + if error.domain == NSURLErrorDomain && error.code == NSURLErrorCancelled { + return "Canceled (\(ms)ms)" + } + return "Failure (\(ms)ms): NSError > \(error)" + } + + return "" +} + +extension Reactive where Base: URLSession { + /** + Observable sequence of responses for URL request. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + - parameter request: URL request. + - returns: Observable sequence of URL responses. + */ + public func response(request: URLRequest) -> Observable<(response: HTTPURLResponse, data: Data)> { + return Observable.create { observer in + + // smart compiler should be able to optimize this out + let d: Date? + + if Logging.URLRequests(request) { + d = Date() + } + else { + d = nil + } + + let task = self.base.dataTask(with: request) { (data, response, error) in + + if Logging.URLRequests(request) { + let interval = Date().timeIntervalSince(d ?? Date()) + print(convertURLRequestToCurlCommand(request)) + #if os(Linux) + print(convertResponseToString(response, error.flatMap { $0 as? NSError }, interval)) + #else + print(convertResponseToString(response, error.map { $0 as NSError }, interval)) + #endif + } + + guard let response = response, let data = data else { + observer.on(.error(error ?? RxCocoaURLError.unknown)) + return + } + + guard let httpResponse = response as? HTTPURLResponse else { + observer.on(.error(RxCocoaURLError.nonHTTPResponse(response: response))) + return + } + + observer.on(.next((httpResponse, data))) + observer.on(.completed) + } + + task.resume() + + return Disposables.create(with: task.cancel) + } + } + + /** + Observable sequence of response data for URL request. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + If response is not HTTP response with status code in the range of `200 ..< 300`, sequence + will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`. + + - parameter request: URL request. + - returns: Observable sequence of response data. + */ + public func data(request: URLRequest) -> Observable { + return response(request: request).map { pair -> Data in + if 200 ..< 300 ~= pair.0.statusCode { + return pair.1 + } + else { + throw RxCocoaURLError.httpRequestFailed(response: pair.0, data: pair.1) + } + } + } + + /** + Observable sequence of response JSON for URL request. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + If response is not HTTP response with status code in the range of `200 ..< 300`, sequence + will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`. + + If there is an error during JSON deserialization observable sequence will fail with that error. + + - parameter request: URL request. + - returns: Observable sequence of response JSON. + */ + public func json(request: URLRequest, options: JSONSerialization.ReadingOptions = []) -> Observable { + return data(request: request).map { (data) -> Any in + do { + return try JSONSerialization.jsonObject(with: data, options: options) + } catch let error { + throw RxCocoaURLError.deserializationError(error: error) + } + } + } + + /** + Observable sequence of response JSON for GET request with `URL`. + + Performing of request starts after observer is subscribed and not after invoking this method. + + **URL requests will be performed per subscribed observer.** + + Any error during fetching of the response will cause observed sequence to terminate with error. + + If response is not HTTP response with status code in the range of `200 ..< 300`, sequence + will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`. + + If there is an error during JSON deserialization observable sequence will fail with that error. + + - parameter url: URL of `NSURLRequest` request. + - returns: Observable sequence of response JSON. + */ + public func json(url: Foundation.URL) -> Observable { + return json(request: URLRequest(url: url)) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RX.m b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RX.m new file mode 100644 index 0000000..cffbfbc --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RX.m @@ -0,0 +1,10 @@ +// +// _RX.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import "include/_RX.h" + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXDelegateProxy.m b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXDelegateProxy.m new file mode 100644 index 0000000..36338a5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXDelegateProxy.m @@ -0,0 +1,147 @@ +// +// _RXDelegateProxy.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import "include/_RXDelegateProxy.h" +#import "include/_RX.h" +#import "include/_RXObjCRuntime.h" + +@interface _RXDelegateProxy () { + id __weak __forwardToDelegate; +} + +@property (nonatomic, strong) id strongForwardDelegate; + +@end + +static NSMutableDictionary *voidSelectorsPerClass = nil; + +@implementation _RXDelegateProxy + ++(NSSet*)collectVoidSelectorsForProtocol:(Protocol *)protocol { + NSMutableSet *selectors = [NSMutableSet set]; + + unsigned int protocolMethodCount = 0; + struct objc_method_description *pMethods = protocol_copyMethodDescriptionList(protocol, NO, YES, &protocolMethodCount); + + for (unsigned int i = 0; i < protocolMethodCount; ++i) { + struct objc_method_description method = pMethods[i]; + if (RX_is_method_with_description_void(method)) { + [selectors addObject:SEL_VALUE(method.name)]; + } + } + + free(pMethods); + + unsigned int numberOfBaseProtocols = 0; + Protocol * __unsafe_unretained * pSubprotocols = protocol_copyProtocolList(protocol, &numberOfBaseProtocols); + + for (unsigned int i = 0; i < numberOfBaseProtocols; ++i) { + [selectors unionSet:[self collectVoidSelectorsForProtocol:pSubprotocols[i]]]; + } + + free(pSubprotocols); + + return selectors; +} + ++(void)initialize { + @synchronized (_RXDelegateProxy.class) { + if (voidSelectorsPerClass == nil) { + voidSelectorsPerClass = [[NSMutableDictionary alloc] init]; + } + + NSMutableSet *voidSelectors = [NSMutableSet set]; + +#define CLASS_HIERARCHY_MAX_DEPTH 100 + + NSInteger classHierarchyDepth = 0; + Class targetClass = NULL; + + for (classHierarchyDepth = 0, targetClass = self; + classHierarchyDepth < CLASS_HIERARCHY_MAX_DEPTH && targetClass != nil; + ++classHierarchyDepth, targetClass = class_getSuperclass(targetClass) + ) { + unsigned int count; + Protocol *__unsafe_unretained *pProtocols = class_copyProtocolList(targetClass, &count); + + for (unsigned int i = 0; i < count; i++) { + NSSet *selectorsForProtocol = [self collectVoidSelectorsForProtocol:pProtocols[i]]; + [voidSelectors unionSet:selectorsForProtocol]; + } + + free(pProtocols); + } + + if (classHierarchyDepth == CLASS_HIERARCHY_MAX_DEPTH) { + NSLog(@"Detected weird class hierarchy with depth over %d. Starting with this class -> %@", CLASS_HIERARCHY_MAX_DEPTH, self); +#if DEBUG + abort(); +#endif + } + + voidSelectorsPerClass[CLASS_VALUE(self)] = voidSelectors; + } +} + +-(id)_forwardToDelegate { + return __forwardToDelegate; +} + +-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate { + __forwardToDelegate = forwardToDelegate; + if (retainDelegate) { + self.strongForwardDelegate = forwardToDelegate; + } + else { + self.strongForwardDelegate = nil; + } +} + +-(BOOL)hasWiredImplementationForSelector:(SEL)selector { + return [super respondsToSelector:selector]; +} + +-(BOOL)voidDelegateMethodsContain:(SEL)selector { + @synchronized(_RXDelegateProxy.class) { + NSSet *voidSelectors = voidSelectorsPerClass[CLASS_VALUE(self.class)]; + NSAssert(voidSelectors != nil, @"Set of allowed methods not initialized"); + return [voidSelectors containsObject:SEL_VALUE(selector)]; + } +} + +-(void)forwardInvocation:(NSInvocation *)anInvocation { + BOOL isVoid = RX_is_method_signature_void(anInvocation.methodSignature); + NSArray *arguments = nil; + if (isVoid) { + arguments = RX_extract_arguments(anInvocation); + [self _sentMessage:anInvocation.selector withArguments:arguments]; + } + + if (self._forwardToDelegate && [self._forwardToDelegate respondsToSelector:anInvocation.selector]) { + [anInvocation invokeWithTarget:self._forwardToDelegate]; + } + + if (isVoid) { + [self _methodInvoked:anInvocation.selector withArguments:arguments]; + } +} + +// abstract method +-(void)_sentMessage:(SEL)selector withArguments:(NSArray *)arguments { + +} + +// abstract method +-(void)_methodInvoked:(SEL)selector withArguments:(NSArray *)arguments { + +} + +-(void)dealloc { +} + +@end diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXKVOObserver.m b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXKVOObserver.m new file mode 100644 index 0000000..fc8fb75 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXKVOObserver.m @@ -0,0 +1,54 @@ +// +// _RXKVOObserver.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import "include/_RXKVOObserver.h" + +@interface _RXKVOObserver () + +@property (nonatomic, unsafe_unretained) id target; +@property (nonatomic, strong ) id retainedTarget; +@property (nonatomic, copy ) NSString *keyPath; +@property (nonatomic, copy ) void (^callback)(id); + +@end + +@implementation _RXKVOObserver + +-(instancetype)initWithTarget:(id)target + retainTarget:(BOOL)retainTarget + keyPath:(NSString*)keyPath + options:(NSKeyValueObservingOptions)options + callback:(void (^)(id))callback { + self = [super init]; + if (!self) return nil; + + self.target = target; + if (retainTarget) { + self.retainedTarget = target; + } + self.keyPath = keyPath; + self.callback = callback; + + [self.target addObserver:self forKeyPath:self.keyPath options:options context:nil]; + + return self; +} + +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + @synchronized(self) { + self.callback(change[NSKeyValueChangeNewKey]); + } +} + +-(void)dispose { + [self.target removeObserver:self forKeyPath:self.keyPath context:nil]; + self.target = nil; + self.retainedTarget = nil; +} + +@end diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXObjCRuntime.m b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXObjCRuntime.m new file mode 100644 index 0000000..9cd5833 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/_RXObjCRuntime.m @@ -0,0 +1,1022 @@ +// +// _RXObjCRuntime.m +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import +#import +#import +#import +#import + +#import "include/_RX.h" +#import "include/_RXObjCRuntime.h" + +#if !DISABLE_SWIZZLING + +#define NSErrorParam NSError *__autoreleasing __nullable * __nullable + +// self + cmd +#define HIDDEN_ARGUMENT_COUNT 2 + +@class RXObjCRuntime; + +BOOL RXAbortOnThreadingHazard = NO; + +typedef NSInvocation *NSInvocationRef; +typedef NSMethodSignature *NSMethodSignatureRef; +typedef unsigned char rx_uchar; +typedef unsigned short rx_ushort; +typedef unsigned int rx_uint; +typedef unsigned long rx_ulong; +typedef id (^rx_block)(id); +typedef BOOL (^RXInterceptWithOptimizedObserver)(RXObjCRuntime * __nonnull self, Class __nonnull class, SEL __nonnull selector, NSErrorParam error); + +static CFTypeID defaultTypeID; +static SEL deallocSelector; + +static int RxSwizzlingTargetClassKey = 0; + +#if TRACE_RESOURCES +static int32_t numberOInterceptedMethods = 0; +static int32_t numberOfForwardedMethods = 0; +#endif + +#define THREADING_HAZARD(class) \ + NSLog(@"There was a problem swizzling on `%@`.\nYou have probably two libraries performing swizzling in runtime.\nWe didn't want to crash your program, but this is not good ...\nYou an solve this problem by either not using swizzling in this library, removing one of those other libraries, or making sure that swizzling parts are synchronized (only perform them on main thread).\nAnd yes, this message will self destruct when you clear the console, and since it's non deterministic, the problem could still exist and it will be hard for you to reproduce it.", NSStringFromClass(class)); ABORT_IN_DEBUG if (RXAbortOnThreadingHazard) { abort(); } + +#define ALWAYS(condition, message) if (!(condition)) { [NSException raise:@"RX Invalid Operator" format:@"%@", message]; } +#define ALWAYS_WITH_INFO(condition, message) NSAssert((condition), @"%@ [%@] > %@", NSStringFromClass(class), NSStringFromSelector(selector), (message)) +#define C_ALWAYS(condition, message) NSCAssert((condition), @"%@ [%@] > %@", NSStringFromClass(class), NSStringFromSelector(selector), (message)) + +#define RX_PREFIX @"_RX_namespace_" + +#define RX_ARG_id(value) ((value) ?: [NSNull null]) +#define RX_ARG_char(value) [NSNumber numberWithChar:value] +#define RX_ARG_short(value) [NSNumber numberWithShort:value] +#define RX_ARG_int(value) [NSNumber numberWithInt:value] +#define RX_ARG_long(value) [NSNumber numberWithLong:value] +#define RX_ARG_BOOL(value) [NSNumber numberWithBool:value] +#define RX_ARG_SEL(value) [NSNumber valueWithPointer:value] +#define RX_ARG_rx_uchar(value) [NSNumber numberWithUnsignedInt:value] +#define RX_ARG_rx_ushort(value) [NSNumber numberWithUnsignedInt:value] +#define RX_ARG_rx_uint(value) [NSNumber numberWithUnsignedInt:value] +#define RX_ARG_rx_ulong(value) [NSNumber numberWithUnsignedLong:value] +#define RX_ARG_rx_block(value) ((id)(value) ?: [NSNull null]) +#define RX_ARG_float(value) [NSNumber numberWithFloat:value] +#define RX_ARG_double(value) [NSNumber numberWithDouble:value] + +typedef struct supported_type { + const char *encoding; +} supported_type_t; + +static supported_type_t supported_types[] = { + { .encoding = @encode(void)}, + { .encoding = @encode(id)}, + { .encoding = @encode(Class)}, + { .encoding = @encode(void (^)(void))}, + { .encoding = @encode(char)}, + { .encoding = @encode(short)}, + { .encoding = @encode(int)}, + { .encoding = @encode(long)}, + { .encoding = @encode(long long)}, + { .encoding = @encode(unsigned char)}, + { .encoding = @encode(unsigned short)}, + { .encoding = @encode(unsigned int)}, + { .encoding = @encode(unsigned long)}, + { .encoding = @encode(unsigned long long)}, + { .encoding = @encode(float)}, + { .encoding = @encode(double)}, + { .encoding = @encode(BOOL)}, + { .encoding = @encode(const char*)}, +}; + +NSString * __nonnull const RXObjCRuntimeErrorDomain = @"RXObjCRuntimeErrorDomain"; +NSString * __nonnull const RXObjCRuntimeErrorIsKVOKey = @"RXObjCRuntimeErrorIsKVOKey"; + +BOOL RX_return_type_is_supported(const char *type) { + if (type == nil) { + return NO; + } + + for (int i = 0; i < sizeof(supported_types) / sizeof(supported_type_t); ++i) { + if (supported_types[i].encoding[0] != type[0]) { + continue; + } + if (strcmp(supported_types[i].encoding, type) == 0) { + return YES; + } + } + + return NO; +} + +static BOOL RX_method_has_supported_return_type(Method method) { + const char *rawEncoding = method_getTypeEncoding(method); + ALWAYS(rawEncoding != nil, @"Example encoding method is nil."); + + NSMethodSignature *methodSignature = [NSMethodSignature signatureWithObjCTypes:rawEncoding]; + ALWAYS(methodSignature != nil, @"Method signature method is nil."); + + return RX_return_type_is_supported(methodSignature.methodReturnType); +} + +SEL __nonnull RX_selector(SEL __nonnull selector) { + NSString *selectorString = NSStringFromSelector(selector); + return NSSelectorFromString([RX_PREFIX stringByAppendingString:selectorString]); +} + +BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature) { + const char *methodReturnType = methodSignature.methodReturnType; + return strcmp(methodReturnType, @encode(void)) == 0; +} + +BOOL RX_is_method_with_description_void(struct objc_method_description method) { + return strncmp(method.types, @encode(void), 1) == 0; +} + +id __nonnull RX_extract_argument_at_index(NSInvocation * __nonnull invocation, NSUInteger index) { + const char *argumentType = [invocation.methodSignature getArgumentTypeAtIndex:index]; + +#define RETURN_VALUE(type) \ + else if (strcmp(argumentType, @encode(type)) == 0) {\ + type val = 0; \ + [invocation getArgument:&val atIndex:index]; \ + return @(val); \ + } + + // Skip const type qualifier. + if (argumentType[0] == 'r') { + argumentType++; + } + + if (strcmp(argumentType, @encode(id)) == 0 + || strcmp(argumentType, @encode(Class)) == 0 + || strcmp(argumentType, @encode(void (^)(void))) == 0 + ) { + __unsafe_unretained id argument = nil; + [invocation getArgument:&argument atIndex:index]; + return argument; + } + RETURN_VALUE(char) + RETURN_VALUE(short) + RETURN_VALUE(int) + RETURN_VALUE(long) + RETURN_VALUE(long long) + RETURN_VALUE(unsigned char) + RETURN_VALUE(unsigned short) + RETURN_VALUE(unsigned int) + RETURN_VALUE(unsigned long) + RETURN_VALUE(unsigned long long) + RETURN_VALUE(float) + RETURN_VALUE(double) + RETURN_VALUE(BOOL) + RETURN_VALUE(const char *) + else { + NSUInteger size = 0; + NSGetSizeAndAlignment(argumentType, &size, NULL); + NSCParameterAssert(size > 0); + uint8_t data[size]; + [invocation getArgument:&data atIndex:index]; + + return [NSValue valueWithBytes:&data objCType:argumentType]; + } +} + +NSArray *RX_extract_arguments(NSInvocation *invocation) { + NSUInteger numberOfArguments = invocation.methodSignature.numberOfArguments; + NSUInteger numberOfVisibleArguments = numberOfArguments - HIDDEN_ARGUMENT_COUNT; + + NSCParameterAssert(numberOfVisibleArguments >= 0); + + NSMutableArray *arguments = [NSMutableArray arrayWithCapacity:numberOfVisibleArguments]; + + for (NSUInteger index = HIDDEN_ARGUMENT_COUNT; index < numberOfArguments; ++index) { + [arguments addObject:RX_extract_argument_at_index(invocation, index) ?: [NSNull null]]; + } + + return arguments; +} + +void * __nonnull RX_reference_from_selector(SEL __nonnull selector) { + return selector; +} + +static BOOL RX_forward_invocation(id __nonnull __unsafe_unretained self, NSInvocation *invocation) { + SEL originalSelector = RX_selector(invocation.selector); + + id messageSentObserver = objc_getAssociatedObject(self, originalSelector); + + if (messageSentObserver != nil) { + NSArray *arguments = RX_extract_arguments(invocation); + [messageSentObserver messageSentWithArguments:arguments]; + } + + if ([self respondsToSelector:originalSelector]) { + invocation.selector = originalSelector; + [invocation invokeWithTarget:self]; + + if (messageSentObserver != nil) { + NSArray *arguments = RX_extract_arguments(invocation); + [messageSentObserver methodInvokedWithArguments:arguments]; + } + + return YES; + } + + return NO; +} + +static BOOL RX_responds_to_selector(id __nonnull __unsafe_unretained self, SEL selector) { + Class class = object_getClass(self); + if (class == nil) { return NO; } + + Method m = class_getInstanceMethod(class, selector); + return m != nil; + +} + +static NSMethodSignatureRef RX_method_signature(id __nonnull __unsafe_unretained self, SEL selector) { + Class class = object_getClass(self); + if (class == nil) { return nil; } + + Method method = class_getInstanceMethod(class, selector); + if (method == nil) { return nil; } + + const char *encoding = method_getTypeEncoding(method); + if (encoding == nil) { return nil; } + + return [NSMethodSignature signatureWithObjCTypes:encoding]; +} + +static NSString * __nonnull RX_method_encoding(Method __nonnull method) { + const char *typeEncoding = method_getTypeEncoding(method); + ALWAYS(typeEncoding != nil, @"Method encoding is nil."); + + NSString *encoding = [NSString stringWithCString:typeEncoding encoding:NSASCIIStringEncoding]; + ALWAYS(encoding != nil, @"Can't convert encoding to NSString."); + return encoding; +} + +@interface RXObjCRuntime: NSObject + +@property (nonatomic, assign) pthread_mutex_t lock; + +@property (nonatomic, strong) NSMutableSet *classesThatSupportObservingByForwarding; +@property (nonatomic, strong) NSMutableDictionary *> *forwardedSelectorsByClass; + +@property (nonatomic, strong) NSMutableDictionary *dynamicSubclassByRealClass; +@property (nonatomic, strong) NSMutableDictionary*> *interceptorIMPbySelectorsByClass; + ++(RXObjCRuntime*)instance; + +-(void)performLocked:(void (^)(RXObjCRuntime* __nonnull))action; +-(IMP __nullable)ensurePrepared:(id __nonnull)target forObserving:(SEL __nonnull)selector error:(NSErrorParam)error; +-(BOOL)ensureSwizzledSelector:(SEL __nonnull)selector + ofClass:(Class __nonnull)class + newImplementationGenerator:(IMP(^)(void))newImplementationGenerator +replacementImplementationGenerator:(IMP (^)(IMP originalImplementation))replacementImplementationGenerator + error:(NSErrorParam)error; + + ++(void)registerOptimizedObserver:(RXInterceptWithOptimizedObserver)registration encodedAs:(SEL)selector; + +@end + +/** + All API methods perform work on locked instance of `RXObjCRuntime`. In that way it's easy to prove + that every action is properly locked. + */ +IMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSErrorParam error) { + __block IMP targetImplementation = nil; + // Target is the second object that needs to be synchronized to TRY to make sure other swizzling framework + // won't do something in parallel. + // Even though this is too fine grained locking and more coarse grained locks should exist, this is just in case + // someone calls this method directly without any external lock. + @synchronized(target) { + // The only other resource that all other swizzling libraries have in common without introducing external + // dependencies is class object. + // + // It is polite to try to synchronize it in hope other unknown entities will also attempt to do so. + // It's like trying to figure out how to communicate with aliens without actually communicating, + // save for the fact that aliens are people, programmers, authors of swizzling libraries. + @synchronized([target class]) { + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + targetImplementation = [self ensurePrepared:target + forObserving:selector + error:error]; + }]; + } + } + + return targetImplementation; +} + +IMP __nonnull RX_default_target_implementation(void) { + return _objc_msgForward; +} + +// bodies + +#define FORWARD_BODY(invocation) if (RX_forward_invocation(self, NAME_CAT(_, 0, invocation))) { return; } + +#define RESPONDS_TO_SELECTOR_BODY(selector) if (RX_responds_to_selector(self, NAME_CAT(_, 0, selector))) return YES; + +#define CLASS_BODY(...) return actAsClass; + +#define METHOD_SIGNATURE_FOR_SELECTOR_BODY(selector) \ + NSMethodSignatureRef methodSignature = RX_method_signature(self, NAME_CAT(_, 0, selector)); \ + if (methodSignature != nil) { \ + return methodSignature; \ + } + +#define DEALLOCATING_BODY(...) \ + id observer = objc_getAssociatedObject(self, rxSelector); \ + if (observer != nil && observer.targetImplementation == thisIMP) { \ + [observer deallocating]; \ + } + +#define OBSERVE_BODY(...) \ + id observer = objc_getAssociatedObject(self, rxSelector); \ + \ + if (observer != nil && observer.targetImplementation == thisIMP) { \ + [observer messageSentWithArguments:@[COMMA_DELIMITED_ARGUMENTS(__VA_ARGS__)]]; \ + } \ + + +#define OBSERVE_INVOKED_BODY(...) \ + if (observer != nil && observer.targetImplementation == thisIMP) { \ + [observer methodInvokedWithArguments:@[COMMA_DELIMITED_ARGUMENTS(__VA_ARGS__)]]; \ + } \ + + +#define BUILD_ARG_WRAPPER(type) RX_ARG_ ## type //RX_ARG_ ## type + +#define CAT(_1, _2, head, tail) RX_CAT2(head, tail) +#define SEPARATE_BY_COMMA(_1, _2, head, tail) head, tail +#define SEPARATE_BY_SPACE(_1, _2, head, tail) head tail +#define SEPARATE_BY_UNDERSCORE(head, tail) RX_CAT2(RX_CAT2(head, _), tail) + +#define UNDERSCORE_TYPE_CAT(_1, index, type) RX_CAT2(_, type) // generates -> _type +#define NAME_CAT(_1, index, type) SEPARATE_BY_UNDERSCORE(type, index) // generates -> type_0 +#define TYPE_AND_NAME_CAT(_1, index, type) type SEPARATE_BY_UNDERSCORE(type, index) // generates -> type type_0 +#define NOT_NULL_ARGUMENT_CAT(_1, index, type) BUILD_ARG_WRAPPER(type)(NAME_CAT(_1, index, type)) // generates -> ((id)(type_0) ?: [NSNull null]) +#define EXAMPLE_PARAMETER(_1, index, type) RX_CAT2(_, type):(type)SEPARATE_BY_UNDERSCORE(type, index) // generates -> _type:(type)type_0 +#define SELECTOR_PART(_1, index, type) RX_CAT2(_, type:) // generates -> _type: + +#define COMMA_DELIMITED_ARGUMENTS(...) RX_FOREACH(_, SEPARATE_BY_COMMA, NOT_NULL_ARGUMENT_CAT, ## __VA_ARGS__) +#define ARGUMENTS(...) RX_FOREACH_COMMA(_, NAME_CAT, ## __VA_ARGS__) +#define DECLARE_ARGUMENTS(...) RX_FOREACH_COMMA(_, TYPE_AND_NAME_CAT, ## __VA_ARGS__) + +// optimized observe methods + +#define GENERATE_METHOD_IDENTIFIER(...) RX_CAT2(swizzle, RX_FOREACH(_, CAT, UNDERSCORE_TYPE_CAT, ## __VA_ARGS__)) + +#define GENERATE_OBSERVE_METHOD_DECLARATION(...) \ + -(BOOL)GENERATE_METHOD_IDENTIFIER(__VA_ARGS__):(Class __nonnull)class \ + selector:(SEL)selector \ + error:(NSErrorParam)error { \ + + +#define BUILD_EXAMPLE_METHOD(return_value, ...) \ + +(return_value)RX_CAT2(RX_CAT2(example_, return_value), RX_FOREACH(_, SEPARATE_BY_SPACE, EXAMPLE_PARAMETER, ## __VA_ARGS__)) {} + +#define BUILD_EXAMPLE_METHOD_SELECTOR(return_value, ...) \ + RX_CAT2(RX_CAT2(example_, return_value), RX_FOREACH(_, SEPARATE_BY_SPACE, SELECTOR_PART, ## __VA_ARGS__)) + +#define SWIZZLE_OBSERVE_METHOD(return_value, ...) \ + @interface RXObjCRuntime (GENERATE_METHOD_IDENTIFIER(return_value, ## __VA_ARGS__)) \ + @end \ + \ + @implementation RXObjCRuntime(GENERATE_METHOD_IDENTIFIER(return_value, ## __VA_ARGS__)) \ + BUILD_EXAMPLE_METHOD(return_value, ## __VA_ARGS__) \ + SWIZZLE_METHOD(return_value, GENERATE_OBSERVE_METHOD_DECLARATION(return_value, ## __VA_ARGS__), OBSERVE_BODY, OBSERVE_INVOKED_BODY, ## __VA_ARGS__) \ + \ + +(void)load { \ + __unused SEL exampleSelector = @selector(BUILD_EXAMPLE_METHOD_SELECTOR(return_value, ## __VA_ARGS__)); \ + [self registerOptimizedObserver:^BOOL(RXObjCRuntime * __nonnull self, Class __nonnull class, \ + SEL __nonnull selector, NSErrorParam error) { \ + return [self GENERATE_METHOD_IDENTIFIER(return_value, ## __VA_ARGS__):class selector:selector error:error]; \ + } encodedAs:exampleSelector]; \ + } \ + \ + @end \ + +// infrastructure method + +#define NO_BODY(...) + +#define SWIZZLE_INFRASTRUCTURE_METHOD(return_value, method_name, parameters, method_selector, body, ...) \ + SWIZZLE_METHOD(return_value, -(BOOL)method_name:(Class __nonnull)class parameters error:(NSErrorParam)error \ + { \ + SEL selector = method_selector; , body, NO_BODY, __VA_ARGS__) \ + + +// common base + +#define SWIZZLE_METHOD(return_value, method_prototype, body, invoked_body, ...) \ +method_prototype \ + __unused SEL rxSelector = RX_selector(selector); \ + IMP (^newImplementationGenerator)(void) = ^() { \ + __block IMP thisIMP = nil; \ + id newImplementation = ^return_value(__unsafe_unretained id self DECLARE_ARGUMENTS(__VA_ARGS__)) { \ + body(__VA_ARGS__) \ + \ + struct objc_super superInfo = { \ + .receiver = self, \ + .super_class = class_getSuperclass(class) \ + }; \ + \ + return_value (*msgSend)(struct objc_super *, SEL DECLARE_ARGUMENTS(__VA_ARGS__)) \ + = (__typeof__(msgSend))objc_msgSendSuper; \ + @try { \ + return msgSend(&superInfo, selector ARGUMENTS(__VA_ARGS__)); \ + } \ + @finally { invoked_body(__VA_ARGS__) } \ + }; \ + \ + thisIMP = imp_implementationWithBlock(newImplementation); \ + return thisIMP; \ + }; \ + \ + IMP (^replacementImplementationGenerator)(IMP) = ^(IMP originalImplementation) { \ + __block return_value (*originalImplementationTyped)(__unsafe_unretained id, SEL DECLARE_ARGUMENTS(__VA_ARGS__) ) \ + = (__typeof__(originalImplementationTyped))(originalImplementation); \ + \ + __block IMP thisIMP = nil; \ + id implementationReplacement = ^return_value(__unsafe_unretained id self DECLARE_ARGUMENTS(__VA_ARGS__) ) { \ + body(__VA_ARGS__) \ + @try { \ + return originalImplementationTyped(self, selector ARGUMENTS(__VA_ARGS__)); \ + } \ + @finally { invoked_body(__VA_ARGS__) } \ + }; \ + \ + thisIMP = imp_implementationWithBlock(implementationReplacement); \ + return thisIMP; \ + }; \ + \ + return [self ensureSwizzledSelector:selector \ + ofClass:class \ + newImplementationGenerator:newImplementationGenerator \ + replacementImplementationGenerator:replacementImplementationGenerator \ + error:error]; \ + } \ + + +@interface RXObjCRuntime (InfrastructureMethods) +@end + +// MARK: Infrastructure Methods + +@implementation RXObjCRuntime (InfrastructureMethods) + +SWIZZLE_INFRASTRUCTURE_METHOD( + void, + swizzleForwardInvocation, + , + @selector(forwardInvocation:), + FORWARD_BODY, + NSInvocationRef +) +SWIZZLE_INFRASTRUCTURE_METHOD( + BOOL, + swizzleRespondsToSelector, + , + @selector(respondsToSelector:), + RESPONDS_TO_SELECTOR_BODY, + SEL +) +SWIZZLE_INFRASTRUCTURE_METHOD( + Class __nonnull, + swizzleClass, + toActAs:(Class)actAsClass, + @selector(class), + CLASS_BODY +) +SWIZZLE_INFRASTRUCTURE_METHOD( + NSMethodSignatureRef, + swizzleMethodSignatureForSelector, + , + @selector(methodSignatureForSelector:), + METHOD_SIGNATURE_FOR_SELECTOR_BODY, + SEL +) +SWIZZLE_INFRASTRUCTURE_METHOD( + void, + swizzleDeallocating, + , + deallocSelector, + DEALLOCATING_BODY +) + +@end + +// MARK: Optimized intercepting methods for specific combination of parameter types + +SWIZZLE_OBSERVE_METHOD(void) + +SWIZZLE_OBSERVE_METHOD(void, id) +SWIZZLE_OBSERVE_METHOD(void, char) +SWIZZLE_OBSERVE_METHOD(void, short) +SWIZZLE_OBSERVE_METHOD(void, int) +SWIZZLE_OBSERVE_METHOD(void, long) +SWIZZLE_OBSERVE_METHOD(void, rx_uchar) +SWIZZLE_OBSERVE_METHOD(void, rx_ushort) +SWIZZLE_OBSERVE_METHOD(void, rx_uint) +SWIZZLE_OBSERVE_METHOD(void, rx_ulong) +SWIZZLE_OBSERVE_METHOD(void, rx_block) +SWIZZLE_OBSERVE_METHOD(void, float) +SWIZZLE_OBSERVE_METHOD(void, double) +SWIZZLE_OBSERVE_METHOD(void, SEL) + +SWIZZLE_OBSERVE_METHOD(void, id, id) +SWIZZLE_OBSERVE_METHOD(void, id, char) +SWIZZLE_OBSERVE_METHOD(void, id, short) +SWIZZLE_OBSERVE_METHOD(void, id, int) +SWIZZLE_OBSERVE_METHOD(void, id, long) +SWIZZLE_OBSERVE_METHOD(void, id, rx_uchar) +SWIZZLE_OBSERVE_METHOD(void, id, rx_ushort) +SWIZZLE_OBSERVE_METHOD(void, id, rx_uint) +SWIZZLE_OBSERVE_METHOD(void, id, rx_ulong) +SWIZZLE_OBSERVE_METHOD(void, id, rx_block) +SWIZZLE_OBSERVE_METHOD(void, id, float) +SWIZZLE_OBSERVE_METHOD(void, id, double) +SWIZZLE_OBSERVE_METHOD(void, id, SEL) + +// MARK: RXObjCRuntime + +@implementation RXObjCRuntime + +static RXObjCRuntime *_instance = nil; +static NSMutableDictionary *optimizedObserversByMethodEncoding = nil; + ++(RXObjCRuntime*)instance { + return _instance; +} + ++(void)initialize { + _instance = [[RXObjCRuntime alloc] init]; + defaultTypeID = CFGetTypeID((CFTypeRef)RXObjCRuntime.class); // just need a reference of some object not from CF + deallocSelector = NSSelectorFromString(@"dealloc"); + NSAssert(_instance != nil, @"Failed to initialize swizzling"); +} + +-(instancetype)init { + self = [super init]; + if (!self) return nil; + + self.classesThatSupportObservingByForwarding = [NSMutableSet set]; + self.forwardedSelectorsByClass = [NSMutableDictionary dictionary]; + + self.dynamicSubclassByRealClass = [NSMutableDictionary dictionary]; + self.interceptorIMPbySelectorsByClass = [NSMutableDictionary dictionary]; + + pthread_mutexattr_t lock_attr; + pthread_mutexattr_init(&lock_attr); + pthread_mutexattr_settype(&lock_attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&_lock, &lock_attr); + pthread_mutexattr_destroy(&lock_attr); + + return self; +} + +-(void)performLocked:(void (^)(RXObjCRuntime* __nonnull))action { + pthread_mutex_lock(&_lock); + action(self); + pthread_mutex_unlock(&_lock); +} + ++(void)registerOptimizedObserver:(RXInterceptWithOptimizedObserver)registration encodedAs:(SEL)selector { + Method exampleEncodingMethod = class_getClassMethod(self, selector); + ALWAYS(exampleEncodingMethod != nil, @"Example encoding method is nil."); + + NSString *methodEncoding = RX_method_encoding(exampleEncodingMethod); + + if (optimizedObserversByMethodEncoding == nil) { + optimizedObserversByMethodEncoding = [NSMutableDictionary dictionary]; + } + + DLOG(@"Added optimized method: %@ (%@)", methodEncoding, NSStringFromSelector(selector)); + ALWAYS(optimizedObserversByMethodEncoding[methodEncoding] == nil, @"Optimized observer already registered") + optimizedObserversByMethodEncoding[methodEncoding] = registration; +} + +/** + This is the main entry point for observing messages sent to arbitrary objects. + */ +-(IMP __nullable)ensurePrepared:(id __nonnull)target forObserving:(SEL __nonnull)selector error:(NSErrorParam)error { + Method instanceMethod = class_getInstanceMethod([target class], selector); + if (instanceMethod == nil) { + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorSelectorNotImplemented + userInfo:nil], nil); + } + + if (selector == @selector(class) + || selector == @selector(forwardingTargetForSelector:) + || selector == @selector(methodSignatureForSelector:) + || selector == @selector(respondsToSelector:)) { + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorObservingPerformanceSensitiveMessages + userInfo:nil], nil); + } + + // For `dealloc` message, original implementation will be swizzled. + // This is a special case because observing `dealloc` message is performed when `observeWeakly` is used. + // + // Some toll free bridged classes don't handle `object_setClass` well and cause crashes. + // + // To make `deallocating` as robust as possible, original implementation will be replaced. + if (selector == deallocSelector) { + Class __nonnull deallocSwizzingTarget = [target class]; + IMP interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:deallocSwizzingTarget]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + + if (![self swizzleDeallocating:deallocSwizzingTarget error:error]) { + return nil; + } + + interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:deallocSwizzingTarget]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + } + else { + Class __nullable swizzlingImplementorClass = [self prepareTargetClassForObserving:target error:error]; + if (swizzlingImplementorClass == nil) { + return nil; + } + + NSString *methodEncoding = RX_method_encoding(instanceMethod); + RXInterceptWithOptimizedObserver optimizedIntercept = optimizedObserversByMethodEncoding[methodEncoding]; + + if (!RX_method_has_supported_return_type(instanceMethod)) { + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorObservingMessagesWithUnsupportedReturnType + userInfo:nil], nil); + } + + // optimized interception method + if (optimizedIntercept != nil) { + IMP interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:swizzlingImplementorClass]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + + if (!optimizedIntercept(self, swizzlingImplementorClass, selector, error)) { + return nil; + } + + interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:swizzlingImplementorClass]; + if (interceptorIMPForSelector != nil) { + return interceptorIMPForSelector; + } + } + // default fallback to observing by forwarding messages + else { + if ([self forwardingSelector:selector forClass:swizzlingImplementorClass]) { + return RX_default_target_implementation(); + } + + if (![self observeByForwardingMessages:swizzlingImplementorClass + selector:selector + target:target + error:error]) { + return nil; + } + + if ([self forwardingSelector:selector forClass:swizzlingImplementorClass]) { + return RX_default_target_implementation(); + } + } + } + + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorUnknown + userInfo:nil], nil); +} + +-(Class __nullable)prepareTargetClassForObserving:(id __nonnull)target error:(NSErrorParam)error { + Class swizzlingClass = objc_getAssociatedObject(target, &RxSwizzlingTargetClassKey); + if (swizzlingClass != nil) { + return swizzlingClass; + } + + Class __nonnull wannaBeClass = [target class]; + /** + Core Foundation classes are usually toll free bridged. Those classes crash the program in case + `object_setClass` is performed on them. + + There is a possibility to just swizzle methods on original object, but since those won't be usual use + cases for this library, then an error will just be reported for now. + */ + BOOL isThisTollFreeFoundationClass = CFGetTypeID((CFTypeRef)target) != defaultTypeID; + + if (isThisTollFreeFoundationClass) { + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorCantInterceptCoreFoundationTollFreeBridgedObjects + userInfo:nil], nil); + } + + /** + If the object is reporting a different class then what it's real class, that means that there is probably + already some interception mechanism in place or something weird is happening. + + Most common case when this would happen is when using KVO (`observe`) and `sentMessage`. + + This error is easily resolved by just using `sentMessage` observing before `observe`. + + The reason why other way around could create issues is because KVO will unregister it's interceptor + class and restore original class. Unfortunately that will happen no matter was there another interceptor + subclass registered in hierarchy or not. + + Failure scenario: + * KVO sets class to be `__KVO__OriginalClass` (subclass of `OriginalClass`) + * `sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`) + * then unobserving with KVO will restore class to be `OriginalClass` -> failure point + + The reason why changing order of observing works is because any interception method should return + object's original real class (if that doesn't happen then it's really easy to argue that's a bug + in that other library). + + This library won't remove registered interceptor even if there aren't any observers left because + it's highly unlikely it would have any benefit in real world use cases, and it's even more + dangerous. + */ + if ([target class] != object_getClass(target)) { + BOOL isKVO = [target respondsToSelector:NSSelectorFromString(@"_isKVOA")]; + + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorObjectMessagesAlreadyBeingIntercepted + userInfo:@{ + RXObjCRuntimeErrorIsKVOKey : @(isKVO) + }], nil); + } + + Class __nullable dynamicFakeSubclass = [self ensureHasDynamicFakeSubclass:wannaBeClass error:error]; + + if (dynamicFakeSubclass == nil) { + return nil; + } + + Class previousClass = object_setClass(target, dynamicFakeSubclass); + if (previousClass != wannaBeClass) { + THREADING_HAZARD(wannaBeClass); + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorThreadingCollisionWithOtherInterceptionMechanism + userInfo:nil], nil); + } + + objc_setAssociatedObject(target, &RxSwizzlingTargetClassKey, dynamicFakeSubclass, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + return dynamicFakeSubclass; +} + + +-(BOOL)forwardingSelector:(SEL)selector forClass:(Class __nonnull)class { + return [self.forwardedSelectorsByClass[CLASS_VALUE(class)] containsObject:SEL_VALUE(selector)]; +} + +-(void)registerForwardedSelector:(SEL)selector forClass:(Class __nonnull)class { + NSValue *classValue = CLASS_VALUE(class); + + NSMutableSet *forwardedSelectors = self.forwardedSelectorsByClass[classValue]; + + if (forwardedSelectors == nil) { + forwardedSelectors = [NSMutableSet set]; + self.forwardedSelectorsByClass[classValue] = forwardedSelectors; + } + + [forwardedSelectors addObject:SEL_VALUE(selector)]; +} + +-(BOOL)observeByForwardingMessages:(Class __nonnull)swizzlingImplementorClass + selector:(SEL)selector + target:(id __nonnull)target + error:(NSErrorParam)error { + if (![self ensureForwardingMethodsAreSwizzled:swizzlingImplementorClass error:error]) { + return NO; + } + + ALWAYS(![self forwardingSelector:selector forClass:swizzlingImplementorClass], @"Already observing selector for class"); + +#if TRACE_RESOURCES + OSAtomicIncrement32Barrier(&numberOfForwardedMethods); +#endif + SEL rxSelector = RX_selector(selector); + + Method instanceMethod = class_getInstanceMethod(swizzlingImplementorClass, selector); + ALWAYS(instanceMethod != nil, @"Instance method is nil"); + + const char* methodEncoding = method_getTypeEncoding(instanceMethod); + ALWAYS(methodEncoding != nil, @"Method encoding is nil."); + NSMethodSignature *methodSignature = [NSMethodSignature signatureWithObjCTypes:methodEncoding]; + ALWAYS(methodSignature != nil, @"Method signature is invalid."); + + IMP implementation = method_getImplementation(instanceMethod); + + if (implementation == nil) { + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorSelectorNotImplemented + userInfo:nil], NO); + } + + if (!class_addMethod(swizzlingImplementorClass, rxSelector, implementation, methodEncoding)) { + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorSavingOriginalForwardingMethodFailed + userInfo:nil], NO); + } + + if (!class_addMethod(swizzlingImplementorClass, selector, _objc_msgForward, methodEncoding)) { + if (implementation != method_setImplementation(instanceMethod, _objc_msgForward)) { + THREADING_HAZARD(swizzlingImplementorClass); + RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain + code:RXObjCRuntimeErrorReplacingMethodWithForwardingImplementation + userInfo:nil], NO); + } + } + + DLOG(@"Rx uses forwarding to observe `%@` for `%@`.", NSStringFromSelector(selector), swizzlingImplementorClass); + [self registerForwardedSelector:selector forClass:swizzlingImplementorClass]; + + return YES; +} + +/** + If object don't have some weird behavior, claims it's the same class that runtime shows, + then dynamic subclass is created (only this instance will have performance hit). + + In case something weird is detected, then original base class is being swizzled and all instances + will have somewhat reduced performance. + + This is especially handy optimization for weak KVO. Nobody will swizzle for example `NSString`, + but to know when instance of a `NSString` was deallocated, performance hit will be only felt on a + single instance of `NSString`, not all instances of `NSString`s. + */ +-(Class __nullable)ensureHasDynamicFakeSubclass:(Class __nonnull)class error:(NSErrorParam)error { + Class dynamicFakeSubclass = self.dynamicSubclassByRealClass[CLASS_VALUE(class)]; + if (dynamicFakeSubclass != nil) { + return dynamicFakeSubclass; + } + + NSString *dynamicFakeSubclassName = [RX_PREFIX stringByAppendingString:NSStringFromClass(class)]; + const char *dynamicFakeSubclassNameRaw = dynamicFakeSubclassName.UTF8String; + dynamicFakeSubclass = objc_allocateClassPair(class, dynamicFakeSubclassNameRaw, 0); + ALWAYS(dynamicFakeSubclass != nil, @"Class not generated"); + + if (![self swizzleClass:dynamicFakeSubclass toActAs:class error:error]) { + return nil; + } + + objc_registerClassPair(dynamicFakeSubclass); + + [self.dynamicSubclassByRealClass setObject:dynamicFakeSubclass forKey:CLASS_VALUE(class)]; + ALWAYS(self.dynamicSubclassByRealClass[CLASS_VALUE(class)] != nil, @"Class not registered"); + + return dynamicFakeSubclass; +} + +-(BOOL)ensureForwardingMethodsAreSwizzled:(Class __nonnull)class error:(NSErrorParam)error { + NSValue *classValue = CLASS_VALUE(class); + if ([self.classesThatSupportObservingByForwarding containsObject:classValue]) { + return YES; + } + + if (![self swizzleForwardInvocation:class error:error]) { return NO; } + if (![self swizzleMethodSignatureForSelector:class error:error]) { return NO; } + if (![self swizzleRespondsToSelector:class error:error]) { return NO; } + + [self.classesThatSupportObservingByForwarding addObject:classValue]; + + return YES; +} + +-(void)registerInterceptedSelector:(SEL)selector implementation:(IMP)implementation forClass:(Class)class { + NSValue * __nonnull classValue = CLASS_VALUE(class); + NSValue * __nonnull selectorValue = SEL_VALUE(selector); + + NSMutableDictionary *swizzledIMPBySelectorsForClass = self.interceptorIMPbySelectorsByClass[classValue]; + + if (swizzledIMPBySelectorsForClass == nil) { + swizzledIMPBySelectorsForClass = [NSMutableDictionary dictionary]; + self.interceptorIMPbySelectorsByClass[classValue] = swizzledIMPBySelectorsForClass; + } + + swizzledIMPBySelectorsForClass[selectorValue] = IMP_VALUE(implementation); + + ALWAYS([self interceptorImplementationForSelector:selector forClass:class] != nil, @"Class should have been swizzled"); +} + +-(IMP)interceptorImplementationForSelector:(SEL)selector forClass:(Class)class { + NSValue * __nonnull classValue = CLASS_VALUE(class); + NSValue * __nonnull selectorValue = SEL_VALUE(selector); + + NSMutableDictionary *swizzledIMPBySelectorForClass = self.interceptorIMPbySelectorsByClass[classValue]; + + NSValue *impValue = swizzledIMPBySelectorForClass[selectorValue]; + return impValue.pointerValue; +} + +-(BOOL)ensureSwizzledSelector:(SEL __nonnull)selector + ofClass:(Class __nonnull)class + newImplementationGenerator:(IMP(^)(void))newImplementationGenerator +replacementImplementationGenerator:(IMP (^)(IMP originalImplementation))replacementImplementationGenerator + error:(NSErrorParam)error { + if ([self interceptorImplementationForSelector:selector forClass:class] != nil) { + DLOG(@"Trying to register same intercept at least once, this sounds like a possible bug"); + return YES; + } + +#if TRACE_RESOURCES + OSAtomicIncrement32Barrier(&numberOInterceptedMethods); +#endif + + DLOG(@"Rx is swizzling `%@` for `%@`", NSStringFromSelector(selector), class); + + Method existingMethod = class_getInstanceMethod(class, selector); + ALWAYS(existingMethod != nil, @"Method doesn't exist"); + + const char *encoding = method_getTypeEncoding(existingMethod); + ALWAYS(encoding != nil, @"Encoding is nil"); + + IMP newImplementation = newImplementationGenerator(); + + if (class_addMethod(class, selector, newImplementation, encoding)) { + // new method added, job done + [self registerInterceptedSelector:selector implementation:newImplementation forClass:class]; + + return YES; + } + + imp_removeBlock(newImplementation); + + // if add fails, that means that method already exists on targetClass + Method existingMethodOnTargetClass = existingMethod; + + IMP originalImplementation = method_getImplementation(existingMethodOnTargetClass); + ALWAYS(originalImplementation != nil, @"Method must exist."); + IMP implementationReplacementIMP = replacementImplementationGenerator(originalImplementation); + ALWAYS(implementationReplacementIMP != nil, @"Method must exist."); + IMP originalImplementationAfterChange = method_setImplementation(existingMethodOnTargetClass, implementationReplacementIMP); + ALWAYS(originalImplementation != nil, @"Method must exist."); + + // If method replacing failed, who knows what happened, better not trying again, otherwise program can get + // corrupted. + [self registerInterceptedSelector:selector implementation:implementationReplacementIMP forClass:class]; + + // ¯\_(ツ)_/¯ + if (originalImplementationAfterChange != originalImplementation) { + THREADING_HAZARD(class); + return NO; + } + + return YES; +} + +@end + +#if TRACE_RESOURCES + +NSInteger RX_number_of_dynamic_subclasses() { + __block NSInteger count = 0; + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + count = self.dynamicSubclassByRealClass.count; + }]; + + return count; +} + +NSInteger RX_number_of_forwarding_enabled_classes() { + __block NSInteger count = 0; + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + count = self.classesThatSupportObservingByForwarding.count; + }]; + + return count; +} + +NSInteger RX_number_of_intercepting_classes() { + __block NSInteger count = 0; + [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { + count = self.interceptorIMPbySelectorsByClass.count; + }]; + + return count; +} + +NSInteger RX_number_of_forwarded_methods() { + return numberOfForwardedMethods; +} + +NSInteger RX_number_of_swizzled_methods() { + return numberOInterceptedMethods; +} + +#endif + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h new file mode 100644 index 0000000..8cf762e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h @@ -0,0 +1,19 @@ +// +// RxCocoaRuntime.h +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import +#import "_RX.h" +#import "_RXDelegateProxy.h" +#import "_RXKVOObserver.h" +#import "_RXObjCRuntime.h" + +//! Project version number for RxCocoa. +FOUNDATION_EXPORT double RxCocoaVersionNumber; + +//! Project version string for RxCocoa. +FOUNDATION_EXPORT const unsigned char RxCocoaVersionString[]; diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h new file mode 100644 index 0000000..b868ac9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h @@ -0,0 +1,93 @@ +// +// _RX.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import +#import + +/** + ################################################################################ + This file is part of RX private API + ################################################################################ + */ + +#if TRACE_RESOURCES >= 2 +# define DLOG(...) NSLog(__VA_ARGS__) +#else +# define DLOG(...) +#endif + +#if DEBUG +# define ABORT_IN_DEBUG abort(); +#else +# define ABORT_IN_DEBUG +#endif + + +#define SEL_VALUE(x) [NSValue valueWithPointer:(x)] +#define CLASS_VALUE(x) [NSValue valueWithNonretainedObject:(x)] +#define IMP_VALUE(x) [NSValue valueWithPointer:(x)] + +/** + Checks that the local `error` instance exists before assigning it's value by reference. + This macro exists to work around static analysis warnings — `NSError` is always assumed to be `nullable`, even though we explicitly define the method parameter as `nonnull`. See http://www.openradar.me/21766176 for more details. + */ +#define RX_THROW_ERROR(errorValue, returnValue) if (error != nil) { *error = (errorValue); } return (returnValue); + +#define RX_CAT2(_1, _2) _RX_CAT2(_1, _2) +#define _RX_CAT2(_1, _2) _1 ## _2 + +#define RX_ELEMENT_AT(n, ...) RX_CAT2(_RX_ELEMENT_AT_, n)(__VA_ARGS__) +#define _RX_ELEMENT_AT_0(x, ...) x +#define _RX_ELEMENT_AT_1(_0, x, ...) x +#define _RX_ELEMENT_AT_2(_0, _1, x, ...) x +#define _RX_ELEMENT_AT_3(_0, _1, _2, x, ...) x +#define _RX_ELEMENT_AT_4(_0, _1, _2, _3, x, ...) x +#define _RX_ELEMENT_AT_5(_0, _1, _2, _3, _4, x, ...) x +#define _RX_ELEMENT_AT_6(_0, _1, _2, _3, _4, _5, x, ...) x + +#define RX_COUNT(...) RX_ELEMENT_AT(6, ## __VA_ARGS__, 6, 5, 4, 3, 2, 1, 0) +#define RX_EMPTY(...) RX_ELEMENT_AT(6, ## __VA_ARGS__, 0, 0, 0, 0, 0, 0, 1) + +/** + #define SUM(context, index, head, tail) head + tail + #define MAP(context, index, element) (context)[index] * (element) + + RX_FOR(numbers, SUM, MAP, b0, b1, b2); + + (numbers)[0] * (b0) + (numbers)[1] * (b1) + (numbers[2]) * (b2) + */ + +#define RX_FOREACH(context, concat, map, ...) RX_FOR_MAX(RX_COUNT(__VA_ARGS__), _RX_FOREACH_CONCAT, _RX_FOREACH_MAP, context, concat, map, __VA_ARGS__) +#define _RX_FOREACH_CONCAT(index, head, tail, context, concat, map, ...) concat(context, index, head, tail) +#define _RX_FOREACH_MAP(index, context, concat, map, ...) map(context, index, RX_ELEMENT_AT(index, __VA_ARGS__)) + +/** + #define MAP(context, index, item) (context)[index] * (item) + + RX_FOR_COMMA(numbers, MAP, b0, b1); + + ,(numbers)[0] * b0, (numbers)[1] * b1 + */ +#define RX_FOREACH_COMMA(context, map, ...) RX_CAT2(_RX_FOREACH_COMMA_EMPTY_, RX_EMPTY(__VA_ARGS__))(context, map, ## __VA_ARGS__) +#define _RX_FOREACH_COMMA_EMPTY_1(context, map, ...) +#define _RX_FOREACH_COMMA_EMPTY_0(context, map, ...) , RX_FOR_MAX(RX_COUNT(__VA_ARGS__), _RX_FOREACH_COMMA_CONCAT, _RX_FOREACH_COMMA_MAP, context, map, __VA_ARGS__) +#define _RX_FOREACH_COMMA_CONCAT(index, head, tail, context, map, ...) head, tail +#define _RX_FOREACH_COMMA_MAP(index, context, map, ...) map(context, index, RX_ELEMENT_AT(index, __VA_ARGS__)) + +// rx for + +#define RX_FOR_MAX(max, concat, map, ...) RX_CAT2(RX_FOR_, max)(concat, map, ## __VA_ARGS__) + +#define RX_FOR_0(concat, map, ...) +#define RX_FOR_1(concat, map, ...) map(0, __VA_ARGS__) +#define RX_FOR_2(concat, map, ...) concat(1, RX_FOR_1(concat, map, ## __VA_ARGS__), map(1, __VA_ARGS__), __VA_ARGS__) +#define RX_FOR_3(concat, map, ...) concat(2, RX_FOR_2(concat, map, ## __VA_ARGS__), map(2, __VA_ARGS__), __VA_ARGS__) +#define RX_FOR_4(concat, map, ...) concat(3, RX_FOR_3(concat, map, ## __VA_ARGS__), map(3, __VA_ARGS__), __VA_ARGS__) +#define RX_FOR_5(concat, map, ...) concat(4, RX_FOR_4(concat, map, ## __VA_ARGS__), map(4, __VA_ARGS__), __VA_ARGS__) +#define RX_FOR_6(concat, map, ...) concat(5, RX_FOR_5(concat, map, ## __VA_ARGS__), map(5, __VA_ARGS__), __VA_ARGS__) + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h new file mode 100644 index 0000000..e1cc207 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h @@ -0,0 +1,27 @@ +// +// _RXDelegateProxy.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface _RXDelegateProxy : NSObject + +@property (nonatomic, weak, readonly) id _forwardToDelegate; + +-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate NS_SWIFT_NAME(_setForwardToDelegate(_:retainDelegate:)) ; + +-(BOOL)hasWiredImplementationForSelector:(SEL)selector; +-(BOOL)voidDelegateMethodsContain:(SEL)selector; + +-(void)_sentMessage:(SEL)selector withArguments:(NSArray*)arguments; +-(void)_methodInvoked:(SEL)selector withArguments:(NSArray*)arguments; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h new file mode 100644 index 0000000..adcfd0a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h @@ -0,0 +1,28 @@ +// +// _RXKVOObserver.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import + +/** + ################################################################################ + This file is part of RX private API + ################################################################################ + */ + +// Exists because if written in Swift, reading unowned is disabled during dealloc process +@interface _RXKVOObserver : NSObject + +-(instancetype)initWithTarget:(id)target + retainTarget:(BOOL)retainTarget + keyPath:(NSString*)keyPath + options:(NSKeyValueObservingOptions)options + callback:(void (^)(id))callback; + +-(void)dispose; + +@end diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h new file mode 100644 index 0000000..9824a3b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h @@ -0,0 +1,102 @@ +// +// _RXObjCRuntime.h +// RxCocoa +// +// Created by Krunoslav Zaher on 7/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import + +#if !DISABLE_SWIZZLING + +/** + ################################################################################ + This file is part of RX private API + ################################################################################ + */ + +/** + This flag controls `RELEASE` configuration behavior in case race was detecting while modifying + ObjC runtime. + + In case this value is set to `YES`, after runtime race is detected, `abort()` will be called. + Otherwise, only error will be reported using normal error reporting mechanism. + + In `DEBUG` mode `abort` will be always called in case race is detected. + + Races can't happen in case this is the only library modifying ObjC runtime, but in case there are multiple libraries + changing ObjC runtime, race conditions can occur because there is no way to synchronize multiple libraries unaware of + each other. + + To help remedy this situation this library will use `synchronized` on target object and it's meta-class, but + there aren't any guarantees of how other libraries will behave. + + Default value is `NO`. + + */ +extern BOOL RXAbortOnThreadingHazard; + +/// Error domain for RXObjCRuntime. +extern NSString * __nonnull const RXObjCRuntimeErrorDomain; + +/// `userInfo` key with additional information is interceptor probably KVO. +extern NSString * __nonnull const RXObjCRuntimeErrorIsKVOKey; + +typedef NS_ENUM(NSInteger, RXObjCRuntimeError) { + RXObjCRuntimeErrorUnknown = 1, + RXObjCRuntimeErrorObjectMessagesAlreadyBeingIntercepted = 2, + RXObjCRuntimeErrorSelectorNotImplemented = 3, + RXObjCRuntimeErrorCantInterceptCoreFoundationTollFreeBridgedObjects = 4, + RXObjCRuntimeErrorThreadingCollisionWithOtherInterceptionMechanism = 5, + RXObjCRuntimeErrorSavingOriginalForwardingMethodFailed = 6, + RXObjCRuntimeErrorReplacingMethodWithForwardingImplementation = 7, + RXObjCRuntimeErrorObservingPerformanceSensitiveMessages = 8, + RXObjCRuntimeErrorObservingMessagesWithUnsupportedReturnType = 9, +}; + +/// Transforms normal selector into a selector with RX prefix. +SEL _Nonnull RX_selector(SEL _Nonnull selector); + +/// Transforms selector into a unique pointer (because of Swift conversion rules) +void * __nonnull RX_reference_from_selector(SEL __nonnull selector); + +/// Protocol that interception observers must implement. +@protocol RXMessageSentObserver + +/// In case the same selector is being intercepted for a pair of base/sub classes, +/// this property will differentiate between interceptors that need to fire. +@property (nonatomic, assign, readonly) IMP __nonnull targetImplementation; + +-(void)messageSentWithArguments:(NSArray* __nonnull)arguments; +-(void)methodInvokedWithArguments:(NSArray* __nonnull)arguments; + +@end + +/// Protocol that deallocating observer must implement. +@protocol RXDeallocatingObserver + +/// In case the same selector is being intercepted for a pair of base/sub classes, +/// this property will differentiate between interceptors that need to fire. +@property (nonatomic, assign, readonly) IMP __nonnull targetImplementation; + +-(void)deallocating; + +@end + +/// Ensures interceptor is installed on target object. +IMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSError *__autoreleasing __nullable * __nullable error); + +/// Extracts arguments for `invocation`. +NSArray * __nonnull RX_extract_arguments(NSInvocation * __nonnull invocation); + +/// Returns `YES` in case method has `void` return type. +BOOL RX_is_method_with_description_void(struct objc_method_description method); + +/// Returns `YES` in case methodSignature has `void` return type. +BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature); + +/// Default value for `RXInterceptionObserver.targetImplementation`. +IMP __nonnull RX_default_target_implementation(void); + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.h b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.h new file mode 100644 index 0000000..7436904 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.h @@ -0,0 +1,19 @@ +// +// RxCocoa.h +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#import +#import "_RX.h" +#import "_RXDelegateProxy.h" +#import "_RXKVOObserver.h" +#import "_RXObjCRuntime.h" + +//! Project version number for RxCocoa. +FOUNDATION_EXPORT double RxCocoaVersionNumber; + +//! Project version string for RxCocoa. +FOUNDATION_EXPORT const unsigned char RxCocoaVersionString[]; \ No newline at end of file diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.swift new file mode 100644 index 0000000..78f8c98 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/RxCocoa.swift @@ -0,0 +1,152 @@ +// +// RxCocoa.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.NSNull + +import RxSwift +#if os(iOS) + import UIKit +#endif + +/// RxCocoa errors. +public enum RxCocoaError + : Swift.Error + , CustomDebugStringConvertible { + /// Unknown error has occurred. + case unknown + /// Invalid operation was attempted. + case invalidOperation(object: Any) + /// Items are not yet bound to user interface but have been requested. + case itemsNotYetBound(object: Any) + /// Invalid KVO Path. + case invalidPropertyName(object: Any, propertyName: String) + /// Invalid object on key path. + case invalidObjectOnKeyPath(object: Any, sourceObject: AnyObject, propertyName: String) + /// Error during swizzling. + case errorDuringSwizzling + /// Casting error. + case castingError(object: Any, targetType: Any.Type) +} + + +// MARK: Debug descriptions + +extension RxCocoaError { + /// A textual representation of `self`, suitable for debugging. + public var debugDescription: String { + switch self { + case .unknown: + return "Unknown error occurred." + case let .invalidOperation(object): + return "Invalid operation was attempted on `\(object)`." + case let .itemsNotYetBound(object): + return "Data source is set, but items are not yet bound to user interface for `\(object)`." + case let .invalidPropertyName(object, propertyName): + return "Object `\(object)` doesn't have a property named `\(propertyName)`." + case let .invalidObjectOnKeyPath(object, sourceObject, propertyName): + return "Unobservable object `\(object)` was observed as `\(propertyName)` of `\(sourceObject)`." + case .errorDuringSwizzling: + return "Error during swizzling." + case .castingError(let object, let targetType): + return "Error casting `\(object)` to `\(targetType)`" + } + } +} + + + +// MARK: Error binding policies + +func bindingError(_ error: Swift.Error) { + let error = "Binding error: \(error)" +#if DEBUG + rxFatalError(error) +#else + print(error) +#endif +} + +/// Swift does not implement abstract methods. This method is used as a runtime check to ensure that methods which intended to be abstract (i.e., they should be implemented in subclasses) are not called directly on the superclass. +func rxAbstractMethod(message: String = "Abstract method", file: StaticString = #file, line: UInt = #line) -> Swift.Never { + rxFatalError(message, file: file, line: line) +} + +func rxFatalError(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Swift.Never { + // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours. + fatalError(lastMessage(), file: file, line: line) +} + +func rxFatalErrorInDebug(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) { + #if DEBUG + fatalError(lastMessage(), file: file, line: line) + #else + print("\(file):\(line): \(lastMessage())") + #endif +} + +// MARK: casts or fatal error + +// workaround for Swift compiler bug, cheers compiler team :) +func castOptionalOrFatalError(_ value: Any?) -> T? { + if value == nil { + return nil + } + let v: T = castOrFatalError(value) + return v +} + +func castOrThrow(_ resultType: T.Type, _ object: Any) throws -> T { + guard let returnValue = object as? T else { + throw RxCocoaError.castingError(object: object, targetType: resultType) + } + + return returnValue +} + +func castOptionalOrThrow(_ resultType: T.Type, _ object: AnyObject) throws -> T? { + if NSNull().isEqual(object) { + return nil + } + + guard let returnValue = object as? T else { + throw RxCocoaError.castingError(object: object, targetType: resultType) + } + + return returnValue +} + +func castOrFatalError(_ value: AnyObject!, message: String) -> T { + let maybeResult: T? = value as? T + guard let result = maybeResult else { + rxFatalError(message) + } + + return result +} + +func castOrFatalError(_ value: Any!) -> T { + let maybeResult: T? = value as? T + guard let result = maybeResult else { + rxFatalError("Failure converting from \(value) to \(T.self)") + } + + return result +} + +// MARK: Error messages + +let dataSourceNotSet = "DataSource not set" +let delegateNotSet = "Delegate not set" + +// MARK: Shared with RxSwift + +func rxFatalError(_ lastMessage: String) -> Never { + // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours. + fatalError(lastMessage) +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/BehaviorRelay.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/BehaviorRelay.swift new file mode 100644 index 0000000..b80b6da --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/BehaviorRelay.swift @@ -0,0 +1,44 @@ +// +// BehaviorRelay.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 10/7/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/// BehaviorRelay is a wrapper for `BehaviorSubject`. +/// +/// Unlike `BehaviorSubject` it can't terminate with error or completed. +public final class BehaviorRelay: ObservableType { + public typealias E = Element + + private let _subject: BehaviorSubject + + // Accepts `event` and emits it to subscribers + public func accept(_ event: Element) { + _subject.onNext(event) + } + + /// Current value of behavior subject + public var value: Element { + // this try! is ok because subject can't error out or be disposed + return try! _subject.value() + } + + /// Initializes variable with initial value. + public init(value: Element) { + _subject = BehaviorSubject(value: value) + } + + /// Subscribes observer + public func subscribe(_ observer: O) -> Disposable where O.E == E { + return _subject.subscribe(observer) + } + + /// - returns: Canonical interface for push style sequence + public func asObservable() -> Observable { + return _subject.asObservable() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlEvent.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlEvent.swift new file mode 100644 index 0000000..06a0f7b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlEvent.swift @@ -0,0 +1,69 @@ +// +// ControlEvent.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 8/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/// Protocol that enables extension of `ControlEvent`. +public protocol ControlEventType : ObservableType { + + /// - returns: `ControlEvent` interface + func asControlEvent() -> ControlEvent +} + +/** + Trait for `Observable`/`ObservableType` that represents event on UI element. + + It's properties are: + + - it never fails + - it won't send any initial value on subscription + - it will `Complete` sequence on control being deallocated + - it never errors out + - it delivers events on `MainScheduler.instance` + + **The implementation of `ControlEvent` will ensure that sequence of events is being subscribed on main scheduler + (`subscribeOn(ConcurrentMainScheduler.instance)` behavior).** + + **It is implementor's responsibility to make sure that that all other properties enumerated above are satisfied.** + + **If they aren't, then using this trait communicates wrong properties and could potentially break someone's code.** + + **In case `events` observable sequence that is being passed into initializer doesn't satisfy all enumerated + properties, please don't use this trait.** +*/ +public struct ControlEvent : ControlEventType { + public typealias E = PropertyType + + let _events: Observable + + /// Initializes control event with a observable sequence that represents events. + /// + /// - parameter events: Observable sequence that represents events. + /// - returns: Control event created with a observable sequence of events. + public init(events: Ev) where Ev.E == E { + _events = events.subscribeOn(ConcurrentMainScheduler.instance) + } + + /// Subscribes an observer to control events. + /// + /// - parameter observer: Observer to subscribe to events. + /// - returns: Disposable object that can be used to unsubscribe the observer from receiving control events. + public func subscribe(_ observer: O) -> Disposable where O.E == E { + return _events.subscribe(observer) + } + + /// - returns: `Observable` interface. + public func asObservable() -> Observable { + return _events + } + + /// - returns: `ControlEvent` interface. + public func asControlEvent() -> ControlEvent { + return self + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlProperty.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlProperty.swift new file mode 100644 index 0000000..821c46d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/ControlProperty.swift @@ -0,0 +1,121 @@ +// +// ControlProperty.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 8/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/// Protocol that enables extension of `ControlProperty`. +public protocol ControlPropertyType : ObservableType, ObserverType { + + /// - returns: `ControlProperty` interface + func asControlProperty() -> ControlProperty +} + +/** + Trait for `Observable`/`ObservableType` that represents property of UI element. + + Sequence of values only represents initial control value and user initiated value changes. + Programatic value changes won't be reported. + + It's properties are: + + - it never fails + - `shareReplay(1)` behavior + - it's stateful, upon subscription (calling subscribe) last element is immediately replayed if it was produced + - it will `Complete` sequence on control being deallocated + - it never errors out + - it delivers events on `MainScheduler.instance` + + **The implementation of `ControlProperty` will ensure that sequence of values is being subscribed on main scheduler + (`subscribeOn(ConcurrentMainScheduler.instance)` behavior).** + + **It is implementor's responsibility to make sure that that all other properties enumerated above are satisfied.** + + **If they aren't, then using this trait communicates wrong properties and could potentially break someone's code.** + + **In case `values` observable sequence that is being passed into initializer doesn't satisfy all enumerated + properties, please don't use this trait.** +*/ +public struct ControlProperty : ControlPropertyType { + public typealias E = PropertyType + + let _values: Observable + let _valueSink: AnyObserver + + /// Initializes control property with a observable sequence that represents property values and observer that enables + /// binding values to property. + /// + /// - parameter values: Observable sequence that represents property values. + /// - parameter valueSink: Observer that enables binding values to control property. + /// - returns: Control property created with a observable sequence of values and an observer that enables binding values + /// to property. + public init(values: V, valueSink: S) where E == V.E, E == S.E { + _values = values.subscribeOn(ConcurrentMainScheduler.instance) + _valueSink = valueSink.asObserver() + } + + /// Subscribes an observer to control property values. + /// + /// - parameter observer: Observer to subscribe to property values. + /// - returns: Disposable object that can be used to unsubscribe the observer from receiving control property values. + public func subscribe(_ observer: O) -> Disposable where O.E == E { + return _values.subscribe(observer) + } + + /// `ControlEvent` of user initiated value changes. Every time user updates control value change event + /// will be emitted from `changed` event. + /// + /// Programatic changes to control value won't be reported. + /// + /// It contains all control property values except for first one. + /// + /// The name only implies that sequence element will be generated once user changes a value and not that + /// adjacent sequence values need to be different (e.g. because of interaction between programatic and user updates, + /// or for any other reason). + public var changed: ControlEvent { + get { + return ControlEvent(events: _values.skip(1)) + } + } + + /// - returns: `Observable` interface. + public func asObservable() -> Observable { + return _values + } + + /// - returns: `ControlProperty` interface. + public func asControlProperty() -> ControlProperty { + return self + } + + /// Binds event to user interface. + /// + /// - In case next element is received, it is being set to control value. + /// - In case error is received, DEBUG buids raise fatal error, RELEASE builds log event to standard output. + /// - In case sequence completes, nothing happens. + public func on(_ event: Event) { + switch event { + case .error(let error): + bindingError(error) + case .next: + _valueSink.on(event) + case .completed: + _valueSink.on(event) + } + } +} + +extension ControlPropertyType where E == String? { + /// Transforms control property of type `String?` into control property of type `String`. + public var orEmpty: ControlProperty { + let original: ControlProperty = self.asControlProperty() + + let values: Observable = original._values.map { $0 ?? "" } + let valueSink: AnyObserver = original._valueSink.mapObserver { $0 } + return ControlProperty(values: values, valueSink: valueSink) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift new file mode 100644 index 0000000..b882e40 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift @@ -0,0 +1,20 @@ +// +// BehaviorRelay+Driver.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 10/7/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension BehaviorRelay { + /// Converts `BehaviorRelay` to `Driver`. + /// + /// - returns: Observable sequence. + public func asDriver() -> Driver { + let source = self.asObservable() + .observeOn(DriverSharingStrategy.scheduler) + return SharedSequence(source) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlEvent+Driver.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlEvent+Driver.swift new file mode 100644 index 0000000..c0ca704 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlEvent+Driver.swift @@ -0,0 +1,24 @@ +// +// ControlEvent+Driver.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension ControlEvent { + /// Converts `ControlEvent` to `Driver` trait. + /// + /// `ControlEvent` already can't fail, so no special case needs to be handled. + public func asDriver() -> Driver { + return self.asDriver { (error) -> Driver in + #if DEBUG + rxFatalError("Somehow driver received error from a source that shouldn't fail.") + #else + return Driver.empty() + #endif + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlProperty+Driver.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlProperty+Driver.swift new file mode 100644 index 0000000..c809780 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlProperty+Driver.swift @@ -0,0 +1,24 @@ +// +// ControlProperty+Driver.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension ControlProperty { + /// Converts `ControlProperty` to `Driver` trait. + /// + /// `ControlProperty` already can't fail, so no special case needs to be handled. + public func asDriver() -> Driver { + return self.asDriver { (error) -> Driver in + #if DEBUG + rxFatalError("Somehow driver received error from a source that shouldn't fail.") + #else + return Driver.empty() + #endif + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver+Subscription.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver+Subscription.swift new file mode 100644 index 0000000..877a2a0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver+Subscription.swift @@ -0,0 +1,121 @@ +// +// Driver+Subscription.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +private let errorMessage = "`drive*` family of methods can be only called from `MainThread`.\n" + +"This is required to ensure that the last replayed `Driver` element is delivered on `MainThread`.\n" + +extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy { + /** + Creates new subscription and sends elements to observer. + This method can be only called from `MainThread`. + + In this form it's equivalent to `subscribe` method, but it communicates intent better. + + - parameter observer: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer from the subject. + */ + public func drive(_ observer: O) -> Disposable where O.E == E { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return self.asSharedSequence().asObservable().subscribe(observer) + } + + /** + Creates new subscription and sends elements to observer. + This method can be only called from `MainThread`. + + In this form it's equivalent to `subscribe` method, but it communicates intent better. + + - parameter observer: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer from the subject. + */ + public func drive(_ observer: O) -> Disposable where O.E == E? { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return self.asSharedSequence().asObservable().map { $0 as E? }.subscribe(observer) + } + + /** + Creates new subscription and sends elements to `BehaviorRelay`. + This method can be only called from `MainThread`. + + - parameter variable: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer from the variable. + */ + public func drive(_ relay: BehaviorRelay) -> Disposable { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return drive(onNext: { e in + relay.accept(e) + }) + } + + /** + Creates new subscription and sends elements to variable. + This method can be only called from `MainThread`. + + - parameter variable: Target variable for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer from the variable. + */ + public func drive(_ relay: BehaviorRelay) -> Disposable { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return drive(onNext: { e in + relay.accept(e) + }) + } + + /** + Subscribes to observable sequence using custom binder function. + This method can be only called from `MainThread`. + + - parameter with: Function used to bind elements from `self`. + - returns: Object representing subscription. + */ + public func drive(_ transformation: (Observable) -> R) -> R { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return transformation(self.asObservable()) + } + + /** + Subscribes to observable sequence using custom binder function and final parameter passed to binder function + after `self` is passed. + + public func drive(with: Self -> R1 -> R2, curriedArgument: R1) -> R2 { + return with(self)(curriedArgument) + } + + This method can be only called from `MainThread`. + + - parameter with: Function used to bind elements from `self`. + - parameter curriedArgument: Final argument passed to `binder` to finish binding process. + - returns: Object representing subscription. + */ + public func drive(_ with: (Observable) -> (R1) -> R2, curriedArgument: R1) -> R2 { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return with(self.asObservable())(curriedArgument) + } + + /** + Subscribes an element handler, a completion handler and disposed handler to an observable sequence. + This method can be only called from `MainThread`. + + Error callback is not exposed because `Driver` can't error out. + + - parameter onNext: Action to invoke for each element in the observable sequence. + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + gracefully completed, errored, or if the generation is canceled by disposing subscription) + - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has + gracefully completed, errored, or if the generation is canceled by disposing subscription) + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + public func drive(onNext: ((E) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) -> Disposable { + MainScheduler.ensureExecutingOnScheduler(errorMessage: errorMessage) + return self.asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed) + } +} + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver.swift new file mode 100644 index 0000000..1f42277 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver.swift @@ -0,0 +1,53 @@ +// +// Driver.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/26/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/** + Trait that represents observable sequence with following properties: + + - it never fails + - it delivers events on `MainScheduler.instance` + - `share(replay: 1, scope: .whileConnected)` sharing strategy + + Additional explanation: + - all observers share sequence computation resources + - it's stateful, upon subscription (calling subscribe) last element is immediately replayed if it was produced + - computation of elements is reference counted with respect to the number of observers + - if there are no subscribers, it will release sequence computation resources + + In case trait that models event bus is required, please check `Signal`. + + `Driver` can be considered a builder pattern for observable sequences that drive the application. + + If observable sequence has produced at least one element, after new subscription is made last produced element will be + immediately replayed on the same thread on which the subscription was made. + + When using `drive*`, `subscribe*` and `bind*` family of methods, they should always be called from main thread. + + If `drive*`, `subscribe*` and `bind*` are called from background thread, it is possible that initial replay + will happen on background thread, and subsequent events will arrive on main thread. + + To find out more about traits and how to use them, please visit `Documentation/Traits.md`. + */ +public typealias Driver = SharedSequence + +public struct DriverSharingStrategy: SharingStrategyProtocol { + public static var scheduler: SchedulerType { return SharingScheduler.make() } + public static func share(_ source: Observable) -> Observable { + return source.share(replay: 1, scope: .whileConnected) + } +} + +extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy { + /// Adds `asDriver` to `SharingSequence` with `DriverSharingStrategy`. + public func asDriver() -> Driver { + return self.asSharedSequence() + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift new file mode 100644 index 0000000..ac62190 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift @@ -0,0 +1,57 @@ +// +// ObservableConvertibleType+Driver.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension ObservableConvertibleType { + /** + Converts observable sequence to `Driver` trait. + + - parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence. + - returns: Driver trait. + */ + public func asDriver(onErrorJustReturn: E) -> Driver { + let source = self + .asObservable() + .observeOn(DriverSharingStrategy.scheduler) + .catchErrorJustReturn(onErrorJustReturn) + return Driver(source) + } + + /** + Converts observable sequence to `Driver` trait. + + - parameter onErrorDriveWith: Driver that continues to drive the sequence in case of error. + - returns: Driver trait. + */ + public func asDriver(onErrorDriveWith: Driver) -> Driver { + let source = self + .asObservable() + .observeOn(DriverSharingStrategy.scheduler) + .catchError { _ in + onErrorDriveWith.asObservable() + } + return Driver(source) + } + + /** + Converts observable sequence to `Driver` trait. + + - parameter onErrorRecover: Calculates driver that continues to drive the sequence in case of error. + - returns: Driver trait. + */ + public func asDriver(onErrorRecover: @escaping (_ error: Swift.Error) -> Driver) -> Driver { + let source = self + .asObservable() + .observeOn(DriverSharingStrategy.scheduler) + .catchError { error in + onErrorRecover(error).asObservable() + } + return Driver(source) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/PublishRelay.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/PublishRelay.swift new file mode 100644 index 0000000..36142cb --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/PublishRelay.swift @@ -0,0 +1,38 @@ +// +// PublishRelay.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/// PublishRelay is a wrapper for `PublishSubject`. +/// +/// Unlike `PublishSubject` it can't terminate with error or completed. +public final class PublishRelay: ObservableType { + public typealias E = Element + + private let _subject: PublishSubject + + // Accepts `event` and emits it to subscribers + public func accept(_ event: Element) { + _subject.onNext(event) + } + + /// Initializes variable with initial value. + public init() { + _subject = PublishSubject() + } + + /// Subscribes observer + public func subscribe(_ observer: O) -> Disposable where O.E == E { + return _subject.subscribe(observer) + } + + /// - returns: Canonical interface for push style sequence + public func asObservable() -> Observable { + return _subject.asObservable() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift new file mode 100644 index 0000000..dac504b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift @@ -0,0 +1,57 @@ +// +// ObservableConvertibleType+SharedSequence.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 11/1/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension ObservableConvertibleType { + /** + Converts anything convertible to `Observable` to `SharedSequence` unit. + + - parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence. + - returns: Driving observable sequence. + */ + public func asSharedSequence(sharingStrategy: S.Type = S.self, onErrorJustReturn: E) -> SharedSequence { + let source = self + .asObservable() + .observeOn(S.scheduler) + .catchErrorJustReturn(onErrorJustReturn) + return SharedSequence(source) + } + + /** + Converts anything convertible to `Observable` to `SharedSequence` unit. + + - parameter onErrorDriveWith: SharedSequence that provides elements of the sequence in case of error. + - returns: Driving observable sequence. + */ + public func asSharedSequence(sharingStrategy: S.Type = S.self, onErrorDriveWith: SharedSequence) -> SharedSequence { + let source = self + .asObservable() + .observeOn(S.scheduler) + .catchError { _ in + onErrorDriveWith.asObservable() + } + return SharedSequence(source) + } + + /** + Converts anything convertible to `Observable` to `SharedSequence` unit. + + - parameter onErrorRecover: Calculates driver that continues to drive the sequence in case of error. + - returns: Driving observable sequence. + */ + public func asSharedSequence(sharingStrategy: S.Type = S.self, onErrorRecover: @escaping (_ error: Swift.Error) -> SharedSequence) -> SharedSequence { + let source = self + .asObservable() + .observeOn(S.scheduler) + .catchError { error in + onErrorRecover(error).asObservable() + } + return SharedSequence(source) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift new file mode 100644 index 0000000..b55911c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift @@ -0,0 +1,61 @@ +// +// SchedulerType+SharedSequence.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 8/27/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +public enum SharingScheduler { + /// Default scheduler used in SharedSequence based traits. + public private(set) static var make: () -> SchedulerType = { MainScheduler() } + + /** + This method can be used in unit tests to ensure that built in shared sequences are using mock schedulers instead + of main schedulers. + + **This shouldn't be used in normal release builds.** + */ + static public func mock(scheduler: SchedulerType, action: () -> ()) { + return mock(makeScheduler: { scheduler }, action: action) + } + + /** + This method can be used in unit tests to ensure that built in shared sequences are using mock schedulers instead + of main schedulers. + + **This shouldn't be used in normal release builds.** + */ + static public func mock(makeScheduler: @escaping () -> SchedulerType, action: () -> ()) { + let originalMake = make + make = makeScheduler + + action() + + // If you remove this line , compiler buggy optimizations will change behavior of this code + _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(makeScheduler) + // Scary, I know + + make = originalMake + } +} + +#if os(Linux) + import Glibc +#else + import func Foundation.arc4random +#endif + +func _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(_ scheduler: () -> SchedulerType) { + let a: Int32 = 1 +#if os(Linux) + let b = 314 + Int32(Glibc.random() & 1) +#else + let b = 314 + Int32(arc4random() & 1) +#endif + if a == b { + print(scheduler()) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift new file mode 100644 index 0000000..980d9d3 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift @@ -0,0 +1,656 @@ +// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project +// +// SharedSequence+Operators+arity.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 10/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + + + +// 2 + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + + + +// 3 + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + + + +// 4 + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + + + +// 5 + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + + + +// 6 + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + + + +// 7 + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + + + +// 8 + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy, + SharingStrategy == O8.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy, + SharingStrategy == O8.SharingStrategy { + let source = Observable.zip( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy, + SharingStrategy == O8.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable(), + resultSelector: resultSelector + ) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8) + -> SharedSequence where SharingStrategy == O1.SharingStrategy, + SharingStrategy == O2.SharingStrategy, + SharingStrategy == O3.SharingStrategy, + SharingStrategy == O4.SharingStrategy, + SharingStrategy == O5.SharingStrategy, + SharingStrategy == O6.SharingStrategy, + SharingStrategy == O7.SharingStrategy, + SharingStrategy == O8.SharingStrategy { + let source = Observable.combineLatest( + source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable() + ) + + return SharedSequence(source) + } +} + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift new file mode 100644 index 0000000..7f4bd28 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift @@ -0,0 +1,515 @@ +// +// SharedSequence+Operators.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +// MARK: map +extension SharedSequenceConvertibleType { + + /** + Projects each element of an observable sequence into a new form. + + - parameter selector: A transform function to apply to each source element. + - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source. + */ + public func map(_ selector: @escaping (E) -> R) -> SharedSequence { + let source = self + .asObservable() + .map(selector) + return SharedSequence(source) + } +} + +// MARK: filter +extension SharedSequenceConvertibleType { + /** + Filters the elements of an observable sequence based on a predicate. + + - parameter predicate: A function to test each source element for a condition. + - returns: An observable sequence that contains elements from the input sequence that satisfy the condition. + */ + public func filter(_ predicate: @escaping (E) -> Bool) -> SharedSequence { + let source = self + .asObservable() + .filter(predicate) + return SharedSequence(source) + } +} + +// MARK: switchLatest +extension SharedSequenceConvertibleType where E : SharedSequenceConvertibleType { + + /** + Transforms an observable sequence of observable sequences into an observable sequence + producing values only from the most recent observable sequence. + + Each time a new inner observable sequence is received, unsubscribe from the + previous inner observable sequence. + + - returns: The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received. + */ + public func switchLatest() -> SharedSequence { + let source: Observable = self + .asObservable() + .map { $0.asSharedSequence() } + .switchLatest() + return SharedSequence(source) + } +} + +// MARK: flatMapLatest +extension SharedSequenceConvertibleType { + /** + Projects each element of an observable sequence into a new sequence of observable sequences and then + transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. + + It is a combination of `map` + `switchLatest` operator + + - parameter selector: A transform function to apply to each element. + - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an + Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received. + */ + public func flatMapLatest(_ selector: @escaping (E) -> SharedSequence) + -> SharedSequence { + let source: Observable = self + .asObservable() + .flatMapLatest(selector) + return SharedSequence(source) + } +} + +// MARK: flatMapFirst +extension SharedSequenceConvertibleType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + If element is received while there is some projected observable sequence being merged it will simply be ignored. + + - parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel. + - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated. + */ + public func flatMapFirst(_ selector: @escaping (E) -> SharedSequence) + -> SharedSequence { + let source: Observable = self + .asObservable() + .flatMapFirst(selector) + return SharedSequence(source) + } +} + +// MARK: do +extension SharedSequenceConvertibleType { + /** + Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence. + + - parameter onNext: Action to invoke for each element in the observable sequence. + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + - parameter onSubscribe: Action to invoke before subscribing to source observable sequence. + - parameter onSubscribed: Action to invoke after subscribing to source observable sequence. + - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed. + - returns: The source sequence with the side-effecting behavior applied. + */ + public func `do`(onNext: ((E) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onSubscribe: (() -> ())? = nil, onSubscribed: (() -> ())? = nil, onDispose: (() -> ())? = nil) + -> SharedSequence { + let source = self.asObservable() + .do(onNext: onNext, onCompleted: onCompleted, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose) + + return SharedSequence(source) + } +} + +// MARK: debug +extension SharedSequenceConvertibleType { + + /** + Prints received events for all observers on standard output. + + - parameter identifier: Identifier that is printed together with event description to standard output. + - returns: An observable sequence whose events are printed to standard output. + */ + public func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function) -> SharedSequence { + let source = self.asObservable() + .debug(identifier, trimOutput: trimOutput, file: file, line: line, function: function) + return SharedSequence(source) + } +} + +// MARK: distinctUntilChanged +extension SharedSequenceConvertibleType where E: Equatable { + + /** + Returns an observable sequence that contains only distinct contiguous elements according to equality operator. + + - returns: An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence. + */ + public func distinctUntilChanged() + -> SharedSequence { + let source = self.asObservable() + .distinctUntilChanged({ $0 }, comparer: { ($0 == $1) }) + + return SharedSequence(source) + } +} + +extension SharedSequenceConvertibleType { + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `keySelector`. + + - parameter keySelector: A function to compute the comparison key for each element. + - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + */ + public func distinctUntilChanged(_ keySelector: @escaping (E) -> K) -> SharedSequence { + let source = self.asObservable() + .distinctUntilChanged(keySelector, comparer: { $0 == $1 }) + return SharedSequence(source) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `comparer`. + + - parameter comparer: Equality comparer for computed key values. + - returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence. + */ + public func distinctUntilChanged(_ comparer: @escaping (E, E) -> Bool) -> SharedSequence { + let source = self.asObservable() + .distinctUntilChanged({ $0 }, comparer: comparer) + return SharedSequence(source) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. + + - parameter keySelector: A function to compute the comparison key for each element. + - parameter comparer: Equality comparer for computed key values. + - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence. + */ + public func distinctUntilChanged(_ keySelector: @escaping (E) -> K, comparer: @escaping (K, K) -> Bool) -> SharedSequence { + let source = self.asObservable() + .distinctUntilChanged(keySelector, comparer: comparer) + return SharedSequence(source) + } +} + + +// MARK: flatMap +extension SharedSequenceConvertibleType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + + - parameter selector: A transform function to apply to each element. + - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence. + */ + public func flatMap(_ selector: @escaping (E) -> SharedSequence) -> SharedSequence { + let source = self.asObservable() + .flatMap(selector) + + return SharedSequence(source) + } +} + +// MARK: merge +extension SharedSequenceConvertibleType { + /** + Merges elements from all observable sequences from collection into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter sources: Collection of observable sequences to merge. + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public static func merge(_ sources: C) -> SharedSequence + where C.Iterator.Element == SharedSequence { + let source = Observable.merge(sources.map { $0.asObservable() }) + return SharedSequence(source) + } + + /** + Merges elements from all observable sequences from array into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter sources: Array of observable sequences to merge. + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public static func merge(_ sources: [SharedSequence]) -> SharedSequence { + let source = Observable.merge(sources.map { $0.asObservable() }) + return SharedSequence(source) + } + + /** + Merges elements from all observable sequences into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter sources: Collection of observable sequences to merge. + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public static func merge(_ sources: SharedSequence...) -> SharedSequence { + let source = Observable.merge(sources.map { $0.asObservable() }) + return SharedSequence(source) + } + +} + +// MARK: merge +extension SharedSequenceConvertibleType where E : SharedSequenceConvertibleType { + /** + Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence. + + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public func merge() -> SharedSequence { + let source = self.asObservable() + .map { $0.asSharedSequence() } + .merge() + return SharedSequence(source) + } + + /** + Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences. + + - parameter maxConcurrent: Maximum number of inner observable sequences being subscribed to concurrently. + - returns: The observable sequence that merges the elements of the inner sequences. + */ + public func merge(maxConcurrent: Int) + -> SharedSequence { + let source = self.asObservable() + .map { $0.asSharedSequence() } + .merge(maxConcurrent: maxConcurrent) + return SharedSequence(source) + } +} + +// MARK: throttle +extension SharedSequenceConvertibleType { + + /** + Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration. + + This operator makes sure that no two elements are emitted in less then dueTime. + + - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html) + + - parameter dueTime: Throttling duration for each element. + - parameter latest: Should latest element received in a dueTime wide time window since last element emission be emitted. + - returns: The throttled sequence. + */ + public func throttle(_ dueTime: RxTimeInterval, latest: Bool = true) + -> SharedSequence { + let source = self.asObservable() + .throttle(dueTime, latest: latest, scheduler: SharingStrategy.scheduler) + + return SharedSequence(source) + } + + /** + Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers. + + - parameter dueTime: Throttling duration for each element. + - returns: The throttled sequence. + */ + public func debounce(_ dueTime: RxTimeInterval) + -> SharedSequence { + let source = self.asObservable() + .debounce(dueTime, scheduler: SharingStrategy.scheduler) + + return SharedSequence(source) + } +} + +// MARK: scan +extension SharedSequenceConvertibleType { + /** + Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. + + For aggregation behavior with no intermediate results, see `reduce`. + + - parameter seed: The initial accumulator value. + - parameter accumulator: An accumulator function to be invoked on each element. + - returns: An observable sequence containing the accumulated values. + */ + public func scan(_ seed: A, accumulator: @escaping (A, E) -> A) + -> SharedSequence { + let source = self.asObservable() + .scan(seed, accumulator: accumulator) + return SharedSequence(source) + } +} + +// MARK: concat + +extension SharedSequence { + /** + Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully. + + - returns: An observable sequence that contains the elements of each given sequence, in sequential order. + */ + public static func concat(_ sequence: S) -> SharedSequence + where S.Iterator.Element == SharedSequence { + let source = Observable.concat(sequence.lazy.map { $0.asObservable() }) + return SharedSequence(source) + } + + /** + Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully. + + - returns: An observable sequence that contains the elements of each given sequence, in sequential order. + */ + public static func concat(_ collection: C) -> SharedSequence + where C.Iterator.Element == SharedSequence { + let source = Observable.concat(collection.map { $0.asObservable() }) + return SharedSequence(source) + } +} + +// MARK: zip + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip(_ collection: C, _ resultSelector: @escaping ([Element]) throws -> R) -> SharedSequence + where C.Iterator.Element == SharedSequence { + let source = Observable.zip(collection.map { $0.asSharedSequence().asObservable() }, resultSelector) + return SharedSequence(source) + } + + /** + Merges the specified observable sequences into one observable sequence all of the observable sequences have produced an element at a corresponding index. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip(_ collection: C) -> SharedSequence + where C.Iterator.Element == SharedSequence { + let source = Observable.zip(collection.map { $0.asSharedSequence().asObservable() }) + return SharedSequence(source) + } +} + +// MARK: combineLatest + +extension SharedSequence { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest(_ collection: C, _ resultSelector: @escaping ([Element]) throws -> R) -> SharedSequence + where C.Iterator.Element == SharedSequence { + let source = Observable.combineLatest(collection.map { $0.asObservable() }, resultSelector) + return SharedSequence(source) + } + + /** + Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element. + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest(_ collection: C) -> SharedSequence + where C.Iterator.Element == SharedSequence { + let source = Observable.combineLatest(collection.map { $0.asObservable() }) + return SharedSequence(source) + } +} + +// MARK: withLatestFrom +extension SharedSequenceConvertibleType { + + /** + Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any. + + - parameter second: Second observable source. + - parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any. + - returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function. + */ + public func withLatestFrom(_ second: SecondO, resultSelector: @escaping (E, SecondO.E) -> ResultType) -> SharedSequence where SecondO.SharingStrategy == SharingStrategy { + let source = self.asObservable() + .withLatestFrom(second.asSharedSequence(), resultSelector: resultSelector) + + return SharedSequence(source) + } + + /** + Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emits an element. + + - parameter second: Second observable source. + - returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function. + */ + public func withLatestFrom(_ second: SecondO) -> SharedSequence { + let source = self.asObservable() + .withLatestFrom(second.asSharedSequence()) + + return SharedSequence(source) + } +} + +// MARK: skip +extension SharedSequenceConvertibleType { + + /** + Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. + + - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html) + + - parameter count: The number of elements to skip before returning the remaining elements. + - returns: An observable sequence that contains the elements that occur after the specified index in the input sequence. + */ + public func skip(_ count: Int) + -> SharedSequence { + let source = self.asObservable() + .skip(count) + return SharedSequence(source) + } +} + +// MARK: startWith +extension SharedSequenceConvertibleType { + + /** + Prepends a value to an observable sequence. + + - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html) + + - parameter element: Element to prepend to the specified sequence. + - returns: The source sequence prepended with the specified values. + */ + public func startWith(_ element: E) + -> SharedSequence { + let source = self.asObservable() + .startWith(element) + + return SharedSequence(source) + } +} + +// MARK: delay +extension SharedSequenceConvertibleType { + + /** + Returns an observable sequence by the source observable sequence shifted forward in time by a specified delay. Error events from the source observable sequence are not delayed. + + - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html) + + - parameter dueTime: Relative time shift of the source by. + - parameter scheduler: Scheduler to run the subscription delay timer on. + - returns: the source Observable shifted in time by the specified delay. + */ + public func delay(_ dueTime: RxTimeInterval) + -> SharedSequence { + let source = self.asObservable() + .delay(dueTime, scheduler: SharingStrategy.scheduler) + + return SharedSequence(source) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence.swift new file mode 100644 index 0000000..b41e7d1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence.swift @@ -0,0 +1,229 @@ +// +// SharedSequence.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 8/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/** + Trait that represents observable sequence that shares computation resources with following properties: + + - it never fails + - it delivers events on `SharingStrategy.scheduler` + - sharing strategy is customizable using `SharingStrategy.share` behavior + + `SharedSequence` can be considered a builder pattern for observable sequences that share computation resources. + + To find out more about units and how to use them, please visit `Documentation/Traits.md`. +*/ +public struct SharedSequence : SharedSequenceConvertibleType { + public typealias E = Element + public typealias SharingStrategy = S + + let _source: Observable + + init(_ source: Observable) { + self._source = S.share(source) + } + + init(raw: Observable) { + self._source = raw + } + + #if EXPANDABLE_SHARED_SEQUENCE + /** + This method is extension hook in case this unit needs to extended from outside the library. + + By defining `EXPANDABLE_SHARED_SEQUENCE` one agrees that it's up to him to ensure shared sequence + properties are preserved after extension. + */ + public static func createUnsafe(source: O) -> SharedSequence { + return SharedSequence(raw: source.asObservable()) + } + #endif + + /** + - returns: Built observable sequence. + */ + public func asObservable() -> Observable { + return _source + } + + /** + - returns: `self` + */ + public func asSharedSequence() -> SharedSequence { + return self + } +} + +/** + Different `SharedSequence` sharing strategies must conform to this protocol. + */ +public protocol SharingStrategyProtocol { + /** + Scheduled on which all sequence events will be delivered. + */ + static var scheduler: SchedulerType { get } + + /** + Computation resources sharing strategy for multiple sequence observers. + + E.g. One can choose `share(replay:scope:)` + as sequence event sharing strategies, but also do something more exotic, like + implementing promises or lazy loading chains. + */ + static func share(_ source: Observable) -> Observable +} + +/** +A type that can be converted to `SharedSequence`. +*/ +public protocol SharedSequenceConvertibleType : ObservableConvertibleType { + associatedtype SharingStrategy: SharingStrategyProtocol + + /** + Converts self to `SharedSequence`. + */ + func asSharedSequence() -> SharedSequence +} + +extension SharedSequenceConvertibleType { + public func asObservable() -> Observable { + return asSharedSequence().asObservable() + } +} + + +extension SharedSequence { + + /** + Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message. + + - returns: An observable sequence with no elements. + */ + public static func empty() -> SharedSequence { + return SharedSequence(raw: Observable.empty().subscribeOn(S.scheduler)) + } + + /** + Returns a non-terminating observable sequence, which can be used to denote an infinite duration. + + - returns: An observable sequence whose observers will never get called. + */ + public static func never() -> SharedSequence { + return SharedSequence(raw: Observable.never()) + } + + /** + Returns an observable sequence that contains a single element. + + - parameter element: Single element in the resulting observable sequence. + - returns: An observable sequence containing the single specified element. + */ + public static func just(_ element: E) -> SharedSequence { + return SharedSequence(raw: Observable.just(element).subscribeOn(S.scheduler)) + } + + /** + Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. + + - parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence. + - returns: An observable sequence whose observers trigger an invocation of the given observable factory function. + */ + public static func deferred(_ observableFactory: @escaping () -> SharedSequence) + -> SharedSequence { + return SharedSequence(Observable.deferred { observableFactory().asObservable() }) + } + + /** + This method creates a new Observable instance with a variable number of elements. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter elements: Elements to generate. + - returns: The observable sequence whose elements are pulled from the given arguments. + */ + public static func of(_ elements: E ...) -> SharedSequence { + let source = Observable.from(elements, scheduler: S.scheduler) + return SharedSequence(raw: source) + } +} + +extension SharedSequence { + + /** + This method converts an array to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - returns: The observable sequence whose elements are pulled from the given enumerable sequence. + */ + public static func from(_ array: [E]) -> SharedSequence { + let source = Observable.from(array, scheduler: S.scheduler) + return SharedSequence(raw: source) + } + + /** + This method converts a sequence to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - returns: The observable sequence whose elements are pulled from the given enumerable sequence. + */ + public static func from(_ sequence: S) -> SharedSequence where S.Iterator.Element == E { + let source = Observable.from(sequence, scheduler: SharingStrategy.scheduler) + return SharedSequence(raw: source) + } + + /** + This method converts a optional to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter optional: Optional element in the resulting observable sequence. + + - returns: An observable sequence containing the wrapped value or not from given optional. + */ + public static func from(optional: E?) -> SharedSequence { + let source = Observable.from(optional: optional, scheduler: S.scheduler) + return SharedSequence(raw: source) + } +} + +extension SharedSequence where Element : RxAbstractInteger { + /** + Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages. + + - seealso: [interval operator on reactivex.io](http://reactivex.io/documentation/operators/interval.html) + + - parameter period: Period for producing the values in the resulting sequence. + - returns: An observable sequence that produces a value after each period. + */ + public static func interval(_ period: RxTimeInterval) + -> SharedSequence { + return SharedSequence(Observable.interval(period, scheduler: S.scheduler)) + } +} + +// MARK: timer + +extension SharedSequence where Element: RxAbstractInteger { + /** + Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers. + + - seealso: [timer operator on reactivex.io](http://reactivex.io/documentation/operators/timer.html) + + - parameter dueTime: Relative time at which to produce the first value. + - parameter period: Period to produce subsequent values. + - returns: An observable sequence that produces a value after due time has elapsed and then each period. + */ + public static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval) + -> SharedSequence { + return SharedSequence(Observable.timer(dueTime, period: period, scheduler: S.scheduler)) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ControlEvent+Signal.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ControlEvent+Signal.swift new file mode 100644 index 0000000..157f8d6 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ControlEvent+Signal.swift @@ -0,0 +1,25 @@ +// +// ControlEvent+Signal.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 11/1/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension ControlEvent { + /// Converts `ControlEvent` to `Signal` trait. + /// + /// `ControlEvent` already can't fail, so no special case needs to be handled. + public func asSignal() -> Signal { + return self.asSignal { (error) -> Signal in + #if DEBUG + rxFatalError("Somehow signal received error from a source that shouldn't fail.") + #else + return Signal.empty() + #endif + } + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift new file mode 100644 index 0000000..acc073a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift @@ -0,0 +1,58 @@ +// +// ObservableConvertibleType+Signal.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension ObservableConvertibleType { + /** + Converts observable sequence to `Signal` trait. + + - parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence. + - returns: Signal trait. + */ + public func asSignal(onErrorJustReturn: E) -> Signal { + let source = self + .asObservable() + .observeOn(SignalSharingStrategy.scheduler) + .catchErrorJustReturn(onErrorJustReturn) + return Signal(source) + } + + /** + Converts observable sequence to `Driver` trait. + + - parameter onErrorDriveWith: Driver that continues to drive the sequence in case of error. + - returns: Signal trait. + */ + public func asSignal(onErrorSignalWith: Signal) -> Signal { + let source = self + .asObservable() + .observeOn(SignalSharingStrategy.scheduler) + .catchError { _ in + onErrorSignalWith.asObservable() + } + return Signal(source) + } + + /** + Converts observable sequence to `Driver` trait. + + - parameter onErrorRecover: Calculates driver that continues to drive the sequence in case of error. + - returns: Signal trait. + */ + public func asSignal(onErrorRecover: @escaping (_ error: Swift.Error) -> Signal) -> Signal { + let source = self + .asObservable() + .observeOn(SignalSharingStrategy.scheduler) + .catchError { error in + onErrorRecover(error).asObservable() + } + return Signal(source) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/PublishRelay+Signal.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/PublishRelay+Signal.swift new file mode 100644 index 0000000..ab4b8d8 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/PublishRelay+Signal.swift @@ -0,0 +1,20 @@ +// +// PublishRelay+Signal.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 12/28/15. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension PublishRelay { + /// Converts `PublishRelay` to `Signal`. + /// + /// - returns: Observable sequence. + public func asSignal() -> Signal { + let source = self.asObservable() + .observeOn(SignalSharingStrategy.scheduler) + return SharedSequence(source) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal+Subscription.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal+Subscription.swift new file mode 100644 index 0000000..cce1a8f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal+Subscription.swift @@ -0,0 +1,78 @@ +// +// Signal+Subscription.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +extension SharedSequenceConvertibleType where SharingStrategy == SignalSharingStrategy { + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better. + + - parameter to: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer from the subject. + */ + public func emit(to observer: O) -> Disposable where O.E == E { + return self.asSharedSequence().asObservable().subscribe(observer) + } + + /** + Creates new subscription and sends elements to observer. + + In this form it's equivalent to `subscribe` method, but it communicates intent better. + + - parameter to: Observer that receives events. + - returns: Disposable object that can be used to unsubscribe the observer from the subject. + */ + public func emit(to observer: O) -> Disposable where O.E == E? { + return self.asSharedSequence().asObservable().map { $0 as E? }.subscribe(observer) + } + + /** + Creates new subscription and sends elements to variable. + + - parameter relay: Target relay for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer from the variable. + */ + public func emit(to relay: PublishRelay) -> Disposable { + return emit(onNext: { e in + relay.accept(e) + }) + } + + /** + Creates new subscription and sends elements to variable. + + - parameter to: Target relay for sequence elements. + - returns: Disposable object that can be used to unsubscribe the observer from the variable. + */ + public func emit(to relay: PublishRelay) -> Disposable { + return emit(onNext: { e in + relay.accept(e) + }) + } + + /** + Subscribes an element handler, a completion handler and disposed handler to an observable sequence. + + Error callback is not exposed because `Signal` can't error out. + + - parameter onNext: Action to invoke for each element in the observable sequence. + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + gracefully completed, errored, or if the generation is canceled by disposing subscription) + - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has + gracefully completed, errored, or if the generation is canceled by disposing subscription) + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + public func emit(onNext: ((E) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) -> Disposable { + return self.asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed) + } +} + + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal.swift new file mode 100644 index 0000000..b717560 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal.swift @@ -0,0 +1,45 @@ +// +// Signal.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 9/26/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import RxSwift + +/** + Trait that represents observable sequence with following properties: + + - it never fails + - it delivers events on `MainScheduler.instance` + - `share(scope: .whileConnected)` sharing strategy + + Additional explanation: + - all observers share sequence computation resources + - there is no replaying of sequence elements on new observer subscription + - computation of elements is reference counted with respect to the number of observers + - if there are no subscribers, it will release sequence computation resources + + In case trait that models state propagation is required, please check `Driver`. + + `Signal` can be considered a builder pattern for observable sequences that model imperative events part of the application. + + To find out more about units and how to use them, please visit `Documentation/Traits.md`. + */ +public typealias Signal = SharedSequence + +public struct SignalSharingStrategy : SharingStrategyProtocol { + public static var scheduler: SchedulerType { return SharingScheduler.make() } + + public static func share(_ source: Observable) -> Observable { + return source.share(scope: .whileConnected) + } +} + +extension SharedSequenceConvertibleType where SharingStrategy == SignalSharingStrategy { + /// Adds `asPublisher` to `SharingSequence` with `PublishSharingStrategy`. + public func asSignal() -> Signal { + return asSharedSequence() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift new file mode 100644 index 0000000..8c4b2ee --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift @@ -0,0 +1,108 @@ +// +// RxCollectionViewReactiveArrayDataSource.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +// objc monkey business +class _RxCollectionViewReactiveArrayDataSource + : NSObject + , UICollectionViewDataSource { + + @objc(numberOfSectionsInCollectionView:) + func numberOfSections(in: UICollectionView) -> Int { + return 1 + } + + func _collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 0 + } + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return _collectionView(collectionView, numberOfItemsInSection: section) + } + + fileprivate func _collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + rxAbstractMethod() + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + return _collectionView(collectionView, cellForItemAt: indexPath) + } +} + +class RxCollectionViewReactiveArrayDataSourceSequenceWrapper + : RxCollectionViewReactiveArrayDataSource + , RxCollectionViewDataSourceType { + typealias Element = S + + override init(cellFactory: @escaping CellFactory) { + super.init(cellFactory: cellFactory) + } + + func collectionView(_ collectionView: UICollectionView, observedEvent: Event) { + Binder(self) { collectionViewDataSource, sectionModels in + let sections = Array(sectionModels) + collectionViewDataSource.collectionView(collectionView, observedElements: sections) + }.on(observedEvent) + } +} + + +// Please take a look at `DelegateProxyType.swift` +class RxCollectionViewReactiveArrayDataSource + : _RxCollectionViewReactiveArrayDataSource + , SectionedViewDataSourceType { + + typealias CellFactory = (UICollectionView, Int, Element) -> UICollectionViewCell + + var itemModels: [Element]? = nil + + func modelAtIndex(_ index: Int) -> Element? { + return itemModels?[index] + } + + func model(at indexPath: IndexPath) throws -> Any { + precondition(indexPath.section == 0) + guard let item = itemModels?[indexPath.item] else { + throw RxCocoaError.itemsNotYetBound(object: self) + } + return item + } + + var cellFactory: CellFactory + + init(cellFactory: @escaping CellFactory) { + self.cellFactory = cellFactory + } + + // data source + + override func _collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return itemModels?.count ?? 0 + } + + override func _collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + return cellFactory(collectionView, indexPath.item, itemModels![indexPath.item]) + } + + // reactive + + func collectionView(_ collectionView: UICollectionView, observedElements: [Element]) { + self.itemModels = observedElements + + collectionView.reloadData() + + // workaround for http://stackoverflow.com/questions/39867325/ios-10-bug-uicollectionview-received-layout-attributes-for-a-cell-with-an-index + collectionView.collectionViewLayout.invalidateLayout() + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift new file mode 100644 index 0000000..550a033 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift @@ -0,0 +1,92 @@ +// +// RxPickerViewAdapter.swift +// RxCocoa +// +// Created by Sergey Shulga on 12/07/2017. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +import RxSwift + +class RxPickerViewArrayDataSource: NSObject, UIPickerViewDataSource, SectionedViewDataSourceType { + fileprivate var items: [T] = [] + + func model(at indexPath: IndexPath) throws -> Any { + guard items.indices ~= indexPath.row else { + throw RxCocoaError.itemsNotYetBound(object: self) + } + return items[indexPath.row] + } + + func numberOfComponents(in pickerView: UIPickerView) -> Int { + return 1 + } + + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + return items.count + } +} + +class RxPickerViewSequenceDataSource + : RxPickerViewArrayDataSource + , RxPickerViewDataSourceType { + typealias Element = S + + func pickerView(_ pickerView: UIPickerView, observedEvent: Event) { + Binder(self) { dataSource, items in + dataSource.items = items + pickerView.reloadAllComponents() + } + .on(observedEvent.map(Array.init)) + } +} + +final class RxStringPickerViewAdapter + : RxPickerViewSequenceDataSource + , UIPickerViewDelegate { + + typealias TitleForRow = (Int, S.Iterator.Element) -> String? + private let titleForRow: TitleForRow + + init(titleForRow: @escaping TitleForRow) { + self.titleForRow = titleForRow + super.init() + } + + func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { + return titleForRow(row, items[row]) + } +} + +final class RxAttributedStringPickerViewAdapter: RxPickerViewSequenceDataSource, UIPickerViewDelegate { + typealias AttributedTitleForRow = (Int, S.Iterator.Element) -> NSAttributedString? + private let attributedTitleForRow: AttributedTitleForRow + + init(attributedTitleForRow: @escaping AttributedTitleForRow) { + self.attributedTitleForRow = attributedTitleForRow + super.init() + } + + func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { + return attributedTitleForRow(row, items[row]) + } +} + +final class RxPickerViewAdapter: RxPickerViewSequenceDataSource, UIPickerViewDelegate { + typealias ViewForRow = (Int, S.Iterator.Element, UIView?) -> UIView + private let viewForRow: ViewForRow + + init(viewForRow: @escaping ViewForRow) { + self.viewForRow = viewForRow + super.init() + } + + func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { + return viewForRow(row, items[row], view) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift new file mode 100644 index 0000000..b99cff5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift @@ -0,0 +1,101 @@ +// +// RxTableViewReactiveArrayDataSource.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/26/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +// objc monkey business +class _RxTableViewReactiveArrayDataSource + : NSObject + , UITableViewDataSource { + + func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + func _tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 0 + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return _tableView(tableView, numberOfRowsInSection: section) + } + + fileprivate func _tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + rxAbstractMethod() + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + return _tableView(tableView, cellForRowAt: indexPath) + } +} + + +class RxTableViewReactiveArrayDataSourceSequenceWrapper + : RxTableViewReactiveArrayDataSource + , RxTableViewDataSourceType { + typealias Element = S + + override init(cellFactory: @escaping CellFactory) { + super.init(cellFactory: cellFactory) + } + + func tableView(_ tableView: UITableView, observedEvent: Event) { + Binder(self) { tableViewDataSource, sectionModels in + let sections = Array(sectionModels) + tableViewDataSource.tableView(tableView, observedElements: sections) + }.on(observedEvent) + } +} + +// Please take a look at `DelegateProxyType.swift` +class RxTableViewReactiveArrayDataSource + : _RxTableViewReactiveArrayDataSource + , SectionedViewDataSourceType { + typealias CellFactory = (UITableView, Int, Element) -> UITableViewCell + + var itemModels: [Element]? = nil + + func modelAtIndex(_ index: Int) -> Element? { + return itemModels?[index] + } + + func model(at indexPath: IndexPath) throws -> Any { + precondition(indexPath.section == 0) + guard let item = itemModels?[indexPath.item] else { + throw RxCocoaError.itemsNotYetBound(object: self) + } + return item + } + + let cellFactory: CellFactory + + init(cellFactory: @escaping CellFactory) { + self.cellFactory = cellFactory + } + + override func _tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return itemModels?.count ?? 0 + } + + override func _tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + return cellFactory(tableView, indexPath.item, itemModels![indexPath.row]) + } + + // reactive + + func tableView(_ tableView: UITableView, observedElements: [Element]) { + self.itemModels = observedElements + + tableView.reloadData() + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift new file mode 100644 index 0000000..aadf749 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift @@ -0,0 +1,15 @@ +// +// ItemEvents.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/20/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) +import UIKit + +public typealias ItemMovedEvent = (sourceIndex: IndexPath, destinationIndex: IndexPath) +public typealias WillDisplayCellEvent = (cell: UITableViewCell, indexPath: IndexPath) +public typealias DidEndDisplayingCellEvent = (cell: UITableViewCell, indexPath: IndexPath) +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift new file mode 100644 index 0000000..fc1f08a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift @@ -0,0 +1,35 @@ +// +// NSTextStorage+Rx.swift +// RxCocoa +// +// Created by Segii Shulga on 12/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + import RxSwift + import UIKit + + extension Reactive where Base: NSTextStorage { + + /// Reactive wrapper for `delegate`. + /// + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxTextStorageDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for `delegate` message. + public var didProcessEditingRangeChangeInLength: Observable<(editedMask:NSTextStorageEditActions, editedRange:NSRange, delta:Int)> { + return delegate + .methodInvoked(#selector(NSTextStorageDelegate.textStorage(_:didProcessEditing:range:changeInLength:))) + .map { a in + let editedMask = NSTextStorageEditActions(rawValue: try castOrThrow(UInt.self, a[1]) ) + let editedRange = try castOrThrow(NSValue.self, a[2]).rangeValue + let delta = try castOrThrow(Int.self, a[3]) + + return (editedMask, editedRange, delta) + } + } + } +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift new file mode 100644 index 0000000..e248ee9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift @@ -0,0 +1,27 @@ +// +// RxCollectionViewDataSourceType.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +/// Marks data source as `UICollectionView` reactive data source enabling it to be used with one of the `bindTo` methods. +public protocol RxCollectionViewDataSourceType /*: UICollectionViewDataSource*/ { + + /// Type of elements that can be bound to collection view. + associatedtype Element + + /// New observable sequence event observed. + /// + /// - parameter collectionView: Bound collection view. + /// - parameter observedEvent: Event + func collectionView(_ collectionView: UICollectionView, observedEvent: Event) -> Void +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift new file mode 100644 index 0000000..1f390bf --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift @@ -0,0 +1,26 @@ +// +// RxPickerViewDataSourceType.swift +// RxCocoa +// +// Created by Sergey Shulga on 05/07/2017. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +import RxSwift + +/// Marks data source as `UIPickerView` reactive data source enabling it to be used with one of the `bindTo` methods. +public protocol RxPickerViewDataSourceType { + /// Type of elements that can be bound to picker view. + associatedtype Element + + /// New observable sequence event observed. + /// + /// - parameter pickerView: Bound picker view. + /// - parameter observedEvent: Event + func pickerView(_ pickerView: UIPickerView, observedEvent: Event) +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift new file mode 100644 index 0000000..4bea943 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift @@ -0,0 +1,27 @@ +// +// RxTableViewDataSourceType.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/26/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +/// Marks data source as `UITableView` reactive data source enabling it to be used with one of the `bindTo` methods. +public protocol RxTableViewDataSourceType /*: UITableViewDataSource*/ { + + /// Type of elements that can be bound to table view. + associatedtype Element + + /// New observable sequence event observed. + /// + /// - parameter tableView: Bound table view. + /// - parameter observedEvent: Event + func tableView(_ tableView: UITableView, observedEvent: Event) -> Void +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift new file mode 100644 index 0000000..5ba478b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift @@ -0,0 +1,77 @@ +// +// RxCollectionViewDataSourceProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension UICollectionView: HasDataSource { + public typealias DataSource = UICollectionViewDataSource +} + +let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet() + +final class CollectionViewDataSourceNotSet + : NSObject + , UICollectionViewDataSource { + + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 0 + } + + // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + rxAbstractMethod(message: dataSourceNotSet) + } + +} + +/// For more information take a look at `DelegateProxyType`. +open class RxCollectionViewDataSourceProxy + : DelegateProxy + , DelegateProxyType + , UICollectionViewDataSource { + + /// Typed parent object. + public weak private(set) var collectionView: UICollectionView? + + /// - parameter collectionView: Parent object for delegate proxy. + public init(collectionView: ParentObject) { + self.collectionView = collectionView + super.init(parentObject: collectionView, delegateProxy: RxCollectionViewDataSourceProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxCollectionViewDataSourceProxy(collectionView: $0) } + } + + private weak var _requiredMethodsDataSource: UICollectionViewDataSource? = collectionViewDataSourceNotSet + + // MARK: delegate + + /// Required delegate method implementation. + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, numberOfItemsInSection: section) + } + + /// Required delegate method implementation. + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, cellForItemAt: indexPath) + } + + /// For more information take a look at `DelegateProxyType`. + open override func setForwardToDelegate(_ forwardToDelegate: UICollectionViewDataSource?, retainDelegate: Bool) { + _requiredMethodsDataSource = forwardToDelegate ?? collectionViewDataSourceNotSet + super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift new file mode 100644 index 0000000..dd8f4b4 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift @@ -0,0 +1,32 @@ +// +// RxCollectionViewDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +/// For more information take a look at `DelegateProxyType`. +open class RxCollectionViewDelegateProxy + : RxScrollViewDelegateProxy + , UICollectionViewDelegate + , UICollectionViewDelegateFlowLayout { + + /// Typed parent object. + public weak private(set) var collectionView: UICollectionView? + + /// Initializes `RxCollectionViewDelegateProxy` + /// + /// - parameter collectionView: Parent object for delegate proxy. + public init(collectionView: UICollectionView) { + self.collectionView = collectionView + super.init(scrollView: collectionView) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift new file mode 100644 index 0000000..372bf79 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift @@ -0,0 +1,38 @@ +// +// RxNavigationControllerDelegateProxy.swift +// RxCocoa +// +// Created by Diogo on 13/04/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + + import UIKit + import RxSwift + + extension UINavigationController: HasDelegate { + public typealias Delegate = UINavigationControllerDelegate + } + + /// For more information take a look at `DelegateProxyType`. + open class RxNavigationControllerDelegateProxy + : DelegateProxy + , DelegateProxyType + , UINavigationControllerDelegate { + + /// Typed parent object. + public weak private(set) var navigationController: UINavigationController? + + /// - parameter navigationController: Parent object for delegate proxy. + public init(navigationController: ParentObject) { + self.navigationController = navigationController + super.init(parentObject: navigationController, delegateProxy: RxNavigationControllerDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxNavigationControllerDelegateProxy(navigationController: $0) } + } + } +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift new file mode 100644 index 0000000..d0d3733 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift @@ -0,0 +1,71 @@ +// +// RxPickerViewDataSourceProxy.swift +// RxCocoa +// +// Created by Sergey Shulga on 05/07/2017. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +import RxSwift + +extension UIPickerView: HasDataSource { + public typealias DataSource = UIPickerViewDataSource +} + +fileprivate let pickerViewDataSourceNotSet = PickerViewDataSourceNotSet() + +final fileprivate class PickerViewDataSourceNotSet: NSObject, UIPickerViewDataSource { + func numberOfComponents(in pickerView: UIPickerView) -> Int { + return 0 + } + + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + return 0 + } +} + +/// For more information take a look at `DelegateProxyType`. +public class RxPickerViewDataSourceProxy + : DelegateProxy + , DelegateProxyType + , UIPickerViewDataSource { + + /// Typed parent object. + public weak private(set) var pickerView: UIPickerView? + + /// - parameter pickerView: Parent object for delegate proxy. + public init(pickerView: ParentObject) { + self.pickerView = pickerView + super.init(parentObject: pickerView, delegateProxy: RxPickerViewDataSourceProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxPickerViewDataSourceProxy(pickerView: $0) } + } + + private weak var _requiredMethodsDataSource: UIPickerViewDataSource? = pickerViewDataSourceNotSet + + // MARK: UIPickerViewDataSource + + /// Required delegate method implementation. + public func numberOfComponents(in pickerView: UIPickerView) -> Int { + return (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).numberOfComponents(in: pickerView) + } + + /// Required delegate method implementation. + public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + return (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).pickerView(pickerView, numberOfRowsInComponent: component) + } + + /// For more information take a look at `DelegateProxyType`. + public override func setForwardToDelegate(_ forwardToDelegate: UIPickerViewDataSource?, retainDelegate: Bool) { + _requiredMethodsDataSource = forwardToDelegate ?? pickerViewDataSourceNotSet + super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift new file mode 100644 index 0000000..922126f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift @@ -0,0 +1,37 @@ +// +// RxPickerViewDelegateProxy.swift +// RxCocoa +// +// Created by Segii Shulga on 5/12/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + + import RxSwift + import UIKit + + extension UIPickerView: HasDelegate { + public typealias Delegate = UIPickerViewDelegate + } + + open class RxPickerViewDelegateProxy + : DelegateProxy + , DelegateProxyType + , UIPickerViewDelegate { + + /// Typed parent object. + public weak private(set) var pickerView: UIPickerView? + + /// - parameter pickerView: Parent object for delegate proxy. + public init(pickerView: ParentObject) { + self.pickerView = pickerView + super.init(parentObject: pickerView, delegateProxy: RxPickerViewDelegateProxy.self) + } + + // Register known implementationss + public static func registerKnownImplementations() { + self.register { RxPickerViewDelegateProxy(pickerView: $0) } + } + } +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift new file mode 100644 index 0000000..dbaf238 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift @@ -0,0 +1,92 @@ +// +// RxScrollViewDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension UIScrollView: HasDelegate { + public typealias Delegate = UIScrollViewDelegate +} + +/// For more information take a look at `DelegateProxyType`. +open class RxScrollViewDelegateProxy + : DelegateProxy + , DelegateProxyType + , UIScrollViewDelegate { + + /// Typed parent object. + public weak private(set) var scrollView: UIScrollView? + + /// - parameter scrollView: Parent object for delegate proxy. + public init(scrollView: ParentObject) { + self.scrollView = scrollView + super.init(parentObject: scrollView, delegateProxy: RxScrollViewDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxScrollViewDelegateProxy(scrollView: $0) } + self.register { RxTableViewDelegateProxy(tableView: $0) } + self.register { RxCollectionViewDelegateProxy(collectionView: $0) } + self.register { RxTextViewDelegateProxy(textView: $0) } + } + + fileprivate var _contentOffsetBehaviorSubject: BehaviorSubject? + fileprivate var _contentOffsetPublishSubject: PublishSubject<()>? + + /// Optimized version used for observing content offset changes. + internal var contentOffsetBehaviorSubject: BehaviorSubject { + if let subject = _contentOffsetBehaviorSubject { + return subject + } + + let subject = BehaviorSubject(value: self.scrollView?.contentOffset ?? CGPoint.zero) + _contentOffsetBehaviorSubject = subject + + return subject + } + + /// Optimized version used for observing content offset changes. + internal var contentOffsetPublishSubject: PublishSubject<()> { + if let subject = _contentOffsetPublishSubject { + return subject + } + + let subject = PublishSubject<()>() + _contentOffsetPublishSubject = subject + + return subject + } + + // MARK: delegate methods + + /// For more information take a look at `DelegateProxyType`. + public func scrollViewDidScroll(_ scrollView: UIScrollView) { + if let subject = _contentOffsetBehaviorSubject { + subject.on(.next(scrollView.contentOffset)) + } + if let subject = _contentOffsetPublishSubject { + subject.on(.next(())) + } + self._forwardToDelegate?.scrollViewDidScroll?(scrollView) + } + + deinit { + if let subject = _contentOffsetBehaviorSubject { + subject.on(.completed) + } + + if let subject = _contentOffsetPublishSubject { + subject.on(.completed) + } + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift new file mode 100644 index 0000000..532ab68 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift @@ -0,0 +1,39 @@ +// +// RxSearchBarDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 7/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension UISearchBar: HasDelegate { + public typealias Delegate = UISearchBarDelegate +} + +/// For more information take a look at `DelegateProxyType`. +open class RxSearchBarDelegateProxy + : DelegateProxy + , DelegateProxyType + , UISearchBarDelegate { + + /// Typed parent object. + public weak private(set) var searchBar: UISearchBar? + + /// - parameter searchBar: Parent object for delegate proxy. + public init(searchBar: ParentObject) { + self.searchBar = searchBar + super.init(parentObject: searchBar, delegateProxy: RxSearchBarDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxSearchBarDelegateProxy(searchBar: $0) } + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift new file mode 100644 index 0000000..8341aa3 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift @@ -0,0 +1,40 @@ +// +// RxSearchControllerDelegateProxy.swift +// RxCocoa +// +// Created by Segii Shulga on 3/17/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import RxSwift +import UIKit + +extension UISearchController: HasDelegate { + public typealias Delegate = UISearchControllerDelegate +} + +/// For more information take a look at `DelegateProxyType`. +@available(iOS 8.0, *) +open class RxSearchControllerDelegateProxy + : DelegateProxy + , DelegateProxyType + , UISearchControllerDelegate { + + /// Typed parent object. + public weak private(set) var searchController: UISearchController? + + /// - parameter searchController: Parent object for delegate proxy. + public init(searchController: UISearchController) { + self.searchController = searchController + super.init(parentObject: searchController, delegateProxy: RxSearchControllerDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxSearchControllerDelegateProxy(searchController: $0) } + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift new file mode 100644 index 0000000..585894c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift @@ -0,0 +1,39 @@ +// +// RxTabBarControllerDelegateProxy.swift +// RxCocoa +// +// Created by Yusuke Kita on 2016/12/07. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension UITabBarController: HasDelegate { + public typealias Delegate = UITabBarControllerDelegate +} + +/// For more information take a look at `DelegateProxyType`. +open class RxTabBarControllerDelegateProxy + : DelegateProxy + , DelegateProxyType + , UITabBarControllerDelegate { + + /// Typed parent object. + public weak private(set) var tabBar: UITabBarController? + + /// - parameter tabBar: Parent object for delegate proxy. + public init(tabBar: ParentObject) { + self.tabBar = tabBar + super.init(parentObject: tabBar, delegateProxy: RxTabBarControllerDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxTabBarControllerDelegateProxy(tabBar: $0) } + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift new file mode 100644 index 0000000..c4a1704 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift @@ -0,0 +1,49 @@ +// +// RxTabBarDelegateProxy.swift +// RxCocoa +// +// Created by Jesse Farless on 5/14/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension UITabBar: HasDelegate { + public typealias Delegate = UITabBarDelegate +} + +/// For more information take a look at `DelegateProxyType`. +open class RxTabBarDelegateProxy + : DelegateProxy + , DelegateProxyType + , UITabBarDelegate { + + /// Typed parent object. + public weak private(set) var tabBar: UITabBar? + + /// - parameter tabBar: Parent object for delegate proxy. + public init(tabBar: ParentObject) { + self.tabBar = tabBar + super.init(parentObject: tabBar, delegateProxy: RxTabBarDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxTabBarDelegateProxy(tabBar: $0) } + } + + /// For more information take a look at `DelegateProxyType`. + open class func currentDelegate(for object: ParentObject) -> UITabBarDelegate? { + return object.delegate + } + + /// For more information take a look at `DelegateProxyType`. + open class func setCurrentDelegate(_ delegate: UITabBarDelegate?, to object: ParentObject) { + object.delegate = delegate + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift new file mode 100644 index 0000000..be553b3 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift @@ -0,0 +1,75 @@ +// +// RxTableViewDataSourceProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension UITableView: HasDataSource { + public typealias DataSource = UITableViewDataSource +} + +let tableViewDataSourceNotSet = TableViewDataSourceNotSet() + +final class TableViewDataSourceNotSet + : NSObject + , UITableViewDataSource { + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 0 + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + rxAbstractMethod(message: dataSourceNotSet) + } +} + +/// For more information take a look at `DelegateProxyType`. +open class RxTableViewDataSourceProxy + : DelegateProxy + , DelegateProxyType + , UITableViewDataSource { + + /// Typed parent object. + public weak private(set) var tableView: UITableView? + + /// - parameter tableView: Parent object for delegate proxy. + public init(tableView: UITableView) { + self.tableView = tableView + super.init(parentObject: tableView, delegateProxy: RxTableViewDataSourceProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxTableViewDataSourceProxy(tableView: $0) } + } + + fileprivate weak var _requiredMethodsDataSource: UITableViewDataSource? = tableViewDataSourceNotSet + + // MARK: delegate + + /// Required delegate method implementation. + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, numberOfRowsInSection: section) + } + + /// Required delegate method implementation. + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, cellForRowAt: indexPath) + } + + /// For more information take a look at `DelegateProxyType`. + open override func setForwardToDelegate(_ forwardToDelegate: UITableViewDataSource?, retainDelegate: Bool) { + _requiredMethodsDataSource = forwardToDelegate ?? tableViewDataSourceNotSet + super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift new file mode 100644 index 0000000..86a8758 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift @@ -0,0 +1,30 @@ +// +// RxTableViewDelegateProxy.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 6/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +/// For more information take a look at `DelegateProxyType`. +open class RxTableViewDelegateProxy + : RxScrollViewDelegateProxy + , UITableViewDelegate { + + /// Typed parent object. + public weak private(set) var tableView: UITableView? + + /// - parameter tableView: Parent object for delegate proxy. + public init(tableView: UITableView) { + self.tableView = tableView + super.init(scrollView: tableView) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift new file mode 100644 index 0000000..12669f9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift @@ -0,0 +1,37 @@ +// +// RxTextStorageDelegateProxy.swift +// RxCocoa +// +// Created by Segii Shulga on 12/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + + import RxSwift + import UIKit + + extension NSTextStorage: HasDelegate { + public typealias Delegate = NSTextStorageDelegate + } + + open class RxTextStorageDelegateProxy + : DelegateProxy + , DelegateProxyType + , NSTextStorageDelegate { + + /// Typed parent object. + public weak private(set) var textStorage: NSTextStorage? + + /// - parameter textStorage: Parent object for delegate proxy. + public init(textStorage: NSTextStorage) { + self.textStorage = textStorage + super.init(parentObject: textStorage, delegateProxy: RxTextStorageDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxTextStorageDelegateProxy(textStorage: $0) } + } + } +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift new file mode 100644 index 0000000..c8a1dfd --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift @@ -0,0 +1,43 @@ +// +// RxTextViewDelegateProxy.swift +// RxCocoa +// +// Created by Yuta ToKoRo on 7/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +/// For more information take a look at `DelegateProxyType`. +open class RxTextViewDelegateProxy + : RxScrollViewDelegateProxy + , UITextViewDelegate { + + /// Typed parent object. + public weak private(set) var textView: UITextView? + + /// - parameter textview: Parent object for delegate proxy. + public init(textView: UITextView) { + self.textView = textView + super.init(scrollView: textView) + } + + // MARK: delegate methods + + /// For more information take a look at `DelegateProxyType`. + @objc open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + /** + We've had some issues with observing text changes. This is here just in case we need the same hack in future and that + we wouldn't need to change the public interface. + */ + let forwardToDelegate = self.forwardToDelegate() as? UITextViewDelegate + return forwardToDelegate?.textView?(textView, + shouldChangeTextIn: range, + replacementText: text) ?? true + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxWebViewDelegateProxy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxWebViewDelegateProxy.swift new file mode 100644 index 0000000..36a03dc --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxWebViewDelegateProxy.swift @@ -0,0 +1,38 @@ +// +// RxWebViewDelegateProxy.swift +// RxCocoa +// +// Created by Andrew Breckenridge on 9/26/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +import RxSwift + +extension UIWebView: HasDelegate { + public typealias Delegate = UIWebViewDelegate +} + +open class RxWebViewDelegateProxy + : DelegateProxy + , DelegateProxyType + , UIWebViewDelegate { + + /// Typed parent object. + public weak private(set) var webView: UIWebView? + + /// - parameter webView: Parent object for delegate proxy. + public init(webView: ParentObject) { + self.webView = webView + super.init(parentObject: webView, delegateProxy: RxWebViewDelegateProxy.self) + } + + // Register known implementations + public static func registerKnownImplementations() { + self.register { RxWebViewDelegateProxy(webView: $0) } + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift new file mode 100644 index 0000000..bf00996 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift @@ -0,0 +1,29 @@ +// +// UIActivityIndicatorView+Rx.swift +// RxCocoa +// +// Created by Ivan Persidskiy on 02/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UIActivityIndicatorView { + + /// Bindable sink for `startAnimating()`, `stopAnimating()` methods. + public var isAnimating: Binder { + return Binder(self.base) { activityIndicator, active in + if active { + activityIndicator.startAnimating() + } else { + activityIndicator.stopAnimating() + } + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIAlertAction+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIAlertAction+Rx.swift new file mode 100644 index 0000000..a992fe1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIAlertAction+Rx.swift @@ -0,0 +1,25 @@ +// +// UIAlertAction+Rx.swift +// RxCocoa +// +// Created by Andrew Breckenridge on 5/7/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UIAlertAction { + + /// Bindable sink for `enabled` property. + public var isEnabled: Binder { + return Binder(self.base) { alertAction, value in + alertAction.isEnabled = value + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift new file mode 100644 index 0000000..c6ed134 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift @@ -0,0 +1,24 @@ +// +// UIApplication+Rx.swift +// RxCocoa +// +// Created by Mads Bøgeskov on 18/01/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + + import UIKit + import RxSwift + + extension Reactive where Base: UIApplication { + + /// Bindable sink for `networkActivityIndicatorVisible`. + public var isNetworkActivityIndicatorVisible: Binder { + return Binder(self.base) { application, active in + application.isNetworkActivityIndicatorVisible = active + } + } + } +#endif + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift new file mode 100644 index 0000000..d4076e4 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift @@ -0,0 +1,87 @@ +// +// UIBarButtonItem+Rx.swift +// RxCocoa +// +// Created by Daniel Tartaglia on 5/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +fileprivate var rx_tap_key: UInt8 = 0 + +extension Reactive where Base: UIBarButtonItem { + + /// Bindable sink for `enabled` property. + public var isEnabled: Binder { + return Binder(self.base) { element, value in + element.isEnabled = value + } + } + + /// Bindable sink for `title` property. + public var title: Binder { + return Binder(self.base) { element, value in + element.title = value + } + } + + /// Reactive wrapper for target action pattern on `self`. + public var tap: ControlEvent<()> { + let source = lazyInstanceObservable(&rx_tap_key) { () -> Observable<()> in + Observable.create { [weak control = self.base] observer in + guard let control = control else { + observer.on(.completed) + return Disposables.create() + } + let target = BarButtonItemTarget(barButtonItem: control) { + observer.on(.next(())) + } + return target + } + .takeUntil(self.deallocated) + .share() + } + + return ControlEvent(events: source) + } +} + + +@objc +final class BarButtonItemTarget: RxTarget { + typealias Callback = () -> Void + + weak var barButtonItem: UIBarButtonItem? + var callback: Callback! + + init(barButtonItem: UIBarButtonItem, callback: @escaping () -> Void) { + self.barButtonItem = barButtonItem + self.callback = callback + super.init() + barButtonItem.target = self + barButtonItem.action = #selector(BarButtonItemTarget.action(_:)) + } + + override func dispose() { + super.dispose() +#if DEBUG + MainScheduler.ensureExecutingOnScheduler() +#endif + + barButtonItem?.target = nil + barButtonItem?.action = nil + + callback = nil + } + + @objc func action(_ sender: AnyObject) { + callback() + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift new file mode 100644 index 0000000..4d16169 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift @@ -0,0 +1,86 @@ +// +// UIButton+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIButton { + + /// Reactive wrapper for `TouchUpInside` control event. + public var tap: ControlEvent { + return controlEvent(.touchUpInside) + } +} + +#endif + +#if os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIButton { + + /// Reactive wrapper for `PrimaryActionTriggered` control event. + public var primaryAction: ControlEvent { + return controlEvent(.primaryActionTriggered) + } + +} + +#endif + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIButton { + + /// Reactive wrapper for `setTitle(_:for:)` + public func title(for controlState: UIControlState = []) -> Binder { + return Binder(self.base) { (button, title) -> () in + button.setTitle(title, for: controlState) + } + } + + /// Reactive wrapper for `setImage(_:for:)` + public func image(for controlState: UIControlState = []) -> Binder { + return Binder(self.base) { (button, image) -> () in + button.setImage(image, for: controlState) + } + } + + /// Reactive wrapper for `setBackgroundImage(_:for:)` + public func backgroundImage(for controlState: UIControlState = []) -> Binder { + return Binder(self.base) { (button, image) -> () in + button.setBackgroundImage(image, for: controlState) + } + } + +} +#endif + +#if os(iOS) || os(tvOS) + + import RxSwift + import UIKit + + extension Reactive where Base: UIButton { + + /// Reactive wrapper for `setAttributedTitle(_:controlState:)` + public func attributedTitle(for controlState: UIControlState = []) -> Binder { + return Binder(self.base) { (button, attributedTitle) -> () in + button.setAttributedTitle(attributedTitle, for: controlState) + } + } + + } +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift new file mode 100644 index 0000000..87eb3fd --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift @@ -0,0 +1,338 @@ +// +// UICollectionView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +// Items + +extension Reactive where Base: UICollectionView { + + /** + Binds sequences of elements to collection view items. + + - parameter source: Observable sequence of items. + - parameter cellFactory: Transform between sequence elements and view cells. + - returns: Disposable object that can be used to unbind. + + Example + + let items = Observable.just([ + 1, + 2, + 3 + ]) + + items + .bind(to: collectionView.rx.items) { (collectionView, row, element) in + let indexPath = IndexPath(row: row, section: 0) + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! NumberCell + cell.value?.text = "\(element) @ \(row)" + return cell + } + .disposed(by: disposeBag) + */ + public func items + (_ source: O) + -> (_ cellFactory: @escaping (UICollectionView, Int, S.Iterator.Element) -> UICollectionViewCell) + -> Disposable where O.E == S { + return { cellFactory in + let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper(cellFactory: cellFactory) + return self.items(dataSource: dataSource)(source) + } + + } + + /** + Binds sequences of elements to collection view items. + + - parameter cellIdentifier: Identifier used to dequeue cells. + - parameter source: Observable sequence of items. + - parameter configureCell: Transform between sequence elements and view cells. + - parameter cellType: Type of table view cell. + - returns: Disposable object that can be used to unbind. + + Example + + let items = Observable.just([ + 1, + 2, + 3 + ]) + + items + .bind(to: collectionView.rx.items(cellIdentifier: "Cell", cellType: NumberCell.self)) { (row, element, cell) in + cell.value?.text = "\(element) @ \(row)" + } + .disposed(by: disposeBag) + */ + public func items + (cellIdentifier: String, cellType: Cell.Type = Cell.self) + -> (_ source: O) + -> (_ configureCell: @escaping (Int, S.Iterator.Element, Cell) -> Void) + -> Disposable where O.E == S { + return { source in + return { configureCell in + let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper { (cv, i, item) in + let indexPath = IndexPath(item: i, section: 0) + let cell = cv.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! Cell + configureCell(i, item, cell) + return cell + } + + return self.items(dataSource: dataSource)(source) + } + } + } + + + /** + Binds sequences of elements to collection view items using a custom reactive data used to perform the transformation. + + - parameter dataSource: Data source used to transform elements to view cells. + - parameter source: Observable sequence of items. + - returns: Disposable object that can be used to unbind. + + Example + + let dataSource = RxCollectionViewSectionedReloadDataSource>() + + let items = Observable.just([ + SectionModel(model: "First section", items: [ + 1.0, + 2.0, + 3.0 + ]), + SectionModel(model: "Second section", items: [ + 1.0, + 2.0, + 3.0 + ]), + SectionModel(model: "Third section", items: [ + 1.0, + 2.0, + 3.0 + ]) + ]) + + dataSource.configureCell = { (dataSource, cv, indexPath, element) in + let cell = cv.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! NumberCell + cell.value?.text = "\(element) @ row \(indexPath.row)" + return cell + } + + items + .bind(to: collectionView.rx.items(dataSource: dataSource)) + .disposed(by: disposeBag) + */ + public func items< + DataSource: RxCollectionViewDataSourceType & UICollectionViewDataSource, + O: ObservableType> + (dataSource: DataSource) + -> (_ source: O) + -> Disposable where DataSource.Element == O.E + { + return { source in + // This is called for sideeffects only, and to make sure delegate proxy is in place when + // data source is being bound. + // This is needed because theoretically the data source subscription itself might + // call `self.rx.delegate`. If that happens, it might cause weird side effects since + // setting data source will set delegate, and UICollectionView might get into a weird state. + // Therefore it's better to set delegate proxy first, just to be sure. + _ = self.delegate + // Strong reference is needed because data source is in use until result subscription is disposed + return source.subscribeProxyDataSource(ofObject: self.base, dataSource: dataSource, retainDataSource: true) { [weak collectionView = self.base] (_: RxCollectionViewDataSourceProxy, event) -> Void in + guard let collectionView = collectionView else { + return + } + dataSource.collectionView(collectionView, observedEvent: event) + } + } + } +} + +extension Reactive where Base: UICollectionView { + public typealias DisplayCollectionViewCellEvent = (cell: UICollectionViewCell, at: IndexPath) + public typealias DisplayCollectionViewSupplementaryViewEvent = (supplementaryView: UICollectionReusableView, elementKind: String, at: IndexPath) + + /// Reactive wrapper for `dataSource`. + /// + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var dataSource: DelegateProxy { + return RxCollectionViewDataSourceProxy.proxy(for: base) + } + + /// Installs data source as forwarding delegate on `rx.dataSource`. + /// Data source won't be retained. + /// + /// It enables using normal delegate mechanism with reactive delegate mechanism. + /// + /// - parameter dataSource: Data source object. + /// - returns: Disposable object that can be used to unbind the data source. + public func setDataSource(_ dataSource: UICollectionViewDataSource) + -> Disposable { + return RxCollectionViewDataSourceProxy.installForwardDelegate(dataSource, retainDelegate: false, onProxyForObject: self.base) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`. + public var itemSelected: ControlEvent { + let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didSelectItemAt:))) + .map { a in + return try castOrThrow(IndexPath.self, a[1]) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`. + public var itemDeselected: ControlEvent { + let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didDeselectItemAt:))) + .map { a in + return try castOrThrow(IndexPath.self, a[1]) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:didHighlightItemAt:)`. + public var itemHighlighted: ControlEvent { + let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didHighlightItemAt:))) + .map { a in + return try castOrThrow(IndexPath.self, a[1]) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:didUnhighlightItemAt:)`. + public var itemUnhighlighted: ControlEvent { + let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didUnhighlightItemAt:))) + .map { a in + return try castOrThrow(IndexPath.self, a[1]) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView:willDisplay:forItemAt:`. + public var willDisplayCell: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:willDisplay:forItemAt:))) + .map { a in + return (try castOrThrow(UICollectionViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2])) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:willDisplaySupplementaryView:forElementKind:at:)`. + public var willDisplaySupplementaryView: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:willDisplaySupplementaryView:forElementKind:at:))) + .map { a in + return (try castOrThrow(UICollectionReusableView.self, a[1]), + try castOrThrow(String.self, a[2]), + try castOrThrow(IndexPath.self, a[3])) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView:didEndDisplaying:forItemAt:`. + public var didEndDisplayingCell: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didEndDisplaying:forItemAt:))) + .map { a in + return (try castOrThrow(UICollectionViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2])) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:)`. + public var didEndDisplayingSupplementaryView: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:))) + .map { a in + return (try castOrThrow(UICollectionReusableView.self, a[1]), + try castOrThrow(String.self, a[2]), + try castOrThrow(IndexPath.self, a[3])) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`. + /// + /// It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence, + /// or any other data source conforming to `SectionedViewDataSourceType` protocol. + /// + /// ``` + /// collectionView.rx.modelSelected(MyModel.self) + /// .map { ... + /// ``` + public func modelSelected(_ modelType: T.Type) -> ControlEvent { + let source: Observable = itemSelected.flatMap { [weak view = self.base as UICollectionView] indexPath -> Observable in + guard let view = view else { + return Observable.empty() + } + + return Observable.just(try view.rx.model(at: indexPath)) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`. + /// + /// It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence, + /// or any other data source conforming to `SectionedViewDataSourceType` protocol. + /// + /// ``` + /// collectionView.rx.modelDeselected(MyModel.self) + /// .map { ... + /// ``` + public func modelDeselected(_ modelType: T.Type) -> ControlEvent { + let source: Observable = itemDeselected.flatMap { [weak view = self.base as UICollectionView] indexPath -> Observable in + guard let view = view else { + return Observable.empty() + } + + return Observable.just(try view.rx.model(at: indexPath)) + } + + return ControlEvent(events: source) + } + + /// Synchronous helper method for retrieving a model at indexPath through a reactive data source + public func model(at indexPath: IndexPath) throws -> T { + let dataSource: SectionedViewDataSourceType = castOrFatalError(self.dataSource.forwardToDelegate(), message: "This method only works in case one of the `rx.itemsWith*` methods was used.") + + let element = try dataSource.model(at: indexPath) + + return try castOrThrow(T.self, element) + } +} +#endif + +#if os(tvOS) + +extension Reactive where Base: UICollectionView { + + /// Reactive wrapper for `delegate` message `collectionView(_:didUpdateFocusInContext:withAnimationCoordinator:)`. + public var didUpdateFocusInContextWithAnimationCoordinator: ControlEvent<(context: UICollectionViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator)> { + + let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didUpdateFocusIn:with:))) + .map { a -> (context: UICollectionViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator) in + let context = try castOrThrow(UICollectionViewFocusUpdateContext.self, a[1]) + let animationCoordinator = try castOrThrow(UIFocusAnimationCoordinator.self, a[2]) + return (context: context, animationCoordinator: animationCoordinator) + } + + return ControlEvent(events: source) + } +} +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift new file mode 100644 index 0000000..01b52bc --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift @@ -0,0 +1,102 @@ +// +// UIControl+Rx.swift +// RxCocoa +// +// Created by Daniel Tartaglia on 5/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIControl { + + /// Bindable sink for `enabled` property. + public var isEnabled: Binder { + return Binder(self.base) { control, value in + control.isEnabled = value + } + } + + /// Bindable sink for `selected` property. + public var isSelected: Binder { + return Binder(self.base) { control, selected in + control.isSelected = selected + } + } + + /// Reactive wrapper for target action pattern. + /// + /// - parameter controlEvents: Filter for observed event types. + public func controlEvent(_ controlEvents: UIControlEvents) -> ControlEvent<()> { + let source: Observable = Observable.create { [weak control = self.base] observer in + MainScheduler.ensureExecutingOnScheduler() + + guard let control = control else { + observer.on(.completed) + return Disposables.create() + } + + let controlTarget = ControlTarget(control: control, controlEvents: controlEvents) { + control in + observer.on(.next(())) + } + + return Disposables.create(with: controlTarget.dispose) + } + .takeUntil(deallocated) + + return ControlEvent(events: source) + } + + /// Creates a `ControlProperty` that is triggered by target/action pattern value updates. + /// + /// - parameter controlEvents: Events that trigger value update sequence elements. + /// - parameter getter: Property value getter. + /// - parameter setter: Property value setter. + public func controlProperty( + editingEvents: UIControlEvents, + getter: @escaping (Base) -> T, + setter: @escaping (Base, T) -> () + ) -> ControlProperty { + let source: Observable = Observable.create { [weak weakControl = base] observer in + guard let control = weakControl else { + observer.on(.completed) + return Disposables.create() + } + + observer.on(.next(getter(control))) + + let controlTarget = ControlTarget(control: control, controlEvents: editingEvents) { _ in + if let control = weakControl { + observer.on(.next(getter(control))) + } + } + + return Disposables.create(with: controlTarget.dispose) + } + .takeUntil(deallocated) + + let bindingObserver = Binder(base, binding: setter) + + return ControlProperty(values: source, valueSink: bindingObserver) + } + + /// This is a separate method is to better communicate to public consumers that + /// an `editingEvent` needs to fire for control property to be updated. + internal func controlPropertyWithDefaultEvents( + editingEvents: UIControlEvents = [.allEditingEvents, .valueChanged], + getter: @escaping (Base) -> T, + setter: @escaping (Base, T) -> () + ) -> ControlProperty { + return controlProperty( + editingEvents: [.allEditingEvents, .valueChanged], + getter: getter, + setter: setter + ) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift new file mode 100644 index 0000000..233be86 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift @@ -0,0 +1,43 @@ +// +// UIDatePicker+Rx.swift +// RxCocoa +// +// Created by Daniel Tartaglia on 5/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIDatePicker { + /// Reactive wrapper for `date` property. + public var date: ControlProperty { + return value + } + + /// Reactive wrapper for `date` property. + public var value: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { datePicker in + datePicker.date + }, setter: { datePicker, value in + datePicker.date = value + } + ) + } + + /// Reactive wrapper for `countDownDuration` property. + public var countDownDuration: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { datePicker in + datePicker.countDownDuration + }, setter: { datePicker, value in + datePicker.countDownDuration = value + } + ) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift new file mode 100644 index 0000000..6da3fb1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift @@ -0,0 +1,76 @@ +// +// UIGestureRecognizer+Rx.swift +// RxCocoa +// +// Created by Carlos García on 10/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +// This should be only used from `MainScheduler` +final class GestureTarget: RxTarget { + typealias Callback = (Recognizer) -> Void + + let selector = #selector(ControlTarget.eventHandler(_:)) + + weak var gestureRecognizer: Recognizer? + var callback: Callback? + + init(_ gestureRecognizer: Recognizer, callback: @escaping Callback) { + self.gestureRecognizer = gestureRecognizer + self.callback = callback + + super.init() + + gestureRecognizer.addTarget(self, action: selector) + + let method = self.method(for: selector) + if method == nil { + fatalError("Can't find method") + } + } + + @objc func eventHandler(_ sender: UIGestureRecognizer) { + if let callback = self.callback, let gestureRecognizer = self.gestureRecognizer { + callback(gestureRecognizer) + } + } + + override func dispose() { + super.dispose() + + self.gestureRecognizer?.removeTarget(self, action: self.selector) + self.callback = nil + } +} + +extension Reactive where Base: UIGestureRecognizer { + + /// Reactive wrapper for gesture recognizer events. + public var event: ControlEvent { + let source: Observable = Observable.create { [weak control = self.base] observer in + MainScheduler.ensureExecutingOnScheduler() + + guard let control = control else { + observer.on(.completed) + return Disposables.create() + } + + let observer = GestureTarget(control) { + control in + observer.on(.next(control)) + } + + return observer + }.takeUntil(deallocated) + + return ControlEvent(events: source) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift new file mode 100644 index 0000000..b6315c2 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIImageView+Rx.swift @@ -0,0 +1,24 @@ +// +// UIImageView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIImageView { + + /// Bindable sink for `image` property. + public var image: Binder { + return Binder(base) { imageView, image in + imageView.image = image + } + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift new file mode 100644 index 0000000..f533f56 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UILabel+Rx.swift @@ -0,0 +1,32 @@ +// +// UILabel+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UILabel { + + /// Bindable sink for `text` property. + public var text: Binder { + return Binder(self.base) { label, text in + label.text = text + } + } + + /// Bindable sink for `attributedText` property. + public var attributedText: Binder { + return Binder(self.base) { label, text in + label.attributedText = text + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationController+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationController+Rx.swift new file mode 100644 index 0000000..2391351 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationController+Rx.swift @@ -0,0 +1,49 @@ +// +// UINavigationController+Rx.swift +// RxCocoa +// +// Created by Diogo on 13/04/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UINavigationController { + public typealias ShowEvent = (viewController: UIViewController, animated: Bool) + + /// Reactive wrapper for `delegate`. + /// + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxNavigationControllerDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for delegate method `navigationController(:willShow:animated:)`. + public var willShow: ControlEvent { + let source: Observable = delegate + .methodInvoked(#selector(UINavigationControllerDelegate.navigationController(_:willShow:animated:))) + .map { arg in + let viewController = try castOrThrow(UIViewController.self, arg[1]) + let animated = try castOrThrow(Bool.self, arg[2]) + return (viewController, animated) + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `navigationController(:didShow:animated:)`. + public var didShow: ControlEvent { + let source: Observable = delegate + .methodInvoked(#selector(UINavigationControllerDelegate.navigationController(_:didShow:animated:))) + .map { arg in + let viewController = try castOrThrow(UIViewController.self, arg[1]) + let animated = try castOrThrow(Bool.self, arg[2]) + return (viewController, animated) + } + return ControlEvent(events: source) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationItem+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationItem+Rx.swift new file mode 100644 index 0000000..6250033 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UINavigationItem+Rx.swift @@ -0,0 +1,25 @@ +// +// UINavigationItem+Rx.swift +// RxCocoa +// +// Created by kumapo on 2016/05/09. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UINavigationItem { + + /// Bindable sink for `title` property. + public var title: Binder { + return Binder(self.base) { navigationItem, text in + navigationItem.title = text + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPageControl+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPageControl+Rx.swift new file mode 100644 index 0000000..f21decf --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPageControl+Rx.swift @@ -0,0 +1,32 @@ +// +// UIPageControl+Rx.swift +// RxCocoa +// +// Created by Francesco Puntillo on 14/04/2016. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIPageControl { + + /// Bindable sink for `currentPage` property. + public var currentPage: Binder { + return Binder(self.base) { controller, page in + controller.currentPage = page + } + } + + /// Bindable sink for `numberOfPages` property. + public var numberOfPages: Binder { + return Binder(self.base) { controller, page in + controller.numberOfPages = page + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPickerView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPickerView+Rx.swift new file mode 100644 index 0000000..f201947 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIPickerView+Rx.swift @@ -0,0 +1,224 @@ +// +// UIPickerView+Rx.swift +// RxCocoa +// +// Created by Segii Shulga on 5/12/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + + import RxSwift + import UIKit + + extension Reactive where Base: UIPickerView { + + /// Reactive wrapper for `delegate`. + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxPickerViewDelegateProxy.proxy(for: base) + } + + /// Installs delegate as forwarding delegate on `delegate`. + /// Delegate won't be retained. + /// + /// It enables using normal delegate mechanism with reactive delegate mechanism. + /// + /// - parameter delegate: Delegate object. + /// - returns: Disposable object that can be used to unbind the delegate. + public func setDelegate(_ delegate: UIPickerViewDelegate) + -> Disposable { + return RxPickerViewDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base) + } + + /** + Reactive wrapper for `dataSource`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var dataSource: DelegateProxy { + return RxPickerViewDataSourceProxy.proxy(for: base) + } + + /** + Reactive wrapper for `delegate` message `pickerView:didSelectRow:inComponent:`. + */ + public var itemSelected: ControlEvent<(row: Int, component: Int)> { + let source = delegate + .methodInvoked(#selector(UIPickerViewDelegate.pickerView(_:didSelectRow:inComponent:))) + .map { + return (row: try castOrThrow(Int.self, $0[1]), component: try castOrThrow(Int.self, $0[2])) + } + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `pickerView:didSelectRow:inComponent:`. + + It can be only used when one of the `rx.itemTitles, rx.itemAttributedTitles, items(_ source: O)` methods is used to bind observable sequence, + or any other data source conforming to a `ViewDataSourceType` protocol. + + ``` + pickerView.rx.modelSelected(MyModel.self) + .map { ... + ``` + - parameter modelType: Type of a Model which bound to the dataSource + */ + public func modelSelected(_ modelType: T.Type) -> ControlEvent<[T]> { + let source = itemSelected.flatMap { [weak view = self.base as UIPickerView] (_, component) -> Observable<[T]> in + guard let view = view else { + return Observable.empty() + } + + let model: [T] = try (0 ..< view.numberOfComponents).map { component in + let row = view.selectedRow(inComponent: component) + return try view.rx.model(at: IndexPath(row: row, section: component)) + } + + return Observable.just(model) + } + + return ControlEvent(events: source) + } + + /** + Binds sequences of elements to picker view rows. + + - parameter source: Observable sequence of items. + - parameter titleForRow: Transform between sequence elements and row titles. + - returns: Disposable object that can be used to unbind. + + Example: + + let items = Observable.just([ + "First Item", + "Second Item", + "Third Item" + ]) + + items + .bind(to: pickerView.rx.itemTitles) { (row, element) in + return element.title + } + .disposed(by: disposeBag) + + */ + + public func itemTitles + (_ source: O) + -> (_ titleForRow: @escaping (Int, S.Iterator.Element) -> String?) + -> Disposable where O.E == S { + return { titleForRow in + let adapter = RxStringPickerViewAdapter(titleForRow: titleForRow) + return self.items(adapter: adapter)(source) + } + } + + /** + Binds sequences of elements to picker view rows. + + - parameter source: Observable sequence of items. + - parameter attributedTitleForRow: Transform between sequence elements and row attributed titles. + - returns: Disposable object that can be used to unbind. + + Example: + + let items = Observable.just([ + "First Item", + "Second Item", + "Third Item" + ]) + + items + .bind(to: pickerView.rx.itemAttributedTitles) { (row, element) in + return NSAttributedString(string: element.title) + } + .disposed(by: disposeBag) + + */ + + public func itemAttributedTitles + (_ source: O) + -> (_ attributedTitleForRow: @escaping (Int, S.Iterator.Element) -> NSAttributedString?) + -> Disposable where O.E == S { + return { attributedTitleForRow in + let adapter = RxAttributedStringPickerViewAdapter(attributedTitleForRow: attributedTitleForRow) + return self.items(adapter: adapter)(source) + } + } + + /** + Binds sequences of elements to picker view rows. + + - parameter source: Observable sequence of items. + - parameter viewForRow: Transform between sequence elements and row views. + - returns: Disposable object that can be used to unbind. + + Example: + + let items = Observable.just([ + "First Item", + "Second Item", + "Third Item" + ]) + + items + .bind(to: pickerView.rx.items) { (row, element, view) in + guard let myView = view as? MyView else { + let view = MyView() + view.configure(with: element) + return view + } + myView.configure(with: element) + return myView + } + .disposed(by: disposeBag) + + */ + + public func items + (_ source: O) + -> (_ viewForRow: @escaping (Int, S.Iterator.Element, UIView?) -> UIView) + -> Disposable where O.E == S { + return { viewForRow in + let adapter = RxPickerViewAdapter(viewForRow: viewForRow) + return self.items(adapter: adapter)(source) + } + } + + /** + Binds sequences of elements to picker view rows using a custom reactive adapter used to perform the transformation. + This method will retain the adapter for as long as the subscription isn't disposed (result `Disposable` + being disposed). + In case `source` observable sequence terminates successfully, the adapter will present latest element + until the subscription isn't disposed. + + - parameter adapter: Adapter used to transform elements to picker components. + - parameter source: Observable sequence of items. + - returns: Disposable object that can be used to unbind. + */ + public func items(adapter: Adapter) + -> (_ source: O) + -> Disposable where O.E == Adapter.Element { + return { source in + let delegateSubscription = self.setDelegate(adapter) + let dataSourceSubscription = source.subscribeProxyDataSource(ofObject: self.base, dataSource: adapter, retainDataSource: true, binding: { [weak pickerView = self.base] (_: RxPickerViewDataSourceProxy, event) in + guard let pickerView = pickerView else { return } + adapter.pickerView(pickerView, observedEvent: event) + }) + return Disposables.create(delegateSubscription, dataSourceSubscription) + } + } + + /** + Synchronous helper method for retrieving a model at indexPath through a reactive data source. + */ + public func model(at indexPath: IndexPath) throws -> T { + let dataSource: SectionedViewDataSourceType = castOrFatalError(self.dataSource.forwardToDelegate(), message: "This method only works in case one of the `rx.itemTitles, rx.itemAttributedTitles, items(_ source: O)` methods was used.") + + return castOrFatalError(try dataSource.model(at: indexPath)) + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift new file mode 100644 index 0000000..7a39d9a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIProgressView+Rx.swift @@ -0,0 +1,25 @@ +// +// UIProgressView+Rx.swift +// RxCocoa +// +// Created by Samuel Bae on 2/27/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UIProgressView { + + /// Bindable sink for `progress` property + public var progress: Binder { + return Binder(self.base) { progressView, progress in + progressView.progress = progress + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift new file mode 100644 index 0000000..cdb10be --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift @@ -0,0 +1,28 @@ +// +// UIRefreshControl+Rx.swift +// RxCocoa +// +// Created by Yosuke Ishikawa on 1/31/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UIRefreshControl { + /// Bindable sink for `beginRefreshing()`, `endRefreshing()` methods. + public var isRefreshing: Binder { + return Binder(self.base) { refreshControl, refresh in + if refresh { + refreshControl.beginRefreshing() + } else { + refreshControl.endRefreshing() + } + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift new file mode 100644 index 0000000..2d5d74c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift @@ -0,0 +1,138 @@ +// +// UIScrollView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/3/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + + import RxSwift + import UIKit + + extension Reactive where Base: UIScrollView { + public typealias EndZoomEvent = (view: UIView?, scale: CGFloat) + public typealias WillEndDraggingEvent = (velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) + + /// Reactive wrapper for `delegate`. + /// + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxScrollViewDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for `contentOffset`. + public var contentOffset: ControlProperty { + let proxy = RxScrollViewDelegateProxy.proxy(for: base) + + let bindingObserver = Binder(self.base) { scrollView, contentOffset in + scrollView.contentOffset = contentOffset + } + + return ControlProperty(values: proxy.contentOffsetBehaviorSubject, valueSink: bindingObserver) + } + + /// Bindable sink for `scrollEnabled` property. + public var isScrollEnabled: Binder { + return Binder(self.base) { scrollView, scrollEnabled in + scrollView.isScrollEnabled = scrollEnabled + } + } + + /// Reactive wrapper for delegate method `scrollViewDidScroll` + public var didScroll: ControlEvent { + let source = RxScrollViewDelegateProxy.proxy(for: base).contentOffsetPublishSubject + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewWillBeginDecelerating` + public var willBeginDecelerating: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginDecelerating(_:))).map { _ in } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewDidEndDecelerating` + public var didEndDecelerating: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndDecelerating(_:))).map { _ in } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewWillBeginDragging` + public var willBeginDragging: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginDragging(_:))).map { _ in } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)` + public var willEndDragging: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillEndDragging(_:withVelocity:targetContentOffset:))) + .map { value -> WillEndDraggingEvent in + let velocity = try castOrThrow(CGPoint.self, value[1]) + let targetContentOffsetValue = try castOrThrow(NSValue.self, value[2]) + + guard let rawPointer = targetContentOffsetValue.pointerValue else { throw RxCocoaError.unknown } + let typedPointer = rawPointer.bindMemory(to: CGPoint.self, capacity: MemoryLayout.size) + + return (velocity, typedPointer) + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewDidEndDragging(_:willDecelerate:)` + public var didEndDragging: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndDragging(_:willDecelerate:))).map { value -> Bool in + return try castOrThrow(Bool.self, value[1]) + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewDidZoom` + public var didZoom: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidZoom)).map { _ in } + return ControlEvent(events: source) + } + + + /// Reactive wrapper for delegate method `scrollViewDidScrollToTop` + public var didScrollToTop: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidScrollToTop(_:))).map { _ in } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewDidEndScrollingAnimation` + public var didEndScrollingAnimation: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndScrollingAnimation(_:))).map { _ in } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewWillBeginZooming(_:with:)` + public var willBeginZooming: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginZooming(_:with:))).map { value -> UIView? in + return try castOptionalOrThrow(UIView.self, value[1] as AnyObject) + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `scrollViewDidEndZooming(_:with:atScale:)` + public var didEndZooming: ControlEvent { + let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndZooming(_:with:atScale:))).map { value -> EndZoomEvent in + return (try castOptionalOrThrow(UIView.self, value[1] as AnyObject), try castOrThrow(CGFloat.self, value[2])) + } + return ControlEvent(events: source) + } + + /// Installs delegate as forwarding delegate on `delegate`. + /// Delegate won't be retained. + /// + /// It enables using normal delegate mechanism with reactive delegate mechanism. + /// + /// - parameter delegate: Delegate object. + /// - returns: Disposable object that can be used to unbind the delegate. + public func setDelegate(_ delegate: UIScrollViewDelegate) + -> Disposable { + return RxScrollViewDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base) + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift new file mode 100644 index 0000000..c8a78c3 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift @@ -0,0 +1,124 @@ +// +// UISearchBar+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UISearchBar { + + /// Reactive wrapper for `delegate`. + /// + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxSearchBarDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for `text` property. + public var text: ControlProperty { + return value + } + + /// Reactive wrapper for `text` property. + public var value: ControlProperty { + let source: Observable = Observable.deferred { [weak searchBar = self.base as UISearchBar] () -> Observable in + let text = searchBar?.text + + return (searchBar?.rx.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBar(_:textDidChange:))) ?? Observable.empty()) + .map { a in + return a[1] as? String + } + .startWith(text) + } + + let bindingObserver = Binder(self.base) { (searchBar, text: String?) in + searchBar.text = text + } + + return ControlProperty(values: source, valueSink: bindingObserver) + } + + /// Reactive wrapper for `selectedScopeButtonIndex` property. + public var selectedScopeButtonIndex: ControlProperty { + let source: Observable = Observable.deferred { [weak source = self.base as UISearchBar] () -> Observable in + let index = source?.selectedScopeButtonIndex ?? 0 + + return (source?.rx.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBar(_:selectedScopeButtonIndexDidChange:))) ?? Observable.empty()) + .map { a in + return try castOrThrow(Int.self, a[1]) + } + .startWith(index) + } + + let bindingObserver = Binder(self.base) { (searchBar, index: Int) in + searchBar.selectedScopeButtonIndex = index + } + + return ControlProperty(values: source, valueSink: bindingObserver) + } + +#if os(iOS) + /// Reactive wrapper for delegate method `searchBarCancelButtonClicked`. + public var cancelButtonClicked: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarCancelButtonClicked(_:))) + .map { _ in + return () + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `searchBarBookmarkButtonClicked`. + public var bookmarkButtonClicked: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarBookmarkButtonClicked(_:))) + .map { _ in + return () + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `searchBarResultsListButtonClicked`. + public var resultsListButtonClicked: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarResultsListButtonClicked(_:))) + .map { _ in + return () + } + return ControlEvent(events: source) + } +#endif + + /// Reactive wrapper for delegate method `searchBarSearchButtonClicked`. + public var searchButtonClicked: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarSearchButtonClicked(_:))) + .map { _ in + return () + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `searchBarTextDidBeginEditing`. + public var textDidBeginEditing: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidBeginEditing(_:))) + .map { _ in + return () + } + return ControlEvent(events: source) + } + + /// Reactive wrapper for delegate method `searchBarTextDidEndEditing`. + public var textDidEndEditing: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidEndEditing(_:))) + .map { _ in + return () + } + return ControlEvent(events: source) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchController+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchController+Rx.swift new file mode 100644 index 0000000..da5a0de --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISearchController+Rx.swift @@ -0,0 +1,59 @@ +// +// UISearchController+Rx.swift +// RxCocoa +// +// Created by Segii Shulga on 3/17/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + + import RxSwift + import UIKit + + @available(iOS 8.0, *) + extension Reactive where Base: UISearchController { + /// Reactive wrapper for `delegate`. + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxSearchControllerDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for `delegate` message. + public var didDismiss: Observable { + return delegate + .methodInvoked( #selector(UISearchControllerDelegate.didDismissSearchController(_:))) + .map {_ in} + } + + /// Reactive wrapper for `delegate` message. + public var didPresent: Observable { + return delegate + .methodInvoked(#selector(UISearchControllerDelegate.didPresentSearchController(_:))) + .map {_ in} + } + + /// Reactive wrapper for `delegate` message. + public var present: Observable { + return delegate + .methodInvoked( #selector(UISearchControllerDelegate.presentSearchController(_:))) + .map {_ in} + } + + /// Reactive wrapper for `delegate` message. + public var willDismiss: Observable { + return delegate + .methodInvoked(#selector(UISearchControllerDelegate.willDismissSearchController(_:))) + .map {_ in} + } + + /// Reactive wrapper for `delegate` message. + public var willPresent: Observable { + return delegate + .methodInvoked( #selector(UISearchControllerDelegate.willPresentSearchController(_:))) + .map {_ in} + } + + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift new file mode 100644 index 0000000..b707eae --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift @@ -0,0 +1,40 @@ +// +// UISegmentedControl+Rx.swift +// RxCocoa +// +// Created by Carlos García on 8/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UISegmentedControl { + /// Reactive wrapper for `selectedSegmentIndex` property. + public var selectedSegmentIndex: ControlProperty { + return value + } + + /// Reactive wrapper for `selectedSegmentIndex` property. + public var value: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { segmentedControl in + segmentedControl.selectedSegmentIndex + }, setter: { segmentedControl, value in + segmentedControl.selectedSegmentIndex = value + } + ) + } + + /// Reactive wrapper for `setEnabled(_:forSegmentAt:)` + public func enabled(forSegmentAt segmentAt: Int) -> Binder { + return Binder(self.base) { (segmentedControl, segmentEnabled) -> () in + segmentedControl.setEnabled(segmentEnabled, forSegmentAt: segmentAt) + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift new file mode 100644 index 0000000..07d4adb --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift @@ -0,0 +1,29 @@ +// +// UISlider+Rx.swift +// RxCocoa +// +// Created by Alexander van der Werff on 28/05/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UISlider { + + /// Reactive wrapper for `value` property. + public var value: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { slider in + slider.value + }, setter: { slider, value in + slider.value = value + } + ) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift new file mode 100644 index 0000000..1fcb57a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift @@ -0,0 +1,37 @@ +// +// UIStepper+Rx.swift +// RxCocoa +// +// Created by Yuta ToKoRo on 9/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UIStepper { + + /// Reactive wrapper for `value` property. + public var value: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { stepper in + stepper.value + }, setter: { stepper, value in + stepper.value = value + } + ) + } + + /// Reactive wrapper for `stepValue` property. + public var stepValue: Binder { + return Binder(self.base) { stepper, value in + stepper.stepValue = value + } + } + +} + +#endif + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift new file mode 100644 index 0000000..4129fce --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift @@ -0,0 +1,41 @@ +// +// UISwitch+Rx.swift +// RxCocoa +// +// Created by Carlos García on 8/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UISwitch { + + /// Reactive wrapper for `isOn` property. + public var isOn: ControlProperty { + return value + } + + /** + Reactive wrapper for `isOn` property. + + **⚠️ Versions prior to iOS 10.2 were leaking `UISwitch`s, so on those versions + underlying observable sequence won't complete when nothing holds a strong reference + to UISwitch.⚠️** + */ + public var value: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { uiSwitch in + uiSwitch.isOn + }, setter: { uiSwitch, value in + uiSwitch.isOn = value + } + ) + } + +} + +#endif + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBar+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBar+Rx.swift new file mode 100644 index 0000000..7879684 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBar+Rx.swift @@ -0,0 +1,92 @@ +// +// UITabBar+Rx.swift +// RxCocoa +// +// Created by Jesse Farless on 5/13/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +/** + iOS only + */ +#if os(iOS) +extension Reactive where Base: UITabBar { + + /// Reactive wrapper for `delegate` message `tabBar(_:willBeginCustomizing:)`. + public var willBeginCustomizing: ControlEvent<[UITabBarItem]> { + + let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:willBeginCustomizing:))) + .map { a in + return try castOrThrow([UITabBarItem].self, a[1]) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `tabBar(_:didBeginCustomizing:)`. + public var didBeginCustomizing: ControlEvent<[UITabBarItem]> { + let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didBeginCustomizing:))) + .map { a in + return try castOrThrow([UITabBarItem].self, a[1]) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `tabBar(_:willEndCustomizing:changed:)`. + public var willEndCustomizing: ControlEvent<([UITabBarItem], Bool)> { + let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:willEndCustomizing:changed:))) + .map { (a: [Any]) -> (([UITabBarItem], Bool)) in + let items = try castOrThrow([UITabBarItem].self, a[1]) + let changed = try castOrThrow(Bool.self, a[2]) + return (items, changed) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `tabBar(_:didEndCustomizing:changed:)`. + public var didEndCustomizing: ControlEvent<([UITabBarItem], Bool)> { + let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didEndCustomizing:changed:))) + .map { (a: [Any]) -> (([UITabBarItem], Bool)) in + let items = try castOrThrow([UITabBarItem].self, a[1]) + let changed = try castOrThrow(Bool.self, a[2]) + return (items, changed) + } + + return ControlEvent(events: source) + } + +} +#endif + +/** + iOS and tvOS + */ + +extension Reactive where Base: UITabBar { + /// Reactive wrapper for `delegate`. + /// + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxTabBarDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for `delegate` message `tabBar(_:didSelect:)`. + public var didSelectItem: ControlEvent { + let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didSelect:))) + .map { a in + return try castOrThrow(UITabBarItem.self, a[1]) + } + + return ControlEvent(events: source) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarController+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarController+Rx.swift new file mode 100644 index 0000000..34a3501 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarController+Rx.swift @@ -0,0 +1,79 @@ +// +// UITabBarController+Rx.swift +// RxCocoa +// +// Created by Yusuke Kita on 2016/12/07. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +/** + iOS only + */ +#if os(iOS) +extension Reactive where Base: UITabBarController { + + /// Reactive wrapper for `delegate` message `tabBarController:willBeginCustomizing:`. + public var willBeginCustomizing: ControlEvent<[UIViewController]> { + let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:willBeginCustomizing:))) + .map { a in + return try castOrThrow([UIViewController].self, a[1]) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `tabBarController:willEndCustomizing:changed:`. + public var willEndCustomizing: ControlEvent<(viewControllers: [UIViewController], changed: Bool)> { + let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:willEndCustomizing:changed:))) + .map { (a: [Any]) -> (viewControllers: [UIViewController], changed: Bool) in + let viewControllers = try castOrThrow([UIViewController].self, a[1]) + let changed = try castOrThrow(Bool.self, a[2]) + return (viewControllers, changed) + } + + return ControlEvent(events: source) + } + + /// Reactive wrapper for `delegate` message `tabBarController:didEndCustomizing:changed:`. + public var didEndCustomizing: ControlEvent<(viewControllers: [UIViewController], changed: Bool)> { + let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:didEndCustomizing:changed:))) + .map { (a: [Any]) -> (viewControllers: [UIViewController], changed: Bool) in + let viewControllers = try castOrThrow([UIViewController].self, a[1]) + let changed = try castOrThrow(Bool.self, a[2]) + return (viewControllers, changed) + } + + return ControlEvent(events: source) + } +} +#endif + +/** + iOS and tvOS + */ + + extension Reactive where Base: UITabBarController { + /// Reactive wrapper for `delegate`. + /// + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxTabBarControllerDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for `delegate` message `tabBarController:didSelect:`. + public var didSelect: ControlEvent { + let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:didSelect:))) + .map { a in + return try castOrThrow(UIViewController.self, a[1]) + } + + return ControlEvent(events: source) + } +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift new file mode 100644 index 0000000..1664e27 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITabBarItem+Rx.swift @@ -0,0 +1,25 @@ +// +// UITabBarItem+Rx.swift +// RxCocoa +// +// Created by Mateusz Derks on 04/03/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UITabBarItem { + + /// Bindable sink for `badgeValue` property. + public var badgeValue: Binder { + return Binder(self.base) { tabBarItem, badgeValue in + tabBarItem.badgeValue = badgeValue + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift new file mode 100644 index 0000000..47e5a5a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift @@ -0,0 +1,396 @@ +// +// UITableView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 4/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +// Items + +extension Reactive where Base: UITableView { + + /** + Binds sequences of elements to table view rows. + + - parameter source: Observable sequence of items. + - parameter cellFactory: Transform between sequence elements and view cells. + - returns: Disposable object that can be used to unbind. + + Example: + + let items = Observable.just([ + "First Item", + "Second Item", + "Third Item" + ]) + + items + .bind(to: tableView.rx.items) { (tableView, row, element) in + let cell = tableView.dequeueReusableCell(withIdentifier: "Cell")! + cell.textLabel?.text = "\(element) @ row \(row)" + return cell + } + .disposed(by: disposeBag) + + */ + public func items + (_ source: O) + -> (_ cellFactory: @escaping (UITableView, Int, S.Iterator.Element) -> UITableViewCell) + -> Disposable + where O.E == S { + return { cellFactory in + let dataSource = RxTableViewReactiveArrayDataSourceSequenceWrapper(cellFactory: cellFactory) + return self.items(dataSource: dataSource)(source) + } + } + + /** + Binds sequences of elements to table view rows. + + - parameter cellIdentifier: Identifier used to dequeue cells. + - parameter source: Observable sequence of items. + - parameter configureCell: Transform between sequence elements and view cells. + - parameter cellType: Type of table view cell. + - returns: Disposable object that can be used to unbind. + + Example: + + let items = Observable.just([ + "First Item", + "Second Item", + "Third Item" + ]) + + items + .bind(to: tableView.rx.items(cellIdentifier: "Cell", cellType: UITableViewCell.self)) { (row, element, cell) in + cell.textLabel?.text = "\(element) @ row \(row)" + } + .disposed(by: disposeBag) + */ + public func items + (cellIdentifier: String, cellType: Cell.Type = Cell.self) + -> (_ source: O) + -> (_ configureCell: @escaping (Int, S.Iterator.Element, Cell) -> Void) + -> Disposable + where O.E == S { + return { source in + return { configureCell in + let dataSource = RxTableViewReactiveArrayDataSourceSequenceWrapper { (tv, i, item) in + let indexPath = IndexPath(item: i, section: 0) + let cell = tv.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! Cell + configureCell(i, item, cell) + return cell + } + return self.items(dataSource: dataSource)(source) + } + } + } + + + /** + Binds sequences of elements to table view rows using a custom reactive data used to perform the transformation. + This method will retain the data source for as long as the subscription isn't disposed (result `Disposable` + being disposed). + In case `source` observable sequence terminates successfully, the data source will present latest element + until the subscription isn't disposed. + + - parameter dataSource: Data source used to transform elements to view cells. + - parameter source: Observable sequence of items. + - returns: Disposable object that can be used to unbind. + + Example + + let dataSource = RxTableViewSectionedReloadDataSource>() + + let items = Observable.just([ + SectionModel(model: "First section", items: [ + 1.0, + 2.0, + 3.0 + ]), + SectionModel(model: "Second section", items: [ + 1.0, + 2.0, + 3.0 + ]), + SectionModel(model: "Third section", items: [ + 1.0, + 2.0, + 3.0 + ]) + ]) + + dataSource.configureCell = { (dataSource, tv, indexPath, element) in + let cell = tv.dequeueReusableCell(withIdentifier: "Cell")! + cell.textLabel?.text = "\(element) @ row \(indexPath.row)" + return cell + } + + items + .bind(to: tableView.rx.items(dataSource: dataSource)) + .disposed(by: disposeBag) + */ + public func items< + DataSource: RxTableViewDataSourceType & UITableViewDataSource, + O: ObservableType> + (dataSource: DataSource) + -> (_ source: O) + -> Disposable + where DataSource.Element == O.E { + return { source in + // This is called for sideeffects only, and to make sure delegate proxy is in place when + // data source is being bound. + // This is needed because theoretically the data source subscription itself might + // call `self.rx.delegate`. If that happens, it might cause weird side effects since + // setting data source will set delegate, and UITableView might get into a weird state. + // Therefore it's better to set delegate proxy first, just to be sure. + _ = self.delegate + // Strong reference is needed because data source is in use until result subscription is disposed + return source.subscribeProxyDataSource(ofObject: self.base, dataSource: dataSource as UITableViewDataSource, retainDataSource: true) { [weak tableView = self.base] (_: RxTableViewDataSourceProxy, event) -> Void in + guard let tableView = tableView else { + return + } + dataSource.tableView(tableView, observedEvent: event) + } + } + } + +} + +extension Reactive where Base: UITableView { + /** + Reactive wrapper for `dataSource`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var dataSource: DelegateProxy { + return RxTableViewDataSourceProxy.proxy(for: base) + } + + /** + Installs data source as forwarding delegate on `rx.dataSource`. + Data source won't be retained. + + It enables using normal delegate mechanism with reactive delegate mechanism. + + - parameter dataSource: Data source object. + - returns: Disposable object that can be used to unbind the data source. + */ + public func setDataSource(_ dataSource: UITableViewDataSource) + -> Disposable { + return RxTableViewDataSourceProxy.installForwardDelegate(dataSource, retainDelegate: false, onProxyForObject: self.base) + } + + // events + + /** + Reactive wrapper for `delegate` message `tableView:didSelectRowAtIndexPath:`. + */ + public var itemSelected: ControlEvent { + let source = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didSelectRowAt:))) + .map { a in + return try castOrThrow(IndexPath.self, a[1]) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:didDeselectRowAtIndexPath:`. + */ + public var itemDeselected: ControlEvent { + let source = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didDeselectRowAt:))) + .map { a in + return try castOrThrow(IndexPath.self, a[1]) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:accessoryButtonTappedForRowWithIndexPath:`. + */ + public var itemAccessoryButtonTapped: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:accessoryButtonTappedForRowWith:))) + .map { a in + return try castOrThrow(IndexPath.self, a[1]) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`. + */ + public var itemInserted: ControlEvent { + let source = self.dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:commit:forRowAt:))) + .filter { a in + return UITableViewCellEditingStyle(rawValue: (try castOrThrow(NSNumber.self, a[1])).intValue) == .insert + } + .map { a in + return (try castOrThrow(IndexPath.self, a[2])) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`. + */ + public var itemDeleted: ControlEvent { + let source = self.dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:commit:forRowAt:))) + .filter { a in + return UITableViewCellEditingStyle(rawValue: (try castOrThrow(NSNumber.self, a[1])).intValue) == .delete + } + .map { a in + return try castOrThrow(IndexPath.self, a[2]) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:moveRowAtIndexPath:toIndexPath:`. + */ + public var itemMoved: ControlEvent { + let source: Observable = self.dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:moveRowAt:to:))) + .map { a in + return (try castOrThrow(IndexPath.self, a[1]), try castOrThrow(IndexPath.self, a[2])) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:willDisplayCell:forRowAtIndexPath:`. + */ + public var willDisplayCell: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:willDisplay:forRowAt:))) + .map { a in + return (try castOrThrow(UITableViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2])) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:didEndDisplayingCell:forRowAtIndexPath:`. + */ + public var didEndDisplayingCell: ControlEvent { + let source: Observable = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didEndDisplaying:forRowAt:))) + .map { a in + return (try castOrThrow(UITableViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2])) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:didSelectRowAtIndexPath:`. + + It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence, + or any other data source conforming to `SectionedViewDataSourceType` protocol. + + ``` + tableView.rx.modelSelected(MyModel.self) + .map { ... + ``` + */ + public func modelSelected(_ modelType: T.Type) -> ControlEvent { + let source: Observable = self.itemSelected.flatMap { [weak view = self.base as UITableView] indexPath -> Observable in + guard let view = view else { + return Observable.empty() + } + + return Observable.just(try view.rx.model(at: indexPath)) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:didDeselectRowAtIndexPath:`. + + It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence, + or any other data source conforming to `SectionedViewDataSourceType` protocol. + + ``` + tableView.rx.modelDeselected(MyModel.self) + .map { ... + ``` + */ + public func modelDeselected(_ modelType: T.Type) -> ControlEvent { + let source: Observable = self.itemDeselected.flatMap { [weak view = self.base as UITableView] indexPath -> Observable in + guard let view = view else { + return Observable.empty() + } + + return Observable.just(try view.rx.model(at: indexPath)) + } + + return ControlEvent(events: source) + } + + /** + Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`. + + It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence, + or any other data source conforming to `SectionedViewDataSourceType` protocol. + + ``` + tableView.rx.modelDeleted(MyModel.self) + .map { ... + ``` + */ + public func modelDeleted(_ modelType: T.Type) -> ControlEvent { + let source: Observable = self.itemDeleted.flatMap { [weak view = self.base as UITableView] indexPath -> Observable in + guard let view = view else { + return Observable.empty() + } + + return Observable.just(try view.rx.model(at: indexPath)) + } + + return ControlEvent(events: source) + } + + /** + Synchronous helper method for retrieving a model at indexPath through a reactive data source. + */ + public func model(at indexPath: IndexPath) throws -> T { + let dataSource: SectionedViewDataSourceType = castOrFatalError(self.dataSource.forwardToDelegate(), message: "This method only works in case one of the `rx.items*` methods was used.") + + let element = try dataSource.model(at: indexPath) + + return castOrFatalError(element) + } +} + +#endif + +#if os(tvOS) + + extension Reactive where Base: UITableView { + + /** + Reactive wrapper for `delegate` message `tableView:didUpdateFocusInContext:withAnimationCoordinator:`. + */ + public var didUpdateFocusInContextWithAnimationCoordinator: ControlEvent<(context: UITableViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator)> { + + let source = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didUpdateFocusIn:with:))) + .map { a -> (context: UITableViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator) in + let context = try castOrThrow(UITableViewFocusUpdateContext.self, a[1]) + let animationCoordinator = try castOrThrow(UIFocusAnimationCoordinator.self, a[2]) + return (context: context, animationCoordinator: animationCoordinator) + } + + return ControlEvent(events: source) + } + } +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift new file mode 100644 index 0000000..4f19c8b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift @@ -0,0 +1,56 @@ +// +// UITextField+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import RxSwift +import UIKit + +extension Reactive where Base: UITextField { + /// Reactive wrapper for `text` property. + public var text: ControlProperty { + return value + } + + /// Reactive wrapper for `text` property. + public var value: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { textField in + textField.text + }, + setter: { textField, value in + // This check is important because setting text value always clears control state + // including marked text selection which is imporant for proper input + // when IME input method is used. + if textField.text != value { + textField.text = value + } + } + ) + } + + /// Bindable sink for `attributedText` property. + public var attributedText: ControlProperty { + return base.rx.controlPropertyWithDefaultEvents( + getter: { textField in + textField.attributedText + }, + setter: { textField, value in + // This check is important because setting text value always clears control state + // including marked text selection which is imporant for proper input + // when IME input method is used. + if textField.attributedText != value { + textField.attributedText = value + } + } + ) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift new file mode 100644 index 0000000..5f38fb5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift @@ -0,0 +1,125 @@ +// +// UITextView+Rx.swift +// RxCocoa +// +// Created by Yuta ToKoRo on 7/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UITextView { + /// Reactive wrapper for `text` property + public var text: ControlProperty { + return value + } + + /// Reactive wrapper for `text` property. + public var value: ControlProperty { + let source: Observable = Observable.deferred { [weak textView = self.base] in + let text = textView?.text + + let textChanged = textView?.textStorage + // This project uses text storage notifications because + // that's the only way to catch autocorrect changes + // in all cases. Other suggestions are welcome. + .rx.didProcessEditingRangeChangeInLength + // This observe on is here because text storage + // will emit event while process is not completely done, + // so rebinding a value will cause an exception to be thrown. + .observeOn(MainScheduler.asyncInstance) + .map { _ in + return textView?.textStorage.string + } + ?? Observable.empty() + + return textChanged + .startWith(text) + } + + let bindingObserver = Binder(self.base) { (textView, text: String?) in + // This check is important because setting text value always clears control state + // including marked text selection which is imporant for proper input + // when IME input method is used. + if textView.text != text { + textView.text = text + } + } + + return ControlProperty(values: source, valueSink: bindingObserver) + } + + + /// Reactive wrapper for `attributedText` property. + public var attributedText: ControlProperty { + let source: Observable = Observable.deferred { [weak textView = self.base] in + let attributedText = textView?.attributedText + + let textChanged: Observable = textView?.textStorage + // This project uses text storage notifications because + // that's the only way to catch autocorrect changes + // in all cases. Other suggestions are welcome. + .rx.didProcessEditingRangeChangeInLength + // This observe on is here because attributedText storage + // will emit event while process is not completely done, + // so rebinding a value will cause an exception to be thrown. + .observeOn(MainScheduler.asyncInstance) + .map { _ in + return textView?.attributedText + } + ?? Observable.empty() + + return textChanged + .startWith(attributedText) + } + + let bindingObserver = Binder(self.base) { (textView, attributedText: NSAttributedString?) in + // This check is important because setting text value always clears control state + // including marked text selection which is imporant for proper input + // when IME input method is used. + if textView.attributedText != attributedText { + textView.attributedText = attributedText + } + } + + return ControlProperty(values: source, valueSink: bindingObserver) + } + + /// Reactive wrapper for `delegate` message. + public var didBeginEditing: ControlEvent<()> { + return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidBeginEditing(_:))) + .map { a in + return () + }) + } + + /// Reactive wrapper for `delegate` message. + public var didEndEditing: ControlEvent<()> { + return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidEndEditing(_:))) + .map { a in + return () + }) + } + + /// Reactive wrapper for `delegate` message. + public var didChange: ControlEvent<()> { + return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidChange(_:))) + .map { a in + return () + }) + } + + /// Reactive wrapper for `delegate` message. + public var didChangeSelection: ControlEvent<()> { + return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidChangeSelection(_:))) + .map { a in + return () + }) + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift new file mode 100644 index 0000000..b52575a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIView+Rx.swift @@ -0,0 +1,38 @@ +// +// UIView+Rx.swift +// RxCocoa +// +// Created by Krunoslav Zaher on 12/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + +import UIKit +import RxSwift + +extension Reactive where Base: UIView { + /// Bindable sink for `hidden` property. + public var isHidden: Binder { + return Binder(self.base) { view, hidden in + view.isHidden = hidden + } + } + + /// Bindable sink for `alpha` property. + public var alpha: Binder { + return Binder(self.base) { view, alpha in + view.alpha = alpha + } + } + + /// Bindable sink for `isUserInteractionEnabled` property. + public var isUserInteractionEnabled: Binder { + return Binder(self.base) { view, userInteractionEnabled in + view.isUserInteractionEnabled = userInteractionEnabled + } + } + +} + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIViewController+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIViewController+Rx.swift new file mode 100644 index 0000000..a9ab2a5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIViewController+Rx.swift @@ -0,0 +1,24 @@ +// +// UIViewController+Rx.swift +// RxCocoa +// +// Created by Kyle Fuller on 27/05/2016. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) || os(tvOS) + + import UIKit + import RxSwift + + extension Reactive where Base: UIViewController { + + /// Bindable sink for `title`. + public var title: Binder { + return Binder(self.base) { viewController, title in + viewController.title = title + } + } + + } +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIWebView+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIWebView+Rx.swift new file mode 100644 index 0000000..61cfe6b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxCocoa/RxCocoa/iOS/UIWebView+Rx.swift @@ -0,0 +1,46 @@ +// +// UIWebView+Rx.swift +// RxCocoa +// +// Created by Andrew Breckenridge on 8/30/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +#if os(iOS) + + import UIKit + import RxSwift + + extension Reactive where Base: UIWebView { + + /// Reactive wrapper for `delegate`. + /// For more information take a look at `DelegateProxyType` protocol documentation. + public var delegate: DelegateProxy { + return RxWebViewDelegateProxy.proxy(for: base) + } + + /// Reactive wrapper for `delegate` message. + public var didStartLoad: Observable { + return delegate + .methodInvoked(#selector(UIWebViewDelegate.webViewDidStartLoad(_:))) + .map {_ in} + } + + /// Reactive wrapper for `delegate` message. + public var didFinishLoad: Observable { + return delegate + .methodInvoked(#selector(UIWebViewDelegate.webViewDidFinishLoad(_:))) + .map {_ in} + } + + /// Reactive wrapper for `delegate` message. + public var didFailLoad: Observable { + return delegate + .methodInvoked(#selector(UIWebViewDelegate.webView(_:didFailLoadWithError:))) + .map { a in + return try castOrThrow(Error.self, a[1]) + } + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/LICENSE.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/LICENSE.md new file mode 100644 index 0000000..d6765d9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/LICENSE.md @@ -0,0 +1,9 @@ +**The MIT License** +**Copyright © 2015 Krunoslav Zaher** +**All rights reserved.** + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Bag.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Bag.swift new file mode 100644 index 0000000..002c3a6 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Bag.swift @@ -0,0 +1,183 @@ +// +// Bag.swift +// Platform +// +// Created by Krunoslav Zaher on 2/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Swift + +let arrayDictionaryMaxSize = 30 + +struct BagKey { + /** + Unique identifier for object added to `Bag`. + + It's underlying type is UInt64. If we assume there in an idealized CPU that works at 4GHz, + it would take ~150 years of continuous running time for it to overflow. + */ + fileprivate let rawValue: UInt64 +} + +/** +Data structure that represents a bag of elements typed `T`. + +Single element can be stored multiple times. + +Time and space complexity of insertion an deletion is O(n). + +It is suitable for storing small number of elements. +*/ +struct Bag : CustomDebugStringConvertible { + /// Type of identifier for inserted elements. + typealias KeyType = BagKey + + typealias Entry = (key: BagKey, value: T) + + fileprivate var _nextKey: BagKey = BagKey(rawValue: 0) + + // data + + // first fill inline variables + var _key0: BagKey? = nil + var _value0: T? = nil + + // then fill "array dictionary" + var _pairs = ContiguousArray() + + // last is sparse dictionary + var _dictionary: [BagKey : T]? = nil + + var _onlyFastPath = true + + /// Creates new empty `Bag`. + init() { + } + + /** + Inserts `value` into bag. + + - parameter element: Element to insert. + - returns: Key that can be used to remove element from bag. + */ + mutating func insert(_ element: T) -> BagKey { + let key = _nextKey + + _nextKey = BagKey(rawValue: _nextKey.rawValue &+ 1) + + if _key0 == nil { + _key0 = key + _value0 = element + return key + } + + _onlyFastPath = false + + if _dictionary != nil { + _dictionary![key] = element + return key + } + + if _pairs.count < arrayDictionaryMaxSize { + _pairs.append((key: key, value: element)) + return key + } + + _dictionary = [key: element] + + return key + } + + /// - returns: Number of elements in bag. + var count: Int { + let dictionaryCount: Int = _dictionary?.count ?? 0 + return (_value0 != nil ? 1 : 0) + _pairs.count + dictionaryCount + } + + /// Removes all elements from bag and clears capacity. + mutating func removeAll() { + _key0 = nil + _value0 = nil + + _pairs.removeAll(keepingCapacity: false) + _dictionary?.removeAll(keepingCapacity: false) + } + + /** + Removes element with a specific `key` from bag. + + - parameter key: Key that identifies element to remove from bag. + - returns: Element that bag contained, or nil in case element was already removed. + */ + mutating func removeKey(_ key: BagKey) -> T? { + if _key0 == key { + _key0 = nil + let value = _value0! + _value0 = nil + return value + } + + if let existingObject = _dictionary?.removeValue(forKey: key) { + return existingObject + } + + for i in 0 ..< _pairs.count { + if _pairs[i].key == key { + let value = _pairs[i].value + _pairs.remove(at: i) + return value + } + } + + return nil + } +} + +extension Bag { + /// A textual representation of `self`, suitable for debugging. + var debugDescription : String { + return "\(self.count) elements in Bag" + } +} + +extension Bag { + /// Enumerates elements inside the bag. + /// + /// - parameter action: Enumeration closure. + func forEach(_ action: (T) -> Void) { + if _onlyFastPath { + if let value0 = _value0 { + action(value0) + } + return + } + + let value0 = _value0 + let dictionary = _dictionary + + if let value0 = value0 { + action(value0) + } + + for i in 0 ..< _pairs.count { + action(_pairs[i].value) + } + + if dictionary?.count ?? 0 > 0 { + for element in dictionary!.values { + action(element) + } + } + } +} + +extension BagKey: Hashable { + var hashValue: Int { + return rawValue.hashValue + } +} + +func ==(lhs: BagKey, rhs: BagKey) -> Bool { + return lhs.rawValue == rhs.rawValue +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift new file mode 100644 index 0000000..5a573a0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift @@ -0,0 +1,26 @@ +// +// InfiniteSequence.swift +// Platform +// +// Created by Krunoslav Zaher on 6/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Sequence that repeats `repeatedValue` infinite number of times. +struct InfiniteSequence : Sequence { + typealias Element = E + typealias Iterator = AnyIterator + + private let _repeatedValue: E + + init(repeatedValue: E) { + _repeatedValue = repeatedValue + } + + func makeIterator() -> Iterator { + let repeatedValue = _repeatedValue + return AnyIterator { + return repeatedValue + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift new file mode 100644 index 0000000..9b2c370 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift @@ -0,0 +1,123 @@ +// +// PriorityQueue.swift +// Platform +// +// Created by Krunoslav Zaher on 12/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +struct PriorityQueue { + private let _hasHigherPriority: (Element, Element) -> Bool + private let _isEqual: (Element, Element) -> Bool + + fileprivate var _elements = [Element]() + + init(hasHigherPriority: @escaping (Element, Element) -> Bool, isEqual: @escaping (Element, Element) -> Bool) { + _hasHigherPriority = hasHigherPriority + _isEqual = isEqual + } + + mutating func enqueue(_ element: Element) { + _elements.append(element) + bubbleToHigherPriority(_elements.count - 1) + } + + func peek() -> Element? { + return _elements.first + } + + var isEmpty: Bool { + return _elements.count == 0 + } + + mutating func dequeue() -> Element? { + guard let front = peek() else { + return nil + } + + removeAt(0) + + return front + } + + mutating func remove(_ element: Element) { + for i in 0 ..< _elements.count { + if _isEqual(_elements[i], element) { + removeAt(i) + return + } + } + } + + private mutating func removeAt(_ index: Int) { + let removingLast = index == _elements.count - 1 + if !removingLast { + #if swift(>=3.2) + _elements.swapAt(index, _elements.count - 1) + #else + swap(&_elements[index], &_elements[_elements.count - 1]) + #endif + } + + _ = _elements.popLast() + + if !removingLast { + bubbleToHigherPriority(index) + bubbleToLowerPriority(index) + } + } + + private mutating func bubbleToHigherPriority(_ initialUnbalancedIndex: Int) { + precondition(initialUnbalancedIndex >= 0) + precondition(initialUnbalancedIndex < _elements.count) + + var unbalancedIndex = initialUnbalancedIndex + + while unbalancedIndex > 0 { + let parentIndex = (unbalancedIndex - 1) / 2 + guard _hasHigherPriority(_elements[unbalancedIndex], _elements[parentIndex]) else { break } + #if swift(>=3.2) + _elements.swapAt(unbalancedIndex, parentIndex) + #else + swap(&_elements[unbalancedIndex], &_elements[parentIndex]) + #endif + unbalancedIndex = parentIndex + } + } + + private mutating func bubbleToLowerPriority(_ initialUnbalancedIndex: Int) { + precondition(initialUnbalancedIndex >= 0) + precondition(initialUnbalancedIndex < _elements.count) + + var unbalancedIndex = initialUnbalancedIndex + while true { + let leftChildIndex = unbalancedIndex * 2 + 1 + let rightChildIndex = unbalancedIndex * 2 + 2 + + var highestPriorityIndex = unbalancedIndex + + if leftChildIndex < _elements.count && _hasHigherPriority(_elements[leftChildIndex], _elements[highestPriorityIndex]) { + highestPriorityIndex = leftChildIndex + } + + if rightChildIndex < _elements.count && _hasHigherPriority(_elements[rightChildIndex], _elements[highestPriorityIndex]) { + highestPriorityIndex = rightChildIndex + } + + guard highestPriorityIndex != unbalancedIndex else { break } + + #if swift(>=3.2) + _elements.swapAt(highestPriorityIndex, unbalancedIndex) + #else + swap(&_elements[highestPriorityIndex], &_elements[unbalancedIndex]) + #endif + unbalancedIndex = highestPriorityIndex + } + } +} + +extension PriorityQueue : CustomDebugStringConvertible { + var debugDescription: String { + return _elements.debugDescription + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Queue.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Queue.swift new file mode 100644 index 0000000..d05726c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DataStructures/Queue.swift @@ -0,0 +1,152 @@ +// +// Queue.swift +// Platform +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/** +Data structure that represents queue. + +Complexity of `enqueue`, `dequeue` is O(1) when number of operations is +averaged over N operations. + +Complexity of `peek` is O(1). +*/ +struct Queue: Sequence { + /// Type of generator. + typealias Generator = AnyIterator + + private let _resizeFactor = 2 + + private var _storage: ContiguousArray + private var _count = 0 + private var _pushNextIndex = 0 + private let _initialCapacity: Int + + /** + Creates new queue. + + - parameter capacity: Capacity of newly created queue. + */ + init(capacity: Int) { + _initialCapacity = capacity + + _storage = ContiguousArray(repeating: nil, count: capacity) + } + + private var dequeueIndex: Int { + let index = _pushNextIndex - count + return index < 0 ? index + _storage.count : index + } + + /// - returns: Is queue empty. + var isEmpty: Bool { + return count == 0 + } + + /// - returns: Number of elements inside queue. + var count: Int { + return _count + } + + /// - returns: Element in front of a list of elements to `dequeue`. + func peek() -> T { + precondition(count > 0) + + return _storage[dequeueIndex]! + } + + mutating private func resizeTo(_ size: Int) { + var newStorage = ContiguousArray(repeating: nil, count: size) + + let count = _count + + let dequeueIndex = self.dequeueIndex + let spaceToEndOfQueue = _storage.count - dequeueIndex + + // first batch is from dequeue index to end of array + let countElementsInFirstBatch = Swift.min(count, spaceToEndOfQueue) + // second batch is wrapped from start of array to end of queue + let numberOfElementsInSecondBatch = count - countElementsInFirstBatch + + newStorage[0 ..< countElementsInFirstBatch] = _storage[dequeueIndex ..< (dequeueIndex + countElementsInFirstBatch)] + newStorage[countElementsInFirstBatch ..< (countElementsInFirstBatch + numberOfElementsInSecondBatch)] = _storage[0 ..< numberOfElementsInSecondBatch] + + _count = count + _pushNextIndex = count + _storage = newStorage + } + + /// Enqueues `element`. + /// + /// - parameter element: Element to enqueue. + mutating func enqueue(_ element: T) { + if count == _storage.count { + resizeTo(Swift.max(_storage.count, 1) * _resizeFactor) + } + + _storage[_pushNextIndex] = element + _pushNextIndex += 1 + _count += 1 + + if _pushNextIndex >= _storage.count { + _pushNextIndex -= _storage.count + } + } + + private mutating func dequeueElementOnly() -> T { + precondition(count > 0) + + let index = dequeueIndex + + defer { + _storage[index] = nil + _count -= 1 + } + + return _storage[index]! + } + + /// Dequeues element or throws an exception in case queue is empty. + /// + /// - returns: Dequeued element. + mutating func dequeue() -> T? { + if self.count == 0 { + return nil + } + + defer { + let downsizeLimit = _storage.count / (_resizeFactor * _resizeFactor) + if _count < downsizeLimit && downsizeLimit >= _initialCapacity { + resizeTo(_storage.count / _resizeFactor) + } + } + + return dequeueElementOnly() + } + + /// - returns: Generator of contained elements. + func makeIterator() -> AnyIterator { + var i = dequeueIndex + var count = _count + + return AnyIterator { + if count == 0 { + return nil + } + + defer { + count -= 1 + i += 1 + } + + if i >= self._storage.count { + i -= self._storage.count + } + + return self._storage[i] + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DeprecationWarner.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DeprecationWarner.swift new file mode 100644 index 0000000..863636b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DeprecationWarner.swift @@ -0,0 +1,43 @@ +// +// DeprecationWarner.swift +// Platform +// +// Created by Shai Mishali on 1/9/18. +// Copyright © 2018 Krunoslav Zaher. All rights reserved. +// + +import Foundation + +#if DEBUG + class DeprecationWarner { + private static var warned = Set() + private static var _lock = NSRecursiveLock() + + static func warnIfNeeded(_ kind: Kind) { + _lock.lock(); defer { _lock.unlock() } + guard !warned.contains(kind) else { return } + + warned.insert(kind) + print("ℹ️ [DEPRECATED] \(kind.message)") + } + } + + extension DeprecationWarner { + enum Kind { + case variable + case globalTestFunctionNext + case globalTestFunctionError + case globalTestFunctionCompleted + + var message: String { + switch self { + case .variable: return "`Variable` is planned for future deprecation. Please consider `BehaviorRelay` as a replacement. Read more at: https://git.io/vNqvx" + case .globalTestFunctionNext: return "The `next()` global function is planned for future deprecation. Please use `Recorded.next()` instead." + case .globalTestFunctionError: return "The `error()` global function is planned for future deprecation. Please use `Recorded.error()` instead." + case .globalTestFunctionCompleted: return "The `completed()` global function is planned for future deprecation. Please use `Recorded.completed()` instead." + } + } + } + } +#endif + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift new file mode 100644 index 0000000..552314a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift @@ -0,0 +1,21 @@ +// +// DispatchQueue+Extensions.swift +// Platform +// +// Created by Krunoslav Zaher on 10/22/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Dispatch + +extension DispatchQueue { + private static var token: DispatchSpecificKey<()> = { + let key = DispatchSpecificKey<()>() + DispatchQueue.main.setSpecific(key: key, value: ()) + return key + }() + + static var isMain: Bool { + return DispatchQueue.getSpecific(key: token) != nil + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Darwin.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Darwin.swift new file mode 100644 index 0000000..d9e744f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Darwin.swift @@ -0,0 +1,66 @@ +// +// Platform.Darwin.swift +// Platform +// +// Created by Krunoslav Zaher on 12/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + + import Darwin + import class Foundation.Thread + import func Foundation.OSAtomicCompareAndSwap32Barrier + import func Foundation.OSAtomicIncrement32Barrier + import func Foundation.OSAtomicDecrement32Barrier + import protocol Foundation.NSCopying + + typealias AtomicInt = Int32 + + fileprivate func castToUInt32Pointer(_ pointer: UnsafeMutablePointer) -> UnsafeMutablePointer { + let raw = UnsafeMutableRawPointer(pointer) + return raw.assumingMemoryBound(to: UInt32.self) + } + + let AtomicCompareAndSwap = OSAtomicCompareAndSwap32Barrier + let AtomicIncrement = OSAtomicIncrement32Barrier + let AtomicDecrement = OSAtomicDecrement32Barrier + func AtomicOr(_ mask: UInt32, _ theValue : UnsafeMutablePointer) -> Int32 { + return OSAtomicOr32OrigBarrier(mask, castToUInt32Pointer(theValue)) + } + func AtomicFlagSet(_ mask: UInt32, _ theValue : UnsafeMutablePointer) -> Bool { + // just used to create a barrier + OSAtomicXor32OrigBarrier(0, castToUInt32Pointer(theValue)) + return (theValue.pointee & Int32(mask)) != 0 + } + + extension Thread { + + static func setThreadLocalStorageValue(_ value: T?, forKey key: NSCopying + ) { + let currentThread = Thread.current + let threadDictionary = currentThread.threadDictionary + + if let newValue = value { + threadDictionary[key] = newValue + } + else { + threadDictionary[key] = nil + } + + } + static func getThreadLocalStorageValueForKey(_ key: NSCopying) -> T? { + let currentThread = Thread.current + let threadDictionary = currentThread.threadDictionary + + return threadDictionary[key] as? T + } + } + + extension AtomicInt { + func valueSnapshot() -> Int32 { + return self + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Linux.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Linux.swift new file mode 100644 index 0000000..5cd07e2 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/Platform.Linux.swift @@ -0,0 +1,105 @@ +// +// Platform.Linux.swift +// Platform +// +// Created by Krunoslav Zaher on 12/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if os(Linux) + + import XCTest + import Glibc + import SwiftShims + import class Foundation.Thread + + final class AtomicInt { + typealias IntegerLiteralType = Int + fileprivate var value: Int32 = 0 + fileprivate var _lock = RecursiveLock() + + func lock() { + _lock.lock() + } + func unlock() { + _lock.unlock() + } + + func valueSnapshot() -> Int32 { + return value + } + } + + extension AtomicInt: ExpressibleByIntegerLiteral { + convenience init(integerLiteral value: Int) { + self.init() + self.value = Int32(value) + } + } + + func >(lhs: AtomicInt, rhs: Int32) -> Bool { + return lhs.value > rhs + } + func ==(lhs: AtomicInt, rhs: Int32) -> Bool { + return lhs.value == rhs + } + + func AtomicFlagSet(_ mask: UInt32, _ atomic: inout AtomicInt) -> Bool { + atomic.lock(); defer { atomic.unlock() } + return (atomic.value & Int32(mask)) != 0 + } + + func AtomicOr(_ mask: UInt32, _ atomic: inout AtomicInt) -> Int32 { + atomic.lock(); defer { atomic.unlock() } + let value = atomic.value + atomic.value |= Int32(mask) + return value + } + + func AtomicIncrement(_ atomic: inout AtomicInt) -> Int32 { + atomic.lock(); defer { atomic.unlock() } + atomic.value += 1 + return atomic.value + } + + func AtomicDecrement(_ atomic: inout AtomicInt) -> Int32 { + atomic.lock(); defer { atomic.unlock() } + atomic.value -= 1 + return atomic.value + } + + func AtomicCompareAndSwap(_ l: Int32, _ r: Int32, _ atomic: inout AtomicInt) -> Bool { + atomic.lock(); defer { atomic.unlock() } + if atomic.value == l { + atomic.value = r + return true + } + + return false + } + + extension Thread { + + static func setThreadLocalStorageValue(_ value: T?, forKey key: String) { + let currentThread = Thread.current + var threadDictionary = currentThread.threadDictionary + + if let newValue = value { + threadDictionary[key] = newValue + } + else { + threadDictionary[key] = nil + } + + currentThread.threadDictionary = threadDictionary + } + + static func getThreadLocalStorageValueForKey(_ key: String) -> T? { + let currentThread = Thread.current + let threadDictionary = currentThread.threadDictionary + + return threadDictionary[key] as? T + } + } + +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/RecursiveLock.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/RecursiveLock.swift new file mode 100644 index 0000000..c03471d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/Platform/RecursiveLock.swift @@ -0,0 +1,34 @@ +// +// RecursiveLock.swift +// Platform +// +// Created by Krunoslav Zaher on 12/18/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.NSRecursiveLock + +#if TRACE_RESOURCES + class RecursiveLock: NSRecursiveLock { + override init() { + _ = Resources.incrementTotal() + super.init() + } + + override func lock() { + super.lock() + _ = Resources.incrementTotal() + } + + override func unlock() { + super.unlock() + _ = Resources.decrementTotal() + } + + deinit { + _ = Resources.decrementTotal() + } + } +#else + typealias RecursiveLock = NSRecursiveLock +#endif diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/README.md b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/README.md new file mode 100644 index 0000000..a423675 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/README.md @@ -0,0 +1,217 @@ +Miss Electric Eel 2016 RxSwift: ReactiveX for Swift +====================================== + +[![Travis CI](https://travis-ci.org/ReactiveX/RxSwift.svg?branch=master)](https://travis-ci.org/ReactiveX/RxSwift) ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg) ![pod](https://img.shields.io/cocoapods/v/RxSwift.svg) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) + +* RxSwift 3.x / Swift 3.x can be found in [**rxswift-3.0** branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-3.0). + +Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable` interface. + +This is a Swift version of [Rx](https://github.com/Reactive-Extensions/Rx.NET). + +It tries to port as many concepts from the original version as possible, but some concepts were adapted for more pleasant and performant integration with iOS/macOS environment. + +Cross platform documentation can be found on [ReactiveX.io](http://reactivex.io/). + +Like the original Rx, its intention is to enable easy composition of asynchronous operations and event/data streams. + +KVO observing, async operations and streams are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful. + +## I came here because I want to ... + +###### ... understand + +* [why use rx?](Documentation/Why.md) +* [the basics, getting started with RxSwift](Documentation/GettingStarted.md) +* [traits](Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, `ControlProperty`, and `Variable` ... and why do they exist? +* [testing](Documentation/UnitTests.md) +* [tips and common errors](Documentation/Tips.md) +* [debugging](Documentation/GettingStarted.md#debugging) +* [the math behind Rx](Documentation/MathBehindRx.md) +* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md) + +###### ... install + +* Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation) + +###### ... hack around + +* with the example app. [Running Example App](Documentation/ExampleApp.md) +* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md) + +###### ... interact + +* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences.
[![Slack channel](http://rxswift-slack.herokuapp.com/badge.svg)](http://bit.ly/rxslack) [Join Slack Channel](http://bit.ly/rxslack) +* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md) +* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md) +* Help out [Check out contribution guide](CONTRIBUTING.md) + +###### ... compare + +* [with other libraries](Documentation/ComparisonWithOtherLibraries.md). + + +###### ... find compatible + +* libraries from [RxSwiftCommunity](https://github.com/RxSwiftCommunity). +* [Pods using RxSwift](https://cocoapods.org/?q=uses%3Arxswift). + +###### ... see the broader vision + +* Does this exist for Android? [RxJava](https://github.com/ReactiveX/RxJava) +* Where is all of this going, what is the future, what about reactive architectures, how do you design entire apps this way? [Cycle.js](https://github.com/cyclejs/cycle-core) - this is javascript, but [RxJS](https://github.com/Reactive-Extensions/RxJS) is javascript version of Rx. + +## Usage + + + + + + + + + + + + + + + + + + + +
Here's an exampleIn Action
Define search for GitHub repositories ...
+let searchResults = searchBar.rx.text.orEmpty
+    .throttle(0.3, scheduler: MainScheduler.instance)
+    .distinctUntilChanged()
+    .flatMapLatest { query -> Observable<[Repository]> in
+        if query.isEmpty {
+            return .just([])
+        }
+        return searchGitHub(query)
+            .catchErrorJustReturn([])
+    }
+    .observeOn(MainScheduler.instance)
... then bind the results to your tableview
+searchResults
+    .bind(to: tableView.rx.items(cellIdentifier: "Cell")) {
+        (index, repository: Repository, cell) in
+        cell.textLabel?.text = repository.name
+        cell.detailTextLabel?.text = repository.url
+    }
+    .disposed(by: disposeBag)
+ + +## Requirements + +* Xcode 9.0 +* Swift 4.0 +* Swift 3.x ([use `rxswift-3.0` branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-3.0) instead) +* Swift 2.3 ([use `rxswift-2.0` branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-2.0) instead) + +## Installation + +Rx doesn't contain any external dependencies. + +These are currently the supported options: + +### Manual + +Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app + +### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) + +**Tested with `pod --version`: `1.3.1`** + +```ruby +# Podfile +use_frameworks! + +target 'YOUR_TARGET_NAME' do + pod 'RxSwift', '~> 4.0' + pod 'RxCocoa', '~> 4.0' +end + +# RxTests and RxBlocking make the most sense in the context of unit/integration tests +target 'YOUR_TESTING_TARGET' do + pod 'RxBlocking', '~> 4.0' + pod 'RxTest', '~> 4.0' +end +``` + +Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type: + +```bash +$ pod install +``` + +### [Carthage](https://github.com/Carthage/Carthage) + +**Tested with `carthage version`: `0.26.2`** + +Add this to `Cartfile` + +``` +github "ReactiveX/RxSwift" ~> 4.0 +``` + +```bash +$ carthage update +``` + +### [Swift Package Manager](https://github.com/apple/swift-package-manager) + +**Tested with `swift build --version`: `Swift 4.0.0-dev (swiftpm-13126)`** + +Create a `Package.swift` file. + +```swift +// swift-tools-version:4.0 + +import PackageDescription + +let package = Package( + name: "RxTestProject", + dependencies: [ + .package(url: "https://github.com/ReactiveX/RxSwift.git", "4.0.0" ..< "5.0.0") + ], + targets: [ + .target(name: "RxTestProject", dependencies: ["RxSwift", "RxCocoa"]) + ] +) +``` + +```bash +$ swift build +``` + +To build or test a module with RxTest dependency, set `TEST=1`. ([RxSwift >= 3.4.2](https://github.com/ReactiveX/RxSwift/releases/tag/3.4.2)) + +```bash +$ TEST=1 swift test +``` + +### Manually using git submodules + +* Add RxSwift as a submodule + +```bash +$ git submodule add git@github.com:ReactiveX/RxSwift.git +``` + +* Drag `Rx.xcodeproj` into Project Navigator +* Go to `Project > Targets > Build Phases > Link Binary With Libraries`, click `+` and select `RxSwift-[Platform]` and `RxCocoa-[Platform]` targets + + +## References + +* [http://reactivex.io/](http://reactivex.io/) +* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions) +* [RxSwift RayWenderlich.com Book](https://store.raywenderlich.com/products/rxswift) +* [Boxue.io RxSwift Online Course](https://boxueio.com/series/rxswift-101) (Chinese 🇨🇳) +* [Erik Meijer (Wikipedia)](http://en.wikipedia.org/wiki/Erik_Meijer_%28computer_scientist%29) +* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY) +* [Reactive Programming Overview (Jafar Husain from Netflix)](https://www.youtube.com/watch?v=dwP1TNXE6fc) +* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf) +* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/) +* [Haskell](https://www.haskell.org/) diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/AnyObserver.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/AnyObserver.swift new file mode 100644 index 0000000..dd4f9c4 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/AnyObserver.swift @@ -0,0 +1,72 @@ +// +// AnyObserver.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// A type-erased `ObserverType`. +/// +/// Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type. +public struct AnyObserver : ObserverType { + /// The type of elements in sequence that observer can observe. + public typealias E = Element + + /// Anonymous event handler type. + public typealias EventHandler = (Event) -> Void + + private let observer: EventHandler + + /// Construct an instance whose `on(event)` calls `eventHandler(event)` + /// + /// - parameter eventHandler: Event handler that observes sequences events. + public init(eventHandler: @escaping EventHandler) { + self.observer = eventHandler + } + + /// Construct an instance whose `on(event)` calls `observer.on(event)` + /// + /// - parameter observer: Observer that receives sequence events. + public init(_ observer: O) where O.E == Element { + self.observer = observer.on + } + + /// Send `event` to this observer. + /// + /// - parameter event: Event instance. + public func on(_ event: Event) { + return self.observer(event) + } + + /// Erases type of observer and returns canonical observer. + /// + /// - returns: type erased observer. + public func asObserver() -> AnyObserver { + return self + } +} + +extension AnyObserver { + /// Collection of `AnyObserver`s + typealias s = Bag<(Event) -> ()> +} + +extension ObserverType { + /// Erases type of observer and returns canonical observer. + /// + /// - returns: type erased observer. + public func asObserver() -> AnyObserver { + return AnyObserver(self) + } + + /// Transforms observer of type R to type E using custom transform method. + /// Each event sent to result observer is transformed and sent to `self`. + /// + /// - returns: observer that transforms events. + public func mapObserver(_ transform: @escaping (R) throws -> E) -> AnyObserver { + return AnyObserver { e in + self.on(e.map(transform)) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Cancelable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Cancelable.swift new file mode 100644 index 0000000..1fa7a67 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Cancelable.swift @@ -0,0 +1,13 @@ +// +// Cancelable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents disposable resource with state tracking. +public protocol Cancelable : Disposable { + /// Was resource disposed. + var isDisposed: Bool { get } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift new file mode 100644 index 0000000..2597078 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift @@ -0,0 +1,102 @@ +// +// AsyncLock.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/** +In case nobody holds this lock, the work will be queued and executed immediately +on thread that is requesting lock. + +In case there is somebody currently holding that lock, action will be enqueued. +When owned of the lock finishes with it's processing, it will also execute +and pending work. + +That means that enqueued work could possibly be executed later on a different thread. +*/ +final class AsyncLock + : Disposable + , Lock + , SynchronizedDisposeType { + typealias Action = () -> Void + + var _lock = SpinLock() + + private var _queue: Queue = Queue(capacity: 0) + + private var _isExecuting: Bool = false + private var _hasFaulted: Bool = false + + // lock { + func lock() { + _lock.lock() + } + + func unlock() { + _lock.unlock() + } + // } + + private func enqueue(_ action: I) -> I? { + _lock.lock(); defer { _lock.unlock() } // { + if _hasFaulted { + return nil + } + + if _isExecuting { + _queue.enqueue(action) + return nil + } + + _isExecuting = true + + return action + // } + } + + private func dequeue() -> I? { + _lock.lock(); defer { _lock.unlock() } // { + if _queue.count > 0 { + return _queue.dequeue() + } + else { + _isExecuting = false + return nil + } + // } + } + + func invoke(_ action: I) { + let firstEnqueuedAction = enqueue(action) + + if let firstEnqueuedAction = firstEnqueuedAction { + firstEnqueuedAction.invoke() + } + else { + // action is enqueued, it's somebody else's concern now + return + } + + while true { + let nextAction = dequeue() + + if let nextAction = nextAction { + nextAction.invoke() + } + else { + return + } + } + } + + func dispose() { + synchronizedDispose() + } + + func _synchronized_dispose() { + _queue = Queue(capacity: 0) + _hasFaulted = true + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/Lock.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/Lock.swift new file mode 100644 index 0000000..52afc1c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/Lock.swift @@ -0,0 +1,36 @@ +// +// Lock.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol Lock { + func lock() + func unlock() +} + +// https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000321.html +typealias SpinLock = RecursiveLock + +extension RecursiveLock : Lock { + @inline(__always) + final func performLocked(_ action: () -> Void) { + lock(); defer { unlock() } + action() + } + + @inline(__always) + final func calculateLocked(_ action: () -> T) -> T { + lock(); defer { unlock() } + return action() + } + + @inline(__always) + final func calculateLockedOrFail(_ action: () throws -> T) throws -> T { + lock(); defer { unlock() } + let result = try action() + return result + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift new file mode 100644 index 0000000..eca8d8e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift @@ -0,0 +1,21 @@ +// +// LockOwnerType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol LockOwnerType : class, Lock { + var _lock: RecursiveLock { get } +} + +extension LockOwnerType { + func lock() { + _lock.lock() + } + + func unlock() { + _lock.unlock() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift new file mode 100644 index 0000000..af9548f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift @@ -0,0 +1,18 @@ +// +// SynchronizedDisposeType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol SynchronizedDisposeType : class, Disposable, Lock { + func _synchronized_dispose() +} + +extension SynchronizedDisposeType { + func synchronizedDispose() { + lock(); defer { unlock() } + _synchronized_dispose() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift new file mode 100644 index 0000000..8dfc556 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift @@ -0,0 +1,18 @@ +// +// SynchronizedOnType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol SynchronizedOnType : class, ObserverType, Lock { + func _synchronized_on(_ event: Event) +} + +extension SynchronizedOnType { + func synchronizedOn(_ event: Event) { + lock(); defer { unlock() } + _synchronized_on(event) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift new file mode 100644 index 0000000..bb1aa7e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift @@ -0,0 +1,13 @@ +// +// SynchronizedUnsubscribeType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol SynchronizedUnsubscribeType : class { + associatedtype DisposeKey + + func synchronizedUnsubscribe(_ disposeKey: DisposeKey) +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ConnectableObservableType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ConnectableObservableType.swift new file mode 100644 index 0000000..52bf93c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ConnectableObservableType.swift @@ -0,0 +1,19 @@ +// +// ConnectableObservableType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/** +Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence. +*/ +public protocol ConnectableObservableType : ObservableType { + /** + Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established. + + - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. + */ + func connect() -> Disposable +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Deprecated.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Deprecated.swift new file mode 100644 index 0000000..cc673c7 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Deprecated.swift @@ -0,0 +1,228 @@ +// +// Deprecated.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/5/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +extension Observable { + /** + Converts a optional to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter optional: Optional element in the resulting observable sequence. + - returns: An observable sequence containing the wrapped value or not from given optional. + */ + @available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:)") + public static func from(_ optional: E?) -> Observable { + return Observable.from(optional: optional) + } + + /** + Converts a optional to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter optional: Optional element in the resulting observable sequence. + - parameter: Scheduler to send the optional element on. + - returns: An observable sequence containing the wrapped value or not from given optional. + */ + @available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:scheduler:)") + public static func from(_ optional: E?, scheduler: ImmediateSchedulerType) -> Observable { + return Observable.from(optional: optional, scheduler: scheduler) + } +} + +extension ObservableType { + /** + + Projects each element of an observable sequence into a new form by incorporating the element's index. + + - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html) + + - parameter selector: A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source. + */ + @available(*, deprecated, message: "Please use enumerated().map()") + public func mapWithIndex(_ selector: @escaping (E, Int) throws -> R) + -> Observable { + return enumerated().map { try selector($0.element, $0.index) } + } + + + /** + + Projects each element of an observable sequence to an observable sequence by incorporating the element's index and merges the resulting observable sequences into one observable sequence. + + - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - parameter selector: A transform function to apply to each element; the second parameter of the function represents the index of the source element. + - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence. + */ + @available(*, deprecated, message: "Please use enumerated().flatMap()") + public func flatMapWithIndex(_ selector: @escaping (E, Int) throws -> O) + -> Observable { + return enumerated().flatMap { try selector($0.element, $0.index) } + } + + /** + + Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. + The element's index is used in the logic of the predicate function. + + - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html) + + - parameter predicate: A function to test each element for a condition; the second parameter of the function represents the index of the source element. + - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. + */ + @available(*, deprecated, message: "Please use enumerated().skipWhile().map()") + public func skipWhileWithIndex(_ predicate: @escaping (E, Int) throws -> Bool) -> Observable { + return enumerated().skipWhile { try predicate($0.element, $0.index) }.map { $0.element } + } + + + /** + + Returns elements from an observable sequence as long as a specified condition is true. + + The element's index is used in the logic of the predicate function. + + - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html) + + - parameter predicate: A function to test each element for a condition; the second parameter of the function represents the index of the source element. + - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. + */ + @available(*, deprecated, message: "Please use enumerated().takeWhile().map()") + public func takeWhileWithIndex(_ predicate: @escaping (E, Int) throws -> Bool) -> Observable { + return enumerated().takeWhile { try predicate($0.element, $0.index) }.map { $0.element } + } +} + +extension Disposable { + /// Deprecated in favor of `disposed(by:)` + /// + /// + /// Adds `self` to `bag`. + /// + /// - parameter bag: `DisposeBag` to add `self` to. + @available(*, deprecated, message: "use disposed(by:) instead", renamed: "disposed(by:)") + public func addDisposableTo(_ bag: DisposeBag) { + disposed(by: bag) + } +} + + +extension ObservableType { + + /** + Returns an observable sequence that shares a single subscription to the underlying sequence, and immediately upon subscription replays latest element in buffer. + + This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. + + - seealso: [shareReplay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. + */ + @available(*, deprecated, message: "use share(replay: 1) instead", renamed: "share(replay:)") + public func shareReplayLatestWhileConnected() + -> Observable { + return share(replay: 1, scope: .whileConnected) + } +} + + +extension ObservableType { + + /** + Returns an observable sequence that shares a single subscription to the underlying sequence, and immediately upon subscription replays maximum number of elements in buffer. + + This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. + + - seealso: [shareReplay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - parameter bufferSize: Maximum element count of the replay buffer. + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. + */ + @available(*, deprecated, message: "Suggested replacement is `share(replay: 1)`. In case old 3.x behavior of `shareReplay` is required please use `share(replay: 1, scope: .forever)` instead.", renamed: "share(replay:)") + public func shareReplay(_ bufferSize: Int) + -> Observable { + return self.share(replay: bufferSize, scope: .forever) + } +} + +/// Variable is a wrapper for `BehaviorSubject`. +/// +/// Unlike `BehaviorSubject` it can't terminate with error, and when variable is deallocated +/// it will complete its observable sequence (`asObservable`). +/// +/// **This concept will be deprecated from RxSwift but offical migration path hasn't been decided yet.** +/// https://github.com/ReactiveX/RxSwift/issues/1501 +/// +/// Current recommended replacement for this API is `RxCocoa.BehaviorRelay` because: +/// * `Variable` isn't a standard cross platform concept, hence it's out of place in RxSwift target. +/// * It doesn't have a counterpart for handling events (`PublishRelay`). It models state only. +/// * It doesn't have a consistent naming with *Relay or other Rx concepts. +/// * It has an inconsistent memory management model compared to other parts of RxSwift (completes on `deinit`). +/// +/// Once plans are finalized, official availability attribute will be added in one of upcoming versions. +public final class Variable { + + public typealias E = Element + + private let _subject: BehaviorSubject + + private var _lock = SpinLock() + + // state + private var _value: E + + #if DEBUG + fileprivate let _synchronizationTracker = SynchronizationTracker() + #endif + + /// Gets or sets current value of variable. + /// + /// Whenever a new value is set, all the observers are notified of the change. + /// + /// Even if the newly set value is same as the old value, observers are still notified for change. + public var value: E { + get { + _lock.lock(); defer { _lock.unlock() } + return _value + } + set(newValue) { + #if DEBUG + _synchronizationTracker.register(synchronizationErrorMessage: .variable) + defer { _synchronizationTracker.unregister() } + #endif + _lock.lock() + _value = newValue + _lock.unlock() + + _subject.on(.next(newValue)) + } + } + + /// Initializes variable with initial value. + /// + /// - parameter value: Initial variable value. + public init(_ value: Element) { + #if DEBUG + DeprecationWarner.warnIfNeeded(.variable) + #endif + + _value = value + _subject = BehaviorSubject(value: value) + } + + /// - returns: Canonical interface for push style sequence + public func asObservable() -> Observable { + return _subject + } + + deinit { + _subject.on(.completed) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposable.swift new file mode 100644 index 0000000..0ff067c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposable.swift @@ -0,0 +1,13 @@ +// +// Disposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Respresents a disposable resource. +public protocol Disposable { + /// Dispose resource. + func dispose() +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift new file mode 100644 index 0000000..e54532b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift @@ -0,0 +1,61 @@ +// +// AnonymousDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents an Action-based disposable. +/// +/// When dispose method is called, disposal action will be dereferenced. +fileprivate final class AnonymousDisposable : DisposeBase, Cancelable { + public typealias DisposeAction = () -> Void + + private var _isDisposed: AtomicInt = 0 + private var _disposeAction: DisposeAction? + + /// - returns: Was resource disposed. + public var isDisposed: Bool { + return _isDisposed == 1 + } + + /// Constructs a new disposable with the given action used for disposal. + /// + /// - parameter disposeAction: Disposal action which will be run upon calling `dispose`. + fileprivate init(_ disposeAction: @escaping DisposeAction) { + _disposeAction = disposeAction + super.init() + } + + // Non-deprecated version of the constructor, used by `Disposables.create(with:)` + fileprivate init(disposeAction: @escaping DisposeAction) { + _disposeAction = disposeAction + super.init() + } + + /// Calls the disposal action if and only if the current instance hasn't been disposed yet. + /// + /// After invoking disposal action, disposal action will be dereferenced. + fileprivate func dispose() { + if AtomicCompareAndSwap(0, 1, &_isDisposed) { + assert(_isDisposed == 1) + + if let action = _disposeAction { + _disposeAction = nil + action() + } + } + } +} + +extension Disposables { + + /// Constructs a new disposable with the given action used for disposal. + /// + /// - parameter dispose: Disposal action which will be run upon calling `dispose`. + public static func create(with dispose: @escaping () -> ()) -> Cancelable { + return AnonymousDisposable(disposeAction: dispose) + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift new file mode 100644 index 0000000..8a518f0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift @@ -0,0 +1,53 @@ +// +// BinaryDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents two disposable resources that are disposed together. +private final class BinaryDisposable : DisposeBase, Cancelable { + + private var _isDisposed: AtomicInt = 0 + + // state + private var _disposable1: Disposable? + private var _disposable2: Disposable? + + /// - returns: Was resource disposed. + var isDisposed: Bool { + return _isDisposed > 0 + } + + /// Constructs new binary disposable from two disposables. + /// + /// - parameter disposable1: First disposable + /// - parameter disposable2: Second disposable + init(_ disposable1: Disposable, _ disposable2: Disposable) { + _disposable1 = disposable1 + _disposable2 = disposable2 + super.init() + } + + /// Calls the disposal action if and only if the current instance hasn't been disposed yet. + /// + /// After invoking disposal action, disposal action will be dereferenced. + func dispose() { + if AtomicCompareAndSwap(0, 1, &_isDisposed) { + _disposable1?.dispose() + _disposable2?.dispose() + _disposable1 = nil + _disposable2 = nil + } + } +} + +extension Disposables { + + /// Creates a disposable with the given disposables. + public static func create(_ disposable1: Disposable, _ disposable2: Disposable) -> Cancelable { + return BinaryDisposable(disposable1, disposable2) + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift new file mode 100644 index 0000000..efae55e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift @@ -0,0 +1,33 @@ +// +// BooleanDisposable.swift +// RxSwift +// +// Created by Junior B. on 10/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents a disposable resource that can be checked for disposal status. +public final class BooleanDisposable : Cancelable { + + internal static let BooleanDisposableTrue = BooleanDisposable(isDisposed: true) + private var _isDisposed = false + + /// Initializes a new instance of the `BooleanDisposable` class + public init() { + } + + /// Initializes a new instance of the `BooleanDisposable` class with given value + public init(isDisposed: Bool) { + self._isDisposed = isDisposed + } + + /// - returns: Was resource disposed. + public var isDisposed: Bool { + return _isDisposed + } + + /// Sets the status to disposed, which can be observer through the `isDisposed` property. + public func dispose() { + _isDisposed = true + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift new file mode 100644 index 0000000..b057817 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift @@ -0,0 +1,151 @@ +// +// CompositeDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/20/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents a group of disposable resources that are disposed together. +public final class CompositeDisposable : DisposeBase, Cancelable { + /// Key used to remove disposable from composite disposable + public struct DisposeKey { + fileprivate let key: BagKey + fileprivate init(key: BagKey) { + self.key = key + } + } + + private var _lock = SpinLock() + + // state + private var _disposables: Bag? = Bag() + + public var isDisposed: Bool { + _lock.lock(); defer { _lock.unlock() } + return _disposables == nil + } + + public override init() { + } + + /// Initializes a new instance of composite disposable with the specified number of disposables. + public init(_ disposable1: Disposable, _ disposable2: Disposable) { + // This overload is here to make sure we are using optimized version up to 4 arguments. + let _ = _disposables!.insert(disposable1) + let _ = _disposables!.insert(disposable2) + } + + /// Initializes a new instance of composite disposable with the specified number of disposables. + public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable) { + // This overload is here to make sure we are using optimized version up to 4 arguments. + let _ = _disposables!.insert(disposable1) + let _ = _disposables!.insert(disposable2) + let _ = _disposables!.insert(disposable3) + } + + /// Initializes a new instance of composite disposable with the specified number of disposables. + public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable, _ disposable4: Disposable, _ disposables: Disposable...) { + // This overload is here to make sure we are using optimized version up to 4 arguments. + let _ = _disposables!.insert(disposable1) + let _ = _disposables!.insert(disposable2) + let _ = _disposables!.insert(disposable3) + let _ = _disposables!.insert(disposable4) + + for disposable in disposables { + let _ = _disposables!.insert(disposable) + } + } + + /// Initializes a new instance of composite disposable with the specified number of disposables. + public init(disposables: [Disposable]) { + for disposable in disposables { + let _ = _disposables!.insert(disposable) + } + } + + /** + Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. + + - parameter disposable: Disposable to add. + - returns: Key that can be used to remove disposable from composite disposable. In case dispose bag was already + disposed `nil` will be returned. + */ + public func insert(_ disposable: Disposable) -> DisposeKey? { + let key = _insert(disposable) + + if key == nil { + disposable.dispose() + } + + return key + } + + private func _insert(_ disposable: Disposable) -> DisposeKey? { + _lock.lock(); defer { _lock.unlock() } + + let bagKey = _disposables?.insert(disposable) + return bagKey.map(DisposeKey.init) + } + + /// - returns: Gets the number of disposables contained in the `CompositeDisposable`. + public var count: Int { + _lock.lock(); defer { _lock.unlock() } + return _disposables?.count ?? 0 + } + + /// Removes and disposes the disposable identified by `disposeKey` from the CompositeDisposable. + /// + /// - parameter disposeKey: Key used to identify disposable to be removed. + public func remove(for disposeKey: DisposeKey) { + _remove(for: disposeKey)?.dispose() + } + + private func _remove(for disposeKey: DisposeKey) -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + return _disposables?.removeKey(disposeKey.key) + } + + /// Disposes all disposables in the group and removes them from the group. + public func dispose() { + if let disposables = _dispose() { + disposeAll(in: disposables) + } + } + + private func _dispose() -> Bag? { + _lock.lock(); defer { _lock.unlock() } + + let disposeBag = _disposables + _disposables = nil + + return disposeBag + } +} + +extension Disposables { + + /// Creates a disposable with the given disposables. + public static func create(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable) -> Cancelable { + return CompositeDisposable(disposable1, disposable2, disposable3) + } + + /// Creates a disposable with the given disposables. + public static func create(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable, _ disposables: Disposable ...) -> Cancelable { + var disposables = disposables + disposables.append(disposable1) + disposables.append(disposable2) + disposables.append(disposable3) + return CompositeDisposable(disposables: disposables) + } + + /// Creates a disposable with the given disposables. + public static func create(_ disposables: [Disposable]) -> Cancelable { + switch disposables.count { + case 2: + return Disposables.create(disposables[0], disposables[1]) + default: + return CompositeDisposable(disposables: disposables) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/Disposables.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/Disposables.swift new file mode 100644 index 0000000..8cd6e28 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/Disposables.swift @@ -0,0 +1,13 @@ +// +// Disposables.swift +// RxSwift +// +// Created by Mohsen Ramezanpoor on 01/08/2016. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +/// A collection of utility methods for common disposable operations. +public struct Disposables { + private init() {} +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift new file mode 100644 index 0000000..d5e3b02 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift @@ -0,0 +1,84 @@ +// +// DisposeBag.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension Disposable { + /// Adds `self` to `bag` + /// + /// - parameter bag: `DisposeBag` to add `self` to. + public func disposed(by bag: DisposeBag) { + bag.insert(self) + } +} + +/** +Thread safe bag that disposes added disposables on `deinit`. + +This returns ARC (RAII) like resource management to `RxSwift`. + +In case contained disposables need to be disposed, just put a different dispose bag +or create a new one in its place. + + self.existingDisposeBag = DisposeBag() + +In case explicit disposal is necessary, there is also `CompositeDisposable`. +*/ +public final class DisposeBag: DisposeBase { + + private var _lock = SpinLock() + + // state + private var _disposables = [Disposable]() + private var _isDisposed = false + + /// Constructs new empty dispose bag. + public override init() { + super.init() + } + + /// Adds `disposable` to be disposed when dispose bag is being deinited. + /// + /// - parameter disposable: Disposable to add. + public func insert(_ disposable: Disposable) { + _insert(disposable)?.dispose() + } + + private func _insert(_ disposable: Disposable) -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + if _isDisposed { + return disposable + } + + _disposables.append(disposable) + + return nil + } + + /// This is internal on purpose, take a look at `CompositeDisposable` instead. + private func dispose() { + let oldDisposables = _dispose() + + for disposable in oldDisposables { + disposable.dispose() + } + } + + private func _dispose() -> [Disposable] { + _lock.lock(); defer { _lock.unlock() } + + let disposables = _disposables + + _disposables.removeAll(keepingCapacity: false) + _isDisposed = true + + return disposables + } + + deinit { + dispose() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift new file mode 100644 index 0000000..8c6a44f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift @@ -0,0 +1,22 @@ +// +// DisposeBase.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Base class for all disposables. +public class DisposeBase { + init() { +#if TRACE_RESOURCES + let _ = Resources.incrementTotal() +#endif + } + + deinit { +#if TRACE_RESOURCES + let _ = Resources.decrementTotal() +#endif + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift new file mode 100644 index 0000000..149f866 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift @@ -0,0 +1,32 @@ +// +// NopDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents a disposable that does nothing on disposal. +/// +/// Nop = No Operation +fileprivate struct NopDisposable : Disposable { + + fileprivate static let noOp: Disposable = NopDisposable() + + fileprivate init() { + + } + + /// Does nothing. + public func dispose() { + } +} + +extension Disposables { + /** + Creates a disposable that does nothing on disposal. + */ + static public func create() -> Disposable { + return NopDisposable.noOp + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift new file mode 100644 index 0000000..a21662a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift @@ -0,0 +1,117 @@ +// +// RefCountDisposable.swift +// RxSwift +// +// Created by Junior B. on 10/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. +public final class RefCountDisposable : DisposeBase, Cancelable { + private var _lock = SpinLock() + private var _disposable = nil as Disposable? + private var _primaryDisposed = false + private var _count = 0 + + /// - returns: Was resource disposed. + public var isDisposed: Bool { + _lock.lock(); defer { _lock.unlock() } + return _disposable == nil + } + + /// Initializes a new instance of the `RefCountDisposable`. + public init(disposable: Disposable) { + _disposable = disposable + super.init() + } + + /** + Holds a dependent disposable that when disposed decreases the refcount on the underlying disposable. + + When getter is called, a dependent disposable contributing to the reference count that manages the underlying disposable's lifetime is returned. + */ + public func retain() -> Disposable { + return _lock.calculateLocked { + if let _ = _disposable { + + do { + let _ = try incrementChecked(&_count) + } catch (_) { + rxFatalError("RefCountDisposable increment failed") + } + + return RefCountInnerDisposable(self) + } else { + return Disposables.create() + } + } + } + + /// Disposes the underlying disposable only when all dependent disposables have been disposed. + public func dispose() { + let oldDisposable: Disposable? = _lock.calculateLocked { + if let oldDisposable = _disposable, !_primaryDisposed + { + _primaryDisposed = true + + if (_count == 0) + { + _disposable = nil + return oldDisposable + } + } + + return nil + } + + if let disposable = oldDisposable { + disposable.dispose() + } + } + + fileprivate func release() { + let oldDisposable: Disposable? = _lock.calculateLocked { + if let oldDisposable = _disposable { + do { + let _ = try decrementChecked(&_count) + } catch (_) { + rxFatalError("RefCountDisposable decrement on release failed") + } + + guard _count >= 0 else { + rxFatalError("RefCountDisposable counter is lower than 0") + } + + if _primaryDisposed && _count == 0 { + _disposable = nil + return oldDisposable + } + } + + return nil + } + + if let disposable = oldDisposable { + disposable.dispose() + } + } +} + +internal final class RefCountInnerDisposable: DisposeBase, Disposable +{ + private let _parent: RefCountDisposable + private var _isDisposed: AtomicInt = 0 + + init(_ parent: RefCountDisposable) + { + _parent = parent + super.init() + } + + internal func dispose() + { + if AtomicCompareAndSwap(0, 1, &_isDisposed) { + _parent.release() + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift new file mode 100644 index 0000000..92c220d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift @@ -0,0 +1,50 @@ +// +// ScheduledDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +private let disposeScheduledDisposable: (ScheduledDisposable) -> Disposable = { sd in + sd.disposeInner() + return Disposables.create() +} + +/// Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler. +public final class ScheduledDisposable : Cancelable { + public let scheduler: ImmediateSchedulerType + + private var _isDisposed: AtomicInt = 0 + + // state + private var _disposable: Disposable? + + /// - returns: Was resource disposed. + public var isDisposed: Bool { + return _isDisposed == 1 + } + + /** + Initializes a new instance of the `ScheduledDisposable` that uses a `scheduler` on which to dispose the `disposable`. + + - parameter scheduler: Scheduler where the disposable resource will be disposed on. + - parameter disposable: Disposable resource to dispose on the given scheduler. + */ + public init(scheduler: ImmediateSchedulerType, disposable: Disposable) { + self.scheduler = scheduler + _disposable = disposable + } + + /// Disposes the wrapped disposable on the provided scheduler. + public func dispose() { + let _ = scheduler.schedule(self, action: disposeScheduledDisposable) + } + + func disposeInner() { + if AtomicCompareAndSwap(0, 1, &_isDisposed) { + _disposable!.dispose() + _disposable = nil + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift new file mode 100644 index 0000000..6373d2b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift @@ -0,0 +1,75 @@ +// +// SerialDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource. +public final class SerialDisposable : DisposeBase, Cancelable { + private var _lock = SpinLock() + + // state + private var _current = nil as Disposable? + private var _isDisposed = false + + /// - returns: Was resource disposed. + public var isDisposed: Bool { + return _isDisposed + } + + /// Initializes a new instance of the `SerialDisposable`. + override public init() { + super.init() + } + + /** + Gets or sets the underlying disposable. + + Assigning this property disposes the previous disposable object. + + If the `SerialDisposable` has already been disposed, assignment to this property causes immediate disposal of the given disposable object. + */ + public var disposable: Disposable { + get { + return _lock.calculateLocked { + return _current ?? Disposables.create() + } + } + set (newDisposable) { + let disposable: Disposable? = _lock.calculateLocked { + if _isDisposed { + return newDisposable + } + else { + let toDispose = _current + _current = newDisposable + return toDispose + } + } + + if let disposable = disposable { + disposable.dispose() + } + } + } + + /// Disposes the underlying disposable as well as all future replacements. + public func dispose() { + _dispose()?.dispose() + } + + private func _dispose() -> Disposable? { + _lock.lock(); defer { _lock.unlock() } + if _isDisposed { + return nil + } + else { + _isDisposed = true + let current = _current + _current = nil + return current + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift new file mode 100644 index 0000000..e8ef67d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift @@ -0,0 +1,76 @@ +// +// SingleAssignmentDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/** +Represents a disposable resource which only allows a single assignment of its underlying disposable resource. + +If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an exception. +*/ +public final class SingleAssignmentDisposable : DisposeBase, Cancelable { + + fileprivate enum DisposeState: UInt32 { + case disposed = 1 + case disposableSet = 2 + } + + // Jeej, swift API consistency rules + fileprivate enum DisposeStateInt32: Int32 { + case disposed = 1 + case disposableSet = 2 + } + + // state + private var _state: AtomicInt = 0 + private var _disposable = nil as Disposable? + + /// - returns: A value that indicates whether the object is disposed. + public var isDisposed: Bool { + return AtomicFlagSet(DisposeState.disposed.rawValue, &_state) + } + + /// Initializes a new instance of the `SingleAssignmentDisposable`. + public override init() { + super.init() + } + + /// Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined. + /// + /// **Throws exception if the `SingleAssignmentDisposable` has already been assigned to.** + public func setDisposable(_ disposable: Disposable) { + _disposable = disposable + + let previousState = AtomicOr(DisposeState.disposableSet.rawValue, &_state) + + if (previousState & DisposeStateInt32.disposableSet.rawValue) != 0 { + rxFatalError("oldState.disposable != nil") + } + + if (previousState & DisposeStateInt32.disposed.rawValue) != 0 { + disposable.dispose() + _disposable = nil + } + } + + /// Disposes the underlying disposable. + public func dispose() { + let previousState = AtomicOr(DisposeState.disposed.rawValue, &_state) + + if (previousState & DisposeStateInt32.disposed.rawValue) != 0 { + return + } + + if (previousState & DisposeStateInt32.disposableSet.rawValue) != 0 { + guard let disposable = _disposable else { + rxFatalError("Disposable not set") + } + disposable.dispose() + _disposable = nil + } + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift new file mode 100644 index 0000000..3ae138a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift @@ -0,0 +1,21 @@ +// +// SubscriptionDisposable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 10/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +struct SubscriptionDisposable : Disposable { + private let _key: T.DisposeKey + private weak var _owner: T? + + init(owner: T, key: T.DisposeKey) { + _owner = owner + _key = key + } + + func dispose() { + _owner?.synchronizedUnsubscribe(_key) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Errors.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Errors.swift new file mode 100644 index 0000000..f17b52d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Errors.swift @@ -0,0 +1,52 @@ +// +// Errors.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +let RxErrorDomain = "RxErrorDomain" +let RxCompositeFailures = "RxCompositeFailures" + +/// Generic Rx error codes. +public enum RxError + : Swift.Error + , CustomDebugStringConvertible { + /// Unknown error occurred. + case unknown + /// Performing an action on disposed object. + case disposed(object: AnyObject) + /// Aritmetic overflow error. + case overflow + /// Argument out of range error. + case argumentOutOfRange + /// Sequence doesn't contain any elements. + case noElements + /// Sequence contains more than one element. + case moreThanOneElement + /// Timeout error. + case timeout +} + +extension RxError { + /// A textual representation of `self`, suitable for debugging. + public var debugDescription: String { + switch self { + case .unknown: + return "Unknown error occurred." + case .disposed(let object): + return "Object `\(object)` was already disposed." + case .overflow: + return "Arithmetic overflow occurred." + case .argumentOutOfRange: + return "Argument out of range." + case .noElements: + return "Sequence doesn't contain any elements." + case .moreThanOneElement: + return "Sequence contains more than one element." + case .timeout: + return "Sequence timeout." + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Event.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Event.swift new file mode 100644 index 0000000..377877b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Event.swift @@ -0,0 +1,106 @@ +// +// Event.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents a sequence event. +/// +/// Sequence grammar: +/// **next\* (error | completed)** +public enum Event { + /// Next element is produced. + case next(Element) + + /// Sequence terminated with an error. + case error(Swift.Error) + + /// Sequence completed successfully. + case completed +} + +extension Event : CustomDebugStringConvertible { + /// - returns: Description of event. + public var debugDescription: String { + switch self { + case .next(let value): + return "next(\(value))" + case .error(let error): + return "error(\(error))" + case .completed: + return "completed" + } + } +} + +extension Event { + /// Is `completed` or `error` event. + public var isStopEvent: Bool { + switch self { + case .next: return false + case .error, .completed: return true + } + } + + /// If `next` event, returns element value. + public var element: Element? { + if case .next(let value) = self { + return value + } + return nil + } + + /// If `error` event, returns error. + public var error: Swift.Error? { + if case .error(let error) = self { + return error + } + return nil + } + + /// If `completed` event, returns true. + public var isCompleted: Bool { + if case .completed = self { + return true + } + return false + } +} + +extension Event { + /// Maps sequence elements using transform. If error happens during the transform .error + /// will be returned as value + public func map(_ transform: (Element) throws -> Result) -> Event { + do { + switch self { + case let .next(element): + return .next(try transform(element)) + case let .error(error): + return .error(error) + case .completed: + return .completed + } + } + catch let e { + return .error(e) + } + } +} + +/// A type that can be converted to `Event`. +public protocol EventConvertible { + /// Type of element in event + associatedtype ElementType + + /// Event representation of this instance + var event: Event { get } +} + +extension Event : EventConvertible { + /// Event representation of this instance + public var event: Event { + return self + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift new file mode 100644 index 0000000..895333c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift @@ -0,0 +1,62 @@ +// +// Bag+Rx.swift +// RxSwift +// +// Created by Krunoslav Zaher on 10/19/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + + +// MARK: forEach + +@inline(__always) +func dispatch(_ bag: Bag<(Event) -> ()>, _ event: Event) { + if bag._onlyFastPath { + bag._value0?(event) + return + } + + let value0 = bag._value0 + let dictionary = bag._dictionary + + if let value0 = value0 { + value0(event) + } + + let pairs = bag._pairs + for i in 0 ..< pairs.count { + pairs[i].value(event) + } + + if let dictionary = dictionary { + for element in dictionary.values { + element(event) + } + } +} + +/// Dispatches `dispose` to all disposables contained inside bag. +func disposeAll(in bag: Bag) { + if bag._onlyFastPath { + bag._value0?.dispose() + return + } + + let value0 = bag._value0 + let dictionary = bag._dictionary + + if let value0 = value0 { + value0.dispose() + } + + let pairs = bag._pairs + for i in 0 ..< pairs.count { + pairs[i].value.dispose() + } + + if let dictionary = dictionary { + for element in dictionary.values { + element.dispose() + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift new file mode 100644 index 0000000..42ef636 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Extensions/String+Rx.swift @@ -0,0 +1,22 @@ +// +// String+Rx.swift +// RxSwift +// +// Created by Krunoslav Zaher on 12/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension String { + /// This is needed because on Linux Swift doesn't have `rangeOfString(..., options: .BackwardsSearch)` + func lastIndexOf(_ character: Character) -> Index? { + var index = endIndex + while index > startIndex { + index = self.index(before: index) + if self[index] == character { + return index + } + } + + return nil + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/GroupedObservable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/GroupedObservable.swift new file mode 100644 index 0000000..d87e0ba --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/GroupedObservable.swift @@ -0,0 +1,37 @@ +// +// GroupedObservable.swift +// RxSwift +// +// Created by Tomi Koskinen on 01/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents an observable sequence of elements that have a common key. +public struct GroupedObservable : ObservableType { + public typealias E = Element + + /// Gets the common key. + public let key: Key + + private let source: Observable + + /// Initializes grouped observable sequence with key and source observable sequence. + /// + /// - parameter key: Grouped observable sequence key + /// - parameter source: Observable sequence that represents sequence of elements for the key + /// - returns: Grouped observable sequence of elements for the specific key + public init(key: Key, source: Observable) { + self.key = key + self.source = source + } + + /// Subscribes `observer` to receive events for this sequence. + public func subscribe(_ observer: O) -> Disposable where O.E == E { + return self.source.subscribe(observer) + } + + /// Converts `self` to `Observable` sequence. + public func asObservable() -> Observable { + return source + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift new file mode 100644 index 0000000..8dc2a85 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift @@ -0,0 +1,36 @@ +// +// ImmediateSchedulerType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/31/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents an object that immediately schedules units of work. +public protocol ImmediateSchedulerType { + /** + Schedules an action to be executed immediately. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable +} + +extension ImmediateSchedulerType { + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleRecursive(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> ()) -> ()) -> Disposable { + let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self) + + recursiveScheduler.schedule(state) + + return Disposables.create(with: recursiveScheduler.dispose) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observable.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observable.swift new file mode 100644 index 0000000..f0c55af --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observable.swift @@ -0,0 +1,44 @@ +// +// Observable.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// A type-erased `ObservableType`. +/// +/// It represents a push style sequence. +public class Observable : ObservableType { + /// Type of elements in sequence. + public typealias E = Element + + init() { +#if TRACE_RESOURCES + let _ = Resources.incrementTotal() +#endif + } + + public func subscribe(_ observer: O) -> Disposable where O.E == E { + rxAbstractMethod() + } + + public func asObservable() -> Observable { + return self + } + + deinit { +#if TRACE_RESOURCES + let _ = Resources.decrementTotal() +#endif + } + + // this is kind of ugly I know :( + // Swift compiler reports "Not supported yet" when trying to override protocol extensions, so ¯\_(ツ)_/¯ + + /// Optimizations for map operator + internal func composeMap(_ transform: @escaping (Element) throws -> R) -> Observable { + return _map(source: self, transform: transform) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift new file mode 100644 index 0000000..d89c5aa --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift @@ -0,0 +1,18 @@ +// +// ObservableConvertibleType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 9/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Type that can be converted to observable sequence (`Observable`). +public protocol ObservableConvertibleType { + /// Type of elements in sequence. + associatedtype E + + /// Converts `self` to `Observable` sequence. + /// + /// - returns: Observable sequence that represents `self`. + func asObservable() -> Observable +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift new file mode 100644 index 0000000..d558cca --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift @@ -0,0 +1,141 @@ +// +// ObservableType+Extensions.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if DEBUG + import Foundation +#endif + +extension ObservableType { + /** + Subscribes an event handler to an observable sequence. + + - parameter on: Action to invoke for each event in the observable sequence. + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + public func subscribe(_ on: @escaping (Event) -> Void) + -> Disposable { + let observer = AnonymousObserver { e in + on(e) + } + return self.asObservable().subscribe(observer) + } + + + /** + Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence. + + - parameter onNext: Action to invoke for each element in the observable sequence. + - parameter onError: Action to invoke upon errored termination of the observable sequence. + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has + gracefully completed, errored, or if the generation is canceled by disposing subscription). + - returns: Subscription object used to unsubscribe from the observable sequence. + */ + public func subscribe(onNext: ((E) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) + -> Disposable { + #if DEBUG + let disposable: Disposable + + if let disposed = onDisposed { + disposable = Disposables.create(with: disposed) + } + else { + disposable = Disposables.create() + } + + let synchronizationTracker = SynchronizationTracker() + + let callStack = Hooks.recordCallStackOnError ? Thread.callStackSymbols : [] + + let observer = AnonymousObserver { event in + + synchronizationTracker.register(synchronizationErrorMessage: .default) + defer { synchronizationTracker.unregister() } + + switch event { + case .next(let value): + onNext?(value) + case .error(let error): + if let onError = onError { + onError(error) + } + else { + Hooks.defaultErrorHandler(callStack, error) + } + disposable.dispose() + case .completed: + onCompleted?() + disposable.dispose() + } + } + return Disposables.create( + self.asObservable().subscribe(observer), + disposable + ) + #else + let disposable: Disposable + + if let disposed = onDisposed { + disposable = Disposables.create(with: disposed) + } + else { + disposable = Disposables.create() + } + + let observer = AnonymousObserver { event in + switch event { + case .next(let value): + onNext?(value) + case .error(let error): + if let onError = onError { + onError(error) + } + else { + Hooks.defaultErrorHandler([], error) + } + disposable.dispose() + case .completed: + onCompleted?() + disposable.dispose() + } + } + return Disposables.create( + self.asObservable().subscribe(observer), + disposable + ) + #endif + + } +} + +import class Foundation.NSRecursiveLock + +extension Hooks { + public typealias DefaultErrorHandler = (_ subscriptionCallStack: [String], _ error: Error) -> () + + fileprivate static let _lock = RecursiveLock() + fileprivate static var _defaultErrorHandler: DefaultErrorHandler = { subscriptionCallStack, error in + #if DEBUG + let serializedCallStack = subscriptionCallStack.joined(separator: "\n") + print("Unhandled error happened: \(error)\n subscription called from:\n\(serializedCallStack)") + #endif + } + + /// Error handler called in case onError handler wasn't provided. + public static var defaultErrorHandler: DefaultErrorHandler { + get { + _lock.lock(); defer { _lock.unlock() } + return _defaultErrorHandler + } + set { + _lock.lock(); defer { _lock.unlock() } + _defaultErrorHandler = newValue + } + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType.swift new file mode 100644 index 0000000..e41a36a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObservableType.swift @@ -0,0 +1,47 @@ +// +// ObservableType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Represents a push style sequence. +public protocol ObservableType : ObservableConvertibleType { + /** + Subscribes `observer` to receive events for this sequence. + + ### Grammar + + **Next\* (Error | Completed)?** + + * sequences can produce zero or more elements so zero or more `Next` events can be sent to `observer` + * once an `Error` or `Completed` event is sent, the sequence terminates and can't produce any other elements + + It is possible that events are sent from different threads, but no two events can be sent concurrently to + `observer`. + + ### Resource Management + + When sequence sends `Complete` or `Error` event all internal resources that compute sequence elements + will be freed. + + To cancel production of sequence elements and free resources immediately, call `dispose` on returned + subscription. + + - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources. + */ + func subscribe(_ observer: O) -> Disposable where O.E == E +} + +extension ObservableType { + + /// Default implementation of converting `ObservableType` to `Observable`. + public func asObservable() -> Observable { + // temporary workaround + //return Observable.create(subscribe: self.subscribe) + return Observable.create { o in + return self.subscribe(o) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AddRef.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AddRef.swift new file mode 100644 index 0000000..b782c13 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AddRef.swift @@ -0,0 +1,45 @@ +// +// AddRef.swift +// RxSwift +// +// Created by Junior B. on 30/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +final class AddRefSink : Sink, ObserverType { + typealias Element = O.E + + override init(observer: O, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(_): + forwardOn(event) + case .completed, .error(_): + forwardOn(event) + dispose() + } + } +} + +final class AddRef : Producer { + typealias EventHandler = (Event) throws -> Void + + private let _source: Observable + private let _refCount: RefCountDisposable + + init(source: Observable, refCount: RefCountDisposable) { + _source = source + _refCount = refCount + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let releaseDisposable = _refCount.retain() + let sink = AddRefSink(observer: observer, cancel: cancel) + let subscription = Disposables.create(releaseDisposable, _source.subscribe(sink)) + + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Amb.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Amb.swift new file mode 100644 index 0000000..08ec04e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Amb.swift @@ -0,0 +1,157 @@ +// +// Amb.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Propagates the observable sequence that reacts first. + + - seealso: [amb operator on reactivex.io](http://reactivex.io/documentation/operators/amb.html) + + - returns: An observable sequence that surfaces any of the given sequences, whichever reacted first. + */ + public static func amb(_ sequence: S) -> Observable + where S.Iterator.Element == Observable { + return sequence.reduce(Observable.never()) { a, o in + return a.amb(o.asObservable()) + } + } +} + +extension ObservableType { + + /** + Propagates the observable sequence that reacts first. + + - seealso: [amb operator on reactivex.io](http://reactivex.io/documentation/operators/amb.html) + + - parameter right: Second observable sequence. + - returns: An observable sequence that surfaces either of the given sequences, whichever reacted first. + */ + public func amb + (_ right: O2) + -> Observable where O2.E == E { + return Amb(left: asObservable(), right: right.asObservable()) + } +} + +fileprivate enum AmbState { + case neither + case left + case right +} + +final fileprivate class AmbObserver : ObserverType { + typealias Element = O.E + typealias Parent = AmbSink + typealias This = AmbObserver + typealias Sink = (This, Event) -> Void + + fileprivate let _parent: Parent + fileprivate var _sink: Sink + fileprivate var _cancel: Disposable + + init(parent: Parent, cancel: Disposable, sink: @escaping Sink) { +#if TRACE_RESOURCES + let _ = Resources.incrementTotal() +#endif + + _parent = parent + _sink = sink + _cancel = cancel + } + + func on(_ event: Event) { + _sink(self, event) + if event.isStopEvent { + _cancel.dispose() + } + } + + deinit { +#if TRACE_RESOURCES + let _ = Resources.decrementTotal() +#endif + } +} + +final fileprivate class AmbSink : Sink { + typealias ElementType = O.E + typealias Parent = Amb + typealias AmbObserverType = AmbObserver + + private let _parent: Parent + + private let _lock = RecursiveLock() + // state + private var _choice = AmbState.neither + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let disposeAll = Disposables.create(subscription1, subscription2) + + let forwardEvent = { (o: AmbObserverType, event: Event) -> Void in + self.forwardOn(event) + if event.isStopEvent { + self.dispose() + } + } + + let decide = { (o: AmbObserverType, event: Event, me: AmbState, otherSubscription: Disposable) in + self._lock.performLocked { + if self._choice == .neither { + self._choice = me + o._sink = forwardEvent + o._cancel = disposeAll + otherSubscription.dispose() + } + + if self._choice == me { + self.forwardOn(event) + if event.isStopEvent { + self.dispose() + } + } + } + } + + let sink1 = AmbObserver(parent: self, cancel: subscription1) { o, e in + decide(o, e, .left, subscription2) + } + + let sink2 = AmbObserver(parent: self, cancel: subscription1) { o, e in + decide(o, e, .right, subscription1) + } + + subscription1.setDisposable(_parent._left.subscribe(sink1)) + subscription2.setDisposable(_parent._right.subscribe(sink2)) + + return disposeAll + } +} + +final fileprivate class Amb: Producer { + fileprivate let _left: Observable + fileprivate let _right: Observable + + init(left: Observable, right: Observable) { + _left = left + _right = right + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = AmbSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift new file mode 100644 index 0000000..36fa685 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift @@ -0,0 +1,49 @@ +// +// AsMaybe.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/12/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +fileprivate final class AsMaybeSink : Sink, ObserverType { + typealias ElementType = O.E + typealias E = ElementType + + private var _element: Event? = nil + + func on(_ event: Event) { + switch event { + case .next: + if _element != nil { + forwardOn(.error(RxError.moreThanOneElement)) + dispose() + } + + _element = event + case .error: + forwardOn(event) + dispose() + case .completed: + if let element = _element { + forwardOn(element) + } + forwardOn(.completed) + dispose() + } + } +} + +final class AsMaybe: Producer { + fileprivate let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = AsMaybeSink(observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsSingle.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsSingle.swift new file mode 100644 index 0000000..080aa8e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/AsSingle.swift @@ -0,0 +1,52 @@ +// +// AsSingle.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/12/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +fileprivate final class AsSingleSink : Sink, ObserverType { + typealias ElementType = O.E + typealias E = ElementType + + private var _element: Event? = nil + + func on(_ event: Event) { + switch event { + case .next: + if _element != nil { + forwardOn(.error(RxError.moreThanOneElement)) + dispose() + } + + _element = event + case .error: + forwardOn(event) + dispose() + case .completed: + if let element = _element { + forwardOn(element) + forwardOn(.completed) + } + else { + forwardOn(.error(RxError.noElements)) + } + dispose() + } + } +} + +final class AsSingle: Producer { + fileprivate let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = AsSingleSink(observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Buffer.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Buffer.swift new file mode 100644 index 0000000..b8c33ae --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Buffer.swift @@ -0,0 +1,139 @@ +// +// Buffer.swift +// RxSwift +// +// Created by Krunoslav Zaher on 9/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers. + + A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first. + + - seealso: [buffer operator on reactivex.io](http://reactivex.io/documentation/operators/buffer.html) + + - parameter timeSpan: Maximum time length of a buffer. + - parameter count: Maximum element count of a buffer. + - parameter scheduler: Scheduler to run buffering timers on. + - returns: An observable sequence of buffers. + */ + public func buffer(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) + -> Observable<[E]> { + return BufferTimeCount(source: self.asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler) + } +} + +final fileprivate class BufferTimeCount : Producer<[Element]> { + + fileprivate let _timeSpan: RxTimeInterval + fileprivate let _count: Int + fileprivate let _scheduler: SchedulerType + fileprivate let _source: Observable + + init(source: Observable, timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) { + _source = source + _timeSpan = timeSpan + _count = count + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == [Element] { + let sink = BufferTimeCountSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class BufferTimeCountSink + : Sink + , LockOwnerType + , ObserverType + , SynchronizedOnType where O.E == [Element] { + typealias Parent = BufferTimeCount + typealias E = Element + + private let _parent: Parent + + let _lock = RecursiveLock() + + // state + private let _timerD = SerialDisposable() + private var _buffer = [Element]() + private var _windowID = 0 + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + createTimer(_windowID) + return Disposables.create(_timerD, _parent._source.subscribe(self)) + } + + func startNewWindowAndSendCurrentOne() { + _windowID = _windowID &+ 1 + let windowID = _windowID + + let buffer = _buffer + _buffer = [] + forwardOn(.next(buffer)) + + createTimer(windowID) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next(let element): + _buffer.append(element) + + if _buffer.count == _parent._count { + startNewWindowAndSendCurrentOne() + } + + case .error(let error): + _buffer = [] + forwardOn(.error(error)) + dispose() + case .completed: + forwardOn(.next(_buffer)) + forwardOn(.completed) + dispose() + } + } + + func createTimer(_ windowID: Int) { + if _timerD.isDisposed { + return + } + + if _windowID != windowID { + return + } + + let nextTimer = SingleAssignmentDisposable() + + _timerD.disposable = nextTimer + + let disposable = _parent._scheduler.scheduleRelative(windowID, dueTime: _parent._timeSpan) { previousWindowID in + self._lock.performLocked { + if previousWindowID != self._windowID { + return + } + + self.startNewWindowAndSendCurrentOne() + } + + return Disposables.create() + } + + nextTimer.setDisposable(disposable) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Catch.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Catch.swift new file mode 100644 index 0000000..187eb8a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Catch.swift @@ -0,0 +1,235 @@ +// +// Catch.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler. + + - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html) + + - parameter handler: Error handler function, producing another observable sequence. + - returns: An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an error occurred. + */ + public func catchError(_ handler: @escaping (Swift.Error) throws -> Observable) + -> Observable { + return Catch(source: asObservable(), handler: handler) + } + + /** + Continues an observable sequence that is terminated by an error with a single element. + + - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html) + + - parameter element: Last element in an observable sequence in case error occurs. + - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred. + */ + public func catchErrorJustReturn(_ element: E) + -> Observable { + return Catch(source: asObservable(), handler: { _ in Observable.just(element) }) + } + +} + +extension ObservableType { + /** + Continues an observable sequence that is terminated by an error with the next observable sequence. + + - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html) + + - returns: An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. + */ + public static func catchError(_ sequence: S) -> Observable + where S.Iterator.Element == Observable { + return CatchSequence(sources: sequence) + } +} + +extension ObservableType { + + /** + Repeats the source observable sequence until it successfully terminates. + + **This could potentially create an infinite sequence.** + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - returns: Observable sequence to repeat until it successfully terminates. + */ + public func retry() -> Observable { + return CatchSequence(sources: InfiniteSequence(repeatedValue: self.asObservable())) + } + + /** + Repeats the source observable sequence the specified number of times in case of an error or until it successfully terminates. + + If you encounter an error and want it to retry once, then you must use `retry(2)` + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - parameter maxAttemptCount: Maximum number of times to repeat the sequence. + - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. + */ + public func retry(_ maxAttemptCount: Int) + -> Observable { + return CatchSequence(sources: Swift.repeatElement(self.asObservable(), count: maxAttemptCount)) + } +} + +// catch with callback + +final fileprivate class CatchSinkProxy : ObserverType { + typealias E = O.E + typealias Parent = CatchSink + + private let _parent: Parent + + init(parent: Parent) { + _parent = parent + } + + func on(_ event: Event) { + _parent.forwardOn(event) + + switch event { + case .next: + break + case .error, .completed: + _parent.dispose() + } + } +} + +final fileprivate class CatchSink : Sink, ObserverType { + typealias E = O.E + typealias Parent = Catch + + private let _parent: Parent + private let _subscription = SerialDisposable() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let d1 = SingleAssignmentDisposable() + _subscription.disposable = d1 + d1.setDisposable(_parent._source.subscribe(self)) + + return _subscription + } + + func on(_ event: Event) { + switch event { + case .next: + forwardOn(event) + case .completed: + forwardOn(event) + dispose() + case .error(let error): + do { + let catchSequence = try _parent._handler(error) + + let observer = CatchSinkProxy(parent: self) + + _subscription.disposable = catchSequence.subscribe(observer) + } + catch let e { + forwardOn(.error(e)) + dispose() + } + } + } +} + +final fileprivate class Catch : Producer { + typealias Handler = (Swift.Error) throws -> Observable + + fileprivate let _source: Observable + fileprivate let _handler: Handler + + init(source: Observable, handler: @escaping Handler) { + _source = source + _handler = handler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = CatchSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + +// catch enumerable + +final fileprivate class CatchSequenceSink + : TailRecursiveSink + , ObserverType where S.Iterator.Element : ObservableConvertibleType, S.Iterator.Element.E == O.E { + typealias Element = O.E + typealias Parent = CatchSequence + + private var _lastError: Swift.Error? + + override init(observer: O, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next: + forwardOn(event) + case .error(let error): + _lastError = error + schedule(.moveNext) + case .completed: + forwardOn(event) + dispose() + } + } + + override func subscribeToNext(_ source: Observable) -> Disposable { + return source.subscribe(self) + } + + override func done() { + if let lastError = _lastError { + forwardOn(.error(lastError)) + } + else { + forwardOn(.completed) + } + + self.dispose() + } + + override func extract(_ observable: Observable) -> SequenceGenerator? { + if let onError = observable as? CatchSequence { + return (onError.sources.makeIterator(), nil) + } + else { + return nil + } + } +} + +final fileprivate class CatchSequence : Producer where S.Iterator.Element : ObservableConvertibleType { + typealias Element = S.Iterator.Element.E + + let sources: S + + init(sources: S) { + self.sources = sources + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = CatchSequenceSink(observer: observer, cancel: cancel) + let subscription = sink.run((self.sources.makeIterator(), nil)) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift new file mode 100644 index 0000000..45e0173 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift @@ -0,0 +1,157 @@ +// +// CombineLatest+Collection.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/29/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combinelatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest(_ collection: C, _ resultSelector: @escaping ([C.Iterator.Element.E]) throws -> E) -> Observable + where C.Iterator.Element: ObservableType { + return CombineLatestCollectionType(sources: collection, resultSelector: resultSelector) + } + + /** + Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element. + + - seealso: [combinelatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest(_ collection: C) -> Observable<[E]> + where C.Iterator.Element: ObservableType, C.Iterator.Element.E == E { + return CombineLatestCollectionType(sources: collection, resultSelector: { $0 }) + } +} + +final fileprivate class CombineLatestCollectionTypeSink + : Sink where C.Iterator.Element : ObservableConvertibleType { + typealias R = O.E + typealias Parent = CombineLatestCollectionType + typealias SourceElement = C.Iterator.Element.E + + let _parent: Parent + + let _lock = RecursiveLock() + + // state + var _numberOfValues = 0 + var _values: [SourceElement?] + var _isDone: [Bool] + var _numberOfDone = 0 + var _subscriptions: [SingleAssignmentDisposable] + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _values = [SourceElement?](repeating: nil, count: parent._count) + _isDone = [Bool](repeating: false, count: parent._count) + _subscriptions = Array() + _subscriptions.reserveCapacity(parent._count) + + for _ in 0 ..< parent._count { + _subscriptions.append(SingleAssignmentDisposable()) + } + + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event, atIndex: Int) { + _lock.lock(); defer { _lock.unlock() } // { + switch event { + case .next(let element): + if _values[atIndex] == nil { + _numberOfValues += 1 + } + + _values[atIndex] = element + + if _numberOfValues < _parent._count { + let numberOfOthersThatAreDone = self._numberOfDone - (_isDone[atIndex] ? 1 : 0) + if numberOfOthersThatAreDone == self._parent._count - 1 { + forwardOn(.completed) + dispose() + } + return + } + + do { + let result = try _parent._resultSelector(_values.map { $0! }) + forwardOn(.next(result)) + } + catch let error { + forwardOn(.error(error)) + dispose() + } + + case .error(let error): + forwardOn(.error(error)) + dispose() + case .completed: + if _isDone[atIndex] { + return + } + + _isDone[atIndex] = true + _numberOfDone += 1 + + if _numberOfDone == self._parent._count { + forwardOn(.completed) + dispose() + } + else { + _subscriptions[atIndex].dispose() + } + } + // } + } + + func run() -> Disposable { + var j = 0 + for i in _parent._sources { + let index = j + let source = i.asObservable() + let disposable = source.subscribe(AnyObserver { event in + self.on(event, atIndex: index) + }) + + _subscriptions[j].setDisposable(disposable) + + j += 1 + } + + if _parent._sources.isEmpty { + self.forwardOn(.completed) + } + + return Disposables.create(_subscriptions) + } +} + +final fileprivate class CombineLatestCollectionType : Producer where C.Iterator.Element : ObservableConvertibleType { + typealias ResultSelector = ([C.Iterator.Element.E]) throws -> R + + let _sources: C + let _resultSelector: ResultSelector + let _count: Int + + init(sources: C, resultSelector: @escaping ResultSelector) { + _sources = sources + _resultSelector = resultSelector + _count = Int(Int64(self._sources.count)) + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestCollectionTypeSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift new file mode 100644 index 0000000..aad2255 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift @@ -0,0 +1,843 @@ +// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project +// +// CombineLatest+arity.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + + + +// 2 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E) + -> Observable { + return CombineLatest2( + source1: source1.asObservable(), source2: source2.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2) + -> Observable<(O1.E, O2.E)> { + return CombineLatest2( + source1: source1.asObservable(), source2: source2.asObservable(), + resultSelector: { ($0, $1) } + ) + } +} + +final class CombineLatestSink2_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest2 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 2, observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + + subscription1.setDisposable(_parent._source1.subscribe(observer1)) + subscription2.setDisposable(_parent._source2.subscribe(observer2)) + + return Disposables.create([ + subscription1, + subscription2 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2) + } +} + +final class CombineLatest2 : Producer { + typealias ResultSelector = (E1, E2) throws -> R + + let _source1: Observable + let _source2: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, resultSelector: @escaping ResultSelector) { + _source1 = source1 + _source2 = source2 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestSink2_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 3 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E) + -> Observable { + return CombineLatest3( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3) + -> Observable<(O1.E, O2.E, O3.E)> { + return CombineLatest3( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), + resultSelector: { ($0, $1, $2) } + ) + } +} + +final class CombineLatestSink3_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest3 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 3, observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + + subscription1.setDisposable(_parent._source1.subscribe(observer1)) + subscription2.setDisposable(_parent._source2.subscribe(observer2)) + subscription3.setDisposable(_parent._source3.subscribe(observer3)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3) + } +} + +final class CombineLatest3 : Producer { + typealias ResultSelector = (E1, E2, E3) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, resultSelector: @escaping ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestSink3_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 4 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> Observable { + return CombineLatest4( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4) + -> Observable<(O1.E, O2.E, O3.E, O4.E)> { + return CombineLatest4( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), + resultSelector: { ($0, $1, $2, $3) } + ) + } +} + +final class CombineLatestSink4_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest4 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 4, observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + + subscription1.setDisposable(_parent._source1.subscribe(observer1)) + subscription2.setDisposable(_parent._source2.subscribe(observer2)) + subscription3.setDisposable(_parent._source3.subscribe(observer3)) + subscription4.setDisposable(_parent._source4.subscribe(observer4)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4) + } +} + +final class CombineLatest4 : Producer { + typealias ResultSelector = (E1, E2, E3, E4) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, resultSelector: @escaping ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestSink4_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 5 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> Observable { + return CombineLatest5( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E)> { + return CombineLatest5( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4) } + ) + } +} + +final class CombineLatestSink5_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest5 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 5, observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + + subscription1.setDisposable(_parent._source1.subscribe(observer1)) + subscription2.setDisposable(_parent._source2.subscribe(observer2)) + subscription3.setDisposable(_parent._source3.subscribe(observer3)) + subscription4.setDisposable(_parent._source4.subscribe(observer4)) + subscription5.setDisposable(_parent._source5.subscribe(observer5)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5) + } +} + +final class CombineLatest5 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, resultSelector: @escaping ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestSink5_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 6 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) + -> Observable { + return CombineLatest6( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E, O6.E)> { + return CombineLatest6( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4, $5) } + ) + } +} + +final class CombineLatestSink6_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest6 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + var _latestElement6: E6! = nil + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 6, observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + let observer6 = CombineLatestObserver(lock: _lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self._latestElement6 = e }, this: subscription6) + + subscription1.setDisposable(_parent._source1.subscribe(observer1)) + subscription2.setDisposable(_parent._source2.subscribe(observer2)) + subscription3.setDisposable(_parent._source3.subscribe(observer3)) + subscription4.setDisposable(_parent._source4.subscribe(observer4)) + subscription5.setDisposable(_parent._source5.subscribe(observer5)) + subscription6.setDisposable(_parent._source6.subscribe(observer6)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5, _latestElement6) + } +} + +final class CombineLatest6 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + let _source6: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, resultSelector: @escaping ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + _source6 = source6 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestSink6_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 7 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) + -> Observable { + return CombineLatest7( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E)> { + return CombineLatest7( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4, $5, $6) } + ) + } +} + +final class CombineLatestSink7_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest7 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + var _latestElement6: E6! = nil + var _latestElement7: E7! = nil + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 7, observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + let observer6 = CombineLatestObserver(lock: _lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self._latestElement6 = e }, this: subscription6) + let observer7 = CombineLatestObserver(lock: _lock, parent: self, index: 6, setLatestValue: { (e: E7) -> Void in self._latestElement7 = e }, this: subscription7) + + subscription1.setDisposable(_parent._source1.subscribe(observer1)) + subscription2.setDisposable(_parent._source2.subscribe(observer2)) + subscription3.setDisposable(_parent._source3.subscribe(observer3)) + subscription4.setDisposable(_parent._source4.subscribe(observer4)) + subscription5.setDisposable(_parent._source5.subscribe(observer5)) + subscription6.setDisposable(_parent._source6.subscribe(observer6)) + subscription7.setDisposable(_parent._source7.subscribe(observer7)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5, _latestElement6, _latestElement7) + } +} + +final class CombineLatest7 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + let _source6: Observable + let _source7: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, resultSelector: @escaping ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + _source6 = source6 + _source7 = source7 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestSink7_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 8 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter resultSelector: Function to invoke whenever any of the sources produces an element. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) + -> Observable { + return CombineLatest8( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func combineLatest + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E)> { + return CombineLatest8( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4, $5, $6, $7) } + ) + } +} + +final class CombineLatestSink8_ : CombineLatestSink { + typealias R = O.E + typealias Parent = CombineLatest8 + + let _parent: Parent + + var _latestElement1: E1! = nil + var _latestElement2: E2! = nil + var _latestElement3: E3! = nil + var _latestElement4: E4! = nil + var _latestElement5: E5! = nil + var _latestElement6: E6! = nil + var _latestElement7: E7! = nil + var _latestElement8: E8! = nil + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 8, observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + let subscription8 = SingleAssignmentDisposable() + + let observer1 = CombineLatestObserver(lock: _lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self._latestElement1 = e }, this: subscription1) + let observer2 = CombineLatestObserver(lock: _lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self._latestElement2 = e }, this: subscription2) + let observer3 = CombineLatestObserver(lock: _lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self._latestElement3 = e }, this: subscription3) + let observer4 = CombineLatestObserver(lock: _lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self._latestElement4 = e }, this: subscription4) + let observer5 = CombineLatestObserver(lock: _lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self._latestElement5 = e }, this: subscription5) + let observer6 = CombineLatestObserver(lock: _lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self._latestElement6 = e }, this: subscription6) + let observer7 = CombineLatestObserver(lock: _lock, parent: self, index: 6, setLatestValue: { (e: E7) -> Void in self._latestElement7 = e }, this: subscription7) + let observer8 = CombineLatestObserver(lock: _lock, parent: self, index: 7, setLatestValue: { (e: E8) -> Void in self._latestElement8 = e }, this: subscription8) + + subscription1.setDisposable(_parent._source1.subscribe(observer1)) + subscription2.setDisposable(_parent._source2.subscribe(observer2)) + subscription3.setDisposable(_parent._source3.subscribe(observer3)) + subscription4.setDisposable(_parent._source4.subscribe(observer4)) + subscription5.setDisposable(_parent._source5.subscribe(observer5)) + subscription6.setDisposable(_parent._source6.subscribe(observer6)) + subscription7.setDisposable(_parent._source7.subscribe(observer7)) + subscription8.setDisposable(_parent._source8.subscribe(observer8)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7, + subscription8 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_latestElement1, _latestElement2, _latestElement3, _latestElement4, _latestElement5, _latestElement6, _latestElement7, _latestElement8) + } +} + +final class CombineLatest8 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7, E8) throws -> R + + let _source1: Observable + let _source2: Observable + let _source3: Observable + let _source4: Observable + let _source5: Observable + let _source6: Observable + let _source7: Observable + let _source8: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, source8: Observable, resultSelector: @escaping ResultSelector) { + _source1 = source1 + _source2 = source2 + _source3 = source3 + _source4 = source4 + _source5 = source5 + _source6 = source6 + _source7 = source7 + _source8 = source8 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = CombineLatestSink8_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift new file mode 100644 index 0000000..8c03e8c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift @@ -0,0 +1,132 @@ +// +// CombineLatest.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol CombineLatestProtocol : class { + func next(_ index: Int) + func fail(_ error: Swift.Error) + func done(_ index: Int) +} + +class CombineLatestSink + : Sink + , CombineLatestProtocol { + typealias Element = O.E + + let _lock = RecursiveLock() + + private let _arity: Int + private var _numberOfValues = 0 + private var _numberOfDone = 0 + private var _hasValue: [Bool] + private var _isDone: [Bool] + + init(arity: Int, observer: O, cancel: Cancelable) { + _arity = arity + _hasValue = [Bool](repeating: false, count: arity) + _isDone = [Bool](repeating: false, count: arity) + + super.init(observer: observer, cancel: cancel) + } + + func getResult() throws -> Element { + rxAbstractMethod() + } + + func next(_ index: Int) { + if !_hasValue[index] { + _hasValue[index] = true + _numberOfValues += 1 + } + + if _numberOfValues == _arity { + do { + let result = try getResult() + forwardOn(.next(result)) + } + catch let e { + forwardOn(.error(e)) + dispose() + } + } + else { + var allOthersDone = true + + for i in 0 ..< _arity { + if i != index && !_isDone[i] { + allOthersDone = false + break + } + } + + if allOthersDone { + forwardOn(.completed) + dispose() + } + } + } + + func fail(_ error: Swift.Error) { + forwardOn(.error(error)) + dispose() + } + + func done(_ index: Int) { + if _isDone[index] { + return + } + + _isDone[index] = true + _numberOfDone += 1 + + if _numberOfDone == _arity { + forwardOn(.completed) + dispose() + } + } +} + +final class CombineLatestObserver + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Element = ElementType + typealias ValueSetter = (Element) -> Void + + private let _parent: CombineLatestProtocol + + let _lock: RecursiveLock + private let _index: Int + private let _this: Disposable + private let _setLatestValue: ValueSetter + + init(lock: RecursiveLock, parent: CombineLatestProtocol, index: Int, setLatestValue: @escaping ValueSetter, this: Disposable) { + _lock = lock + _parent = parent + _index = index + _this = this + _setLatestValue = setLatestValue + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next(let value): + _setLatestValue(value) + _parent.next(_index) + case .error(let error): + _this.dispose() + _parent.fail(error) + case .completed: + _this.dispose() + _parent.done(_index) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Concat.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Concat.swift new file mode 100644 index 0000000..35ef0e1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Concat.swift @@ -0,0 +1,131 @@ +// +// Concat.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Concatenates the second observable sequence to `self` upon successful termination of `self`. + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - parameter second: Second observable sequence. + - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence. + */ + public func concat(_ second: O) -> Observable where O.E == E { + return Observable.concat([self.asObservable(), second.asObservable()]) + } +} + +extension ObservableType { + /** + Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully. + + This operator has tail recursive optimizations that will prevent stack overflow. + + Optimizations will be performed in cases equivalent to following: + + [1, [2, [3, .....].concat()].concat].concat() + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each given sequence, in sequential order. + */ + public static func concat(_ sequence: S) -> Observable + where S.Iterator.Element == Observable { + return Concat(sources: sequence, count: nil) + } + + /** + Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully. + + This operator has tail recursive optimizations that will prevent stack overflow. + + Optimizations will be performed in cases equivalent to following: + + [1, [2, [3, .....].concat()].concat].concat() + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each given sequence, in sequential order. + */ + public static func concat(_ collection: S) -> Observable + where S.Iterator.Element == Observable { + return Concat(sources: collection, count: Int64(collection.count)) + } + + /** + Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully. + + This operator has tail recursive optimizations that will prevent stack overflow. + + Optimizations will be performed in cases equivalent to following: + + [1, [2, [3, .....].concat()].concat].concat() + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each given sequence, in sequential order. + */ + public static func concat(_ sources: Observable ...) -> Observable { + return Concat(sources: sources, count: Int64(sources.count)) + } +} + +final fileprivate class ConcatSink + : TailRecursiveSink + , ObserverType where S.Iterator.Element : ObservableConvertibleType, S.Iterator.Element.E == O.E { + typealias Element = O.E + + override init(observer: O, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event){ + switch event { + case .next: + forwardOn(event) + case .error: + forwardOn(event) + dispose() + case .completed: + schedule(.moveNext) + } + } + + override func subscribeToNext(_ source: Observable) -> Disposable { + return source.subscribe(self) + } + + override func extract(_ observable: Observable) -> SequenceGenerator? { + if let source = observable as? Concat { + return (source._sources.makeIterator(), source._count) + } + else { + return nil + } + } +} + +final fileprivate class Concat : Producer where S.Iterator.Element : ObservableConvertibleType { + typealias Element = S.Iterator.Element.E + + fileprivate let _sources: S + fileprivate let _count: IntMax? + + init(sources: S, count: IntMax?) { + _sources = sources + _count = count + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = ConcatSink(observer: observer, cancel: cancel) + let subscription = sink.run((_sources.makeIterator(), _count)) + return (sink: sink, subscription: subscription) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Create.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Create.swift new file mode 100644 index 0000000..4a1804a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Create.swift @@ -0,0 +1,78 @@ +// +// Create.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + // MARK: create + + /** + Creates an observable sequence from a specified subscribe method implementation. + + - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html) + + - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method. + - returns: The observable sequence with the specified implementation for the `subscribe` method. + */ + public static func create(_ subscribe: @escaping (AnyObserver) -> Disposable) -> Observable { + return AnonymousObservable(subscribe) + } +} + +final fileprivate class AnonymousObservableSink : Sink, ObserverType { + typealias E = O.E + typealias Parent = AnonymousObservable + + // state + private var _isStopped: AtomicInt = 0 + + #if DEBUG + fileprivate let _synchronizationTracker = SynchronizationTracker() + #endif + + override init(observer: O, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + #if DEBUG + _synchronizationTracker.register(synchronizationErrorMessage: .default) + defer { _synchronizationTracker.unregister() } + #endif + switch event { + case .next: + if _isStopped == 1 { + return + } + forwardOn(event) + case .error, .completed: + if AtomicCompareAndSwap(0, 1, &_isStopped) { + forwardOn(event) + dispose() + } + } + } + + func run(_ parent: Parent) -> Disposable { + return parent._subscribeHandler(AnyObserver(self)) + } +} + +final fileprivate class AnonymousObservable : Producer { + typealias SubscribeHandler = (AnyObserver) -> Disposable + + let _subscribeHandler: SubscribeHandler + + init(_ subscribeHandler: @escaping SubscribeHandler) { + _subscribeHandler = subscribeHandler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = AnonymousObservableSink(observer: observer, cancel: cancel) + let subscription = sink.run(self) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debounce.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debounce.swift new file mode 100644 index 0000000..866427a --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debounce.swift @@ -0,0 +1,119 @@ +// +// Debounce.swift +// RxSwift +// +// Created by Krunoslav Zaher on 9/11/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers. + + - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html) + + - parameter dueTime: Throttling duration for each element. + - parameter scheduler: Scheduler to run the throttle timers on. + - returns: The throttled sequence. + */ + public func debounce(_ dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return Debounce(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler) + } +} + +final fileprivate class DebounceSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Element = O.E + typealias ParentType = Debounce + + private let _parent: ParentType + + let _lock = RecursiveLock() + + // state + private var _id = 0 as UInt64 + private var _value: Element? = nil + + let cancellable = SerialDisposable() + + init(parent: ParentType, observer: O, cancel: Cancelable) { + _parent = parent + + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription = _parent._source.subscribe(self) + + return Disposables.create(subscription, cancellable) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next(let element): + _id = _id &+ 1 + let currentId = _id + _value = element + + + let scheduler = _parent._scheduler + let dueTime = _parent._dueTime + + let d = SingleAssignmentDisposable() + self.cancellable.disposable = d + d.setDisposable(scheduler.scheduleRelative(currentId, dueTime: dueTime, action: self.propagate)) + case .error: + _value = nil + forwardOn(event) + dispose() + case .completed: + if let value = _value { + _value = nil + forwardOn(.next(value)) + } + forwardOn(.completed) + dispose() + } + } + + func propagate(_ currentId: UInt64) -> Disposable { + _lock.lock(); defer { _lock.unlock() } // { + let originalValue = _value + + if let value = originalValue, _id == currentId { + _value = nil + forwardOn(.next(value)) + } + // } + return Disposables.create() + } +} + +final fileprivate class Debounce : Producer { + + fileprivate let _source: Observable + fileprivate let _dueTime: RxTimeInterval + fileprivate let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = DebounceSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debug.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debug.swift new file mode 100644 index 0000000..85b8af7 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Debug.swift @@ -0,0 +1,103 @@ +// +// Debug.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.Date +import class Foundation.DateFormatter + +extension ObservableType { + + /** + Prints received events for all observers on standard output. + + - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html) + + - parameter identifier: Identifier that is printed together with event description to standard output. + - parameter trimOutput: Should output be trimmed to max 40 characters. + - returns: An observable sequence whose events are printed to standard output. + */ + public func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function) + -> Observable { + return Debug(source: self, identifier: identifier, trimOutput: trimOutput, file: file, line: line, function: function) + } +} + +fileprivate let dateFormat = "yyyy-MM-dd HH:mm:ss.SSS" + +fileprivate func logEvent(_ identifier: String, dateFormat: DateFormatter, content: String) { + print("\(dateFormat.string(from: Date())): \(identifier) -> \(content)") +} + +final fileprivate class DebugSink : Sink, ObserverType where O.E == Source.E { + typealias Element = O.E + typealias Parent = Debug + + private let _parent: Parent + private let _timestampFormatter = DateFormatter() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _timestampFormatter.dateFormat = dateFormat + + logEvent(_parent._identifier, dateFormat: _timestampFormatter, content: "subscribed") + + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + let maxEventTextLength = 40 + let eventText = "\(event)" + + let eventNormalized = (eventText.count > maxEventTextLength) && _parent._trimOutput + ? String(eventText.prefix(maxEventTextLength / 2)) + "..." + String(eventText.suffix(maxEventTextLength / 2)) + : eventText + + logEvent(_parent._identifier, dateFormat: _timestampFormatter, content: "Event \(eventNormalized)") + + forwardOn(event) + if event.isStopEvent { + dispose() + } + } + + override func dispose() { + if !self.disposed { + logEvent(_parent._identifier, dateFormat: _timestampFormatter, content: "isDisposed") + } + super.dispose() + } +} + +final fileprivate class Debug : Producer { + fileprivate let _identifier: String + fileprivate let _trimOutput: Bool + fileprivate let _source: Source + + init(source: Source, identifier: String?, trimOutput: Bool, file: String, line: UInt, function: String) { + _trimOutput = trimOutput + if let identifier = identifier { + _identifier = identifier + } + else { + let trimmedFile: String + if let lastIndex = file.lastIndexOf("/") { + trimmedFile = String(file[file.index(after: lastIndex) ..< file.endIndex]) + } + else { + trimmedFile = file + } + _identifier = "\(trimmedFile):\(line) (\(function))" + } + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Source.E { + let sink = DebugSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift new file mode 100644 index 0000000..696361f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift @@ -0,0 +1,66 @@ +// +// DefaultIfEmpty.swift +// RxSwift +// +// Created by sergdort on 23/12/2016. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Emits elements from the source observable sequence, or a default element if the source observable sequence is empty. + + - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html) + + - parameter default: Default element to be sent if the source does not emit any elements + - returns: An observable sequence which emits default element end completes in case the original sequence is empty + */ + public func ifEmpty(default: E) -> Observable { + return DefaultIfEmpty(source: self.asObservable(), default: `default`) + } +} + +final fileprivate class DefaultIfEmptySink: Sink, ObserverType { + typealias E = O.E + private let _default: E + private var _isEmpty = true + + init(default: E, observer: O, cancel: Cancelable) { + _default = `default` + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(_): + _isEmpty = false + forwardOn(event) + case .error(_): + forwardOn(event) + dispose() + case .completed: + if _isEmpty { + forwardOn(.next(_default)) + } + forwardOn(.completed) + dispose() + } + } +} + +final fileprivate class DefaultIfEmpty: Producer { + private let _source: Observable + private let _default: SourceType + + init(source: Observable, `default`: SourceType) { + _source = source + _default = `default` + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == SourceType { + let sink = DefaultIfEmptySink(default: _default, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Deferred.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Deferred.swift new file mode 100644 index 0000000..947f604 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Deferred.swift @@ -0,0 +1,74 @@ +// +// Deferred.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. + + - seealso: [defer operator on reactivex.io](http://reactivex.io/documentation/operators/defer.html) + + - parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence. + - returns: An observable sequence whose observers trigger an invocation of the given observable factory function. + */ + public static func deferred(_ observableFactory: @escaping () throws -> Observable) + -> Observable { + return Deferred(observableFactory: observableFactory) + } +} + +final fileprivate class DeferredSink : Sink, ObserverType where S.E == O.E { + typealias E = O.E + + private let _observableFactory: () throws -> S + + init(observableFactory: @escaping () throws -> S, observer: O, cancel: Cancelable) { + _observableFactory = observableFactory + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + do { + let result = try _observableFactory() + return result.subscribe(self) + } + catch let e { + forwardOn(.error(e)) + dispose() + return Disposables.create() + } + } + + func on(_ event: Event) { + forwardOn(event) + + switch event { + case .next: + break + case .error: + dispose() + case .completed: + dispose() + } + } +} + +final fileprivate class Deferred : Producer { + typealias Factory = () throws -> S + + private let _observableFactory : Factory + + init(observableFactory: @escaping Factory) { + _observableFactory = observableFactory + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == S.E { + let sink = DeferredSink(observableFactory: _observableFactory, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Delay.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Delay.swift new file mode 100644 index 0000000..b13ee9c --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Delay.swift @@ -0,0 +1,181 @@ +// +// Delay.swift +// RxSwift +// +// Created by tarunon on 2016/02/09. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.Date + +extension ObservableType { + + /** + Returns an observable sequence by the source observable sequence shifted forward in time by a specified delay. Error events from the source observable sequence are not delayed. + + - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html) + + - parameter dueTime: Relative time shift of the source by. + - parameter scheduler: Scheduler to run the subscription delay timer on. + - returns: the source Observable shifted in time by the specified delay. + */ + public func delay(_ dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return Delay(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler) + } +} + +final fileprivate class DelaySink + : Sink + , ObserverType { + typealias E = O.E + typealias Source = Observable + typealias DisposeKey = Bag.KeyType + + private let _lock = RecursiveLock() + + private let _dueTime: RxTimeInterval + private let _scheduler: SchedulerType + + private let _sourceSubscription = SingleAssignmentDisposable() + private let _cancelable = SerialDisposable() + + // is scheduled some action + private var _active = false + // is "run loop" on different scheduler running + private var _running = false + private var _errorEvent: Event? = nil + + // state + private var _queue = Queue<(eventTime: RxTime, event: Event)>(capacity: 0) + private var _disposed = false + + init(observer: O, dueTime: RxTimeInterval, scheduler: SchedulerType, cancel: Cancelable) { + _dueTime = dueTime + _scheduler = scheduler + super.init(observer: observer, cancel: cancel) + } + + // All of these complications in this method are caused by the fact that + // error should be propagated immediately. Error can be potentially received on different + // scheduler so this process needs to be synchronized somehow. + // + // Another complication is that scheduler is potentially concurrent so internal queue is used. + func drainQueue(state: (), scheduler: AnyRecursiveScheduler<()>) { + + _lock.lock() // { + let hasFailed = _errorEvent != nil + if !hasFailed { + _running = true + } + _lock.unlock() // } + + if hasFailed { + return + } + + var ranAtLeastOnce = false + + while true { + _lock.lock() // { + let errorEvent = _errorEvent + + let eventToForwardImmediatelly = ranAtLeastOnce ? nil : _queue.dequeue()?.event + let nextEventToScheduleOriginalTime: Date? = ranAtLeastOnce && !_queue.isEmpty ? _queue.peek().eventTime : nil + + if let _ = errorEvent { + } + else { + if let _ = eventToForwardImmediatelly { + } + else if let _ = nextEventToScheduleOriginalTime { + _running = false + } + else { + _running = false + _active = false + } + } + _lock.unlock() // { + + if let errorEvent = errorEvent { + self.forwardOn(errorEvent) + self.dispose() + return + } + else { + if let eventToForwardImmediatelly = eventToForwardImmediatelly { + ranAtLeastOnce = true + self.forwardOn(eventToForwardImmediatelly) + if case .completed = eventToForwardImmediatelly { + self.dispose() + return + } + } + else if let nextEventToScheduleOriginalTime = nextEventToScheduleOriginalTime { + let elapsedTime = _scheduler.now.timeIntervalSince(nextEventToScheduleOriginalTime) + let interval = _dueTime - elapsedTime + let normalizedInterval = interval < 0.0 ? 0.0 : interval + scheduler.schedule((), dueTime: normalizedInterval) + return + } + else { + return + } + } + } + } + + func on(_ event: Event) { + if event.isStopEvent { + _sourceSubscription.dispose() + } + + switch event { + case .error(_): + _lock.lock() // { + let shouldSendImmediatelly = !_running + _queue = Queue(capacity: 0) + _errorEvent = event + _lock.unlock() // } + + if shouldSendImmediatelly { + forwardOn(event) + dispose() + } + default: + _lock.lock() // { + let shouldSchedule = !_active + _active = true + _queue.enqueue((_scheduler.now, event)) + _lock.unlock() // } + + if shouldSchedule { + _cancelable.disposable = _scheduler.scheduleRecursive((), dueTime: _dueTime, action: self.drainQueue) + } + } + } + + func run(source: Observable) -> Disposable { + _sourceSubscription.setDisposable(source.subscribe(self)) + return Disposables.create(_sourceSubscription, _cancelable) + } +} + +final fileprivate class Delay: Producer { + private let _source: Observable + private let _dueTime: RxTimeInterval + private let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = DelaySink(observer: observer, dueTime: _dueTime, scheduler: _scheduler, cancel: cancel) + let subscription = sink.run(source: _source) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift new file mode 100644 index 0000000..9225a19 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift @@ -0,0 +1,66 @@ +// +// DelaySubscription.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers. + + - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html) + + - parameter dueTime: Relative time shift of the subscription. + - parameter scheduler: Scheduler to run the subscription delay timer on. + - returns: Time-shifted sequence. + */ + public func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return DelaySubscription(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler) + } +} + +final fileprivate class DelaySubscriptionSink + : Sink, ObserverType { + typealias E = O.E + typealias Parent = DelaySubscription + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + forwardOn(event) + if event.isStopEvent { + dispose() + } + } + +} + +final fileprivate class DelaySubscription: Producer { + private let _source: Observable + private let _dueTime: RxTimeInterval + private let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = DelaySubscriptionSink(parent: self, observer: observer, cancel: cancel) + let subscription = _scheduler.scheduleRelative((), dueTime: _dueTime) { _ in + return self._source.subscribe(sink) + } + + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift new file mode 100644 index 0000000..d142249 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift @@ -0,0 +1,51 @@ +// +// Dematerialize.swift +// RxSwift +// +// Created by Jamie Pinkham on 3/13/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType where E: EventConvertible { + /** + Convert any previously materialized Observable into it's original form. + - seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html) + - returns: The dematerialized observable sequence. + */ + public func dematerialize() -> Observable { + return Dematerialize(source: self.asObservable()) + } + +} + +fileprivate final class DematerializeSink: Sink, ObserverType where O.E == Element.ElementType { + fileprivate func on(_ event: Event) { + switch event { + case .next(let element): + forwardOn(element.event) + if element.event.isStopEvent { + dispose() + } + case .completed: + forwardOn(.completed) + dispose() + case .error(let error): + forwardOn(.error(error)) + dispose() + } + } +} + +final fileprivate class Dematerialize: Producer { + private let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element.ElementType { + let sink = DematerializeSink(observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift new file mode 100644 index 0000000..f72f520 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift @@ -0,0 +1,125 @@ +// +// DistinctUntilChanged.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType where E: Equatable { + + /** + Returns an observable sequence that contains only distinct contiguous elements according to equality operator. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - returns: An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence. + */ + public func distinctUntilChanged() + -> Observable { + return self.distinctUntilChanged({ $0 }, comparer: { ($0 == $1) }) + } +} + +extension ObservableType { + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `keySelector`. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - parameter keySelector: A function to compute the comparison key for each element. + - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + */ + public func distinctUntilChanged(_ keySelector: @escaping (E) throws -> K) + -> Observable { + return self.distinctUntilChanged(keySelector, comparer: { $0 == $1 }) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the `comparer`. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - parameter comparer: Equality comparer for computed key values. + - returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence. + */ + public func distinctUntilChanged(_ comparer: @escaping (E, E) throws -> Bool) + -> Observable { + return self.distinctUntilChanged({ $0 }, comparer: comparer) + } + + /** + Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. + + - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html) + + - parameter keySelector: A function to compute the comparison key for each element. + - parameter comparer: Equality comparer for computed key values. + - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence. + */ + public func distinctUntilChanged(_ keySelector: @escaping (E) throws -> K, comparer: @escaping (K, K) throws -> Bool) + -> Observable { + return DistinctUntilChanged(source: self.asObservable(), selector: keySelector, comparer: comparer) + } +} + +final fileprivate class DistinctUntilChangedSink: Sink, ObserverType { + typealias E = O.E + + private let _parent: DistinctUntilChanged + private var _currentKey: Key? = nil + + init(parent: DistinctUntilChanged, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + do { + let key = try _parent._selector(value) + var areEqual = false + if let currentKey = _currentKey { + areEqual = try _parent._comparer(currentKey, key) + } + + if areEqual { + return + } + + _currentKey = key + + forwardOn(event) + } + catch let error { + forwardOn(.error(error)) + dispose() + } + case .error, .completed: + forwardOn(event) + dispose() + } + } +} + +final fileprivate class DistinctUntilChanged: Producer { + typealias KeySelector = (Element) throws -> Key + typealias EqualityComparer = (Key, Key) throws -> Bool + + fileprivate let _source: Observable + fileprivate let _selector: KeySelector + fileprivate let _comparer: EqualityComparer + + init(source: Observable, selector: @escaping KeySelector, comparer: @escaping EqualityComparer) { + _source = source + _selector = selector + _comparer = comparer + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = DistinctUntilChangedSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Do.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Do.swift new file mode 100644 index 0000000..2be6d58 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Do.swift @@ -0,0 +1,93 @@ +// +// Do.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence. + + - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html) + + - parameter onNext: Action to invoke for each element in the observable sequence. + - parameter onError: Action to invoke upon errored termination of the observable sequence. + - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. + - parameter onSubscribe: Action to invoke before subscribing to source observable sequence. + - parameter onSubscribed: Action to invoke after subscribing to source observable sequence. + - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed. + - returns: The source sequence with the side-effecting behavior applied. + */ + public func `do`(onNext: ((E) throws -> Void)? = nil, onError: ((Swift.Error) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> ())? = nil, onSubscribed: (() -> ())? = nil, onDispose: (() -> ())? = nil) + -> Observable { + return Do(source: self.asObservable(), eventHandler: { e in + switch e { + case .next(let element): + try onNext?(element) + case .error(let e): + try onError?(e) + case .completed: + try onCompleted?() + } + }, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose) + } +} + +final fileprivate class DoSink : Sink, ObserverType { + typealias Element = O.E + typealias EventHandler = (Event) throws -> Void + + private let _eventHandler: EventHandler + + init(eventHandler: @escaping EventHandler, observer: O, cancel: Cancelable) { + _eventHandler = eventHandler + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + do { + try _eventHandler(event) + forwardOn(event) + if event.isStopEvent { + dispose() + } + } + catch let error { + forwardOn(.error(error)) + dispose() + } + } +} + +final fileprivate class Do : Producer { + typealias EventHandler = (Event) throws -> Void + + fileprivate let _source: Observable + fileprivate let _eventHandler: EventHandler + fileprivate let _onSubscribe: (() -> ())? + fileprivate let _onSubscribed: (() -> ())? + fileprivate let _onDispose: (() -> ())? + + init(source: Observable, eventHandler: @escaping EventHandler, onSubscribe: (() -> ())?, onSubscribed: (() -> ())?, onDispose: (() -> ())?) { + _source = source + _eventHandler = eventHandler + _onSubscribe = onSubscribe + _onSubscribed = onSubscribed + _onDispose = onDispose + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + _onSubscribe?() + let sink = DoSink(eventHandler: _eventHandler, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + _onSubscribed?() + let onDispose = _onDispose + let allSubscriptions = Disposables.create { + subscription.dispose() + onDispose?() + } + return (sink: sink, subscription: allSubscriptions) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ElementAt.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ElementAt.swift new file mode 100644 index 0000000..500a044 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ElementAt.swift @@ -0,0 +1,93 @@ +// +// ElementAt.swift +// RxSwift +// +// Created by Junior B. on 21/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Returns a sequence emitting only element _n_ emitted by an Observable + + - seealso: [elementAt operator on reactivex.io](http://reactivex.io/documentation/operators/elementat.html) + + - parameter index: The index of the required element (starting from 0). + - returns: An observable sequence that emits the desired element as its own sole emission. + */ + public func elementAt(_ index: Int) + -> Observable { + return ElementAt(source: asObservable(), index: index, throwOnEmpty: true) + } +} + +final fileprivate class ElementAtSink : Sink, ObserverType { + typealias SourceType = O.E + typealias Parent = ElementAt + + let _parent: Parent + var _i: Int + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _i = parent._index + + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(_): + + if (_i == 0) { + forwardOn(event) + forwardOn(.completed) + self.dispose() + } + + do { + let _ = try decrementChecked(&_i) + } catch(let e) { + forwardOn(.error(e)) + dispose() + return + } + + case .error(let e): + forwardOn(.error(e)) + self.dispose() + case .completed: + if (_parent._throwOnEmpty) { + forwardOn(.error(RxError.argumentOutOfRange)) + } else { + forwardOn(.completed) + } + + self.dispose() + } + } +} + +final fileprivate class ElementAt : Producer { + + let _source: Observable + let _throwOnEmpty: Bool + let _index: Int + + init(source: Observable, index: Int, throwOnEmpty: Bool) { + if index < 0 { + rxFatalError("index can't be negative") + } + + self._source = source + self._index = index + self._throwOnEmpty = throwOnEmpty + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == SourceType { + let sink = ElementAtSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Empty.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Empty.swift new file mode 100644 index 0000000..d2dcdb0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Empty.swift @@ -0,0 +1,27 @@ +// +// Empty.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message. + + - seealso: [empty operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) + + - returns: An observable sequence with no elements. + */ + public static func empty() -> Observable { + return EmptyProducer() + } +} + +final fileprivate class EmptyProducer : Producer { + override func subscribe(_ observer: O) -> Disposable where O.E == Element { + observer.on(.completed) + return Disposables.create() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Enumerated.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Enumerated.swift new file mode 100644 index 0000000..2a6cd98 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Enumerated.swift @@ -0,0 +1,62 @@ +// +// Enumerated.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/6/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Enumerates the elements of an observable sequence. + + - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html) + + - returns: An observable sequence that contains tuples of source sequence elements and their indexes. + */ + public func enumerated() + -> Observable<(index: Int, element: E)> { + return Enumerated(source: self.asObservable()) + } +} + +final fileprivate class EnumeratedSink: Sink, ObserverType where O.E == (index: Int, element: Element) { + typealias E = Element + var index = 0 + + func on(_ event: Event) { + switch event { + case .next(let value): + do { + let nextIndex = try incrementChecked(&index) + let next = (index: nextIndex, element: value) + forwardOn(.next(next)) + } + catch let e { + forwardOn(.error(e)) + dispose() + } + case .completed: + forwardOn(.completed) + dispose() + case .error(let error): + forwardOn(.error(error)) + dispose() + } + } +} + +final fileprivate class Enumerated : Producer<(index: Int, element: Element)> { + private let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == (index: Int, element: Element) { + let sink = EnumeratedSink(observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Error.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Error.swift new file mode 100644 index 0000000..a15942b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Error.swift @@ -0,0 +1,33 @@ +// +// Error.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Returns an observable sequence that terminates with an `error`. + + - seealso: [throw operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) + + - returns: The observable sequence that terminates with specified error. + */ + public static func error(_ error: Swift.Error) -> Observable { + return ErrorProducer(error: error) + } +} + +final fileprivate class ErrorProducer : Producer { + private let _error: Swift.Error + + init(error: Swift.Error) { + _error = error + } + + override func subscribe(_ observer: O) -> Disposable where O.E == Element { + observer.on(.error(_error)) + return Disposables.create() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Filter.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Filter.swift new file mode 100644 index 0000000..2a1f496 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Filter.swift @@ -0,0 +1,90 @@ +// +// Filter.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Filters the elements of an observable sequence based on a predicate. + + - seealso: [filter operator on reactivex.io](http://reactivex.io/documentation/operators/filter.html) + + - parameter predicate: A function to test each source element for a condition. + - returns: An observable sequence that contains elements from the input sequence that satisfy the condition. + */ + public func filter(_ predicate: @escaping (E) throws -> Bool) + -> Observable { + return Filter(source: asObservable(), predicate: predicate) + } +} + +extension ObservableType { + + /** + Skips elements and completes (or errors) when the receiver completes (or errors). Equivalent to filter that always returns false. + + - seealso: [ignoreElements operator on reactivex.io](http://reactivex.io/documentation/operators/ignoreelements.html) + + - returns: An observable sequence that skips all elements of the source sequence. + */ + public func ignoreElements() + -> Completable { + return flatMap { _ in + return Observable.empty() + } + .asCompletable() + } +} + +final fileprivate class FilterSink: Sink, ObserverType { + typealias Predicate = (Element) throws -> Bool + typealias Element = O.E + + private let _predicate: Predicate + + init(predicate: @escaping Predicate, observer: O, cancel: Cancelable) { + _predicate = predicate + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + do { + let satisfies = try _predicate(value) + if satisfies { + forwardOn(.next(value)) + } + } + catch let e { + forwardOn(.error(e)) + dispose() + } + case .completed, .error: + forwardOn(event) + dispose() + } + } +} + +final fileprivate class Filter : Producer { + typealias Predicate = (Element) throws -> Bool + + private let _source: Observable + private let _predicate: Predicate + + init(source: Observable, predicate: @escaping Predicate) { + _source = source + _predicate = predicate + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = FilterSink(predicate: _predicate, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/First.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/First.swift new file mode 100644 index 0000000..4a72ba0 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/First.swift @@ -0,0 +1,42 @@ +// +// First.swift +// RxSwift +// +// Created by Krunoslav Zaher on 7/31/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +fileprivate final class FirstSink : Sink, ObserverType where O.E == Element? { + typealias E = Element + typealias Parent = First + + func on(_ event: Event) { + switch event { + case .next(let value): + forwardOn(.next(value)) + forwardOn(.completed) + dispose() + case .error(let error): + forwardOn(.error(error)) + dispose() + case .completed: + forwardOn(.next(nil)) + forwardOn(.completed) + dispose() + } + } +} + +final class First: Producer { + fileprivate let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element? { + let sink = FirstSink(observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Generate.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Generate.swift new file mode 100644 index 0000000..6469937 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Generate.swift @@ -0,0 +1,87 @@ +// +// Generate.swift +// RxSwift +// +// Created by Krunoslav Zaher on 9/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler + to run the loop send out observer messages. + + - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html) + + - parameter initialState: Initial state. + - parameter condition: Condition to terminate generation (upon returning `false`). + - parameter iterate: Iteration step function. + - parameter scheduler: Scheduler on which to run the generator loop. + - returns: The generated sequence. + */ + public static func generate(initialState: E, condition: @escaping (E) throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: @escaping (E) throws -> E) -> Observable { + return Generate(initialState: initialState, condition: condition, iterate: iterate, resultSelector: { $0 }, scheduler: scheduler) + } +} + +final fileprivate class GenerateSink : Sink { + typealias Parent = Generate + + private let _parent: Parent + + private var _state: S + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _state = parent._initialState + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRecursive(true) { (isFirst, recurse) -> Void in + do { + if !isFirst { + self._state = try self._parent._iterate(self._state) + } + + if try self._parent._condition(self._state) { + let result = try self._parent._resultSelector(self._state) + self.forwardOn(.next(result)) + + recurse(false) + } + else { + self.forwardOn(.completed) + self.dispose() + } + } + catch let error { + self.forwardOn(.error(error)) + self.dispose() + } + } + } +} + +final fileprivate class Generate : Producer { + fileprivate let _initialState: S + fileprivate let _condition: (S) throws -> Bool + fileprivate let _iterate: (S) throws -> S + fileprivate let _resultSelector: (S) throws -> E + fileprivate let _scheduler: ImmediateSchedulerType + + init(initialState: S, condition: @escaping (S) throws -> Bool, iterate: @escaping (S) throws -> S, resultSelector: @escaping (S) throws -> E, scheduler: ImmediateSchedulerType) { + _initialState = initialState + _condition = condition + _iterate = iterate + _resultSelector = resultSelector + _scheduler = scheduler + super.init() + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = GenerateSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/GroupBy.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/GroupBy.swift new file mode 100644 index 0000000..a8a0e78 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/GroupBy.swift @@ -0,0 +1,134 @@ +// +// GroupBy.swift +// RxSwift +// +// Created by Tomi Koskinen on 01/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /* + Groups the elements of an observable sequence according to a specified key selector function. + + - seealso: [groupBy operator on reactivex.io](http://reactivex.io/documentation/operators/groupby.html) + + - parameter keySelector: A function to extract the key for each element. + - returns: A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. + */ + public func groupBy(keySelector: @escaping (E) throws -> K) + -> Observable> { + return GroupBy(source: self.asObservable(), selector: keySelector) + } +} + +final fileprivate class GroupedObservableImpl : Observable { + private var _subject: PublishSubject + private var _refCount: RefCountDisposable + + init(key: Key, subject: PublishSubject, refCount: RefCountDisposable) { + _subject = subject + _refCount = refCount + } + + override public func subscribe(_ observer: O) -> Disposable where O.E == E { + let release = _refCount.retain() + let subscription = _subject.subscribe(observer) + return Disposables.create(release, subscription) + } +} + + +final fileprivate class GroupBySink + : Sink + , ObserverType where O.E == GroupedObservable { + typealias E = Element + typealias ResultType = O.E + typealias Parent = GroupBy + + private let _parent: Parent + private let _subscription = SingleAssignmentDisposable() + private var _refCountDisposable: RefCountDisposable! + private var _groupedSubjectTable: [Key: PublishSubject] + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _groupedSubjectTable = [Key: PublishSubject]() + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + _refCountDisposable = RefCountDisposable(disposable: _subscription) + + _subscription.setDisposable(_parent._source.subscribe(self)) + + return _refCountDisposable + } + + private func onGroupEvent(key: Key, value: Element) { + if let writer = _groupedSubjectTable[key] { + writer.on(.next(value)) + } else { + let writer = PublishSubject() + _groupedSubjectTable[key] = writer + + let group = GroupedObservable( + key: key, + source: GroupedObservableImpl(key: key, subject: writer, refCount: _refCountDisposable) + ) + + forwardOn(.next(group)) + writer.on(.next(value)) + } + } + + final func on(_ event: Event) { + switch event { + case let .next(value): + do { + let groupKey = try _parent._selector(value) + onGroupEvent(key: groupKey, value: value) + } + catch let e { + error(e) + return + } + case let .error(e): + error(e) + case .completed: + forwardOnGroups(event: .completed) + forwardOn(.completed) + _subscription.dispose() + dispose() + } + } + + final func error(_ error: Swift.Error) { + forwardOnGroups(event: .error(error)) + forwardOn(.error(error)) + _subscription.dispose() + dispose() + } + + final func forwardOnGroups(event: Event) { + for writer in _groupedSubjectTable.values { + writer.on(event) + } + } +} + +final fileprivate class GroupBy: Producer> { + typealias KeySelector = (Element) throws -> Key + + fileprivate let _source: Observable + fileprivate let _selector: KeySelector + + init(source: Observable, selector: @escaping KeySelector) { + _source = source + _selector = selector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == GroupedObservable { + let sink = GroupBySink(parent: self, observer: observer, cancel: cancel) + return (sink: sink, subscription: sink.run()) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Just.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Just.swift new file mode 100644 index 0000000..443cdaa --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Just.swift @@ -0,0 +1,87 @@ +// +// Just.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Returns an observable sequence that contains a single element. + + - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html) + + - parameter element: Single element in the resulting observable sequence. + - returns: An observable sequence containing the single specified element. + */ + public static func just(_ element: E) -> Observable { + return Just(element: element) + } + + /** + Returns an observable sequence that contains a single element. + + - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html) + + - parameter element: Single element in the resulting observable sequence. + - parameter: Scheduler to send the single element on. + - returns: An observable sequence containing the single specified element. + */ + public static func just(_ element: E, scheduler: ImmediateSchedulerType) -> Observable { + return JustScheduled(element: element, scheduler: scheduler) + } +} + +final fileprivate class JustScheduledSink : Sink { + typealias Parent = JustScheduled + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let scheduler = _parent._scheduler + return scheduler.schedule(_parent._element) { element in + self.forwardOn(.next(element)) + return scheduler.schedule(()) { _ in + self.forwardOn(.completed) + self.dispose() + return Disposables.create() + } + } + } +} + +final fileprivate class JustScheduled : Producer { + fileprivate let _scheduler: ImmediateSchedulerType + fileprivate let _element: Element + + init(element: Element, scheduler: ImmediateSchedulerType) { + _scheduler = scheduler + _element = element + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = JustScheduledSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class Just : Producer { + private let _element: Element + + init(element: Element) { + _element = element + } + + override func subscribe(_ observer: O) -> Disposable where O.E == Element { + observer.on(.next(_element)) + observer.on(.completed) + return Disposables.create() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Map.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Map.swift new file mode 100644 index 0000000..df0e0d1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Map.swift @@ -0,0 +1,108 @@ +// +// Map.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Projects each element of an observable sequence into a new form. + + - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html) + + - parameter transform: A transform function to apply to each source element. + - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source. + + */ + public func map(_ transform: @escaping (E) throws -> R) + -> Observable { + return self.asObservable().composeMap(transform) + } +} + +final fileprivate class MapSink : Sink, ObserverType { + typealias Transform = (SourceType) throws -> ResultType + + typealias ResultType = O.E + typealias Element = SourceType + + private let _transform: Transform + + init(transform: @escaping Transform, observer: O, cancel: Cancelable) { + _transform = transform + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let element): + do { + let mappedElement = try _transform(element) + forwardOn(.next(mappedElement)) + } + catch let e { + forwardOn(.error(e)) + dispose() + } + case .error(let error): + forwardOn(.error(error)) + dispose() + case .completed: + forwardOn(.completed) + dispose() + } + } +} + +#if TRACE_RESOURCES + fileprivate var _numberOfMapOperators: AtomicInt = 0 + extension Resources { + public static var numberOfMapOperators: Int32 { + return _numberOfMapOperators.valueSnapshot() + } + } +#endif + +internal func _map(source: Observable, transform: @escaping (Element) throws -> R) -> Observable { + return Map(source: source, transform: transform) +} + +final fileprivate class Map: Producer { + typealias Transform = (SourceType) throws -> ResultType + + private let _source: Observable + + private let _transform: Transform + + init(source: Observable, transform: @escaping Transform) { + _source = source + _transform = transform + +#if TRACE_RESOURCES + let _ = AtomicIncrement(&_numberOfMapOperators) +#endif + } + + override func composeMap(_ selector: @escaping (ResultType) throws -> R) -> Observable { + let originalSelector = _transform + return Map(source: _source, transform: { (s: SourceType) throws -> R in + let r: ResultType = try originalSelector(s) + return try selector(r) + }) + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == ResultType { + let sink = MapSink(transform: _transform, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } + + #if TRACE_RESOURCES + deinit { + let _ = AtomicDecrement(&_numberOfMapOperators) + } + #endif +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Materialize.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Materialize.swift new file mode 100644 index 0000000..cf19b6d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Materialize.swift @@ -0,0 +1,44 @@ +// +// Materialize.swift +// RxSwift +// +// Created by sergdort on 08/03/2017. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Convert any Observable into an Observable of its events. + - seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html) + - 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. + */ + public func materialize() -> Observable> { + return Materialize(source: self.asObservable()) + } +} + +fileprivate final class MaterializeSink: Sink, ObserverType where O.E == Event { + + func on(_ event: Event) { + forwardOn(.next(event)) + if event.isStopEvent { + forwardOn(.completed) + dispose() + } + } +} + +final fileprivate class Materialize: Producer> { + private let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = MaterializeSink(observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Merge.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Merge.swift new file mode 100644 index 0000000..7ba17dd --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Merge.swift @@ -0,0 +1,600 @@ +// +// Merge.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/28/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + + - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - parameter selector: A transform function to apply to each element. + - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence. + */ + public func flatMap(_ selector: @escaping (E) throws -> O) + -> Observable { + return FlatMap(source: asObservable(), selector: selector) + } + +} + +extension ObservableType { + + /** + Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + If element is received while there is some projected observable sequence being merged it will simply be ignored. + + - seealso: [flatMapFirst operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel. + - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated. + */ + public func flatMapFirst(_ selector: @escaping (E) throws -> O) + -> Observable { + return FlatMapFirst(source: asObservable(), selector: selector) + } +} + +extension ObservableType where E : ObservableConvertibleType { + + /** + Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public func merge() -> Observable { + return Merge(source: asObservable()) + } + + /** + Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter maxConcurrent: Maximum number of inner observable sequences being subscribed to concurrently. + - returns: The observable sequence that merges the elements of the inner sequences. + */ + public func merge(maxConcurrent: Int) + -> Observable { + return MergeLimited(source: asObservable(), maxConcurrent: maxConcurrent) + } +} + +extension ObservableType where E : ObservableConvertibleType { + + /** + Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully. + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each observed inner sequence, in sequential order. + */ + public func concat() -> Observable { + return merge(maxConcurrent: 1) + } +} + +extension ObservableType { + /** + Merges elements from all observable sequences from collection into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter sources: Collection of observable sequences to merge. + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public static func merge(_ sources: C) -> Observable where C.Iterator.Element == Observable { + return MergeArray(sources: Array(sources)) + } + + /** + Merges elements from all observable sequences from array into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter sources: Array of observable sequences to merge. + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public static func merge(_ sources: [Observable]) -> Observable { + return MergeArray(sources: sources) + } + + /** + Merges elements from all observable sequences into a single observable sequence. + + - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html) + + - parameter sources: Collection of observable sequences to merge. + - returns: The observable sequence that merges the elements of the observable sequences. + */ + public static func merge(_ sources: Observable...) -> Observable { + return MergeArray(sources: sources) + } +} + +// MARK: concatMap + +extension ObservableType { + /** + Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence. + + - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html) + + - returns: An observable sequence that contains the elements of each observed inner sequence, in sequential order. + */ + + public func concatMap(_ selector: @escaping (E) throws -> O) + -> Observable { + return ConcatMap(source: asObservable(), selector: selector) + } +} + +fileprivate final class MergeLimitedSinkIter + : ObserverType + , LockOwnerType + , SynchronizedOnType where SourceSequence.E == Observer.E { + typealias E = Observer.E + typealias DisposeKey = CompositeDisposable.DisposeKey + typealias Parent = MergeLimitedSink + + private let _parent: Parent + private let _disposeKey: DisposeKey + + var _lock: RecursiveLock { + return _parent._lock + } + + init(parent: Parent, disposeKey: DisposeKey) { + _parent = parent + _disposeKey = disposeKey + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next: + _parent.forwardOn(event) + case .error: + _parent.forwardOn(event) + _parent.dispose() + case .completed: + _parent._group.remove(for: _disposeKey) + if let next = _parent._queue.dequeue() { + _parent.subscribe(next, group: _parent._group) + } + else { + _parent._activeCount = _parent._activeCount - 1 + + if _parent._stopped && _parent._activeCount == 0 { + _parent.forwardOn(.completed) + _parent.dispose() + } + } + } + } +} + +fileprivate final class ConcatMapSink: MergeLimitedSink where Observer.E == SourceSequence.E { + typealias Selector = (SourceElement) throws -> SourceSequence + + private let _selector: Selector + + init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) { + _selector = selector + super.init(maxConcurrent: 1, observer: observer, cancel: cancel) + } + + override func performMap(_ element: SourceElement) throws -> SourceSequence { + return try _selector(element) + } +} + +fileprivate final class MergeLimitedBasicSink: MergeLimitedSink where Observer.E == SourceSequence.E { + + override func performMap(_ element: SourceSequence) throws -> SourceSequence { + return element + } +} + +fileprivate class MergeLimitedSink + : Sink + , ObserverType where Observer.E == SourceSequence.E { + typealias QueueType = Queue + + let _maxConcurrent: Int + + let _lock = RecursiveLock() + + // state + var _stopped = false + var _activeCount = 0 + var _queue = QueueType(capacity: 2) + + let _sourceSubscription = SingleAssignmentDisposable() + let _group = CompositeDisposable() + + init(maxConcurrent: Int, observer: Observer, cancel: Cancelable) { + _maxConcurrent = maxConcurrent + + let _ = _group.insert(_sourceSubscription) + super.init(observer: observer, cancel: cancel) + } + + func run(_ source: Observable) -> Disposable { + let _ = _group.insert(_sourceSubscription) + + let disposable = source.subscribe(self) + _sourceSubscription.setDisposable(disposable) + return _group + } + + func subscribe(_ innerSource: SourceSequence, group: CompositeDisposable) { + let subscription = SingleAssignmentDisposable() + + let key = group.insert(subscription) + + if let key = key { + let observer = MergeLimitedSinkIter(parent: self, disposeKey: key) + + let disposable = innerSource.asObservable().subscribe(observer) + subscription.setDisposable(disposable) + } + } + + func performMap(_ element: SourceElement) throws -> SourceSequence { + rxAbstractMethod() + } + + @inline(__always) + final private func nextElementArrived(element: SourceElement) -> SourceSequence? { + _lock.lock(); defer { _lock.unlock() } // { + let subscribe: Bool + if _activeCount < _maxConcurrent { + _activeCount += 1 + subscribe = true + } + else { + do { + let value = try performMap(element) + _queue.enqueue(value) + } catch { + forwardOn(.error(error)) + dispose() + } + subscribe = false + } + + if subscribe { + do { + return try performMap(element) + } catch { + forwardOn(.error(error)) + dispose() + } + } + + return nil + // } + } + + func on(_ event: Event) { + switch event { + case .next(let element): + if let sequence = self.nextElementArrived(element: element) { + self.subscribe(sequence, group: _group) + } + case .error(let error): + _lock.lock(); defer { _lock.unlock() } + + forwardOn(.error(error)) + dispose() + case .completed: + _lock.lock(); defer { _lock.unlock() } + + if _activeCount == 0 { + forwardOn(.completed) + dispose() + } + else { + _sourceSubscription.dispose() + } + + _stopped = true + } + } +} + +final fileprivate class MergeLimited : Producer { + private let _source: Observable + private let _maxConcurrent: Int + + init(source: Observable, maxConcurrent: Int) { + _source = source + _maxConcurrent = maxConcurrent + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == SourceSequence.E { + let sink = MergeLimitedBasicSink(maxConcurrent: _maxConcurrent, observer: observer, cancel: cancel) + let subscription = sink.run(_source) + return (sink: sink, subscription: subscription) + } +} + +// MARK: Merge + +fileprivate final class MergeBasicSink : MergeSink where O.E == S.E { + override func performMap(_ element: S) throws -> S { + return element + } +} + +// MARK: flatMap + +fileprivate final class FlatMapSink : MergeSink where Observer.E == SourceSequence.E { + typealias Selector = (SourceElement) throws -> SourceSequence + + private let _selector: Selector + + init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) { + _selector = selector + super.init(observer: observer, cancel: cancel) + } + + override func performMap(_ element: SourceElement) throws -> SourceSequence { + return try _selector(element) + } +} + +// MARK: FlatMapFirst + +fileprivate final class FlatMapFirstSink : MergeSink where Observer.E == SourceSequence.E { + typealias Selector = (SourceElement) throws -> SourceSequence + + private let _selector: Selector + + override var subscribeNext: Bool { + return _activeCount == 0 + } + + init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) { + _selector = selector + super.init(observer: observer, cancel: cancel) + } + + override func performMap(_ element: SourceElement) throws -> SourceSequence { + return try _selector(element) + } +} + +fileprivate final class MergeSinkIter : ObserverType where Observer.E == SourceSequence.E { + typealias Parent = MergeSink + typealias DisposeKey = CompositeDisposable.DisposeKey + typealias E = Observer.E + + private let _parent: Parent + private let _disposeKey: DisposeKey + + init(parent: Parent, disposeKey: DisposeKey) { + _parent = parent + _disposeKey = disposeKey + } + + func on(_ event: Event) { + _parent._lock.lock(); defer { _parent._lock.unlock() } // lock { + switch event { + case .next(let value): + _parent.forwardOn(.next(value)) + case .error(let error): + _parent.forwardOn(.error(error)) + _parent.dispose() + case .completed: + _parent._group.remove(for: _disposeKey) + _parent._activeCount -= 1 + _parent.checkCompleted() + } + // } + } +} + + +fileprivate class MergeSink + : Sink + , ObserverType where Observer.E == SourceSequence.E { + typealias ResultType = Observer.E + typealias Element = SourceElement + + let _lock = RecursiveLock() + + var subscribeNext: Bool { + return true + } + + // state + let _group = CompositeDisposable() + let _sourceSubscription = SingleAssignmentDisposable() + + var _activeCount = 0 + var _stopped = false + + override init(observer: Observer, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + func performMap(_ element: SourceElement) throws -> SourceSequence { + rxAbstractMethod() + } + + @inline(__always) + final private func nextElementArrived(element: SourceElement) -> SourceSequence? { + _lock.lock(); defer { _lock.unlock() } // { + if !subscribeNext { + return nil + } + + do { + let value = try performMap(element) + _activeCount += 1 + return value + } + catch let e { + forwardOn(.error(e)) + dispose() + return nil + } + // } + } + + func on(_ event: Event) { + switch event { + case .next(let element): + if let value = nextElementArrived(element: element) { + subscribeInner(value.asObservable()) + } + case .error(let error): + _lock.lock(); defer { _lock.unlock() } + forwardOn(.error(error)) + dispose() + case .completed: + _lock.lock(); defer { _lock.unlock() } + _stopped = true + _sourceSubscription.dispose() + checkCompleted() + } + } + + func subscribeInner(_ source: Observable) { + let iterDisposable = SingleAssignmentDisposable() + if let disposeKey = _group.insert(iterDisposable) { + let iter = MergeSinkIter(parent: self, disposeKey: disposeKey) + let subscription = source.subscribe(iter) + iterDisposable.setDisposable(subscription) + } + } + + func run(_ sources: [Observable]) -> Disposable { + _activeCount += sources.count + + for source in sources { + subscribeInner(source) + } + + _stopped = true + + checkCompleted() + + return _group + } + + @inline(__always) + func checkCompleted() { + if _stopped && _activeCount == 0 { + self.forwardOn(.completed) + self.dispose() + } + } + + func run(_ source: Observable) -> Disposable { + let _ = _group.insert(_sourceSubscription) + + let subscription = source.subscribe(self) + _sourceSubscription.setDisposable(subscription) + + return _group + } +} + +// MARK: Producers + +final fileprivate class FlatMap: Producer { + typealias Selector = (SourceElement) throws -> SourceSequence + + private let _source: Observable + + private let _selector: Selector + + init(source: Observable, selector: @escaping Selector) { + _source = source + _selector = selector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == SourceSequence.E { + let sink = FlatMapSink(selector: _selector, observer: observer, cancel: cancel) + let subscription = sink.run(_source) + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class FlatMapFirst: Producer { + typealias Selector = (SourceElement) throws -> SourceSequence + + private let _source: Observable + + private let _selector: Selector + + init(source: Observable, selector: @escaping Selector) { + _source = source + _selector = selector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == SourceSequence.E { + let sink = FlatMapFirstSink(selector: _selector, observer: observer, cancel: cancel) + let subscription = sink.run(_source) + return (sink: sink, subscription: subscription) + } +} + +final class ConcatMap: Producer { + typealias Selector = (SourceElement) throws -> SourceSequence + + private let _source: Observable + private let _selector: Selector + + init(source: Observable, selector: @escaping Selector) { + _source = source + _selector = selector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == SourceSequence.E { + let sink = ConcatMapSink(selector: _selector, observer: observer, cancel: cancel) + let subscription = sink.run(_source) + return (sink: sink, subscription: subscription) + } +} + +final class Merge : Producer { + private let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == SourceSequence.E { + let sink = MergeBasicSink(observer: observer, cancel: cancel) + let subscription = sink.run(_source) + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class MergeArray : Producer { + private let _sources: [Observable] + + init(sources: [Observable]) { + _sources = sources + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = MergeBasicSink, O>(observer: observer, cancel: cancel) + let subscription = sink.run(_sources) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Multicast.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Multicast.swift new file mode 100644 index 0000000..a027c4f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Multicast.swift @@ -0,0 +1,408 @@ +// +// Multicast.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/** + Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence. + */ +public class ConnectableObservable + : Observable + , ConnectableObservableType { + + /** + Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established. + + - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. + */ + public func connect() -> Disposable { + rxAbstractMethod() + } +} + +extension ObservableType { + + /** + Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. + + Each subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's invocation. + + For specializations with fixed subject types, see `publish` and `replay`. + + - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html) + + - parameter subjectSelector: Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function. + - parameter selector: Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. + */ + public func multicast(_ subjectSelector: @escaping () throws -> S, selector: @escaping (Observable) throws -> Observable) + -> Observable where S.SubjectObserverType.E == E { + return Multicast( + source: self.asObservable(), + subjectSelector: subjectSelector, + selector: selector + ) + } +} + +extension ObservableType { + + /** + Returns a connectable observable sequence that shares a single subscription to the underlying sequence. + + This operator is a specialization of `multicast` using a `PublishSubject`. + + - seealso: [publish operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html) + + - returns: A connectable observable sequence that shares a single subscription to the underlying sequence. + */ + public func publish() -> ConnectableObservable { + return self.multicast { PublishSubject() } + } +} + +extension ObservableType { + + /** + Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize elements. + + This operator is a specialization of `multicast` using a `ReplaySubject`. + + - seealso: [replay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - parameter bufferSize: Maximum element count of the replay buffer. + - returns: A connectable observable sequence that shares a single subscription to the underlying sequence. + */ + public func replay(_ bufferSize: Int) + -> ConnectableObservable { + return self.multicast { ReplaySubject.create(bufferSize: bufferSize) } + } + + /** + Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all elements. + + This operator is a specialization of `multicast` using a `ReplaySubject`. + + - seealso: [replay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - returns: A connectable observable sequence that shares a single subscription to the underlying sequence. + */ + public func replayAll() + -> ConnectableObservable { + return self.multicast { ReplaySubject.createUnbounded() } + } +} + +extension ConnectableObservableType { + + /** + Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence. + + - seealso: [refCount operator on reactivex.io](http://reactivex.io/documentation/operators/refcount.html) + + - returns: An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence. + */ + public func refCount() -> Observable { + return RefCount(source: self) + } +} + +extension ObservableType { + + /** + Multicasts the source sequence notifications through the specified subject to the resulting connectable observable. + + Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable. + + For specializations with fixed subject types, see `publish` and `replay`. + + - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html) + + - parameter subject: Subject to push source elements into. + - returns: A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject. + */ + public func multicast(_ subject: S) + -> ConnectableObservable where S.SubjectObserverType.E == E { + return ConnectableObservableAdapter(source: self.asObservable(), makeSubject: { subject }) + } + + /** + Multicasts the source sequence notifications through an instantiated subject to the resulting connectable observable. + + Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable. + + Subject is cleared on connection disposal or in case source sequence produces terminal event. + + - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html) + + - parameter makeSubject: Factory function used to instantiate a subject for each connection. + - returns: A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject. + */ + public func multicast(makeSubject: @escaping () -> S) + -> ConnectableObservable where S.SubjectObserverType.E == E { + return ConnectableObservableAdapter(source: self.asObservable(), makeSubject: makeSubject) + } +} + +final fileprivate class Connection : ObserverType, Disposable { + typealias E = S.SubjectObserverType.E + + private var _lock: RecursiveLock + // state + private var _parent: ConnectableObservableAdapter? + private var _subscription : Disposable? + private var _subjectObserver: S.SubjectObserverType + + private var _disposed: Bool = false + + init(parent: ConnectableObservableAdapter, subjectObserver: S.SubjectObserverType, lock: RecursiveLock, subscription: Disposable) { + _parent = parent + _subscription = subscription + _lock = lock + _subjectObserver = subjectObserver + } + + func on(_ event: Event) { + if _disposed { + return + } + if event.isStopEvent { + self.dispose() + } + _subjectObserver.on(event) + } + + func dispose() { + _lock.lock(); defer { _lock.unlock() } // { + _disposed = true + guard let parent = _parent else { + return + } + + if parent._connection === self { + parent._connection = nil + parent._subject = nil + } + _parent = nil + + _subscription?.dispose() + _subscription = nil + // } + } +} + +final fileprivate class ConnectableObservableAdapter + : ConnectableObservable { + typealias ConnectionType = Connection + + fileprivate let _source: Observable + fileprivate let _makeSubject: () -> S + + fileprivate let _lock = RecursiveLock() + fileprivate var _subject: S? + + // state + fileprivate var _connection: ConnectionType? + + init(source: Observable, makeSubject: @escaping () -> S) { + _source = source + _makeSubject = makeSubject + _subject = nil + _connection = nil + } + + override func connect() -> Disposable { + return _lock.calculateLocked { + if let connection = _connection { + return connection + } + + let singleAssignmentDisposable = SingleAssignmentDisposable() + let connection = Connection(parent: self, subjectObserver: self.lazySubject.asObserver(), lock: _lock, subscription: singleAssignmentDisposable) + _connection = connection + let subscription = _source.subscribe(connection) + singleAssignmentDisposable.setDisposable(subscription) + return connection + } + } + + fileprivate var lazySubject: S { + if let subject = self._subject { + return subject + } + + let subject = _makeSubject() + self._subject = subject + return subject + } + + override func subscribe(_ observer: O) -> Disposable where O.E == S.E { + return self.lazySubject.subscribe(observer) + } +} + +final fileprivate class RefCountSink + : Sink + , ObserverType where CO.E == O.E { + typealias Element = O.E + typealias Parent = RefCount + + private let _parent: Parent + + private var _connectionIdSnapshot: Int64 = -1 + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription = _parent._source.subscribe(self) + _parent._lock.lock(); defer { _parent._lock.unlock() } // { + + _connectionIdSnapshot = _parent._connectionId + + if self.disposed { + return Disposables.create() + } + + if _parent._count == 0 { + _parent._count = 1 + _parent._connectableSubscription = _parent._source.connect() + } + else { + _parent._count = _parent._count + 1 + } + // } + + return Disposables.create { + subscription.dispose() + self._parent._lock.lock(); defer { self._parent._lock.unlock() } // { + if self._parent._connectionId != self._connectionIdSnapshot { + return + } + if self._parent._count == 1 { + self._parent._count = 0 + guard let connectableSubscription = self._parent._connectableSubscription else { + return + } + + connectableSubscription.dispose() + self._parent._connectableSubscription = nil + } + else if self._parent._count > 1 { + self._parent._count = self._parent._count - 1 + } + else { + rxFatalError("Something went wrong with RefCount disposing mechanism") + } + // } + } + } + + func on(_ event: Event) { + switch event { + case .next: + forwardOn(event) + case .error, .completed: + _parent._lock.lock() // { + if _parent._connectionId == self._connectionIdSnapshot { + let connection = _parent._connectableSubscription + defer { connection?.dispose() } + _parent._count = 0 + _parent._connectionId = _parent._connectionId &+ 1 + _parent._connectableSubscription = nil + } + // } + _parent._lock.unlock() + forwardOn(event) + dispose() + } + } +} + +final fileprivate class RefCount: Producer { + fileprivate let _lock = RecursiveLock() + + // state + fileprivate var _count = 0 + fileprivate var _connectionId: Int64 = 0 + fileprivate var _connectableSubscription = nil as Disposable? + + fileprivate let _source: CO + + init(source: CO) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == CO.E { + let sink = RefCountSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class MulticastSink: Sink, ObserverType { + typealias Element = O.E + typealias ResultType = Element + typealias MutlicastType = Multicast + + private let _parent: MutlicastType + + init(parent: MutlicastType, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + do { + let subject = try _parent._subjectSelector() + let connectable = ConnectableObservableAdapter(source: _parent._source, makeSubject: { subject }) + + let observable = try _parent._selector(connectable) + + let subscription = observable.subscribe(self) + let connection = connectable.connect() + + return Disposables.create(subscription, connection) + } + catch let e { + forwardOn(.error(e)) + dispose() + return Disposables.create() + } + } + + func on(_ event: Event) { + forwardOn(event) + switch event { + case .next: break + case .error, .completed: + dispose() + } + } +} + +final fileprivate class Multicast: Producer { + typealias SubjectSelectorType = () throws -> S + typealias SelectorType = (Observable) throws -> Observable + + fileprivate let _source: Observable + fileprivate let _subjectSelector: SubjectSelectorType + fileprivate let _selector: SelectorType + + init(source: Observable, subjectSelector: @escaping SubjectSelectorType, selector: @escaping SelectorType) { + _source = source + _subjectSelector = subjectSelector + _selector = selector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = MulticastSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Never.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Never.swift new file mode 100644 index 0000000..d98a7a8 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Never.swift @@ -0,0 +1,27 @@ +// +// Never.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Returns a non-terminating observable sequence, which can be used to denote an infinite duration. + + - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html) + + - returns: An observable sequence whose observers will never get called. + */ + public static func never() -> Observable { + return NeverProducer() + } +} + +final fileprivate class NeverProducer : Producer { + override func subscribe(_ observer: O) -> Disposable where O.E == Element { + return Disposables.create() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift new file mode 100644 index 0000000..ce2a0d4 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift @@ -0,0 +1,229 @@ +// +// ObserveOn.swift +// RxSwift +// +// Created by Krunoslav Zaher on 7/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Wraps the source sequence in order to run its observer callbacks on the specified scheduler. + + This only invokes observer callbacks on a `scheduler`. In case the subscription and/or unsubscription + actions have side-effects that require to be run on a scheduler, use `subscribeOn`. + + - seealso: [observeOn operator on reactivex.io](http://reactivex.io/documentation/operators/observeon.html) + + - parameter scheduler: Scheduler to notify observers on. + - returns: The source sequence whose observations happen on the specified scheduler. + */ + public func observeOn(_ scheduler: ImmediateSchedulerType) + -> Observable { + if let scheduler = scheduler as? SerialDispatchQueueScheduler { + return ObserveOnSerialDispatchQueue(source: self.asObservable(), scheduler: scheduler) + } + else { + return ObserveOn(source: self.asObservable(), scheduler: scheduler) + } + } +} + +final fileprivate class ObserveOn : Producer { + let scheduler: ImmediateSchedulerType + let source: Observable + + init(source: Observable, scheduler: ImmediateSchedulerType) { + self.scheduler = scheduler + self.source = source + +#if TRACE_RESOURCES + let _ = Resources.incrementTotal() +#endif + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = ObserveOnSink(scheduler: scheduler, observer: observer, cancel: cancel) + let subscription = source.subscribe(sink) + return (sink: sink, subscription: subscription) + } + +#if TRACE_RESOURCES + deinit { + let _ = Resources.decrementTotal() + } +#endif +} + +enum ObserveOnState : Int32 { + // pump is not running + case stopped = 0 + // pump is running + case running = 1 +} + +final fileprivate class ObserveOnSink : ObserverBase { + typealias E = O.E + + let _scheduler: ImmediateSchedulerType + + var _lock = SpinLock() + let _observer: O + + // state + var _state = ObserveOnState.stopped + var _queue = Queue>(capacity: 10) + + let _scheduleDisposable = SerialDisposable() + let _cancel: Cancelable + + init(scheduler: ImmediateSchedulerType, observer: O, cancel: Cancelable) { + _scheduler = scheduler + _observer = observer + _cancel = cancel + } + + override func onCore(_ event: Event) { + let shouldStart = _lock.calculateLocked { () -> Bool in + self._queue.enqueue(event) + + switch self._state { + case .stopped: + self._state = .running + return true + case .running: + return false + } + } + + if shouldStart { + _scheduleDisposable.disposable = self._scheduler.scheduleRecursive((), action: self.run) + } + } + + func run(_ state: (), _ recurse: (()) -> ()) { + let (nextEvent, observer) = self._lock.calculateLocked { () -> (Event?, O) in + if self._queue.count > 0 { + return (self._queue.dequeue(), self._observer) + } + else { + self._state = .stopped + return (nil, self._observer) + } + } + + if let nextEvent = nextEvent, !_cancel.isDisposed { + observer.on(nextEvent) + if nextEvent.isStopEvent { + dispose() + } + } + else { + return + } + + let shouldContinue = _shouldContinue_synchronized() + + if shouldContinue { + recurse(()) + } + } + + func _shouldContinue_synchronized() -> Bool { + _lock.lock(); defer { _lock.unlock() } // { + if self._queue.count > 0 { + return true + } + else { + self._state = .stopped + return false + } + // } + } + + override func dispose() { + super.dispose() + + _cancel.dispose() + _scheduleDisposable.dispose() + } +} + +#if TRACE_RESOURCES + fileprivate var _numberOfSerialDispatchQueueObservables: AtomicInt = 0 + extension Resources { + /** + Counts number of `SerialDispatchQueueObservables`. + + Purposed for unit tests. + */ + public static var numberOfSerialDispatchQueueObservables: Int32 { + return _numberOfSerialDispatchQueueObservables.valueSnapshot() + } + } +#endif + +final fileprivate class ObserveOnSerialDispatchQueueSink : ObserverBase { + let scheduler: SerialDispatchQueueScheduler + let observer: O + + let cancel: Cancelable + + var cachedScheduleLambda: (((sink: ObserveOnSerialDispatchQueueSink, event: Event)) -> Disposable)! + + init(scheduler: SerialDispatchQueueScheduler, observer: O, cancel: Cancelable) { + self.scheduler = scheduler + self.observer = observer + self.cancel = cancel + super.init() + + cachedScheduleLambda = { pair in + pair.sink.observer.on(pair.event) + + if pair.event.isStopEvent { + pair.sink.dispose() + } + + return Disposables.create() + } + } + + override func onCore(_ event: Event) { + let _ = self.scheduler.schedule((self, event), action: cachedScheduleLambda!) + } + + override func dispose() { + super.dispose() + + cancel.dispose() + } +} + +final fileprivate class ObserveOnSerialDispatchQueue : Producer { + let scheduler: SerialDispatchQueueScheduler + let source: Observable + + init(source: Observable, scheduler: SerialDispatchQueueScheduler) { + self.scheduler = scheduler + self.source = source + + #if TRACE_RESOURCES + let _ = Resources.incrementTotal() + let _ = AtomicIncrement(&_numberOfSerialDispatchQueueObservables) + #endif + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = ObserveOnSerialDispatchQueueSink(scheduler: scheduler, observer: observer, cancel: cancel) + let subscription = source.subscribe(sink) + return (sink: sink, subscription: subscription) + } + + #if TRACE_RESOURCES + deinit { + let _ = Resources.decrementTotal() + let _ = AtomicDecrement(&_numberOfSerialDispatchQueueObservables) + } + #endif +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Optional.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Optional.swift new file mode 100644 index 0000000..52ba0d9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Optional.swift @@ -0,0 +1,95 @@ +// +// Optional.swift +// RxSwift +// +// Created by tarunon on 2016/12/13. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Converts a optional to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter optional: Optional element in the resulting observable sequence. + - returns: An observable sequence containing the wrapped value or not from given optional. + */ + public static func from(optional: E?) -> Observable { + return ObservableOptional(optional: optional) + } + + /** + Converts a optional to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter optional: Optional element in the resulting observable sequence. + - parameter: Scheduler to send the optional element on. + - returns: An observable sequence containing the wrapped value or not from given optional. + */ + public static func from(optional: E?, scheduler: ImmediateSchedulerType) -> Observable { + return ObservableOptionalScheduled(optional: optional, scheduler: scheduler) + } +} + +final fileprivate class ObservableOptionalScheduledSink : Sink { + typealias E = O.E + typealias Parent = ObservableOptionalScheduled + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + return _parent._scheduler.schedule(_parent._optional) { (optional: E?) -> Disposable in + if let next = optional { + self.forwardOn(.next(next)) + return self._parent._scheduler.schedule(()) { _ in + self.forwardOn(.completed) + self.dispose() + return Disposables.create() + } + } else { + self.forwardOn(.completed) + self.dispose() + return Disposables.create() + } + } + } +} + +final fileprivate class ObservableOptionalScheduled : Producer { + fileprivate let _optional: E? + fileprivate let _scheduler: ImmediateSchedulerType + + init(optional: E?, scheduler: ImmediateSchedulerType) { + _optional = optional + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = ObservableOptionalScheduledSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class ObservableOptional: Producer { + private let _optional: E? + + init(optional: E?) { + _optional = optional + } + + override func subscribe(_ observer: O) -> Disposable where O.E == E { + if let element = _optional { + observer.on(.next(element)) + } + observer.on(.completed) + return Disposables.create() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Producer.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Producer.swift new file mode 100644 index 0000000..996b011 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Producer.swift @@ -0,0 +1,98 @@ +// +// Producer.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/20/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +class Producer : Observable { + override init() { + super.init() + } + + override func subscribe(_ observer: O) -> Disposable where O.E == Element { + if !CurrentThreadScheduler.isScheduleRequired { + // The returned disposable needs to release all references once it was disposed. + let disposer = SinkDisposer() + let sinkAndSubscription = run(observer, cancel: disposer) + disposer.setSinkAndSubscription(sink: sinkAndSubscription.sink, subscription: sinkAndSubscription.subscription) + + return disposer + } + else { + return CurrentThreadScheduler.instance.schedule(()) { _ in + let disposer = SinkDisposer() + let sinkAndSubscription = self.run(observer, cancel: disposer) + disposer.setSinkAndSubscription(sink: sinkAndSubscription.sink, subscription: sinkAndSubscription.subscription) + + return disposer + } + } + } + + func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + rxAbstractMethod() + } +} + +fileprivate final class SinkDisposer: Cancelable { + fileprivate enum DisposeState: UInt32 { + case disposed = 1 + case sinkAndSubscriptionSet = 2 + } + + // Jeej, swift API consistency rules + fileprivate enum DisposeStateInt32: Int32 { + case disposed = 1 + case sinkAndSubscriptionSet = 2 + } + + private var _state: AtomicInt = 0 + private var _sink: Disposable? = nil + private var _subscription: Disposable? = nil + + var isDisposed: Bool { + return AtomicFlagSet(DisposeState.disposed.rawValue, &_state) + } + + func setSinkAndSubscription(sink: Disposable, subscription: Disposable) { + _sink = sink + _subscription = subscription + + let previousState = AtomicOr(DisposeState.sinkAndSubscriptionSet.rawValue, &_state) + if (previousState & DisposeStateInt32.sinkAndSubscriptionSet.rawValue) != 0 { + rxFatalError("Sink and subscription were already set") + } + + if (previousState & DisposeStateInt32.disposed.rawValue) != 0 { + sink.dispose() + subscription.dispose() + _sink = nil + _subscription = nil + } + } + + func dispose() { + let previousState = AtomicOr(DisposeState.disposed.rawValue, &_state) + + if (previousState & DisposeStateInt32.disposed.rawValue) != 0 { + return + } + + if (previousState & DisposeStateInt32.sinkAndSubscriptionSet.rawValue) != 0 { + guard let sink = _sink else { + rxFatalError("Sink not set") + } + guard let subscription = _subscription else { + rxFatalError("Subscription not set") + } + + sink.dispose() + subscription.dispose() + + _sink = nil + _subscription = nil + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Range.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Range.swift new file mode 100644 index 0000000..9b85554 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Range.swift @@ -0,0 +1,73 @@ +// +// Range.swift +// RxSwift +// +// Created by Krunoslav Zaher on 9/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType where E : RxAbstractInteger { + /** + Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to generate and send out observer messages. + + - seealso: [range operator on reactivex.io](http://reactivex.io/documentation/operators/range.html) + + - parameter start: The value of the first integer in the sequence. + - parameter count: The number of sequential integers to generate. + - parameter scheduler: Scheduler to run the generator loop on. + - returns: An observable sequence that contains a range of sequential integral numbers. + */ + public static func range(start: E, count: E, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { + return RangeProducer(start: start, count: count, scheduler: scheduler) + } +} + +final fileprivate class RangeProducer : Producer { + fileprivate let _start: E + fileprivate let _count: E + fileprivate let _scheduler: ImmediateSchedulerType + + init(start: E, count: E, scheduler: ImmediateSchedulerType) { + if count < 0 { + rxFatalError("count can't be negative") + } + + if start &+ (count - 1) < start { + rxFatalError("overflow of count") + } + + _start = start + _count = count + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = RangeSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class RangeSink : Sink where O.E: RxAbstractInteger { + typealias Parent = RangeProducer + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRecursive(0 as O.E) { i, recurse in + if i < self._parent._count { + self.forwardOn(.next(self._parent._start + i)) + recurse(i + 1) + } + else { + self.forwardOn(.completed) + self.dispose() + } + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Reduce.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Reduce.swift new file mode 100644 index 0000000..3e4a7b9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Reduce.swift @@ -0,0 +1,109 @@ +// +// Reduce.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + + +extension ObservableType { + /** + Applies an `accumulator` function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified `seed` value is used as the initial accumulator value. + + For aggregation behavior with incremental intermediate results, see `scan`. + + - seealso: [reduce operator on reactivex.io](http://reactivex.io/documentation/operators/reduce.html) + + - parameter seed: The initial accumulator value. + - parameter accumulator: A accumulator function to be invoked on each element. + - parameter mapResult: A function to transform the final accumulator value into the result value. + - returns: An observable sequence containing a single element with the final accumulator value. + */ + public func reduce(_ seed: A, accumulator: @escaping (A, E) throws -> A, mapResult: @escaping (A) throws -> R) + -> Observable { + return Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: mapResult) + } + + /** + Applies an `accumulator` function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified `seed` value is used as the initial accumulator value. + + For aggregation behavior with incremental intermediate results, see `scan`. + + - seealso: [reduce operator on reactivex.io](http://reactivex.io/documentation/operators/reduce.html) + + - parameter seed: The initial accumulator value. + - parameter accumulator: A accumulator function to be invoked on each element. + - returns: An observable sequence containing a single element with the final accumulator value. + */ + public func reduce
(_ seed: A, accumulator: @escaping (A, E) throws -> A) + -> Observable { + return Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: { $0 }) + } +} + +final fileprivate class ReduceSink : Sink, ObserverType { + typealias ResultType = O.E + typealias Parent = Reduce + + private let _parent: Parent + private var _accumulation: AccumulateType + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _accumulation = parent._seed + + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + do { + _accumulation = try _parent._accumulator(_accumulation, value) + } + catch let e { + forwardOn(.error(e)) + dispose() + } + case .error(let e): + forwardOn(.error(e)) + dispose() + case .completed: + do { + let result = try _parent._mapResult(_accumulation) + forwardOn(.next(result)) + forwardOn(.completed) + dispose() + } + catch let e { + forwardOn(.error(e)) + dispose() + } + } + } +} + +final fileprivate class Reduce : Producer { + typealias AccumulatorType = (AccumulateType, SourceType) throws -> AccumulateType + typealias ResultSelectorType = (AccumulateType) throws -> ResultType + + fileprivate let _source: Observable + fileprivate let _seed: AccumulateType + fileprivate let _accumulator: AccumulatorType + fileprivate let _mapResult: ResultSelectorType + + init(source: Observable, seed: AccumulateType, accumulator: @escaping AccumulatorType, mapResult: @escaping ResultSelectorType) { + _source = source + _seed = seed + _accumulator = accumulator + _mapResult = mapResult + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == ResultType { + let sink = ReduceSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Repeat.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Repeat.swift new file mode 100644 index 0000000..6892ec1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Repeat.swift @@ -0,0 +1,57 @@ +// +// Repeat.swift +// RxSwift +// +// Created by Krunoslav Zaher on 9/13/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages. + + - seealso: [repeat operator on reactivex.io](http://reactivex.io/documentation/operators/repeat.html) + + - parameter element: Element to repeat. + - parameter scheduler: Scheduler to run the producer loop on. + - returns: An observable sequence that repeats the given element infinitely. + */ + public static func repeatElement(_ element: E, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { + return RepeatElement(element: element, scheduler: scheduler) + } +} + +final fileprivate class RepeatElement : Producer { + fileprivate let _element: Element + fileprivate let _scheduler: ImmediateSchedulerType + + init(element: Element, scheduler: ImmediateSchedulerType) { + _element = element + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = RepeatElementSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class RepeatElementSink : Sink { + typealias Parent = RepeatElement + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRecursive(_parent._element) { e, recurse in + self.forwardOn(.next(e)) + recurse(e) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift new file mode 100644 index 0000000..268b399 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift @@ -0,0 +1,182 @@ +// +// RetryWhen.swift +// RxSwift +// +// Created by Junior B. on 06/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Repeats the source observable sequence on error when the notifier emits a next value. + If the source observable errors and the notifier completes, it will complete the source sequence. + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable. + - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete. + */ + public func retryWhen(_ notificationHandler: @escaping (Observable) -> TriggerObservable) + -> Observable { + return RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler) + } + + /** + Repeats the source observable sequence on error when the notifier emits a next value. + If the source observable errors and the notifier completes, it will complete the source sequence. + + - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html) + + - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable. + - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete. + */ + public func retryWhen(_ notificationHandler: @escaping (Observable) -> TriggerObservable) + -> Observable { + return RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler) + } +} + +final fileprivate class RetryTriggerSink + : ObserverType where S.Iterator.Element : ObservableType, S.Iterator.Element.E == O.E { + typealias E = TriggerObservable.E + + typealias Parent = RetryWhenSequenceSinkIter + + fileprivate let _parent: Parent + + init(parent: Parent) { + _parent = parent + } + + func on(_ event: Event) { + switch event { + case .next: + _parent._parent._lastError = nil + _parent._parent.schedule(.moveNext) + case .error(let e): + _parent._parent.forwardOn(.error(e)) + _parent._parent.dispose() + case .completed: + _parent._parent.forwardOn(.completed) + _parent._parent.dispose() + } + } +} + +final fileprivate class RetryWhenSequenceSinkIter + : ObserverType + , Disposable where S.Iterator.Element : ObservableType, S.Iterator.Element.E == O.E { + typealias E = O.E + typealias Parent = RetryWhenSequenceSink + + fileprivate let _parent: Parent + fileprivate let _errorHandlerSubscription = SingleAssignmentDisposable() + fileprivate let _subscription: Disposable + + init(parent: Parent, subscription: Disposable) { + _parent = parent + _subscription = subscription + } + + func on(_ event: Event) { + switch event { + case .next: + _parent.forwardOn(event) + case .error(let error): + _parent._lastError = error + + if let failedWith = error as? Error { + // dispose current subscription + _subscription.dispose() + + let errorHandlerSubscription = _parent._notifier.subscribe(RetryTriggerSink(parent: self)) + _errorHandlerSubscription.setDisposable(errorHandlerSubscription) + _parent._errorSubject.on(.next(failedWith)) + } + else { + _parent.forwardOn(.error(error)) + _parent.dispose() + } + case .completed: + _parent.forwardOn(event) + _parent.dispose() + } + } + + final func dispose() { + _subscription.dispose() + _errorHandlerSubscription.dispose() + } +} + +final fileprivate class RetryWhenSequenceSink + : TailRecursiveSink where S.Iterator.Element : ObservableType, S.Iterator.Element.E == O.E { + typealias Element = O.E + typealias Parent = RetryWhenSequence + + let _lock = RecursiveLock() + + fileprivate let _parent: Parent + + fileprivate var _lastError: Swift.Error? + fileprivate let _errorSubject = PublishSubject() + fileprivate let _handler: Observable + fileprivate let _notifier = PublishSubject() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _handler = parent._notificationHandler(_errorSubject).asObservable() + super.init(observer: observer, cancel: cancel) + } + + override func done() { + if let lastError = _lastError { + forwardOn(.error(lastError)) + _lastError = nil + } + else { + forwardOn(.completed) + } + + dispose() + } + + override func extract(_ observable: Observable) -> SequenceGenerator? { + // It is important to always return `nil` here because there are sideffects in the `run` method + // that are dependant on particular `retryWhen` operator so single operator stack can't be reused in this + // case. + return nil + } + + override func subscribeToNext(_ source: Observable) -> Disposable { + let subscription = SingleAssignmentDisposable() + let iter = RetryWhenSequenceSinkIter(parent: self, subscription: subscription) + subscription.setDisposable(source.subscribe(iter)) + return iter + } + + override func run(_ sources: SequenceGenerator) -> Disposable { + let triggerSubscription = _handler.subscribe(_notifier.asObserver()) + let superSubscription = super.run(sources) + return Disposables.create(superSubscription, triggerSubscription) + } +} + +final fileprivate class RetryWhenSequence : Producer where S.Iterator.Element : ObservableType { + typealias Element = S.Iterator.Element.E + + fileprivate let _sources: S + fileprivate let _notificationHandler: (Observable) -> TriggerObservable + + init(sources: S, notificationHandler: @escaping (Observable) -> TriggerObservable) { + _sources = sources + _notificationHandler = notificationHandler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = RetryWhenSequenceSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run((self._sources.makeIterator(), nil)) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sample.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sample.swift new file mode 100644 index 0000000..31f8b62 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sample.swift @@ -0,0 +1,142 @@ +// +// Sample.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/1/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Samples the source observable sequence using a sampler observable sequence producing sampling ticks. + + Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence. + + **In case there were no new elements between sampler ticks, no element is sent to the resulting sequence.** + + - seealso: [sample operator on reactivex.io](http://reactivex.io/documentation/operators/sample.html) + + - parameter sampler: Sampling tick sequence. + - returns: Sampled observable sequence. + */ + public func sample(_ sampler: O) + -> Observable { + return Sample(source: self.asObservable(), sampler: sampler.asObservable()) + } +} + +final fileprivate class SamplerSink + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = SampleType + + typealias Parent = SampleSequenceSink + + fileprivate let _parent: Parent + + var _lock: RecursiveLock { + return _parent._lock + } + + init(parent: Parent) { + _parent = parent + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next: + if let element = _parent._element { + _parent._element = nil + _parent.forwardOn(.next(element)) + } + + if _parent._atEnd { + _parent.forwardOn(.completed) + _parent.dispose() + } + case .error(let e): + _parent.forwardOn(.error(e)) + _parent.dispose() + case .completed: + if let element = _parent._element { + _parent._element = nil + _parent.forwardOn(.next(element)) + } + if _parent._atEnd { + _parent.forwardOn(.completed) + _parent.dispose() + } + } + } +} + +final fileprivate class SampleSequenceSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Element = O.E + typealias Parent = Sample + + fileprivate let _parent: Parent + + let _lock = RecursiveLock() + + // state + fileprivate var _element = nil as Element? + fileprivate var _atEnd = false + + fileprivate let _sourceSubscription = SingleAssignmentDisposable() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + _sourceSubscription.setDisposable(_parent._source.subscribe(self)) + let samplerSubscription = _parent._sampler.subscribe(SamplerSink(parent: self)) + + return Disposables.create(_sourceSubscription, samplerSubscription) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next(let element): + _element = element + case .error: + forwardOn(event) + dispose() + case .completed: + _atEnd = true + _sourceSubscription.dispose() + } + } + +} + +final fileprivate class Sample : Producer { + fileprivate let _source: Observable + fileprivate let _sampler: Observable + + init(source: Observable, sampler: Observable) { + _source = source + _sampler = sampler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = SampleSequenceSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Scan.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Scan.swift new file mode 100644 index 0000000..e94db11 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Scan.swift @@ -0,0 +1,82 @@ +// +// Scan.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. + + For aggregation behavior with no intermediate results, see `reduce`. + + - seealso: [scan operator on reactivex.io](http://reactivex.io/documentation/operators/scan.html) + + - parameter seed: The initial accumulator value. + - parameter accumulator: An accumulator function to be invoked on each element. + - returns: An observable sequence containing the accumulated values. + */ + public func scan(_ seed: A, accumulator: @escaping (A, E) throws -> A) + -> Observable { + return Scan(source: self.asObservable(), seed: seed, accumulator: accumulator) + } +} + +final fileprivate class ScanSink : Sink, ObserverType { + typealias Accumulate = O.E + typealias Parent = Scan + typealias E = ElementType + + fileprivate let _parent: Parent + fileprivate var _accumulate: Accumulate + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _accumulate = parent._seed + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let element): + do { + _accumulate = try _parent._accumulator(_accumulate, element) + forwardOn(.next(_accumulate)) + } + catch let error { + forwardOn(.error(error)) + dispose() + } + case .error(let error): + forwardOn(.error(error)) + dispose() + case .completed: + forwardOn(.completed) + dispose() + } + } + +} + +final fileprivate class Scan: Producer { + typealias Accumulator = (Accumulate, Element) throws -> Accumulate + + fileprivate let _source: Observable + fileprivate let _seed: Accumulate + fileprivate let _accumulator: Accumulator + + init(source: Observable, seed: Accumulate, accumulator: @escaping Accumulator) { + _source = source + _seed = seed + _accumulator = accumulator + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Accumulate { + let sink = ScanSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sequence.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sequence.swift new file mode 100644 index 0000000..e141bc7 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sequence.swift @@ -0,0 +1,89 @@ +// +// Sequence.swift +// RxSwift +// +// Created by Krunoslav Zaher on 11/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + // MARK: of + + /** + This method creates a new Observable instance with a variable number of elements. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - parameter elements: Elements to generate. + - parameter scheduler: Scheduler to send elements on. If `nil`, elements are sent immediately on subscription. + - returns: The observable sequence whose elements are pulled from the given arguments. + */ + public static func of(_ elements: E ..., scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { + return ObservableSequence(elements: elements, scheduler: scheduler) + } +} + +extension ObservableType { + /** + Converts an array to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - returns: The observable sequence whose elements are pulled from the given enumerable sequence. + */ + public static func from(_ array: [E], scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { + return ObservableSequence(elements: array, scheduler: scheduler) + } + + /** + Converts a sequence to an observable sequence. + + - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html) + + - returns: The observable sequence whose elements are pulled from the given enumerable sequence. + */ + public static func from(_ sequence: S, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable where S.Iterator.Element == E { + return ObservableSequence(elements: sequence, scheduler: scheduler) + } +} + +final fileprivate class ObservableSequenceSink : Sink where S.Iterator.Element == O.E { + typealias Parent = ObservableSequence + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRecursive((_parent._elements.makeIterator(), _parent._elements)) { (iterator, recurse) in + var mutableIterator = iterator + if let next = mutableIterator.0.next() { + self.forwardOn(.next(next)) + recurse(mutableIterator) + } + else { + self.forwardOn(.completed) + self.dispose() + } + } + } +} + +final fileprivate class ObservableSequence : Producer { + fileprivate let _elements: S + fileprivate let _scheduler: ImmediateSchedulerType + + init(elements: S, scheduler: ImmediateSchedulerType) { + _elements = elements + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = ObservableSequenceSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift new file mode 100644 index 0000000..8ba2898 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift @@ -0,0 +1,458 @@ +// +// ShareReplayScope.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/28/17. +// Copyright © 2017 Krunoslav Zaher. All rights reserved. +// + +/// Subject lifetime scope +public enum SubjectLifetimeScope { + /** + **Each connection will have it's own subject instance to store replay events.** + **Connections will be isolated from each another.** + + Configures the underlying implementation to behave equivalent to. + + ``` + source.multicast(makeSubject: { MySubject() }).refCount() + ``` + + **This is the recommended default.** + + This has the following consequences: + * `retry` or `concat` operators will function as expected because terminating the sequence will clear internal state. + * Each connection to source observable sequence will use it's own subject. + * When the number of subscribers drops from 1 to 0 and connection to source sequence is disposed, subject will be cleared. + + + ``` + let xs = Observable.deferred { () -> Observable in + print("Performing work ...") + return Observable.just(Date().timeIntervalSince1970) + } + .share(replay: 1, scope: .whileConnected) + + _ = xs.subscribe(onNext: { print("next \($0)") }, onCompleted: { print("completed\n") }) + _ = xs.subscribe(onNext: { print("next \($0)") }, onCompleted: { print("completed\n") }) + _ = xs.subscribe(onNext: { print("next \($0)") }, onCompleted: { print("completed\n") }) + + ``` + + Notice how time interval is different and `Performing work ...` is printed each time) + + ``` + Performing work ... + next 1495998900.82141 + completed + + Performing work ... + next 1495998900.82359 + completed + + Performing work ... + next 1495998900.82444 + completed + + + ``` + + */ + case whileConnected + + /** + **One subject will store replay events for all connections to source.** + **Connections won't be isolated from each another.** + + Configures the underlying implementation behave equivalent to. + + ``` + source.multicast(MySubject()).refCount() + ``` + + This has the following consequences: + * Using `retry` or `concat` operators after this operator usually isn't advised. + * Each connection to source observable sequence will share the same subject. + * After number of subscribers drops from 1 to 0 and connection to source observable sequence is dispose, this operator will + continue holding a reference to the same subject. + If at some later moment a new observer initiates a new connection to source it can potentially receive + some of the stale events received during previous connection. + * After source sequence terminates any new observer will always immediatelly receive replayed elements and terminal event. + No new subscriptions to source observable sequence will be attempted. + + ``` + let xs = Observable.deferred { () -> Observable in + print("Performing work ...") + return Observable.just(Date().timeIntervalSince1970) + } + .share(replay: 1, scope: .forever) + + _ = xs.subscribe(onNext: { print("next \($0)") }, onCompleted: { print("completed\n") }) + _ = xs.subscribe(onNext: { print("next \($0)") }, onCompleted: { print("completed\n") }) + _ = xs.subscribe(onNext: { print("next \($0)") }, onCompleted: { print("completed\n") }) + ``` + + Notice how time interval is the same, replayed, and `Performing work ...` is printed only once + + ``` + Performing work ... + next 1495999013.76356 + completed + + next 1495999013.76356 + completed + + next 1495999013.76356 + completed + ``` + + */ + case forever +} + +extension ObservableType { + + /** + Returns an observable sequence that **shares a single subscription to the underlying sequence**, and immediately upon subscription replays elements in buffer. + + This operator is equivalent to: + * `.whileConnected` + ``` + // Each connection will have it's own subject instance to store replay events. + // Connections will be isolated from each another. + source.multicast(makeSubject: { Replay.create(bufferSize: replay) }).refCount() + ``` + * `.forever` + ``` + // One subject will store replay events for all connections to source. + // Connections won't be isolated from each another. + source.multicast(Replay.create(bufferSize: replay)).refCount() + ``` + + It uses optimized versions of the operators for most common operations. + + - parameter replay: Maximum element count of the replay buffer. + - parameter scope: Lifetime scope of sharing subject. For more information see `SubjectLifetimeScope` enum. + + - seealso: [shareReplay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html) + + - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. + */ + public func share(replay: Int = 0, scope: SubjectLifetimeScope = .whileConnected) + -> Observable { + switch scope { + case .forever: + switch replay { + case 0: return self.multicast(PublishSubject()).refCount() + default: return self.multicast(ReplaySubject.create(bufferSize: replay)).refCount() + } + case .whileConnected: + switch replay { + case 0: return ShareWhileConnected(source: self.asObservable()) + case 1: return ShareReplay1WhileConnected(source: self.asObservable()) + default: return self.multicast(makeSubject: { ReplaySubject.create(bufferSize: replay) }).refCount() + } + } + } +} + +fileprivate final class ShareReplay1WhileConnectedConnection + : ObserverType + , SynchronizedUnsubscribeType { + typealias E = Element + typealias Observers = AnyObserver.s + typealias DisposeKey = Observers.KeyType + + typealias Parent = ShareReplay1WhileConnected + private let _parent: Parent + private let _subscription = SingleAssignmentDisposable() + + private let _lock: RecursiveLock + private var _disposed: Bool = false + fileprivate var _observers = Observers() + fileprivate var _element: Element? + + init(parent: Parent, lock: RecursiveLock) { + _parent = parent + _lock = lock + + #if TRACE_RESOURCES + _ = Resources.incrementTotal() + #endif + } + + final func on(_ event: Event) { + _lock.lock() + let observers = _synchronized_on(event) + _lock.unlock() + dispatch(observers, event) + } + + final private func _synchronized_on(_ event: Event) -> Observers { + if _disposed { + return Observers() + } + + switch event { + case .next(let element): + _element = element + return _observers + case .error, .completed: + let observers = _observers + self._synchronized_dispose() + return observers + } + } + + final func connect() { + _subscription.setDisposable(_parent._source.subscribe(self)) + } + + final func _synchronized_subscribe(_ observer: O) -> Disposable where O.E == Element { + _lock.lock(); defer { _lock.unlock() } + if let element = _element { + observer.on(.next(element)) + } + + let disposeKey = _observers.insert(observer.on) + + return SubscriptionDisposable(owner: self, key: disposeKey) + } + + final private func _synchronized_dispose() { + _disposed = true + if _parent._connection === self { + _parent._connection = nil + } + _observers = Observers() + } + + final func synchronizedUnsubscribe(_ disposeKey: DisposeKey) { + _lock.lock() + let shouldDisconnect = _synchronized_unsubscribe(disposeKey) + _lock.unlock() + if shouldDisconnect { + _subscription.dispose() + } + } + + @inline(__always) + final private func _synchronized_unsubscribe(_ disposeKey: DisposeKey) -> Bool { + // if already unsubscribed, just return + if self._observers.removeKey(disposeKey) == nil { + return false + } + + if _observers.count == 0 { + _synchronized_dispose() + return true + } + + return false + } + + #if TRACE_RESOURCES + deinit { + _ = Resources.decrementTotal() + } + #endif +} + +// optimized version of share replay for most common case +final fileprivate class ShareReplay1WhileConnected + : Observable { + + fileprivate typealias Connection = ShareReplay1WhileConnectedConnection + + fileprivate let _source: Observable + + fileprivate let _lock = RecursiveLock() + + fileprivate var _connection: Connection? + + init(source: Observable) { + self._source = source + } + + override func subscribe(_ observer: O) -> Disposable where O.E == E { + _lock.lock() + + let connection = _synchronized_subscribe(observer) + let count = connection._observers.count + + let disposable = connection._synchronized_subscribe(observer) + + _lock.unlock() + + if count == 0 { + connection.connect() + } + + return disposable + } + + @inline(__always) + private func _synchronized_subscribe(_ observer: O) -> Connection where O.E == E { + let connection: Connection + + if let existingConnection = _connection { + connection = existingConnection + } + else { + connection = ShareReplay1WhileConnectedConnection( + parent: self, + lock: _lock) + _connection = connection + } + + return connection + } +} + +fileprivate final class ShareWhileConnectedConnection + : ObserverType + , SynchronizedUnsubscribeType { + typealias E = Element + typealias Observers = AnyObserver.s + typealias DisposeKey = Observers.KeyType + + typealias Parent = ShareWhileConnected + private let _parent: Parent + private let _subscription = SingleAssignmentDisposable() + + private let _lock: RecursiveLock + private var _disposed: Bool = false + fileprivate var _observers = Observers() + + init(parent: Parent, lock: RecursiveLock) { + _parent = parent + _lock = lock + + #if TRACE_RESOURCES + _ = Resources.incrementTotal() + #endif + } + + final func on(_ event: Event) { + _lock.lock() + let observers = _synchronized_on(event) + _lock.unlock() + dispatch(observers, event) + } + + final private func _synchronized_on(_ event: Event) -> Observers { + if _disposed { + return Observers() + } + + switch event { + case .next: + return _observers + case .error, .completed: + let observers = _observers + self._synchronized_dispose() + return observers + } + } + + final func connect() { + _subscription.setDisposable(_parent._source.subscribe(self)) + } + + final func _synchronized_subscribe(_ observer: O) -> Disposable where O.E == Element { + _lock.lock(); defer { _lock.unlock() } + + let disposeKey = _observers.insert(observer.on) + + return SubscriptionDisposable(owner: self, key: disposeKey) + } + + final private func _synchronized_dispose() { + _disposed = true + if _parent._connection === self { + _parent._connection = nil + } + _observers = Observers() + } + + final func synchronizedUnsubscribe(_ disposeKey: DisposeKey) { + _lock.lock() + let shouldDisconnect = _synchronized_unsubscribe(disposeKey) + _lock.unlock() + if shouldDisconnect { + _subscription.dispose() + } + } + + @inline(__always) + final private func _synchronized_unsubscribe(_ disposeKey: DisposeKey) -> Bool { + // if already unsubscribed, just return + if self._observers.removeKey(disposeKey) == nil { + return false + } + + if _observers.count == 0 { + _synchronized_dispose() + return true + } + + return false + } + + #if TRACE_RESOURCES + deinit { + _ = Resources.decrementTotal() + } + #endif +} + +// optimized version of share replay for most common case +final fileprivate class ShareWhileConnected + : Observable { + + fileprivate typealias Connection = ShareWhileConnectedConnection + + fileprivate let _source: Observable + + fileprivate let _lock = RecursiveLock() + + fileprivate var _connection: Connection? + + init(source: Observable) { + self._source = source + } + + override func subscribe(_ observer: O) -> Disposable where O.E == E { + _lock.lock() + + let connection = _synchronized_subscribe(observer) + let count = connection._observers.count + + let disposable = connection._synchronized_subscribe(observer) + + _lock.unlock() + + if count == 0 { + connection.connect() + } + + return disposable + } + + @inline(__always) + private func _synchronized_subscribe(_ observer: O) -> Connection where O.E == E { + let connection: Connection + + if let existingConnection = _connection { + connection = existingConnection + } + else { + connection = ShareWhileConnectedConnection( + parent: self, + lock: _lock) + _connection = connection + } + + return connection + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift new file mode 100644 index 0000000..1419a93 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift @@ -0,0 +1,105 @@ +// +// SingleAsync.swift +// RxSwift +// +// Created by Junior B. on 09/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + The single operator is similar to first, but throws a `RxError.noElements` or `RxError.moreThanOneElement` + if the source Observable does not emit exactly one element before successfully completing. + + - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html) + + - returns: An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted. + */ + public func single() + -> Observable { + return SingleAsync(source: asObservable()) + } + + /** + The single operator is similar to first, but throws a `RxError.NoElements` or `RxError.MoreThanOneElement` + if the source Observable does not emit exactly one element before successfully completing. + + - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html) + + - parameter predicate: A function to test each source element for a condition. + - returns: An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted. + */ + public func single(_ predicate: @escaping (E) throws -> Bool) + -> Observable { + return SingleAsync(source: asObservable(), predicate: predicate) + } +} + +fileprivate final class SingleAsyncSink : Sink, ObserverType { + typealias ElementType = O.E + typealias Parent = SingleAsync + typealias E = ElementType + + private let _parent: Parent + private var _seenValue: Bool = false + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + do { + let forward = try _parent._predicate?(value) ?? true + if !forward { + return + } + } + catch let error { + forwardOn(.error(error as Swift.Error)) + dispose() + return + } + + if _seenValue { + forwardOn(.error(RxError.moreThanOneElement)) + dispose() + return + } + + _seenValue = true + forwardOn(.next(value)) + case .error: + forwardOn(event) + dispose() + case .completed: + if (_seenValue) { + forwardOn(.completed) + } else { + forwardOn(.error(RxError.noElements)) + } + dispose() + } + } +} + +final class SingleAsync: Producer { + typealias Predicate = (Element) throws -> Bool + + fileprivate let _source: Observable + fileprivate let _predicate: Predicate? + + init(source: Observable, predicate: Predicate? = nil) { + _source = source + _predicate = predicate + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = SingleAsyncSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sink.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sink.swift new file mode 100644 index 0000000..214cfda --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Sink.swift @@ -0,0 +1,76 @@ +// +// Sink.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +class Sink : Disposable { + fileprivate let _observer: O + fileprivate let _cancel: Cancelable + fileprivate var _disposed: Bool + + #if DEBUG + fileprivate let _synchronizationTracker = SynchronizationTracker() + #endif + + init(observer: O, cancel: Cancelable) { +#if TRACE_RESOURCES + let _ = Resources.incrementTotal() +#endif + _observer = observer + _cancel = cancel + _disposed = false + } + + final func forwardOn(_ event: Event) { + #if DEBUG + _synchronizationTracker.register(synchronizationErrorMessage: .default) + defer { _synchronizationTracker.unregister() } + #endif + if _disposed { + return + } + _observer.on(event) + } + + final func forwarder() -> SinkForward { + return SinkForward(forward: self) + } + + final var disposed: Bool { + return _disposed + } + + func dispose() { + _disposed = true + _cancel.dispose() + } + + deinit { +#if TRACE_RESOURCES + let _ = Resources.decrementTotal() +#endif + } +} + +final class SinkForward: ObserverType { + typealias E = O.E + + private let _forward: Sink + + init(forward: Sink) { + _forward = forward + } + + final func on(_ event: Event) { + switch event { + case .next: + _forward._observer.on(event) + case .error, .completed: + _forward._observer.on(event) + _forward._cancel.dispose() + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Skip.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Skip.swift new file mode 100644 index 0000000..fcac9d4 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Skip.swift @@ -0,0 +1,159 @@ +// +// Skip.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/25/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. + + - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html) + + - parameter count: The number of elements to skip before returning the remaining elements. + - returns: An observable sequence that contains the elements that occur after the specified index in the input sequence. + */ + public func skip(_ count: Int) + -> Observable { + return SkipCount(source: asObservable(), count: count) + } +} + +extension ObservableType { + + /** + Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. + + - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html) + + - parameter duration: Duration for skipping elements from the start of the sequence. + - parameter scheduler: Scheduler to run the timer on. + - returns: An observable sequence with the elements skipped during the specified duration from the start of the source sequence. + */ + public func skip(_ duration: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return SkipTime(source: self.asObservable(), duration: duration, scheduler: scheduler) + } +} + +// count version + +final fileprivate class SkipCountSink : Sink, ObserverType { + typealias Element = O.E + typealias Parent = SkipCount + + let parent: Parent + + var remaining: Int + + init(parent: Parent, observer: O, cancel: Cancelable) { + self.parent = parent + self.remaining = parent.count + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + + if remaining <= 0 { + forwardOn(.next(value)) + } + else { + remaining -= 1 + } + case .error: + forwardOn(event) + self.dispose() + case .completed: + forwardOn(event) + self.dispose() + } + } + +} + +final fileprivate class SkipCount: Producer { + let source: Observable + let count: Int + + init(source: Observable, count: Int) { + self.source = source + self.count = count + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = SkipCountSink(parent: self, observer: observer, cancel: cancel) + let subscription = source.subscribe(sink) + + return (sink: sink, subscription: subscription) + } +} + +// time version + +final fileprivate class SkipTimeSink : Sink, ObserverType where O.E == ElementType { + typealias Parent = SkipTime + typealias Element = ElementType + + let parent: Parent + + // state + var open = false + + init(parent: Parent, observer: O, cancel: Cancelable) { + self.parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + if open { + forwardOn(.next(value)) + } + case .error: + forwardOn(event) + self.dispose() + case .completed: + forwardOn(event) + self.dispose() + } + } + + func tick() { + open = true + } + + func run() -> Disposable { + let disposeTimer = parent.scheduler.scheduleRelative((), dueTime: self.parent.duration) { _ in + self.tick() + return Disposables.create() + } + + let disposeSubscription = parent.source.subscribe(self) + + return Disposables.create(disposeTimer, disposeSubscription) + } +} + +final fileprivate class SkipTime: Producer { + let source: Observable + let duration: RxTimeInterval + let scheduler: SchedulerType + + init(source: Observable, duration: RxTimeInterval, scheduler: SchedulerType) { + self.source = source + self.scheduler = scheduler + self.duration = duration + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = SkipTimeSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift new file mode 100644 index 0000000..f35f1fd --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift @@ -0,0 +1,139 @@ +// +// SkipUntil.swift +// RxSwift +// +// Created by Yury Korolev on 10/3/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element. + + - seealso: [skipUntil operator on reactivex.io](http://reactivex.io/documentation/operators/skipuntil.html) + + - parameter other: Observable sequence that starts propagation of elements of the source sequence. + - returns: An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item. + */ + public func skipUntil(_ other: O) + -> Observable { + return SkipUntil(source: asObservable(), other: other.asObservable()) + } +} + +final fileprivate class SkipUntilSinkOther + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Parent = SkipUntilSink + typealias E = Other + + fileprivate let _parent: Parent + + var _lock: RecursiveLock { + return _parent._lock + } + + let _subscription = SingleAssignmentDisposable() + + init(parent: Parent) { + _parent = parent + #if TRACE_RESOURCES + let _ = Resources.incrementTotal() + #endif + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next: + _parent._forwardElements = true + _subscription.dispose() + case .error(let e): + _parent.forwardOn(.error(e)) + _parent.dispose() + case .completed: + _subscription.dispose() + } + } + + #if TRACE_RESOURCES + deinit { + let _ = Resources.decrementTotal() + } + #endif + +} + + +final fileprivate class SkipUntilSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = O.E + typealias Parent = SkipUntil + + let _lock = RecursiveLock() + fileprivate let _parent: Parent + fileprivate var _forwardElements = false + + fileprivate let _sourceSubscription = SingleAssignmentDisposable() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next: + if _forwardElements { + forwardOn(event) + } + case .error: + forwardOn(event) + self.dispose() + case .completed: + if _forwardElements { + forwardOn(event) + } + self.dispose() + } + } + + func run() -> Disposable { + let sourceSubscription = _parent._source.subscribe(self) + let otherObserver = SkipUntilSinkOther(parent: self) + let otherSubscription = _parent._other.subscribe(otherObserver) + _sourceSubscription.setDisposable(sourceSubscription) + otherObserver._subscription.setDisposable(otherSubscription) + + return Disposables.create(_sourceSubscription, otherObserver._subscription) + } +} + +final fileprivate class SkipUntil: Producer { + + fileprivate let _source: Observable + fileprivate let _other: Observable + + init(source: Observable, other: Observable) { + _source = source + _other = other + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = SkipUntilSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift new file mode 100644 index 0000000..4bb394b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift @@ -0,0 +1,77 @@ +// +// SkipWhile.swift +// RxSwift +// +// Created by Yury Korolev on 10/9/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. + + - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html) + + - parameter predicate: A function to test each element for a condition. + - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. + */ + public func skipWhile(_ predicate: @escaping (E) throws -> Bool) -> Observable { + return SkipWhile(source: asObservable(), predicate: predicate) + } +} + +final fileprivate class SkipWhileSink : Sink, ObserverType { + + typealias Element = O.E + typealias Parent = SkipWhile + + fileprivate let _parent: Parent + fileprivate var _running = false + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + if !_running { + do { + _running = try !_parent._predicate(value) + } catch let e { + forwardOn(.error(e)) + dispose() + return + } + } + + if _running { + forwardOn(.next(value)) + } + case .error, .completed: + forwardOn(event) + dispose() + } + } +} + +final fileprivate class SkipWhile: Producer { + typealias Predicate = (Element) throws -> Bool + typealias PredicateWithIndex = (Element, Int) throws -> Bool + + fileprivate let _source: Observable + fileprivate let _predicate: Predicate + + init(source: Observable, predicate: @escaping Predicate) { + _source = source + _predicate = predicate + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = SkipWhileSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/StartWith.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/StartWith.swift new file mode 100644 index 0000000..14776f9 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/StartWith.swift @@ -0,0 +1,42 @@ +// +// StartWith.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Prepends a sequence of values to an observable sequence. + + - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html) + + - parameter elements: Elements to prepend to the specified sequence. + - returns: The source sequence prepended with the specified values. + */ + public func startWith(_ elements: E ...) + -> Observable { + return StartWith(source: self.asObservable(), elements: elements) + } +} + +final fileprivate class StartWith: Producer { + let elements: [Element] + let source: Observable + + init(source: Observable, elements: [Element]) { + self.source = source + self.elements = elements + super.init() + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + for e in elements { + observer.on(.next(e)) + } + + return (sink: Disposables.create(), subscription: source.subscribe(observer)) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift new file mode 100644 index 0000000..2a33e03 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift @@ -0,0 +1,83 @@ +// +// SubscribeOn.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Wraps the source sequence in order to run its subscription and unsubscription logic on the specified + scheduler. + + This operation is not commonly used. + + This only performs the side-effects of subscription and unsubscription on the specified scheduler. + + In order to invoke observer callbacks on a `scheduler`, use `observeOn`. + + - seealso: [subscribeOn operator on reactivex.io](http://reactivex.io/documentation/operators/subscribeon.html) + + - parameter scheduler: Scheduler to perform subscription and unsubscription actions on. + - returns: The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. + */ + public func subscribeOn(_ scheduler: ImmediateSchedulerType) + -> Observable { + return SubscribeOn(source: self, scheduler: scheduler) + } +} + +final fileprivate class SubscribeOnSink : Sink, ObserverType where Ob.E == O.E { + typealias Element = O.E + typealias Parent = SubscribeOn + + let parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + self.parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + forwardOn(event) + + if event.isStopEvent { + self.dispose() + } + } + + func run() -> Disposable { + let disposeEverything = SerialDisposable() + let cancelSchedule = SingleAssignmentDisposable() + + disposeEverything.disposable = cancelSchedule + + let disposeSchedule = parent.scheduler.schedule(()) { (_) -> Disposable in + let subscription = self.parent.source.subscribe(self) + disposeEverything.disposable = ScheduledDisposable(scheduler: self.parent.scheduler, disposable: subscription) + return Disposables.create() + } + + cancelSchedule.setDisposable(disposeSchedule) + + return disposeEverything + } +} + +final fileprivate class SubscribeOn : Producer { + let source: Ob + let scheduler: ImmediateSchedulerType + + init(source: Ob, scheduler: ImmediateSchedulerType) { + self.source = source + self.scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Ob.E { + let sink = SubscribeOnSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Switch.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Switch.swift new file mode 100644 index 0000000..2da1000 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Switch.swift @@ -0,0 +1,233 @@ +// +// Switch.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Projects each element of an observable sequence into a new sequence of observable sequences and then + transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. + + It is a combination of `map` + `switchLatest` operator + + - seealso: [flatMapLatest operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html) + + - parameter selector: A transform function to apply to each element. + - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an + Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received. + */ + public func flatMapLatest(_ selector: @escaping (E) throws -> O) + -> Observable { + return FlatMapLatest(source: asObservable(), selector: selector) + } +} + +extension ObservableType where E : ObservableConvertibleType { + + /** + Transforms an observable sequence of observable sequences into an observable sequence + producing values only from the most recent observable sequence. + + Each time a new inner observable sequence is received, unsubscribe from the + previous inner observable sequence. + + - seealso: [switch operator on reactivex.io](http://reactivex.io/documentation/operators/switch.html) + + - returns: The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received. + */ + public func switchLatest() -> Observable { + return Switch(source: asObservable()) + } +} + +fileprivate class SwitchSink + : Sink + , ObserverType where S.E == O.E { + typealias E = SourceType + + fileprivate let _subscriptions: SingleAssignmentDisposable = SingleAssignmentDisposable() + fileprivate let _innerSubscription: SerialDisposable = SerialDisposable() + + let _lock = RecursiveLock() + + // state + fileprivate var _stopped = false + fileprivate var _latest = 0 + fileprivate var _hasLatest = false + + override init(observer: O, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + func run(_ source: Observable) -> Disposable { + let subscription = source.subscribe(self) + _subscriptions.setDisposable(subscription) + return Disposables.create(_subscriptions, _innerSubscription) + } + + func performMap(_ element: SourceType) throws -> S { + rxAbstractMethod() + } + + @inline(__always) + final private func nextElementArrived(element: E) -> (Int, Observable)? { + _lock.lock(); defer { _lock.unlock() } // { + do { + let observable = try performMap(element).asObservable() + _hasLatest = true + _latest = _latest &+ 1 + return (_latest, observable) + } + catch let error { + forwardOn(.error(error)) + dispose() + } + + return nil + // } + } + + func on(_ event: Event) { + switch event { + case .next(let element): + if let (latest, observable) = nextElementArrived(element: element) { + let d = SingleAssignmentDisposable() + _innerSubscription.disposable = d + + let observer = SwitchSinkIter(parent: self, id: latest, _self: d) + let disposable = observable.subscribe(observer) + d.setDisposable(disposable) + } + case .error(let error): + _lock.lock(); defer { _lock.unlock() } + forwardOn(.error(error)) + dispose() + case .completed: + _lock.lock(); defer { _lock.unlock() } + _stopped = true + + _subscriptions.dispose() + + if !_hasLatest { + forwardOn(.completed) + dispose() + } + } + } +} + +final fileprivate class SwitchSinkIter + : ObserverType + , LockOwnerType + , SynchronizedOnType where S.E == O.E { + typealias E = S.E + typealias Parent = SwitchSink + + fileprivate let _parent: Parent + fileprivate let _id: Int + fileprivate let _self: Disposable + + var _lock: RecursiveLock { + return _parent._lock + } + + init(parent: Parent, id: Int, _self: Disposable) { + _parent = parent + _id = id + self._self = _self + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next: break + case .error, .completed: + _self.dispose() + } + + if _parent._latest != _id { + return + } + + switch event { + case .next: + _parent.forwardOn(event) + case .error: + _parent.forwardOn(event) + _parent.dispose() + case .completed: + _parent._hasLatest = false + if _parent._stopped { + _parent.forwardOn(event) + _parent.dispose() + } + } + } +} + +// MARK: Specializations + +final fileprivate class SwitchIdentitySink : SwitchSink where O.E == S.E { + override init(observer: O, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + override func performMap(_ element: S) throws -> S { + return element + } +} + +final fileprivate class MapSwitchSink : SwitchSink where O.E == S.E { + typealias Selector = (SourceType) throws -> S + + fileprivate let _selector: Selector + + init(selector: @escaping Selector, observer: O, cancel: Cancelable) { + _selector = selector + super.init(observer: observer, cancel: cancel) + } + + override func performMap(_ element: SourceType) throws -> S { + return try _selector(element) + } +} + +// MARK: Producers + +final fileprivate class Switch : Producer { + fileprivate let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == S.E { + let sink = SwitchIdentitySink(observer: observer, cancel: cancel) + let subscription = sink.run(_source) + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class FlatMapLatest : Producer { + typealias Selector = (SourceType) throws -> S + + fileprivate let _source: Observable + fileprivate let _selector: Selector + + init(source: Observable, selector: @escaping Selector) { + _source = source + _selector = selector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == S.E { + let sink = MapSwitchSink(selector: _selector, observer: observer, cancel: cancel) + let subscription = sink.run(_source) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift new file mode 100644 index 0000000..0b10dc6 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift @@ -0,0 +1,104 @@ +// +// SwitchIfEmpty.swift +// RxSwift +// +// Created by sergdort on 23/12/2016. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Returns the elements of the specified sequence or `switchTo` sequence if the sequence is empty. + + - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html) + + - parameter switchTo: Observable sequence being returned when source sequence is empty. + - returns: Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements. + */ + public func ifEmpty(switchTo other: Observable) -> Observable { + return SwitchIfEmpty(source: asObservable(), ifEmpty: other) + } +} + +final fileprivate class SwitchIfEmpty: Producer { + + private let _source: Observable + private let _ifEmpty: Observable + + init(source: Observable, ifEmpty: Observable) { + _source = source + _ifEmpty = ifEmpty + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = SwitchIfEmptySink(ifEmpty: _ifEmpty, + observer: observer, + cancel: cancel) + let subscription = sink.run(_source.asObservable()) + + return (sink: sink, subscription: subscription) + } +} + +final fileprivate class SwitchIfEmptySink: Sink + , ObserverType { + typealias E = O.E + + private let _ifEmpty: Observable + private var _isEmpty = true + private let _ifEmptySubscription = SingleAssignmentDisposable() + + init(ifEmpty: Observable, observer: O, cancel: Cancelable) { + _ifEmpty = ifEmpty + super.init(observer: observer, cancel: cancel) + } + + func run(_ source: Observable) -> Disposable { + let subscription = source.subscribe(self) + return Disposables.create(subscription, _ifEmptySubscription) + } + + func on(_ event: Event) { + switch event { + case .next: + _isEmpty = false + forwardOn(event) + case .error: + forwardOn(event) + dispose() + case .completed: + guard _isEmpty else { + forwardOn(.completed) + dispose() + return + } + let ifEmptySink = SwitchIfEmptySinkIter(parent: self) + _ifEmptySubscription.setDisposable(_ifEmpty.subscribe(ifEmptySink)) + } + } +} + +final fileprivate class SwitchIfEmptySinkIter + : ObserverType { + typealias E = O.E + typealias Parent = SwitchIfEmptySink + + private let _parent: Parent + + init(parent: Parent) { + _parent = parent + } + + func on(_ event: Event) { + switch event { + case .next: + _parent.forwardOn(event) + case .error: + _parent.forwardOn(event) + _parent.dispose() + case .completed: + _parent.forwardOn(event) + _parent.dispose() + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Take.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Take.swift new file mode 100644 index 0000000..661f858 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Take.swift @@ -0,0 +1,180 @@ +// +// Take.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/12/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Returns a specified number of contiguous elements from the start of an observable sequence. + + - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html) + + - parameter count: The number of elements to return. + - returns: An observable sequence that contains the specified number of elements from the start of the input sequence. + */ + public func take(_ count: Int) + -> Observable { + if count == 0 { + return Observable.empty() + } + else { + return TakeCount(source: asObservable(), count: count) + } + } +} + +extension ObservableType { + + /** + Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. + + - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html) + + - parameter duration: Duration for taking elements from the start of the sequence. + - parameter scheduler: Scheduler to run the timer on. + - returns: An observable sequence with the elements taken during the specified duration from the start of the source sequence. + */ + public func take(_ duration: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return TakeTime(source: self.asObservable(), duration: duration, scheduler: scheduler) + } +} + +// count version + +final fileprivate class TakeCountSink : Sink, ObserverType { + typealias E = O.E + typealias Parent = TakeCount + + private let _parent: Parent + + private var _remaining: Int + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _remaining = parent._count + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + + if _remaining > 0 { + _remaining -= 1 + + forwardOn(.next(value)) + + if _remaining == 0 { + forwardOn(.completed) + dispose() + } + } + case .error: + forwardOn(event) + dispose() + case .completed: + forwardOn(event) + dispose() + } + } + +} + +final fileprivate class TakeCount: Producer { + fileprivate let _source: Observable + fileprivate let _count: Int + + init(source: Observable, count: Int) { + if count < 0 { + rxFatalError("count can't be negative") + } + _source = source + _count = count + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = TakeCountSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} + +// time version + +final fileprivate class TakeTimeSink + : Sink + , LockOwnerType + , ObserverType + , SynchronizedOnType where O.E == ElementType { + typealias Parent = TakeTime + typealias E = ElementType + + fileprivate let _parent: Parent + + let _lock = RecursiveLock() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next(let value): + forwardOn(.next(value)) + case .error: + forwardOn(event) + dispose() + case .completed: + forwardOn(event) + dispose() + } + } + + func tick() { + _lock.lock(); defer { _lock.unlock() } + + forwardOn(.completed) + dispose() + } + + func run() -> Disposable { + let disposeTimer = _parent._scheduler.scheduleRelative((), dueTime: _parent._duration) { _ in + self.tick() + return Disposables.create() + } + + let disposeSubscription = _parent._source.subscribe(self) + + return Disposables.create(disposeTimer, disposeSubscription) + } +} + +final fileprivate class TakeTime : Producer { + typealias TimeInterval = RxTimeInterval + + fileprivate let _source: Observable + fileprivate let _duration: TimeInterval + fileprivate let _scheduler: SchedulerType + + init(source: Observable, duration: TimeInterval, scheduler: SchedulerType) { + _source = source + _scheduler = scheduler + _duration = duration + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = TakeTimeSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeLast.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeLast.swift new file mode 100644 index 0000000..7bf1664 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeLast.swift @@ -0,0 +1,78 @@ +// +// TakeLast.swift +// RxSwift +// +// Created by Tomi Koskinen on 25/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Returns a specified number of contiguous elements from the end of an observable sequence. + + This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. + + - seealso: [takeLast operator on reactivex.io](http://reactivex.io/documentation/operators/takelast.html) + + - parameter count: Number of elements to take from the end of the source sequence. + - returns: An observable sequence containing the specified number of elements from the end of the source sequence. + */ + public func takeLast(_ count: Int) + -> Observable { + return TakeLast(source: asObservable(), count: count) + } +} + +final fileprivate class TakeLastSink : Sink, ObserverType { + typealias E = O.E + typealias Parent = TakeLast + + private let _parent: Parent + + private var _elements: Queue + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _elements = Queue(capacity: parent._count + 1) + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + _elements.enqueue(value) + if _elements.count > self._parent._count { + let _ = _elements.dequeue() + } + case .error: + forwardOn(event) + dispose() + case .completed: + for e in _elements { + forwardOn(.next(e)) + } + forwardOn(.completed) + dispose() + } + } +} + +final fileprivate class TakeLast: Producer { + fileprivate let _source: Observable + fileprivate let _count: Int + + init(source: Observable, count: Int) { + if count < 0 { + rxFatalError("count can't be negative") + } + _source = source + _count = count + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = TakeLastSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeUntil.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeUntil.swift new file mode 100644 index 0000000..f2e5f98 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeUntil.swift @@ -0,0 +1,131 @@ +// +// TakeUntil.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Returns the elements from the source observable sequence until the other observable sequence produces an element. + + - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html) + + - parameter other: Observable sequence that terminates propagation of elements of the source sequence. + - returns: An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. + */ + public func takeUntil(_ other: O) + -> Observable { + return TakeUntil(source: asObservable(), other: other.asObservable()) + } +} + +final fileprivate class TakeUntilSinkOther + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Parent = TakeUntilSink + typealias E = Other + + fileprivate let _parent: Parent + + var _lock: RecursiveLock { + return _parent._lock + } + + fileprivate let _subscription = SingleAssignmentDisposable() + + init(parent: Parent) { + _parent = parent +#if TRACE_RESOURCES + let _ = Resources.incrementTotal() +#endif + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next: + _parent.forwardOn(.completed) + _parent.dispose() + case .error(let e): + _parent.forwardOn(.error(e)) + _parent.dispose() + case .completed: + _subscription.dispose() + } + } + +#if TRACE_RESOURCES + deinit { + let _ = Resources.decrementTotal() + } +#endif +} + +final fileprivate class TakeUntilSink + : Sink + , LockOwnerType + , ObserverType + , SynchronizedOnType { + typealias E = O.E + typealias Parent = TakeUntil + + fileprivate let _parent: Parent + + let _lock = RecursiveLock() + + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next: + forwardOn(event) + case .error: + forwardOn(event) + dispose() + case .completed: + forwardOn(event) + dispose() + } + } + + func run() -> Disposable { + let otherObserver = TakeUntilSinkOther(parent: self) + let otherSubscription = _parent._other.subscribe(otherObserver) + otherObserver._subscription.setDisposable(otherSubscription) + let sourceSubscription = _parent._source.subscribe(self) + + return Disposables.create(sourceSubscription, otherObserver._subscription) + } +} + +final fileprivate class TakeUntil: Producer { + + fileprivate let _source: Observable + fileprivate let _other: Observable + + init(source: Observable, other: Observable) { + _source = source + _other = other + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = TakeUntilSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeWhile.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeWhile.swift new file mode 100644 index 0000000..2b7b551 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/TakeWhile.swift @@ -0,0 +1,85 @@ +// +// TakeWhile.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Returns elements from an observable sequence as long as a specified condition is true. + + - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html) + + - parameter predicate: A function to test each element for a condition. + - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. + */ + public func takeWhile(_ predicate: @escaping (E) throws -> Bool) + -> Observable { + return TakeWhile(source: asObservable(), predicate: predicate) + } +} + +final fileprivate class TakeWhileSink + : Sink + , ObserverType { + typealias Element = O.E + typealias Parent = TakeWhile + + fileprivate let _parent: Parent + + fileprivate var _running = true + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + if !_running { + return + } + + do { + _running = try _parent._predicate(value) + } catch let e { + forwardOn(.error(e)) + dispose() + return + } + + if _running { + forwardOn(.next(value)) + } else { + forwardOn(.completed) + dispose() + } + case .error, .completed: + forwardOn(event) + dispose() + } + } + +} + +final fileprivate class TakeWhile: Producer { + typealias Predicate = (Element) throws -> Bool + + fileprivate let _source: Observable + fileprivate let _predicate: Predicate + + init(source: Observable, predicate: @escaping Predicate) { + _source = source + _predicate = predicate + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = TakeWhileSink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Throttle.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Throttle.swift new file mode 100644 index 0000000..0c4ca74 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Throttle.swift @@ -0,0 +1,163 @@ +// +// Throttle.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.Date + +extension ObservableType { + + /** + Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration. + + This operator makes sure that no two elements are emitted in less then dueTime. + + - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html) + + - parameter dueTime: Throttling duration for each element. + - parameter latest: Should latest element received in a dueTime wide time window since last element emission be emitted. + - parameter scheduler: Scheduler to run the throttle timers on. + - returns: The throttled sequence. + */ + public func throttle(_ dueTime: RxTimeInterval, latest: Bool = true, scheduler: SchedulerType) + -> Observable { + return Throttle(source: self.asObservable(), dueTime: dueTime, latest: latest, scheduler: scheduler) + } +} + +final fileprivate class ThrottleSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias Element = O.E + typealias ParentType = Throttle + + private let _parent: ParentType + + let _lock = RecursiveLock() + + // state + private var _lastUnsentElement: Element? = nil + private var _lastSentTime: Date? = nil + private var _completed: Bool = false + + let cancellable = SerialDisposable() + + init(parent: ParentType, observer: O, cancel: Cancelable) { + _parent = parent + + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let subscription = _parent._source.subscribe(self) + + return Disposables.create(subscription, cancellable) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case .next(let element): + let now = _parent._scheduler.now + + let timeIntervalSinceLast: RxTimeInterval + + if let lastSendingTime = _lastSentTime { + timeIntervalSinceLast = now.timeIntervalSince(lastSendingTime) + } + else { + timeIntervalSinceLast = _parent._dueTime + } + + let couldSendNow = timeIntervalSinceLast >= _parent._dueTime + + if couldSendNow { + self.sendNow(element: element) + return + } + + if !_parent._latest { + return + } + + let isThereAlreadyInFlightRequest = _lastUnsentElement != nil + + _lastUnsentElement = element + + if isThereAlreadyInFlightRequest { + return + } + + let scheduler = _parent._scheduler + let dueTime = _parent._dueTime + + let d = SingleAssignmentDisposable() + self.cancellable.disposable = d + + d.setDisposable(scheduler.scheduleRelative(0, dueTime: dueTime - timeIntervalSinceLast, action: self.propagate)) + case .error: + _lastUnsentElement = nil + forwardOn(event) + dispose() + case .completed: + if let _ = _lastUnsentElement { + _completed = true + } + else { + forwardOn(.completed) + dispose() + } + } + } + + private func sendNow(element: Element) { + _lastUnsentElement = nil + self.forwardOn(.next(element)) + // in case element processing takes a while, this should give some more room + _lastSentTime = _parent._scheduler.now + } + + func propagate(_: Int) -> Disposable { + _lock.lock(); defer { _lock.unlock() } // { + if let lastUnsentElement = _lastUnsentElement { + sendNow(element: lastUnsentElement) + } + + if _completed { + forwardOn(.completed) + dispose() + } + // } + return Disposables.create() + } +} + +final fileprivate class Throttle : Producer { + + fileprivate let _source: Observable + fileprivate let _dueTime: RxTimeInterval + fileprivate let _latest: Bool + fileprivate let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, latest: Bool, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _latest = latest + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = ThrottleSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timeout.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timeout.swift new file mode 100644 index 0000000..7008de8 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timeout.swift @@ -0,0 +1,152 @@ +// +// Timeout.swift +// RxSwift +// +// Created by Tomi Koskinen on 13/11/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Applies a timeout policy for each element in the observable sequence. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutError is propagated to the observer. + + - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html) + + - parameter dueTime: Maximum duration between values before a timeout occurs. + - parameter scheduler: Scheduler to run the timeout timer on. + - returns: An observable sequence with a `RxError.timeout` in case of a timeout. + */ + public func timeout(_ dueTime: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return Timeout(source: self.asObservable(), dueTime: dueTime, other: Observable.error(RxError.timeout), scheduler: scheduler) + } + + /** + Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on. + + - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html) + + - parameter dueTime: Maximum duration between values before a timeout occurs. + - parameter other: Sequence to return in case of a timeout. + - parameter scheduler: Scheduler to run the timeout timer on. + - returns: The source sequence switching to the other sequence in case of a timeout. + */ + public func timeout(_ dueTime: RxTimeInterval, other: O, scheduler: SchedulerType) + -> Observable where E == O.E { + return Timeout(source: self.asObservable(), dueTime: dueTime, other: other.asObservable(), scheduler: scheduler) + } +} + +final fileprivate class TimeoutSink: Sink, LockOwnerType, ObserverType { + typealias E = O.E + typealias Parent = Timeout + + private let _parent: Parent + + let _lock = RecursiveLock() + + private let _timerD = SerialDisposable() + private let _subscription = SerialDisposable() + + private var _id = 0 + private var _switched = false + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let original = SingleAssignmentDisposable() + _subscription.disposable = original + + _createTimeoutTimer() + + original.setDisposable(_parent._source.subscribe(self)) + + return Disposables.create(_subscription, _timerD) + } + + func on(_ event: Event) { + switch event { + case .next: + var onNextWins = false + + _lock.performLocked() { + onNextWins = !self._switched + if onNextWins { + self._id = self._id &+ 1 + } + } + + if onNextWins { + forwardOn(event) + self._createTimeoutTimer() + } + case .error, .completed: + var onEventWins = false + + _lock.performLocked() { + onEventWins = !self._switched + if onEventWins { + self._id = self._id &+ 1 + } + } + + if onEventWins { + forwardOn(event) + self.dispose() + } + } + } + + private func _createTimeoutTimer() { + if _timerD.isDisposed { + return + } + + let nextTimer = SingleAssignmentDisposable() + _timerD.disposable = nextTimer + + let disposeSchedule = _parent._scheduler.scheduleRelative(_id, dueTime: _parent._dueTime) { state in + + var timerWins = false + + self._lock.performLocked() { + self._switched = (state == self._id) + timerWins = self._switched + } + + if timerWins { + self._subscription.disposable = self._parent._other.subscribe(self.forwarder()) + } + + return Disposables.create() + } + + nextTimer.setDisposable(disposeSchedule) + } +} + + +final fileprivate class Timeout : Producer { + + fileprivate let _source: Observable + fileprivate let _dueTime: RxTimeInterval + fileprivate let _other: Observable + fileprivate let _scheduler: SchedulerType + + init(source: Observable, dueTime: RxTimeInterval, other: Observable, scheduler: SchedulerType) { + _source = source + _dueTime = dueTime + _other = other + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element { + let sink = TimeoutSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timer.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timer.swift new file mode 100644 index 0000000..dec69e1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Timer.swift @@ -0,0 +1,111 @@ +// +// Timer.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType where E : RxAbstractInteger { + /** + Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages. + + - seealso: [interval operator on reactivex.io](http://reactivex.io/documentation/operators/interval.html) + + - parameter period: Period for producing the values in the resulting sequence. + - parameter scheduler: Scheduler to run the timer on. + - returns: An observable sequence that produces a value after each period. + */ + public static func interval(_ period: RxTimeInterval, scheduler: SchedulerType) + -> Observable { + return Timer(dueTime: period, + period: period, + scheduler: scheduler + ) + } +} + +extension ObservableType where E: RxAbstractInteger { + /** + Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers. + + - seealso: [timer operator on reactivex.io](http://reactivex.io/documentation/operators/timer.html) + + - parameter dueTime: Relative time at which to produce the first value. + - parameter period: Period to produce subsequent values. + - parameter scheduler: Scheduler to run timers on. + - returns: An observable sequence that produces a value after due time has elapsed and then each period. + */ + public static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval? = nil, scheduler: SchedulerType) + -> Observable { + return Timer( + dueTime: dueTime, + period: period, + scheduler: scheduler + ) + } +} + +final fileprivate class TimerSink : Sink where O.E : RxAbstractInteger { + typealias Parent = Timer + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + return _parent._scheduler.schedulePeriodic(0 as O.E, startAfter: _parent._dueTime, period: _parent._period!) { state in + self.forwardOn(.next(state)) + return state &+ 1 + } + } +} + +final fileprivate class TimerOneOffSink : Sink where O.E : RxAbstractInteger { + typealias Parent = Timer + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + return _parent._scheduler.scheduleRelative(self, dueTime: _parent._dueTime) { (`self`) -> Disposable in + self.forwardOn(.next(0)) + self.forwardOn(.completed) + self.dispose() + + return Disposables.create() + } + } +} + +final fileprivate class Timer: Producer { + fileprivate let _scheduler: SchedulerType + fileprivate let _dueTime: RxTimeInterval + fileprivate let _period: RxTimeInterval? + + init(dueTime: RxTimeInterval, period: RxTimeInterval?, scheduler: SchedulerType) { + _scheduler = scheduler + _dueTime = dueTime + _period = period + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + if let _ = _period { + let sink = TimerSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } + else { + let sink = TimerOneOffSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ToArray.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ToArray.swift new file mode 100644 index 0000000..93fcb80 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/ToArray.swift @@ -0,0 +1,66 @@ +// +// ToArray.swift +// RxSwift +// +// Created by Junior B. on 20/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + + +extension ObservableType { + + /** + Converts an Observable into another Observable that emits the whole sequence as a single array and then terminates. + + For aggregation behavior see `reduce`. + + - seealso: [toArray operator on reactivex.io](http://reactivex.io/documentation/operators/to.html) + + - returns: An observable sequence containing all the emitted elements as array. + */ + public func toArray() + -> Observable<[E]> { + return ToArray(source: self.asObservable()) + } +} + +final fileprivate class ToArraySink : Sink, ObserverType where O.E == [SourceType] { + typealias Parent = ToArray + + let _parent: Parent + var _list = Array() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event) { + switch event { + case .next(let value): + self._list.append(value) + case .error(let e): + forwardOn(.error(e)) + self.dispose() + case .completed: + forwardOn(.next(_list)) + forwardOn(.completed) + self.dispose() + } + } +} + +final fileprivate class ToArray : Producer<[SourceType]> { + let _source: Observable + + init(source: Observable) { + _source = source + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == [SourceType] { + let sink = ToArraySink(parent: self, observer: observer, cancel: cancel) + let subscription = _source.subscribe(sink) + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Using.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Using.swift new file mode 100644 index 0000000..8ea8326 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Using.swift @@ -0,0 +1,90 @@ +// +// Using.swift +// RxSwift +// +// Created by Yury Korolev on 10/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. + + - seealso: [using operator on reactivex.io](http://reactivex.io/documentation/operators/using.html) + + - parameter resourceFactory: Factory function to obtain a resource object. + - parameter observableFactory: Factory function to obtain an observable sequence that depends on the obtained resource. + - returns: An observable sequence whose lifetime controls the lifetime of the dependent resource object. + */ + public static func using(_ resourceFactory: @escaping () throws -> Resource, observableFactory: @escaping (Resource) throws -> Observable) -> Observable { + return Using(resourceFactory: resourceFactory, observableFactory: observableFactory) + } +} + +final fileprivate class UsingSink : Sink, ObserverType { + typealias SourceType = O.E + typealias Parent = Using + + private let _parent: Parent + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + var disposable = Disposables.create() + + do { + let resource = try _parent._resourceFactory() + disposable = resource + let source = try _parent._observableFactory(resource) + + return Disposables.create( + source.subscribe(self), + disposable + ) + } catch let error { + return Disposables.create( + Observable.error(error).subscribe(self), + disposable + ) + } + } + + func on(_ event: Event) { + switch event { + case let .next(value): + forwardOn(.next(value)) + case let .error(error): + forwardOn(.error(error)) + dispose() + case .completed: + forwardOn(.completed) + dispose() + } + } +} + +final fileprivate class Using: Producer { + + typealias E = SourceType + + typealias ResourceFactory = () throws -> ResourceType + typealias ObservableFactory = (ResourceType) throws -> Observable + + fileprivate let _resourceFactory: ResourceFactory + fileprivate let _observableFactory: ObservableFactory + + + init(resourceFactory: @escaping ResourceFactory, observableFactory: @escaping ObservableFactory) { + _resourceFactory = resourceFactory + _observableFactory = observableFactory + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == E { + let sink = UsingSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Window.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Window.swift new file mode 100644 index 0000000..c862dfb --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Window.swift @@ -0,0 +1,170 @@ +// +// Window.swift +// RxSwift +// +// Created by Junior B. on 29/10/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Projects each element of an observable sequence into a window that is completed when either it’s full or a given amount of time has elapsed. + + - seealso: [window operator on reactivex.io](http://reactivex.io/documentation/operators/window.html) + + - parameter timeSpan: Maximum time length of a window. + - parameter count: Maximum element count of a window. + - parameter scheduler: Scheduler to run windowing timers on. + - returns: An observable sequence of windows (instances of `Observable`). + */ + public func window(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) + -> Observable> { + return WindowTimeCount(source: self.asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler) + } +} + +final fileprivate class WindowTimeCountSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType where O.E == Observable { + typealias Parent = WindowTimeCount + typealias E = Element + + private let _parent: Parent + + let _lock = RecursiveLock() + + private var _subject = PublishSubject() + private var _count = 0 + private var _windowId = 0 + + private let _timerD = SerialDisposable() + private let _refCountDisposable: RefCountDisposable + private let _groupDisposable = CompositeDisposable() + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + + let _ = _groupDisposable.insert(_timerD) + + _refCountDisposable = RefCountDisposable(disposable: _groupDisposable) + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + + forwardOn(.next(AddRef(source: _subject, refCount: _refCountDisposable).asObservable())) + createTimer(_windowId) + + let _ = _groupDisposable.insert(_parent._source.subscribe(self)) + return _refCountDisposable + } + + func startNewWindowAndCompleteCurrentOne() { + _subject.on(.completed) + _subject = PublishSubject() + + forwardOn(.next(AddRef(source: _subject, refCount: _refCountDisposable).asObservable())) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + var newWindow = false + var newId = 0 + + switch event { + case .next(let element): + _subject.on(.next(element)) + + do { + let _ = try incrementChecked(&_count) + } catch (let e) { + _subject.on(.error(e as Swift.Error)) + dispose() + } + + if (_count == _parent._count) { + newWindow = true + _count = 0 + _windowId += 1 + newId = _windowId + self.startNewWindowAndCompleteCurrentOne() + } + + case .error(let error): + _subject.on(.error(error)) + forwardOn(.error(error)) + dispose() + case .completed: + _subject.on(.completed) + forwardOn(.completed) + dispose() + } + + if newWindow { + createTimer(newId) + } + } + + func createTimer(_ windowId: Int) { + if _timerD.isDisposed { + return + } + + if _windowId != windowId { + return + } + + let nextTimer = SingleAssignmentDisposable() + + _timerD.disposable = nextTimer + + let scheduledRelative = _parent._scheduler.scheduleRelative(windowId, dueTime: _parent._timeSpan) { previousWindowId in + + var newId = 0 + + self._lock.performLocked { + if previousWindowId != self._windowId { + return + } + + self._count = 0 + self._windowId = self._windowId &+ 1 + newId = self._windowId + self.startNewWindowAndCompleteCurrentOne() + } + + self.createTimer(newId) + + return Disposables.create() + } + + nextTimer.setDisposable(scheduledRelative) + } +} + +final fileprivate class WindowTimeCount : Producer> { + + fileprivate let _timeSpan: RxTimeInterval + fileprivate let _count: Int + fileprivate let _scheduler: SchedulerType + fileprivate let _source: Observable + + init(source: Observable, timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) { + _source = source + _timeSpan = timeSpan + _count = count + _scheduler = scheduler + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Observable { + let sink = WindowTimeCountSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift new file mode 100644 index 0000000..bd22e2f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift @@ -0,0 +1,149 @@ +// +// WithLatestFrom.swift +// RxSwift +// +// Created by Yury Korolev on 10/19/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + + /** + Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter second: Second observable source. + - parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any. + - returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function. + */ + public func withLatestFrom(_ second: SecondO, resultSelector: @escaping (E, SecondO.E) throws -> ResultType) -> Observable { + return WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: resultSelector) + } + + /** + Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emits an element. + + - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html) + + - parameter second: Second observable source. + - returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function. + */ + public func withLatestFrom(_ second: SecondO) -> Observable { + return WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: { $1 }) + } +} + +final fileprivate class WithLatestFromSink + : Sink + , ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias ResultType = O.E + typealias Parent = WithLatestFrom + typealias E = FirstType + + fileprivate let _parent: Parent + + var _lock = RecursiveLock() + fileprivate var _latest: SecondType? + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + + super.init(observer: observer, cancel: cancel) + } + + func run() -> Disposable { + let sndSubscription = SingleAssignmentDisposable() + let sndO = WithLatestFromSecond(parent: self, disposable: sndSubscription) + + sndSubscription.setDisposable(_parent._second.subscribe(sndO)) + let fstSubscription = _parent._first.subscribe(self) + + return Disposables.create(fstSubscription, sndSubscription) + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case let .next(value): + guard let latest = _latest else { return } + do { + let res = try _parent._resultSelector(value, latest) + + forwardOn(.next(res)) + } catch let e { + forwardOn(.error(e)) + dispose() + } + case .completed: + forwardOn(.completed) + dispose() + case let .error(error): + forwardOn(.error(error)) + dispose() + } + } +} + +final fileprivate class WithLatestFromSecond + : ObserverType + , LockOwnerType + , SynchronizedOnType { + + typealias ResultType = O.E + typealias Parent = WithLatestFromSink + typealias E = SecondType + + private let _parent: Parent + private let _disposable: Disposable + + var _lock: RecursiveLock { + return _parent._lock + } + + init(parent: Parent, disposable: Disposable) { + _parent = parent + _disposable = disposable + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + switch event { + case let .next(value): + _parent._latest = value + case .completed: + _disposable.dispose() + case let .error(error): + _parent.forwardOn(.error(error)) + _parent.dispose() + } + } +} + +final fileprivate class WithLatestFrom: Producer { + typealias ResultSelector = (FirstType, SecondType) throws -> ResultType + + fileprivate let _first: Observable + fileprivate let _second: Observable + fileprivate let _resultSelector: ResultSelector + + init(first: Observable, second: Observable, resultSelector: @escaping ResultSelector) { + _first = first + _second = second + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == ResultType { + let sink = WithLatestFromSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift new file mode 100644 index 0000000..11f25fc --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift @@ -0,0 +1,169 @@ +// +// Zip+Collection.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip(_ collection: C, _ resultSelector: @escaping ([C.Iterator.Element.E]) throws -> E) -> Observable + where C.Iterator.Element: ObservableType { + return ZipCollectionType(sources: collection, resultSelector: resultSelector) + } + + /** + Merges the specified observable sequences into one observable sequence whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip(_ collection: C) -> Observable<[E]> + where C.Iterator.Element: ObservableType, C.Iterator.Element.E == E { + return ZipCollectionType(sources: collection, resultSelector: { $0 }) + } + +} + +final fileprivate class ZipCollectionTypeSink + : Sink where C.Iterator.Element : ObservableConvertibleType { + typealias R = O.E + typealias Parent = ZipCollectionType + typealias SourceElement = C.Iterator.Element.E + + private let _parent: Parent + + private let _lock = RecursiveLock() + + // state + private var _numberOfValues = 0 + private var _values: [Queue] + private var _isDone: [Bool] + private var _numberOfDone = 0 + private var _subscriptions: [SingleAssignmentDisposable] + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + _values = [Queue](repeating: Queue(capacity: 4), count: parent.count) + _isDone = [Bool](repeating: false, count: parent.count) + _subscriptions = Array() + _subscriptions.reserveCapacity(parent.count) + + for _ in 0 ..< parent.count { + _subscriptions.append(SingleAssignmentDisposable()) + } + + super.init(observer: observer, cancel: cancel) + } + + func on(_ event: Event, atIndex: Int) { + _lock.lock(); defer { _lock.unlock() } // { + switch event { + case .next(let element): + _values[atIndex].enqueue(element) + + if _values[atIndex].count == 1 { + _numberOfValues += 1 + } + + if _numberOfValues < _parent.count { + if _numberOfDone == _parent.count - 1 { + self.forwardOn(.completed) + self.dispose() + } + return + } + + do { + var arguments = [SourceElement]() + arguments.reserveCapacity(_parent.count) + + // recalculate number of values + _numberOfValues = 0 + + for i in 0 ..< _values.count { + arguments.append(_values[i].dequeue()!) + if _values[i].count > 0 { + _numberOfValues += 1 + } + } + + let result = try _parent.resultSelector(arguments) + self.forwardOn(.next(result)) + } + catch let error { + self.forwardOn(.error(error)) + self.dispose() + } + + case .error(let error): + self.forwardOn(.error(error)) + self.dispose() + case .completed: + if _isDone[atIndex] { + return + } + + _isDone[atIndex] = true + _numberOfDone += 1 + + if _numberOfDone == _parent.count { + self.forwardOn(.completed) + self.dispose() + } + else { + _subscriptions[atIndex].dispose() + } + } + // } + } + + func run() -> Disposable { + var j = 0 + for i in _parent.sources { + let index = j + let source = i.asObservable() + + let disposable = source.subscribe(AnyObserver { event in + self.on(event, atIndex: index) + }) + _subscriptions[j].setDisposable(disposable) + j += 1 + } + + if _parent.sources.isEmpty { + self.forwardOn(.completed) + } + + return Disposables.create(_subscriptions) + } +} + +final fileprivate class ZipCollectionType : Producer where C.Iterator.Element : ObservableConvertibleType { + typealias ResultSelector = ([C.Iterator.Element.E]) throws -> R + + let sources: C + let resultSelector: ResultSelector + let count: Int + + init(sources: C, resultSelector: @escaping ResultSelector) { + self.sources = sources + self.resultSelector = resultSelector + self.count = Int(Int64(self.sources.count)) + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipCollectionTypeSink(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift new file mode 100644 index 0000000..04bf68f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift @@ -0,0 +1,948 @@ +// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project +// +// Zip+arity.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + + + +// 2 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.E, O2.E) throws -> E) + -> Observable { + return Zip2( + source1: source1.asObservable(), source2: source2.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2) + -> Observable<(O1.E, O2.E)> { + return Zip2( + source1: source1.asObservable(), source2: source2.asObservable(), + resultSelector: { ($0, $1) } + ) + } +} + +final class ZipSink2_ : ZipSink { + typealias R = O.E + typealias Parent = Zip2 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 2, observer: observer, cancel: cancel) + } + + override func hasElements(_ index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + + subscription1.setDisposable(_parent.source1.subscribe(observer1)) + subscription2.setDisposable(_parent.source2.subscribe(observer2)) + + return Disposables.create([ + subscription1, + subscription2 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!) + } +} + +final class Zip2 : Producer { + typealias ResultSelector = (E1, E2) throws -> R + + let source1: Observable + let source2: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, resultSelector: @escaping ResultSelector) { + self.source1 = source1 + self.source2 = source2 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipSink2_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 3 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.E, O2.E, O3.E) throws -> E) + -> Observable { + return Zip3( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3) + -> Observable<(O1.E, O2.E, O3.E)> { + return Zip3( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), + resultSelector: { ($0, $1, $2) } + ) + } +} + +final class ZipSink3_ : ZipSink { + typealias R = O.E + typealias Parent = Zip3 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 3, observer: observer, cancel: cancel) + } + + override func hasElements(_ index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + + subscription1.setDisposable(_parent.source1.subscribe(observer1)) + subscription2.setDisposable(_parent.source2.subscribe(observer2)) + subscription3.setDisposable(_parent.source3.subscribe(observer3)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!) + } +} + +final class Zip3 : Producer { + typealias ResultSelector = (E1, E2, E3) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, resultSelector: @escaping ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipSink3_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 4 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E) throws -> E) + -> Observable { + return Zip4( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4) + -> Observable<(O1.E, O2.E, O3.E, O4.E)> { + return Zip4( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), + resultSelector: { ($0, $1, $2, $3) } + ) + } +} + +final class ZipSink4_ : ZipSink { + typealias R = O.E + typealias Parent = Zip4 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 4, observer: observer, cancel: cancel) + } + + override func hasElements(_ index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + + subscription1.setDisposable(_parent.source1.subscribe(observer1)) + subscription2.setDisposable(_parent.source2.subscribe(observer2)) + subscription3.setDisposable(_parent.source3.subscribe(observer3)) + subscription4.setDisposable(_parent.source4.subscribe(observer4)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!) + } +} + +final class Zip4 : Producer { + typealias ResultSelector = (E1, E2, E3, E4) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, resultSelector: @escaping ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipSink4_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 5 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E) throws -> E) + -> Observable { + return Zip5( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E)> { + return Zip5( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4) } + ) + } +} + +final class ZipSink5_ : ZipSink { + typealias R = O.E + typealias Parent = Zip5 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 5, observer: observer, cancel: cancel) + } + + override func hasElements(_ index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + + subscription1.setDisposable(_parent.source1.subscribe(observer1)) + subscription2.setDisposable(_parent.source2.subscribe(observer2)) + subscription3.setDisposable(_parent.source3.subscribe(observer3)) + subscription4.setDisposable(_parent.source4.subscribe(observer4)) + subscription5.setDisposable(_parent.source5.subscribe(observer5)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!) + } +} + +final class Zip5 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, resultSelector: @escaping ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipSink5_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 6 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E) throws -> E) + -> Observable { + return Zip6( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E, O6.E)> { + return Zip6( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4, $5) } + ) + } +} + +final class ZipSink6_ : ZipSink { + typealias R = O.E + typealias Parent = Zip6 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + var _values6: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 6, observer: observer, cancel: cancel) + } + + override func hasElements(_ index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + case 5: return _values6.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + let observer6 = ZipObserver(lock: _lock, parent: self, index: 5, setNextValue: { self._values6.enqueue($0) }, this: subscription6) + + subscription1.setDisposable(_parent.source1.subscribe(observer1)) + subscription2.setDisposable(_parent.source2.subscribe(observer2)) + subscription3.setDisposable(_parent.source3.subscribe(observer3)) + subscription4.setDisposable(_parent.source4.subscribe(observer4)) + subscription5.setDisposable(_parent.source5.subscribe(observer5)) + subscription6.setDisposable(_parent.source6.subscribe(observer6)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!, _values6.dequeue()!) + } +} + +final class Zip6 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + let source6: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, resultSelector: @escaping ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + self.source6 = source6 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipSink6_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 7 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E) throws -> E) + -> Observable { + return Zip7( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E)> { + return Zip7( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4, $5, $6) } + ) + } +} + +final class ZipSink7_ : ZipSink { + typealias R = O.E + typealias Parent = Zip7 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + var _values6: Queue = Queue(capacity: 2) + var _values7: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 7, observer: observer, cancel: cancel) + } + + override func hasElements(_ index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + case 5: return _values6.count > 0 + case 6: return _values7.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + let observer6 = ZipObserver(lock: _lock, parent: self, index: 5, setNextValue: { self._values6.enqueue($0) }, this: subscription6) + let observer7 = ZipObserver(lock: _lock, parent: self, index: 6, setNextValue: { self._values7.enqueue($0) }, this: subscription7) + + subscription1.setDisposable(_parent.source1.subscribe(observer1)) + subscription2.setDisposable(_parent.source2.subscribe(observer2)) + subscription3.setDisposable(_parent.source3.subscribe(observer3)) + subscription4.setDisposable(_parent.source4.subscribe(observer4)) + subscription5.setDisposable(_parent.source5.subscribe(observer5)) + subscription6.setDisposable(_parent.source6.subscribe(observer6)) + subscription7.setDisposable(_parent.source7.subscribe(observer7)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!, _values6.dequeue()!, _values7.dequeue()!) + } +} + +final class Zip7 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + let source6: Observable + let source7: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, resultSelector: @escaping ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + self.source6 = source6 + self.source7 = source7 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipSink7_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + + +// 8 + +extension ObservableType { + /** + Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources. + - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E) throws -> E) + -> Observable { + return Zip8( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(), + resultSelector: resultSelector + ) + } +} + +extension ObservableType where E == Any { + /** + Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index. + + - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html) + + - returns: An observable sequence containing the result of combining elements of the sources. + */ + public static func zip + (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8) + -> Observable<(O1.E, O2.E, O3.E, O4.E, O5.E, O6.E, O7.E, O8.E)> { + return Zip8( + source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(), + resultSelector: { ($0, $1, $2, $3, $4, $5, $6, $7) } + ) + } +} + +final class ZipSink8_ : ZipSink { + typealias R = O.E + typealias Parent = Zip8 + + let _parent: Parent + + var _values1: Queue = Queue(capacity: 2) + var _values2: Queue = Queue(capacity: 2) + var _values3: Queue = Queue(capacity: 2) + var _values4: Queue = Queue(capacity: 2) + var _values5: Queue = Queue(capacity: 2) + var _values6: Queue = Queue(capacity: 2) + var _values7: Queue = Queue(capacity: 2) + var _values8: Queue = Queue(capacity: 2) + + init(parent: Parent, observer: O, cancel: Cancelable) { + _parent = parent + super.init(arity: 8, observer: observer, cancel: cancel) + } + + override func hasElements(_ index: Int) -> Bool { + switch (index) { + case 0: return _values1.count > 0 + case 1: return _values2.count > 0 + case 2: return _values3.count > 0 + case 3: return _values4.count > 0 + case 4: return _values5.count > 0 + case 5: return _values6.count > 0 + case 6: return _values7.count > 0 + case 7: return _values8.count > 0 + + default: + rxFatalError("Unhandled case (Function)") + } + + return false + } + + func run() -> Disposable { + let subscription1 = SingleAssignmentDisposable() + let subscription2 = SingleAssignmentDisposable() + let subscription3 = SingleAssignmentDisposable() + let subscription4 = SingleAssignmentDisposable() + let subscription5 = SingleAssignmentDisposable() + let subscription6 = SingleAssignmentDisposable() + let subscription7 = SingleAssignmentDisposable() + let subscription8 = SingleAssignmentDisposable() + + let observer1 = ZipObserver(lock: _lock, parent: self, index: 0, setNextValue: { self._values1.enqueue($0) }, this: subscription1) + let observer2 = ZipObserver(lock: _lock, parent: self, index: 1, setNextValue: { self._values2.enqueue($0) }, this: subscription2) + let observer3 = ZipObserver(lock: _lock, parent: self, index: 2, setNextValue: { self._values3.enqueue($0) }, this: subscription3) + let observer4 = ZipObserver(lock: _lock, parent: self, index: 3, setNextValue: { self._values4.enqueue($0) }, this: subscription4) + let observer5 = ZipObserver(lock: _lock, parent: self, index: 4, setNextValue: { self._values5.enqueue($0) }, this: subscription5) + let observer6 = ZipObserver(lock: _lock, parent: self, index: 5, setNextValue: { self._values6.enqueue($0) }, this: subscription6) + let observer7 = ZipObserver(lock: _lock, parent: self, index: 6, setNextValue: { self._values7.enqueue($0) }, this: subscription7) + let observer8 = ZipObserver(lock: _lock, parent: self, index: 7, setNextValue: { self._values8.enqueue($0) }, this: subscription8) + + subscription1.setDisposable(_parent.source1.subscribe(observer1)) + subscription2.setDisposable(_parent.source2.subscribe(observer2)) + subscription3.setDisposable(_parent.source3.subscribe(observer3)) + subscription4.setDisposable(_parent.source4.subscribe(observer4)) + subscription5.setDisposable(_parent.source5.subscribe(observer5)) + subscription6.setDisposable(_parent.source6.subscribe(observer6)) + subscription7.setDisposable(_parent.source7.subscribe(observer7)) + subscription8.setDisposable(_parent.source8.subscribe(observer8)) + + return Disposables.create([ + subscription1, + subscription2, + subscription3, + subscription4, + subscription5, + subscription6, + subscription7, + subscription8 + ]) + } + + override func getResult() throws -> R { + return try _parent._resultSelector(_values1.dequeue()!, _values2.dequeue()!, _values3.dequeue()!, _values4.dequeue()!, _values5.dequeue()!, _values6.dequeue()!, _values7.dequeue()!, _values8.dequeue()!) + } +} + +final class Zip8 : Producer { + typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7, E8) throws -> R + + let source1: Observable + let source2: Observable + let source3: Observable + let source4: Observable + let source5: Observable + let source6: Observable + let source7: Observable + let source8: Observable + + let _resultSelector: ResultSelector + + init(source1: Observable, source2: Observable, source3: Observable, source4: Observable, source5: Observable, source6: Observable, source7: Observable, source8: Observable, resultSelector: @escaping ResultSelector) { + self.source1 = source1 + self.source2 = source2 + self.source3 = source3 + self.source4 = source4 + self.source5 = source5 + self.source6 = source6 + self.source7 = source7 + self.source8 = source8 + + _resultSelector = resultSelector + } + + override func run(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == R { + let sink = ZipSink8_(parent: self, observer: observer, cancel: cancel) + let subscription = sink.run() + return (sink: sink, subscription: subscription) + } +} + + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip.swift new file mode 100644 index 0000000..a283bf2 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observables/Zip.swift @@ -0,0 +1,155 @@ +// +// Zip.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol ZipSinkProtocol : class +{ + func next(_ index: Int) + func fail(_ error: Swift.Error) + func done(_ index: Int) +} + +class ZipSink : Sink, ZipSinkProtocol { + typealias Element = O.E + + let _arity: Int + + let _lock = RecursiveLock() + + // state + private var _isDone: [Bool] + + init(arity: Int, observer: O, cancel: Cancelable) { + _isDone = [Bool](repeating: false, count: arity) + _arity = arity + + super.init(observer: observer, cancel: cancel) + } + + func getResult() throws -> Element { + rxAbstractMethod() + } + + func hasElements(_ index: Int) -> Bool { + rxAbstractMethod() + } + + func next(_ index: Int) { + var hasValueAll = true + + for i in 0 ..< _arity { + if !hasElements(i) { + hasValueAll = false + break + } + } + + if hasValueAll { + do { + let result = try getResult() + self.forwardOn(.next(result)) + } + catch let e { + self.forwardOn(.error(e)) + dispose() + } + } + else { + var allOthersDone = true + + let arity = _isDone.count + for i in 0 ..< arity { + if i != index && !_isDone[i] { + allOthersDone = false + break + } + } + + if allOthersDone { + forwardOn(.completed) + self.dispose() + } + } + } + + func fail(_ error: Swift.Error) { + forwardOn(.error(error)) + dispose() + } + + func done(_ index: Int) { + _isDone[index] = true + + var allDone = true + + for done in _isDone { + if !done { + allDone = false + break + } + } + + if allDone { + forwardOn(.completed) + dispose() + } + } +} + +final class ZipObserver + : ObserverType + , LockOwnerType + , SynchronizedOnType { + typealias E = ElementType + typealias ValueSetter = (ElementType) -> () + + private var _parent: ZipSinkProtocol? + + let _lock: RecursiveLock + + // state + private let _index: Int + private let _this: Disposable + private let _setNextValue: ValueSetter + + init(lock: RecursiveLock, parent: ZipSinkProtocol, index: Int, setNextValue: @escaping ValueSetter, this: Disposable) { + _lock = lock + _parent = parent + _index = index + _this = this + _setNextValue = setNextValue + } + + func on(_ event: Event) { + synchronizedOn(event) + } + + func _synchronized_on(_ event: Event) { + if let _ = _parent { + switch event { + case .next(_): + break + case .error(_): + _this.dispose() + case .completed: + _this.dispose() + } + } + + if let parent = _parent { + switch event { + case .next(let value): + _setNextValue(value) + parent.next(_index) + case .error(let error): + parent.fail(error) + case .completed: + parent.done(_index) + } + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObserverType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObserverType.swift new file mode 100644 index 0000000..e3ed7aa --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/ObserverType.swift @@ -0,0 +1,40 @@ +// +// ObserverType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Supports push-style iteration over an observable sequence. +public protocol ObserverType { + /// The type of elements in sequence that observer can observe. + associatedtype E + + /// Notify observer about sequence event. + /// + /// - parameter event: Event that occurred. + func on(_ event: Event) +} + +/// Convenience API extensions to provide alternate next, error, completed events +extension ObserverType { + + /// Convenience method equivalent to `on(.next(element: E))` + /// + /// - parameter element: Next element to send to observer(s) + public func onNext(_ element: E) { + on(.next(element)) + } + + /// Convenience method equivalent to `on(.completed)` + public func onCompleted() { + on(.completed) + } + + /// Convenience method equivalent to `on(.error(Swift.Error))` + /// - parameter error: Swift.Error to send to observer(s) + public func onError(_ error: Swift.Error) { + on(.error(error)) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift new file mode 100644 index 0000000..54e83f5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift @@ -0,0 +1,32 @@ +// +// AnonymousObserver.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +final class AnonymousObserver : ObserverBase { + typealias Element = ElementType + + typealias EventHandler = (Event) -> Void + + private let _eventHandler : EventHandler + + init(_ eventHandler: @escaping EventHandler) { +#if TRACE_RESOURCES + let _ = Resources.incrementTotal() +#endif + _eventHandler = eventHandler + } + + override func onCore(_ event: Event) { + return _eventHandler(event) + } + +#if TRACE_RESOURCES + deinit { + let _ = Resources.decrementTotal() + } +#endif +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift new file mode 100644 index 0000000..3811565 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift @@ -0,0 +1,34 @@ +// +// ObserverBase.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/15/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +class ObserverBase : Disposable, ObserverType { + typealias E = ElementType + + private var _isStopped: AtomicInt = 0 + + func on(_ event: Event) { + switch event { + case .next: + if _isStopped == 0 { + onCore(event) + } + case .error, .completed: + if AtomicCompareAndSwap(0, 1, &_isStopped) { + onCore(event) + } + } + } + + func onCore(_ event: Event) { + rxAbstractMethod() + } + + func dispose() { + _ = AtomicCompareAndSwap(0, 1, &_isStopped) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift new file mode 100644 index 0000000..48a599d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift @@ -0,0 +1,151 @@ +// +// TailRecursiveSink.swift +// RxSwift +// +// Created by Krunoslav Zaher on 3/21/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +enum TailRecursiveSinkCommand { + case moveNext + case dispose +} + +#if DEBUG || TRACE_RESOURCES + public var maxTailRecursiveSinkStackSize = 0 +#endif + +/// This class is usually used with `Generator` version of the operators. +class TailRecursiveSink + : Sink + , InvocableWithValueType where S.Iterator.Element: ObservableConvertibleType, S.Iterator.Element.E == O.E { + typealias Value = TailRecursiveSinkCommand + typealias E = O.E + typealias SequenceGenerator = (generator: S.Iterator, remaining: IntMax?) + + var _generators: [SequenceGenerator] = [] + var _isDisposed = false + var _subscription = SerialDisposable() + + // this is thread safe object + var _gate = AsyncLock>>() + + override init(observer: O, cancel: Cancelable) { + super.init(observer: observer, cancel: cancel) + } + + func run(_ sources: SequenceGenerator) -> Disposable { + _generators.append(sources) + + schedule(.moveNext) + + return _subscription + } + + func invoke(_ command: TailRecursiveSinkCommand) { + switch command { + case .dispose: + disposeCommand() + case .moveNext: + moveNextCommand() + } + } + + // simple implementation for now + func schedule(_ command: TailRecursiveSinkCommand) { + _gate.invoke(InvocableScheduledItem(invocable: self, state: command)) + } + + func done() { + forwardOn(.completed) + dispose() + } + + func extract(_ observable: Observable) -> SequenceGenerator? { + rxAbstractMethod() + } + + // should be done on gate locked + + private func moveNextCommand() { + var next: Observable? = nil + + repeat { + guard let (g, left) = _generators.last else { + break + } + + if _isDisposed { + return + } + + _generators.removeLast() + + var e = g + + guard let nextCandidate = e.next()?.asObservable() else { + continue + } + + // `left` is a hint of how many elements are left in generator. + // In case this is the last element, then there is no need to push + // that generator on stack. + // + // This is an optimization used to make sure in tail recursive case + // there is no memory leak in case this operator is used to generate non terminating + // sequence. + + if let knownOriginalLeft = left { + // `- 1` because generator.next() has just been called + if knownOriginalLeft - 1 >= 1 { + _generators.append((e, knownOriginalLeft - 1)) + } + } + else { + _generators.append((e, nil)) + } + + let nextGenerator = extract(nextCandidate) + + if let nextGenerator = nextGenerator { + _generators.append(nextGenerator) + #if DEBUG || TRACE_RESOURCES + if maxTailRecursiveSinkStackSize < _generators.count { + maxTailRecursiveSinkStackSize = _generators.count + } + #endif + } + else { + next = nextCandidate + } + } while next == nil + + guard let existingNext = next else { + done() + return + } + + let disposable = SingleAssignmentDisposable() + _subscription.disposable = disposable + disposable.setDisposable(subscribeToNext(existingNext)) + } + + func subscribeToNext(_ source: Observable) -> Disposable { + rxAbstractMethod() + } + + func disposeCommand() { + _isDisposed = true + _generators.removeAll(keepingCapacity: false) + } + + override func dispose() { + super.dispose() + + _subscription.dispose() + _gate.dispose() + + schedule(.dispose) + } +} + diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Reactive.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Reactive.swift new file mode 100644 index 0000000..b873996 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Reactive.swift @@ -0,0 +1,74 @@ +// +// Reactive.swift +// RxSwift +// +// Created by Yury Korolev on 5/2/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +/** + Use `Reactive` proxy as customization point for constrained protocol extensions. + + General pattern would be: + + // 1. Extend Reactive protocol with constrain on Base + // Read as: Reactive Extension where Base is a SomeType + extension Reactive where Base: SomeType { + // 2. Put any specific reactive extension for SomeType here + } + + With this approach we can have more specialized methods and properties using + `Base` and not just specialized on common base type. + + */ + +public struct Reactive { + /// Base object to extend. + public let base: Base + + /// Creates extensions with base object. + /// + /// - parameter base: Base object. + public init(_ base: Base) { + self.base = base + } +} + +/// A type that has reactive extensions. +public protocol ReactiveCompatible { + /// Extended type + associatedtype CompatibleType + + /// Reactive extensions. + static var rx: Reactive.Type { get set } + + /// Reactive extensions. + var rx: Reactive { get set } +} + +extension ReactiveCompatible { + /// Reactive extensions. + public static var rx: Reactive.Type { + get { + return Reactive.self + } + set { + // this enables using Reactive to "mutate" base type + } + } + + /// Reactive extensions. + public var rx: Reactive { + get { + return Reactive(self) + } + set { + // this enables using Reactive to "mutate" base object + } + } +} + +import class Foundation.NSObject + +/// Extend NSObject with `rx` proxy. +extension NSObject: ReactiveCompatible { } diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Rx.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Rx.swift new file mode 100644 index 0000000..bbce79f --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Rx.swift @@ -0,0 +1,142 @@ +// +// Rx.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +#if TRACE_RESOURCES + fileprivate var resourceCount: AtomicInt = 0 + + /// Resource utilization information + public struct Resources { + /// Counts internal Rx resource allocations (Observables, Observers, Disposables, etc.). This provides a simple way to detect leaks during development. + public static var total: Int32 { + return resourceCount.valueSnapshot() + } + + /// Increments `Resources.total` resource count. + /// + /// - returns: New resource count + public static func incrementTotal() -> Int32 { + return AtomicIncrement(&resourceCount) + } + + /// Decrements `Resources.total` resource count + /// + /// - returns: New resource count + public static func decrementTotal() -> Int32 { + return AtomicDecrement(&resourceCount) + } + } +#endif + +/// Swift does not implement abstract methods. This method is used as a runtime check to ensure that methods which intended to be abstract (i.e., they should be implemented in subclasses) are not called directly on the superclass. +func rxAbstractMethod(file: StaticString = #file, line: UInt = #line) -> Swift.Never { + rxFatalError("Abstract method", file: file, line: line) +} + +func rxFatalError(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Swift.Never { + // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours. + fatalError(lastMessage(), file: file, line: line) +} + +func rxFatalErrorInDebug(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) { + #if DEBUG + fatalError(lastMessage(), file: file, line: line) + #else + print("\(file):\(line): \(lastMessage())") + #endif +} + +func incrementChecked(_ i: inout Int) throws -> Int { + if i == Int.max { + throw RxError.overflow + } + defer { i += 1 } + return i +} + +func decrementChecked(_ i: inout Int) throws -> Int { + if i == Int.min { + throw RxError.overflow + } + defer { i -= 1 } + return i +} + +#if DEBUG + import class Foundation.Thread + final class SynchronizationTracker { + private let _lock = RecursiveLock() + + public enum SychronizationErrorMessages: String { + case variable = "Two different threads are trying to assign the same `Variable.value` unsynchronized.\n This is undefined behavior because the end result (variable value) is nondeterministic and depends on the \n operating system thread scheduler. This will cause random behavior of your program.\n" + case `default` = "Two different unsynchronized threads are trying to send some event simultaneously.\n This is undefined behavior because the ordering of the effects caused by these events is nondeterministic and depends on the \n operating system thread scheduler. This will result in a random behavior of your program.\n" + } + + private var _threads = Dictionary() + + private func synchronizationError(_ message: String) { + #if FATAL_SYNCHRONIZATION + rxFatalError(message) + #else + print(message) + #endif + } + + func register(synchronizationErrorMessage: SychronizationErrorMessages) { + _lock.lock(); defer { _lock.unlock() } + let pointer = Unmanaged.passUnretained(Thread.current).toOpaque() + let count = (_threads[pointer] ?? 0) + 1 + + if count > 1 { + synchronizationError( + "⚠️ Reentrancy anomaly was detected.\n" + + " > Debugging: To debug this issue you can set a breakpoint in \(#file):\(#line) and observe the call stack.\n" + + " > Problem: This behavior is breaking the observable sequence grammar. `next (error | completed)?`\n" + + " This behavior breaks the grammar because there is overlapping between sequence events.\n" + + " Observable sequence is trying to send an event before sending of previous event has finished.\n" + + " > Interpretation: This could mean that there is some kind of unexpected cyclic dependency in your code,\n" + + " or that the system is not behaving in the expected way.\n" + + " > Remedy: If this is the expected behavior this message can be suppressed by adding `.observeOn(MainScheduler.asyncInstance)`\n" + + " or by enqueing sequence events in some other way.\n" + ) + } + + _threads[pointer] = count + + if _threads.count > 1 { + synchronizationError( + "⚠️ Synchronization anomaly was detected.\n" + + " > Debugging: To debug this issue you can set a breakpoint in \(#file):\(#line) and observe the call stack.\n" + + " > Problem: This behavior is breaking the observable sequence grammar. `next (error | completed)?`\n" + + " This behavior breaks the grammar because there is overlapping between sequence events.\n" + + " Observable sequence is trying to send an event before sending of previous event has finished.\n" + + " > Interpretation: " + synchronizationErrorMessage.rawValue + + " > Remedy: If this is the expected behavior this message can be suppressed by adding `.observeOn(MainScheduler.asyncInstance)`\n" + + " or by synchronizing sequence events in some other way.\n" + ) + } + } + + func unregister() { + _lock.lock(); defer { _lock.unlock() } + let pointer = Unmanaged.passUnretained(Thread.current).toOpaque() + _threads[pointer] = (_threads[pointer] ?? 1) - 1 + if _threads[pointer] == 0 { + _threads[pointer] = nil + } + } + } + +#endif + +/// RxSwift global hooks +public enum Hooks { + + // Should capture call stack + public static var recordCallStackOnError: Bool = false + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/RxMutableBox.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/RxMutableBox.swift new file mode 100644 index 0000000..7f3c333 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/RxMutableBox.swift @@ -0,0 +1,27 @@ +// +// RxMutableBox.swift +// RxSwift +// +// Created by Krunoslav Zaher on 5/22/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Creates mutable reference wrapper for any type. +final class RxMutableBox : CustomDebugStringConvertible { + /// Wrapped value + var value : T + + /// Creates reference wrapper for `value`. + /// + /// - parameter value: Value to wrap. + init (_ value: T) { + self.value = value + } +} + +extension RxMutableBox { + /// - returns: Box description. + var debugDescription: String { + return "MutatingBox(\(self.value))" + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/SchedulerType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/SchedulerType.swift new file mode 100644 index 0000000..bdfcf8b --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/SchedulerType.swift @@ -0,0 +1,71 @@ +// +// SchedulerType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.TimeInterval +import struct Foundation.Date + +// Type that represents time interval in the context of RxSwift. +public typealias RxTimeInterval = TimeInterval + +/// Type that represents absolute time in the context of RxSwift. +public typealias RxTime = Date + +/// Represents an object that schedules units of work. +public protocol SchedulerType: ImmediateSchedulerType { + + /// - returns: Current time. + var now : RxTime { + get + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + func scheduleRelative(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + func schedulePeriodic(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable +} + +extension SchedulerType { + + /** + Periodic task will be emulated using recursive scheduling. + + - parameter state: Initial state passed to the action upon the first iteration. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - returns: The disposable object used to cancel the scheduled recurring action (best effort). + */ + public func schedulePeriodic(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { + let schedule = SchedulePeriodicRecursive(scheduler: self, startAfter: startAfter, period: period, action: action, state: state) + + return schedule.start() + } + + func scheduleRecursive(_ state: State, dueTime: RxTimeInterval, action: @escaping (State, AnyRecursiveScheduler) -> ()) -> Disposable { + let scheduler = AnyRecursiveScheduler(scheduler: self, action: action) + + scheduler.schedule(state, dueTime: dueTime) + + return Disposables.create(with: scheduler.dispose) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift new file mode 100644 index 0000000..c6acaa1 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift @@ -0,0 +1,82 @@ +// +// ConcurrentDispatchQueueScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 7/5/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.Date +import struct Foundation.TimeInterval +import Dispatch + +/// Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. You can also pass a serial dispatch queue, it shouldn't cause any problems. +/// +/// This scheduler is suitable when some work needs to be performed in background. +public class ConcurrentDispatchQueueScheduler: SchedulerType { + public typealias TimeInterval = Foundation.TimeInterval + public typealias Time = Date + + public var now : Date { + return Date() + } + + let configuration: DispatchQueueConfiguration + + /// Constructs new `ConcurrentDispatchQueueScheduler` that wraps `queue`. + /// + /// - parameter queue: Target dispatch queue. + public init(queue: DispatchQueue, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) { + configuration = DispatchQueueConfiguration(queue: queue, leeway: leeway) + } + + /// Convenience init for scheduler that wraps one of the global concurrent dispatch queues. + /// + /// - parameter qos: Target global dispatch queue, by quality of service class. + @available(iOS 8, OSX 10.10, *) + public convenience init(qos: DispatchQoS, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) { + self.init(queue: DispatchQueue( + label: "rxswift.queue.\(qos)", + qos: qos, + attributes: [DispatchQueue.Attributes.concurrent], + target: nil), + leeway: leeway + ) + } + + /** + Schedules an action to be executed immediately. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + return self.configuration.schedule(state, action: action) + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func scheduleRelative(_ state: StateType, dueTime: Foundation.TimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + return self.configuration.scheduleRelative(state, dueTime: dueTime, action: action) + } + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { + return self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift new file mode 100644 index 0000000..a98ad21 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift @@ -0,0 +1,88 @@ +// +// ConcurrentMainScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 10/17/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.Date +import struct Foundation.TimeInterval +import Dispatch + +/** +Abstracts work that needs to be performed on `MainThread`. In case `schedule` methods are called from main thread, it will perform action immediately without scheduling. + +This scheduler is optimized for `subscribeOn` operator. If you want to observe observable sequence elements on main thread using `observeOn` operator, +`MainScheduler` is more suitable for that purpose. +*/ +public final class ConcurrentMainScheduler : SchedulerType { + public typealias TimeInterval = Foundation.TimeInterval + public typealias Time = Date + + private let _mainScheduler: MainScheduler + private let _mainQueue: DispatchQueue + + /// - returns: Current time. + public var now : Date { + return _mainScheduler.now as Date + } + + private init(mainScheduler: MainScheduler) { + _mainQueue = DispatchQueue.main + _mainScheduler = mainScheduler + } + + /// Singleton instance of `ConcurrentMainScheduler` + public static let instance = ConcurrentMainScheduler(mainScheduler: MainScheduler.instance) + + /** + Schedules an action to be executed immediately. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + if DispatchQueue.isMain { + return action(state) + } + + let cancel = SingleAssignmentDisposable() + + _mainQueue.async { + if cancel.isDisposed { + return + } + + cancel.setDisposable(action(state)) + } + + return cancel + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func scheduleRelative(_ state: StateType, dueTime: Foundation.TimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + return _mainScheduler.scheduleRelative(state, dueTime: dueTime, action: action) + } + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { + return _mainScheduler.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift new file mode 100644 index 0000000..2fe822d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift @@ -0,0 +1,140 @@ +// +// CurrentThreadScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 8/30/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.NSObject +import protocol Foundation.NSCopying +import class Foundation.Thread +import Dispatch + +#if os(Linux) + import struct Foundation.pthread_key_t + import func Foundation.pthread_setspecific + import func Foundation.pthread_getspecific + import func Foundation.pthread_key_create + + fileprivate enum CurrentThreadSchedulerQueueKey { + fileprivate static let instance = "RxSwift.CurrentThreadScheduler.Queue" + } +#else + fileprivate class CurrentThreadSchedulerQueueKey: NSObject, NSCopying { + static let instance = CurrentThreadSchedulerQueueKey() + private override init() { + super.init() + } + + override var hash: Int { + return 0 + } + + public func copy(with zone: NSZone? = nil) -> Any { + return self + } + } +#endif + +/// Represents an object that schedules units of work on the current thread. +/// +/// This is the default scheduler for operators that generate elements. +/// +/// This scheduler is also sometimes called `trampoline scheduler`. +public class CurrentThreadScheduler : ImmediateSchedulerType { + typealias ScheduleQueue = RxMutableBox> + + /// The singleton instance of the current thread scheduler. + public static let instance = CurrentThreadScheduler() + + private static var isScheduleRequiredKey: pthread_key_t = { () -> pthread_key_t in + let key = UnsafeMutablePointer.allocate(capacity: 1) + defer { + key.deallocate(capacity: 1) + } + + guard pthread_key_create(key, nil) == 0 else { + rxFatalError("isScheduleRequired key creation failed") + } + + return key.pointee + }() + + private static var scheduleInProgressSentinel: UnsafeRawPointer = { () -> UnsafeRawPointer in + return UnsafeRawPointer(UnsafeMutablePointer.allocate(capacity: 1)) + }() + + static var queue : ScheduleQueue? { + get { + return Thread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerQueueKey.instance) + } + set { + Thread.setThreadLocalStorageValue(newValue, forKey: CurrentThreadSchedulerQueueKey.instance) + } + } + + /// Gets a value that indicates whether the caller must call a `schedule` method. + public static fileprivate(set) var isScheduleRequired: Bool { + get { + return pthread_getspecific(CurrentThreadScheduler.isScheduleRequiredKey) == nil + } + set(isScheduleRequired) { + if pthread_setspecific(CurrentThreadScheduler.isScheduleRequiredKey, isScheduleRequired ? nil : scheduleInProgressSentinel) != 0 { + rxFatalError("pthread_setspecific failed") + } + } + } + + /** + Schedules an action to be executed as soon as possible on current thread. + + If this method is called on some thread that doesn't have `CurrentThreadScheduler` installed, scheduler will be + automatically installed and uninstalled after all work is performed. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + if CurrentThreadScheduler.isScheduleRequired { + CurrentThreadScheduler.isScheduleRequired = false + + let disposable = action(state) + + defer { + CurrentThreadScheduler.isScheduleRequired = true + CurrentThreadScheduler.queue = nil + } + + guard let queue = CurrentThreadScheduler.queue else { + return disposable + } + + while let latest = queue.value.dequeue() { + if latest.isDisposed { + continue + } + latest.invoke() + } + + return disposable + } + + let existingQueue = CurrentThreadScheduler.queue + + let queue: RxMutableBox> + if let existingQueue = existingQueue { + queue = existingQueue + } + else { + queue = RxMutableBox(Queue(capacity: 1)) + CurrentThreadScheduler.queue = queue + } + + let scheduledItem = ScheduledItem(action: action, state: state) + queue.value.enqueue(scheduledItem) + + return scheduledItem + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift new file mode 100644 index 0000000..11af238 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift @@ -0,0 +1,22 @@ +// +// HistoricalScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 12/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.Date + +/// Provides a virtual time scheduler that uses `Date` for absolute time and `NSTimeInterval` for relative time. +public class HistoricalScheduler : VirtualTimeScheduler { + + /** + Creates a new historical scheduler with initial clock value. + + - parameter initialClock: Initial value for virtual clock. + */ + public init(initialClock: RxTime = Date(timeIntervalSince1970: 0)) { + super.init(initialClock: initialClock, converter: HistoricalSchedulerTimeConverter()) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift new file mode 100644 index 0000000..3602d2d --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift @@ -0,0 +1,67 @@ +// +// HistoricalSchedulerTimeConverter.swift +// RxSwift +// +// Created by Krunoslav Zaher on 12/27/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.Date + +/// Converts historial virtual time into real time. +/// +/// Since historical virtual time is also measured in `Date`, this converter is identity function. +public struct HistoricalSchedulerTimeConverter : VirtualTimeConverterType { + /// Virtual time unit used that represents ticks of virtual clock. + public typealias VirtualTimeUnit = RxTime + + /// Virtual time unit used to represent differences of virtual times. + public typealias VirtualTimeIntervalUnit = RxTimeInterval + + /// Returns identical value of argument passed because historical virtual time is equal to real time, just + /// decoupled from local machine clock. + public func convertFromVirtualTime(_ virtualTime: VirtualTimeUnit) -> RxTime { + return virtualTime + } + + /// Returns identical value of argument passed because historical virtual time is equal to real time, just + /// decoupled from local machine clock. + public func convertToVirtualTime(_ time: RxTime) -> VirtualTimeUnit { + return time + } + + /// Returns identical value of argument passed because historical virtual time is equal to real time, just + /// decoupled from local machine clock. + public func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> RxTimeInterval { + return virtualTimeInterval + } + + /// Returns identical value of argument passed because historical virtual time is equal to real time, just + /// decoupled from local machine clock. + public func convertToVirtualTimeInterval(_ timeInterval: RxTimeInterval) -> VirtualTimeIntervalUnit { + return timeInterval + } + + /** + Offsets `Date` by time interval. + + - parameter time: Time. + - parameter timeInterval: Time interval offset. + - returns: Time offsetted by time interval. + */ + public func offsetVirtualTime(_ time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit { + return time.addingTimeInterval(offset) + } + + /// Compares two `Date`s. + public func compareVirtualTime(_ lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison { + switch lhs.compare(rhs as Date) { + case .orderedAscending: + return .lessThan + case .orderedSame: + return .equal + case .orderedDescending: + return .greaterThan + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift new file mode 100644 index 0000000..b82f011 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift @@ -0,0 +1,112 @@ +// +// DispatchQueueConfiguration.swift +// RxSwift +// +// Created by Krunoslav Zaher on 7/23/16. +// Copyright © 2016 Krunoslav Zaher. All rights reserved. +// + +import Dispatch +import struct Foundation.TimeInterval + +struct DispatchQueueConfiguration { + let queue: DispatchQueue + let leeway: DispatchTimeInterval +} + +private func dispatchInterval(_ interval: Foundation.TimeInterval) -> DispatchTimeInterval { + precondition(interval >= 0.0) + // TODO: Replace 1000 with something that actually works + // NSEC_PER_MSEC returns 1000000 + return DispatchTimeInterval.milliseconds(Int(interval * 1000.0)) +} + +extension DispatchQueueConfiguration { + func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + let cancel = SingleAssignmentDisposable() + + queue.async { + if cancel.isDisposed { + return + } + + + cancel.setDisposable(action(state)) + } + + return cancel + } + + func scheduleRelative(_ state: StateType, dueTime: Foundation.TimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + let deadline = DispatchTime.now() + dispatchInterval(dueTime) + + let compositeDisposable = CompositeDisposable() + + let timer = DispatchSource.makeTimerSource(queue: queue) + #if swift(>=4.0) + timer.schedule(deadline: deadline, leeway: leeway) + #else + timer.scheduleOneshot(deadline: deadline, leeway: leeway) + #endif + + // TODO: + // This looks horrible, and yes, it is. + // It looks like Apple has made a conceputal change here, and I'm unsure why. + // Need more info on this. + // It looks like just setting timer to fire and not holding a reference to it + // until deadline causes timer cancellation. + var timerReference: DispatchSourceTimer? = timer + let cancelTimer = Disposables.create { + timerReference?.cancel() + timerReference = nil + } + + timer.setEventHandler(handler: { + if compositeDisposable.isDisposed { + return + } + _ = compositeDisposable.insert(action(state)) + cancelTimer.dispose() + }) + timer.resume() + + _ = compositeDisposable.insert(cancelTimer) + + return compositeDisposable + } + + func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { + let initial = DispatchTime.now() + dispatchInterval(startAfter) + + var timerState = state + + let timer = DispatchSource.makeTimerSource(queue: queue) + #if swift(>=4.0) + timer.schedule(deadline: initial, repeating: dispatchInterval(period), leeway: leeway) + #else + timer.scheduleRepeating(deadline: initial, interval: dispatchInterval(period), leeway: leeway) + #endif + + // TODO: + // This looks horrible, and yes, it is. + // It looks like Apple has made a conceputal change here, and I'm unsure why. + // Need more info on this. + // It looks like just setting timer to fire and not holding a reference to it + // until deadline causes timer cancellation. + var timerReference: DispatchSourceTimer? = timer + let cancelTimer = Disposables.create { + timerReference?.cancel() + timerReference = nil + } + + timer.setEventHandler(handler: { + if cancelTimer.isDisposed { + return + } + timerState = action(timerState) + }) + timer.resume() + + return cancelTimer + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift new file mode 100644 index 0000000..90445f8 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift @@ -0,0 +1,22 @@ +// +// InvocableScheduledItem.swift +// RxSwift +// +// Created by Krunoslav Zaher on 11/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +struct InvocableScheduledItem : InvocableType { + + let _invocable: I + let _state: I.Value + + init(invocable: I, state: I.Value) { + _invocable = invocable + _state = state + } + + func invoke() { + _invocable.invoke(_state) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift new file mode 100644 index 0000000..0dba433 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift @@ -0,0 +1,17 @@ +// +// InvocableType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 11/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol InvocableType { + func invoke() +} + +protocol InvocableWithValueType { + associatedtype Value + + func invoke(_ value: Value) +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift new file mode 100644 index 0000000..454fb34 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift @@ -0,0 +1,35 @@ +// +// ScheduledItem.swift +// RxSwift +// +// Created by Krunoslav Zaher on 9/2/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +struct ScheduledItem + : ScheduledItemType + , InvocableType { + typealias Action = (T) -> Disposable + + private let _action: Action + private let _state: T + + private let _disposable = SingleAssignmentDisposable() + + var isDisposed: Bool { + return _disposable.isDisposed + } + + init(action: @escaping Action, state: T) { + _action = action + _state = state + } + + func invoke() { + _disposable.setDisposable(_action(_state)) + } + + func dispose() { + _disposable.dispose() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift new file mode 100644 index 0000000..d2b16ca --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift @@ -0,0 +1,13 @@ +// +// ScheduledItemType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 11/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +protocol ScheduledItemType + : Cancelable + , InvocableType { + func invoke() +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift new file mode 100644 index 0000000..e219e4e --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift @@ -0,0 +1,68 @@ +// +// MainScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import Dispatch + +/** +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. + +This scheduler is usually used to perform UI work. + +Main scheduler is a specialization of `SerialDispatchQueueScheduler`. + +This scheduler is optimized for `observeOn` operator. To ensure observable sequence is subscribed on main thread using `subscribeOn` +operator please use `ConcurrentMainScheduler` because it is more optimized for that purpose. +*/ +public final class MainScheduler : SerialDispatchQueueScheduler { + + private let _mainQueue: DispatchQueue + + var numberEnqueued: AtomicInt = 0 + + /// Initializes new instance of `MainScheduler`. + public init() { + _mainQueue = DispatchQueue.main + super.init(serialQueue: _mainQueue) + } + + /// Singleton instance of `MainScheduler` + public static let instance = MainScheduler() + + /// Singleton instance of `MainScheduler` that always schedules work asynchronously + /// and doesn't perform optimizations for calls scheduled from main queue. + public static let asyncInstance = SerialDispatchQueueScheduler(serialQueue: DispatchQueue.main) + + /// In case this method is called on a background thread it will throw an exception. + public class func ensureExecutingOnScheduler(errorMessage: String? = nil) { + if !DispatchQueue.isMain { + rxFatalError(errorMessage ?? "Executing on background thread. Please use `MainScheduler.instance.schedule` to schedule work on main thread.") + } + } + + override func scheduleInternal(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + let currentNumberEnqueued = AtomicIncrement(&numberEnqueued) + + if DispatchQueue.isMain && currentNumberEnqueued == 1 { + let disposable = action(state) + _ = AtomicDecrement(&numberEnqueued) + return disposable + } + + let cancel = SingleAssignmentDisposable() + + _mainQueue.async { + if !cancel.isDisposed { + _ = action(state) + } + + _ = AtomicDecrement(&self.numberEnqueued) + } + + return cancel + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift new file mode 100644 index 0000000..82d30fb --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift @@ -0,0 +1,50 @@ +// +// OperationQueueScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 4/4/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import class Foundation.OperationQueue +import class Foundation.BlockOperation +import Dispatch + +/// Abstracts the work that needs to be performed on a specific `NSOperationQueue`. +/// +/// This scheduler is suitable for cases when there is some bigger chunk of work that needs to be performed in background and you want to fine tune concurrent processing using `maxConcurrentOperationCount`. +public class OperationQueueScheduler: ImmediateSchedulerType { + public let operationQueue: OperationQueue + + /// Constructs new instance of `OperationQueueScheduler` that performs work on `operationQueue`. + /// + /// - parameter operationQueue: Operation queue targeted to perform work on. + public init(operationQueue: OperationQueue) { + self.operationQueue = operationQueue + } + + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + let cancel = SingleAssignmentDisposable() + + let operation = BlockOperation { + if cancel.isDisposed { + return + } + + + cancel.setDisposable(action(state)) + } + + self.operationQueue.addOperation(operation) + + return cancel + } + +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift new file mode 100644 index 0000000..24d19cc --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift @@ -0,0 +1,226 @@ +// +// RecursiveScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/7/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +fileprivate enum ScheduleState { + case initial + case added(CompositeDisposable.DisposeKey) + case done +} + +/// Type erased recursive scheduler. +final class AnyRecursiveScheduler { + + typealias Action = (State, AnyRecursiveScheduler) -> Void + + private let _lock = RecursiveLock() + + // state + private let _group = CompositeDisposable() + + private var _scheduler: SchedulerType + private var _action: Action? + + init(scheduler: SchedulerType, action: @escaping Action) { + _action = action + _scheduler = scheduler + } + + /** + Schedules an action to be executed recursively. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the recursive action. + */ + func schedule(_ state: State, dueTime: RxTimeInterval) { + var scheduleState: ScheduleState = .initial + + let d = _scheduler.scheduleRelative(state, dueTime: dueTime) { (state) -> Disposable in + // best effort + if self._group.isDisposed { + return Disposables.create() + } + + let action = self._lock.calculateLocked { () -> Action? in + switch scheduleState { + case let .added(removeKey): + self._group.remove(for: removeKey) + case .initial: + break + case .done: + break + } + + scheduleState = .done + + return self._action + } + + if let action = action { + action(state, self) + } + + return Disposables.create() + } + + _lock.performLocked { + switch scheduleState { + case .added: + rxFatalError("Invalid state") + break + case .initial: + if let removeKey = _group.insert(d) { + scheduleState = .added(removeKey) + } + else { + scheduleState = .done + } + break + case .done: + break + } + } + } + + /// Schedules an action to be executed recursively. + /// + /// - parameter state: State passed to the action to be executed. + func schedule(_ state: State) { + var scheduleState: ScheduleState = .initial + + let d = _scheduler.schedule(state) { (state) -> Disposable in + // best effort + if self._group.isDisposed { + return Disposables.create() + } + + let action = self._lock.calculateLocked { () -> Action? in + switch scheduleState { + case let .added(removeKey): + self._group.remove(for: removeKey) + case .initial: + break + case .done: + break + } + + scheduleState = .done + + return self._action + } + + if let action = action { + action(state, self) + } + + return Disposables.create() + } + + _lock.performLocked { + switch scheduleState { + case .added: + rxFatalError("Invalid state") + break + case .initial: + if let removeKey = _group.insert(d) { + scheduleState = .added(removeKey) + } + else { + scheduleState = .done + } + break + case .done: + break + } + } + } + + func dispose() { + _lock.performLocked { + _action = nil + } + _group.dispose() + } +} + +/// Type erased recursive scheduler. +final class RecursiveImmediateScheduler { + typealias Action = (_ state: State, _ recurse: (State) -> Void) -> Void + + private var _lock = SpinLock() + private let _group = CompositeDisposable() + + private var _action: Action? + private let _scheduler: ImmediateSchedulerType + + init(action: @escaping Action, scheduler: ImmediateSchedulerType) { + _action = action + _scheduler = scheduler + } + + // immediate scheduling + + /// Schedules an action to be executed recursively. + /// + /// - parameter state: State passed to the action to be executed. + func schedule(_ state: State) { + var scheduleState: ScheduleState = .initial + + let d = _scheduler.schedule(state) { (state) -> Disposable in + // best effort + if self._group.isDisposed { + return Disposables.create() + } + + let action = self._lock.calculateLocked { () -> Action? in + switch scheduleState { + case let .added(removeKey): + self._group.remove(for: removeKey) + case .initial: + break + case .done: + break + } + + scheduleState = .done + + return self._action + } + + if let action = action { + action(state, self.schedule) + } + + return Disposables.create() + } + + _lock.performLocked { + switch scheduleState { + case .added: + rxFatalError("Invalid state") + break + case .initial: + if let removeKey = _group.insert(d) { + scheduleState = .added(removeKey) + } + else { + scheduleState = .done + } + break + case .done: + break + } + } + } + + func dispose() { + _lock.performLocked { + _action = nil + } + _group.dispose() + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift new file mode 100644 index 0000000..41f2947 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift @@ -0,0 +1,61 @@ +// +// SchedulerServices+Emulation.swift +// RxSwift +// +// Created by Krunoslav Zaher on 6/6/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +enum SchedulePeriodicRecursiveCommand { + case tick + case dispatchStart +} + +final class SchedulePeriodicRecursive { + typealias RecursiveAction = (State) -> State + typealias RecursiveScheduler = AnyRecursiveScheduler + + private let _scheduler: SchedulerType + private let _startAfter: RxTimeInterval + private let _period: RxTimeInterval + private let _action: RecursiveAction + + private var _state: State + private var _pendingTickCount: AtomicInt = 0 + + init(scheduler: SchedulerType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping RecursiveAction, state: State) { + _scheduler = scheduler + _startAfter = startAfter + _period = period + _action = action + _state = state + } + + func start() -> Disposable { + return _scheduler.scheduleRecursive(SchedulePeriodicRecursiveCommand.tick, dueTime: _startAfter, action: self.tick) + } + + func tick(_ command: SchedulePeriodicRecursiveCommand, scheduler: RecursiveScheduler) -> Void { + // Tries to emulate periodic scheduling as best as possible. + // The problem that could arise is if handling periodic ticks take too long, or + // tick interval is short. + switch command { + case .tick: + scheduler.schedule(.tick, dueTime: _period) + + // The idea is that if on tick there wasn't any item enqueued, schedule to perform work immediately. + // Else work will be scheduled after previous enqueued work completes. + if AtomicIncrement(&_pendingTickCount) == 1 { + self.tick(.dispatchStart, scheduler: scheduler) + } + + case .dispatchStart: + _state = _action(_state) + // Start work and schedule check is this last batch of work + if AtomicDecrement(&_pendingTickCount) > 0 { + // This gives priority to scheduler emulation, it's not perfect, but helps + scheduler.schedule(SchedulePeriodicRecursiveCommand.dispatchStart) + } + } + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift new file mode 100644 index 0000000..71733d3 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift @@ -0,0 +1,123 @@ +// +// SerialDispatchQueueScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/8/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +import struct Foundation.TimeInterval +import struct Foundation.Date +import Dispatch + +/** +Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. It will make sure +that even if concurrent dispatch queue is passed, it's transformed into a serial one. + +It is extremely important that this scheduler is serial, because +certain operator perform optimizations that rely on that property. + +Because there is no way of detecting is passed dispatch queue serial or +concurrent, for every queue that is being passed, worst case (concurrent) +will be assumed, and internal serial proxy dispatch queue will be created. + +This scheduler can also be used with internal serial queue alone. + +In case some customization need to be made on it before usage, +internal serial queue can be customized using `serialQueueConfiguration` +callback. +*/ +public class SerialDispatchQueueScheduler : SchedulerType { + public typealias TimeInterval = Foundation.TimeInterval + public typealias Time = Date + + /// - returns: Current time. + public var now : Date { + return Date() + } + + let configuration: DispatchQueueConfiguration + + init(serialQueue: DispatchQueue, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) { + configuration = DispatchQueueConfiguration(queue: serialQueue, leeway: leeway) + } + + /** + Constructs new `SerialDispatchQueueScheduler` with internal serial queue named `internalSerialQueueName`. + + Additional dispatch queue properties can be set after dispatch queue is created using `serialQueueConfiguration`. + + - parameter internalSerialQueueName: Name of internal serial dispatch queue. + - parameter serialQueueConfiguration: Additional configuration of internal serial dispatch queue. + */ + public convenience init(internalSerialQueueName: String, serialQueueConfiguration: ((DispatchQueue) -> Void)? = nil, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) { + let queue = DispatchQueue(label: internalSerialQueueName, attributes: []) + serialQueueConfiguration?(queue) + self.init(serialQueue: queue, leeway: leeway) + } + + /** + Constructs new `SerialDispatchQueueScheduler` named `internalSerialQueueName` that wraps `queue`. + + - parameter queue: Possibly concurrent dispatch queue used to perform work. + - parameter internalSerialQueueName: Name of internal serial dispatch queue proxy. + */ + public convenience init(queue: DispatchQueue, internalSerialQueueName: String, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) { + // Swift 3.0 IUO + let serialQueue = DispatchQueue(label: internalSerialQueueName, + attributes: [], + target: queue) + self.init(serialQueue: serialQueue, leeway: leeway) + } + + /** + Constructs new `SerialDispatchQueueScheduler` that wraps on of the global concurrent dispatch queues. + + - parameter qos: Identifier for global dispatch queue with specified quality of service class. + - parameter internalSerialQueueName: Custom name for internal serial dispatch queue proxy. + */ + @available(iOS 8, OSX 10.10, *) + public convenience init(qos: DispatchQoS, internalSerialQueueName: String = "rx.global_dispatch_queue.serial", leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) { + self.init(queue: DispatchQueue.global(qos: qos.qosClass), internalSerialQueueName: internalSerialQueueName, leeway: leeway) + } + + /** + Schedules an action to be executed immediately. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + return self.scheduleInternal(state, action: action) + } + + func scheduleInternal(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + return self.configuration.schedule(state, action: action) + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public final func scheduleRelative(_ state: StateType, dueTime: Foundation.TimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + return self.configuration.scheduleRelative(state, dueTime: dueTime, action: action) + } + + /** + Schedules a periodic piece of work. + + - parameter state: State passed to the action to be executed. + - parameter startAfter: Period after which initial work should be run. + - parameter period: Period for running the work periodically. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { + return self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift new file mode 100644 index 0000000..b207836 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift @@ -0,0 +1,95 @@ +// +// VirtualTimeConverterType.swift +// RxSwift +// +// Created by Krunoslav Zaher on 12/23/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Parametrization for virtual time used by `VirtualTimeScheduler`s. +public protocol VirtualTimeConverterType { + /// Virtual time unit used that represents ticks of virtual clock. + associatedtype VirtualTimeUnit + + /// Virtual time unit used to represent differences of virtual times. + associatedtype VirtualTimeIntervalUnit + + /** + Converts virtual time to real time. + + - parameter virtualTime: Virtual time to convert to `Date`. + - returns: `Date` corresponding to virtual time. + */ + func convertFromVirtualTime(_ virtualTime: VirtualTimeUnit) -> RxTime + + /** + Converts real time to virtual time. + + - parameter time: `Date` to convert to virtual time. + - returns: Virtual time corresponding to `Date`. + */ + func convertToVirtualTime(_ time: RxTime) -> VirtualTimeUnit + + /** + Converts from virtual time interval to `NSTimeInterval`. + + - parameter virtualTimeInterval: Virtual time interval to convert to `NSTimeInterval`. + - returns: `NSTimeInterval` corresponding to virtual time interval. + */ + func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> RxTimeInterval + + /** + Converts from virtual time interval to `NSTimeInterval`. + + - parameter timeInterval: `NSTimeInterval` to convert to virtual time interval. + - returns: Virtual time interval corresponding to time interval. + */ + func convertToVirtualTimeInterval(_ timeInterval: RxTimeInterval) -> VirtualTimeIntervalUnit + + /** + Offsets virtual time by virtual time interval. + + - parameter time: Virtual time. + - parameter offset: Virtual time interval. + - returns: Time corresponding to time offsetted by virtual time interval. + */ + func offsetVirtualTime(_ time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit + + /** + This is aditional abstraction because `Date` is unfortunately not comparable. + Extending `Date` with `Comparable` would be too risky because of possible collisions with other libraries. + */ + func compareVirtualTime(_ lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison +} + +/** + Virtual time comparison result. + + This is aditional abstraction because `Date` is unfortunately not comparable. + Extending `Date` with `Comparable` would be too risky because of possible collisions with other libraries. +*/ +public enum VirtualTimeComparison { + /// lhs < rhs. + case lessThan + /// lhs == rhs. + case equal + /// lhs > rhs. + case greaterThan +} + +extension VirtualTimeComparison { + /// lhs < rhs. + var lessThen: Bool { + return self == .lessThan + } + + /// lhs > rhs + var greaterThan: Bool { + return self == .greaterThan + } + + /// lhs == rhs + var equal: Bool { + return self == .equal + } +} diff --git a/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift new file mode 100644 index 0000000..c0e1aa5 --- /dev/null +++ b/Poc.Mauro.Bianchelli.germanAutolabs/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift @@ -0,0 +1,269 @@ +// +// VirtualTimeScheduler.swift +// RxSwift +// +// Created by Krunoslav Zaher on 2/14/15. +// Copyright © 2015 Krunoslav Zaher. All rights reserved. +// + +/// Base class for virtual time schedulers using a priority queue for scheduled items. +open class VirtualTimeScheduler + : SchedulerType { + + public typealias VirtualTime = Converter.VirtualTimeUnit + public typealias VirtualTimeInterval = Converter.VirtualTimeIntervalUnit + + private var _running : Bool + + private var _clock: VirtualTime + + fileprivate var _schedulerQueue : PriorityQueue> + private var _converter: Converter + + private var _nextId = 0 + + /// - returns: Current time. + public var now: RxTime { + return _converter.convertFromVirtualTime(clock) + } + + /// - returns: Scheduler's absolute time clock value. + public var clock: VirtualTime { + return _clock + } + + /// Creates a new virtual time scheduler. + /// + /// - parameter initialClock: Initial value for the clock. + public init(initialClock: VirtualTime, converter: Converter) { + _clock = initialClock + _running = false + _converter = converter + _schedulerQueue = PriorityQueue(hasHigherPriority: { + switch converter.compareVirtualTime($0.time, $1.time) { + case .lessThan: + return true + case .equal: + return $0.id < $1.id + case .greaterThan: + return false + } + }, isEqual: { $0 === $1 }) + #if TRACE_RESOURCES + let _ = Resources.incrementTotal() + #endif + } + + /** + Schedules an action to be executed immediately. + + - parameter state: State passed to the action to be executed. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + return self.scheduleRelative(state, dueTime: 0.0) { a in + return action(a) + } + } + + /** + Schedules an action to be executed. + + - parameter state: State passed to the action to be executed. + - parameter dueTime: Relative time after which to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleRelative(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + let time = self.now.addingTimeInterval(dueTime) + let absoluteTime = _converter.convertToVirtualTime(time) + let adjustedTime = self.adjustScheduledTime(absoluteTime) + return scheduleAbsoluteVirtual(state, time: adjustedTime, action: action) + } + + /** + Schedules an action to be executed after relative time has passed. + + - parameter state: State passed to the action to be executed. + - parameter time: Absolute time when to execute the action. If this is less or equal then `now`, `now + 1` will be used. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleRelativeVirtual(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + let time = _converter.offsetVirtualTime(self.clock, offset: dueTime) + return scheduleAbsoluteVirtual(state, time: time, action: action) + } + + /** + Schedules an action to be executed at absolute virtual time. + + - parameter state: State passed to the action to be executed. + - parameter time: Absolute time when to execute the action. + - parameter action: Action to be executed. + - returns: The disposable object used to cancel the scheduled action (best effort). + */ + public func scheduleAbsoluteVirtual(_ state: StateType, time: Converter.VirtualTimeUnit, action: @escaping (StateType) -> Disposable) -> Disposable { + MainScheduler.ensureExecutingOnScheduler() + + let compositeDisposable = CompositeDisposable() + + let item = VirtualSchedulerItem(action: { + let dispose = action(state) + return dispose + }, time: time, id: _nextId) + + _nextId += 1 + + _schedulerQueue.enqueue(item) + + _ = compositeDisposable.insert(item) + + return compositeDisposable + } + + /// Adjusts time of scheduling before adding item to schedule queue. + open func adjustScheduledTime(_ time: Converter.VirtualTimeUnit) -> Converter.VirtualTimeUnit { + return time + } + + /// Starts the virtual time scheduler. + public func start() { + MainScheduler.ensureExecutingOnScheduler() + + if _running { + return + } + + _running = true + repeat { + guard let next = findNext() else { + break + } + + if _converter.compareVirtualTime(next.time, self.clock).greaterThan { + _clock = next.time + } + + next.invoke() + _schedulerQueue.remove(next) + } while _running + + _running = false + } + + func findNext() -> VirtualSchedulerItem? { + while let front = _schedulerQueue.peek() { + if front.isDisposed { + _schedulerQueue.remove(front) + continue + } + + return front + } + + return nil + } + + /// Advances the scheduler's clock to the specified time, running all work till that point. + /// + /// - parameter virtualTime: Absolute time to advance the scheduler's clock to. + public func advanceTo(_ virtualTime: VirtualTime) { + MainScheduler.ensureExecutingOnScheduler() + + if _running { + fatalError("Scheduler is already running") + } + + _running = true + repeat { + guard let next = findNext() else { + break + } + + if _converter.compareVirtualTime(next.time, virtualTime).greaterThan { + break + } + + if _converter.compareVirtualTime(next.time, self.clock).greaterThan { + _clock = next.time + } + + next.invoke() + _schedulerQueue.remove(next) + } while _running + + _clock = virtualTime + _running = false + } + + /// Advances the scheduler's clock by the specified relative time. + public func sleep(_ virtualInterval: VirtualTimeInterval) { + MainScheduler.ensureExecutingOnScheduler() + + let sleepTo = _converter.offsetVirtualTime(clock, offset: virtualInterval) + if _converter.compareVirtualTime(sleepTo, clock).lessThen { + fatalError("Can't sleep to past.") + } + + _clock = sleepTo + } + + /// Stops the virtual time scheduler. + public func stop() { + MainScheduler.ensureExecutingOnScheduler() + + _running = false + } + + #if TRACE_RESOURCES + deinit { + _ = Resources.decrementTotal() + } + #endif +} + +// MARK: description + +extension VirtualTimeScheduler: CustomDebugStringConvertible { + /// A textual representation of `self`, suitable for debugging. + public var debugDescription: String { + return self._schedulerQueue.debugDescription + } +} + +final class VirtualSchedulerItem