Repository: ReactiveX/RxSwift Branch: main Commit: 132aea4f236c Files: 825 Total size: 7.8 MB Directory structure: gitextract_g9qpiggw/ ├── .editorConfig ├── .github/ │ ├── ISSUE_TEMPLATE.md │ └── workflows/ │ └── tests.yml ├── .gitignore ├── .jazzy.yml ├── .ruby-version ├── .swift-version ├── .swiftformat ├── .swiftlint.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dangerfile ├── Documentation/ │ ├── ComparisonWithOtherLibraries.md │ ├── DesignRationale.md │ ├── ExampleApp.md │ ├── Examples.md │ ├── GettingStarted.md │ ├── HotAndColdObservables.md │ ├── MathBehindRx.md │ ├── NewFeatureRequestTemplate.md │ ├── Playgrounds.md │ ├── Schedulers.md │ ├── Subjects.md │ ├── SwiftConcurrency.md │ ├── Tips.md │ ├── Traits.md │ ├── UnitTests.md │ ├── Warnings.md │ └── Why.md ├── Gemfile ├── LICENSE.md ├── Makefile ├── Package.swift ├── Package@swift-5.9.swift ├── Platform/ │ ├── AtomicInt.swift │ ├── DataStructures/ │ │ ├── Bag.swift │ │ ├── InfiniteSequence.swift │ │ ├── PriorityQueue.swift │ │ └── Queue.swift │ ├── DispatchQueue+Extensions.swift │ ├── Platform.Darwin.swift │ ├── Platform.Linux.swift │ └── RecursiveLock.swift ├── Preprocessor/ │ ├── Preprocessor/ │ │ └── main.swift │ ├── Preprocessor.xcodeproj/ │ │ ├── project.pbxproj │ │ ├── project.xcworkspace/ │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ └── xcschemes/ │ │ └── Preprocessor.xcscheme │ └── README.md ├── README.md ├── Rx.playground/ │ ├── Pages/ │ │ ├── Combining_Operators.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Connectable_Operators.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Creating_and_Subscribing_to_Observables.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Debugging_Operators.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Enable_RxSwift.Resources.total.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Error_Handling_Operators.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Filtering_and_Conditional_Operators.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Introduction.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Mathematical_and_Aggregate_Operators.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Table_of_Contents.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── Transforming_Operators.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ ├── TryYourself.xcplaygroundpage/ │ │ │ └── Contents.swift │ │ └── Working_with_Subjects.xcplaygroundpage/ │ │ └── Contents.swift │ ├── Sources/ │ │ └── SupportCode.swift │ ├── SupportCode.remap │ ├── contents.xcplayground │ └── playground.xcworkspace/ │ └── contents.xcworkspacedata ├── Rx.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata/ │ ├── xcbaselines/ │ │ └── C8E8BA541E2C181A00A4AC2C.xcbaseline/ │ │ ├── 91761072-433E-43DC-A058-545FB88C59EC.plist │ │ ├── 996C445D-86F0-429E-92A9-44EBD3769290.plist │ │ ├── B553A9F9-C6F1-4009-9BDC-AC42F9D31E38.plist │ │ └── Info.plist │ └── xcschemes/ │ ├── AllTests-iOS.xcscheme │ ├── AllTests-macOS.xcscheme │ ├── AllTests-tvOS.xcscheme │ ├── RxBlocking.xcscheme │ ├── RxCocoa.xcscheme │ ├── RxRelay.xcscheme │ ├── RxSwift.xcscheme │ └── RxTest.xcscheme ├── Rx.xcworkspace/ │ ├── contents.xcworkspacedata │ └── xcshareddata/ │ └── IDEWorkspaceChecks.plist ├── RxBlocking/ │ ├── BlockingObservable+Operators.swift │ ├── BlockingObservable.swift │ ├── Info.plist │ ├── ObservableConvertibleType+Blocking.swift │ ├── README.md │ ├── Resources.swift │ └── RunLoopLock.swift ├── RxCocoa/ │ ├── Common/ │ │ ├── ControlTarget.swift │ │ ├── DelegateProxy.swift │ │ ├── DelegateProxyType.swift │ │ ├── Infallible+Bind.swift │ │ ├── Observable+Bind.swift │ │ ├── RxCocoaObjCRuntimeError+Extensions.swift │ │ ├── RxTarget.swift │ │ ├── SectionedViewDataSourceType.swift │ │ └── TextInput.swift │ ├── Foundation/ │ │ ├── KVORepresentable+CoreGraphics.swift │ │ ├── KVORepresentable+Swift.swift │ │ ├── KVORepresentable.swift │ │ ├── NSObject+Rx+KVORepresentable.swift │ │ ├── NSObject+Rx+RawRepresentable.swift │ │ ├── NSObject+Rx.swift │ │ ├── NotificationCenter+Rx.swift │ │ └── URLSession+Rx.swift │ ├── Info.plist │ ├── Runtime/ │ │ ├── _RX.m │ │ ├── _RXDelegateProxy.m │ │ ├── _RXKVOObserver.m │ │ ├── _RXObjCRuntime.m │ │ └── include/ │ │ ├── RxCocoaRuntime.h │ │ ├── _RX.h │ │ ├── _RXDelegateProxy.h │ │ ├── _RXKVOObserver.h │ │ └── _RXObjCRuntime.h │ ├── RxCocoa.h │ ├── RxCocoa.swift │ ├── Traits/ │ │ ├── ControlEvent.swift │ │ ├── ControlProperty.swift │ │ ├── Driver/ │ │ │ ├── BehaviorRelay+Driver.swift │ │ │ ├── ControlEvent+Driver.swift │ │ │ ├── ControlProperty+Driver.swift │ │ │ ├── Driver+Subscription.swift │ │ │ ├── Driver.swift │ │ │ ├── Infallible+Driver.swift │ │ │ └── ObservableConvertibleType+Driver.swift │ │ ├── SharedSequence/ │ │ │ ├── ObservableConvertibleType+SharedSequence.swift │ │ │ ├── SchedulerType+SharedSequence.swift │ │ │ ├── SharedSequence+Concurrency.swift │ │ │ ├── SharedSequence+Operators+arity.swift │ │ │ ├── SharedSequence+Operators+arity.tt │ │ │ ├── SharedSequence+Operators.swift │ │ │ └── SharedSequence.swift │ │ └── Signal/ │ │ ├── ControlEvent+Signal.swift │ │ ├── ObservableConvertibleType+Signal.swift │ │ ├── PublishRelay+Signal.swift │ │ ├── Signal+Subscription.swift │ │ └── Signal.swift │ ├── iOS/ │ │ ├── DataSources/ │ │ │ ├── RxCollectionViewReactiveArrayDataSource.swift │ │ │ ├── RxPickerViewAdapter.swift │ │ │ └── RxTableViewReactiveArrayDataSource.swift │ │ ├── Events/ │ │ │ └── ItemEvents.swift │ │ ├── NSTextStorage+Rx.swift │ │ ├── Protocols/ │ │ │ ├── RxCollectionViewDataSourceType.swift │ │ │ ├── RxPickerViewDataSourceType.swift │ │ │ └── RxTableViewDataSourceType.swift │ │ ├── Proxies/ │ │ │ ├── RxCollectionViewDataSourcePrefetchingProxy.swift │ │ │ ├── RxCollectionViewDataSourceProxy.swift │ │ │ ├── RxCollectionViewDelegateProxy.swift │ │ │ ├── RxNavigationControllerDelegateProxy.swift │ │ │ ├── RxPickerViewDataSourceProxy.swift │ │ │ ├── RxPickerViewDelegateProxy.swift │ │ │ ├── RxScrollViewDelegateProxy.swift │ │ │ ├── RxSearchBarDelegateProxy.swift │ │ │ ├── RxSearchControllerDelegateProxy.swift │ │ │ ├── RxTabBarControllerDelegateProxy.swift │ │ │ ├── RxTabBarDelegateProxy.swift │ │ │ ├── RxTableViewDataSourcePrefetchingProxy.swift │ │ │ ├── RxTableViewDataSourceProxy.swift │ │ │ ├── RxTableViewDelegateProxy.swift │ │ │ ├── RxTextStorageDelegateProxy.swift │ │ │ ├── RxTextViewDelegateProxy.swift │ │ │ └── RxWKNavigationDelegateProxy.swift │ │ ├── UIActivityIndicatorView+Rx.swift │ │ ├── UIApplication+Rx.swift │ │ ├── UIBarButtonItem+Rx.swift │ │ ├── UIButton+Rx.swift │ │ ├── UICollectionView+Rx.swift │ │ ├── UIControl+Rx.swift │ │ ├── UIDatePicker+Rx.swift │ │ ├── UIGestureRecognizer+Rx.swift │ │ ├── UINavigationController+Rx.swift │ │ ├── UIPickerView+Rx.swift │ │ ├── UIRefreshControl+Rx.swift │ │ ├── UIScrollView+Rx.swift │ │ ├── UISearchBar+Rx.swift │ │ ├── UISearchController+Rx.swift │ │ ├── UISegmentedControl+Rx.swift │ │ ├── UISlider+Rx.swift │ │ ├── UIStepper+Rx.swift │ │ ├── UISwitch+Rx.swift │ │ ├── UITabBar+Rx.swift │ │ ├── UITabBarController+Rx.swift │ │ ├── UITableView+Rx.swift │ │ ├── UITextField+Rx.swift │ │ ├── UITextView+Rx.swift │ │ └── WKWebView+Rx.swift │ └── macOS/ │ ├── NSButton+Rx.swift │ ├── NSControl+Rx.swift │ ├── NSSlider+Rx.swift │ ├── NSTextField+Rx.swift │ ├── NSTextView+Rx.swift │ └── NSView+Rx.swift ├── RxExample/ │ ├── Extensions/ │ │ ├── CLLocationManager+Rx.swift │ │ ├── RxCLLocationManagerDelegateProxy.swift │ │ ├── RxImagePickerDelegateProxy.swift │ │ └── UIImagePickerController+Rx.swift │ ├── Playgrounds/ │ │ ├── Info.plist │ │ └── RxPlaygrounds.swift │ ├── RxDataSources/ │ │ ├── Differentiator/ │ │ │ ├── AnimatableSectionModel.swift │ │ │ ├── AnimatableSectionModelType+ItemPath.swift │ │ │ ├── AnimatableSectionModelType.swift │ │ │ ├── Changeset.swift │ │ │ ├── Diff.swift │ │ │ ├── Differentiator.h │ │ │ ├── IdentifiableType.swift │ │ │ ├── IdentifiableValue.swift │ │ │ ├── Info.plist │ │ │ ├── ItemPath.swift │ │ │ ├── Optional+Extensions.swift │ │ │ ├── SectionModel.swift │ │ │ ├── SectionModelType.swift │ │ │ └── Utilities.swift │ │ ├── README.md │ │ └── RxDataSources/ │ │ ├── AnimationConfiguration.swift │ │ ├── Array+Extensions.swift │ │ ├── CollectionViewSectionedDataSource.swift │ │ ├── DataSources.swift │ │ ├── Deprecated.swift │ │ ├── FloatingPointType+IdentifiableType.swift │ │ ├── Info.plist │ │ ├── IntegerType+IdentifiableType.swift │ │ ├── RxCollectionViewSectionedAnimatedDataSource.swift │ │ ├── RxCollectionViewSectionedReloadDataSource.swift │ │ ├── RxDataSources.h │ │ ├── RxPickerViewAdapter.swift │ │ ├── RxTableViewSectionedAnimatedDataSource.swift │ │ ├── RxTableViewSectionedReloadDataSource.swift │ │ ├── String+IdentifiableType.swift │ │ ├── TableViewSectionedDataSource.swift │ │ └── UI+SectionedViewType.swift │ ├── RxExample/ │ │ ├── Application+Extensions.swift │ │ ├── Example.swift │ │ ├── Examples/ │ │ │ ├── APIWrappers/ │ │ │ │ ├── APIWrappers.storyboard │ │ │ │ └── APIWrappersViewController.swift │ │ │ ├── Calculator/ │ │ │ │ ├── Calculator.storyboard │ │ │ │ ├── Calculator.swift │ │ │ │ └── CalculatorViewController.swift │ │ │ ├── Dependencies.swift │ │ │ ├── GeolocationExample/ │ │ │ │ ├── Geolocation.storyboard │ │ │ │ └── GeolocationViewController.swift │ │ │ ├── GitHubSearchRepositories/ │ │ │ │ ├── GitHubSearchRepositories.storyboard │ │ │ │ ├── GitHubSearchRepositories.swift │ │ │ │ ├── GitHubSearchRepositoriesAPI.swift │ │ │ │ ├── GitHubSearchRepositoriesViewController.swift │ │ │ │ └── UINavigationController+Extensions.swift │ │ │ ├── GitHubSignup/ │ │ │ │ ├── BindingExtensions.swift │ │ │ │ ├── DefaultImplementations.swift │ │ │ │ ├── GitHubSignup1.storyboard │ │ │ │ ├── GitHubSignup2.storyboard │ │ │ │ ├── Protocols.swift │ │ │ │ ├── UsingDriver/ │ │ │ │ │ ├── GitHubSignupViewController2.swift │ │ │ │ │ └── GithubSignupViewModel2.swift │ │ │ │ └── UsingVanillaObservables/ │ │ │ │ ├── GitHubSignupViewController1.swift │ │ │ │ └── GithubSignupViewModel1.swift │ │ │ ├── ImagePicker/ │ │ │ │ ├── ImagePicker.storyboard │ │ │ │ ├── ImagePickerController.swift │ │ │ │ └── UIImagePickerController+RxCreate.swift │ │ │ ├── Numbers/ │ │ │ │ ├── Numbers.storyboard │ │ │ │ └── NumbersViewController.swift │ │ │ ├── SimpleTableViewExample/ │ │ │ │ ├── SimpleTableViewExample.storyboard │ │ │ │ └── SimpleTableViewExampleViewController.swift │ │ │ ├── SimpleTableViewExampleSectioned/ │ │ │ │ ├── SimpleTableViewExampleSectioned.storyboard │ │ │ │ └── SimpleTableViewExampleSectionedViewController.swift │ │ │ ├── SimpleValidation/ │ │ │ │ ├── SimpleValidation.storyboard │ │ │ │ └── SimpleValidationViewController.swift │ │ │ ├── TableViewPartialUpdates/ │ │ │ │ ├── NumberCell.swift │ │ │ │ ├── NumberSectionView.swift │ │ │ │ ├── PartialUpdates.storyboard │ │ │ │ └── PartialUpdatesViewController.swift │ │ │ ├── TableViewWithEditingCommands/ │ │ │ │ ├── DetailViewController.swift │ │ │ │ ├── RandomUserAPI.swift │ │ │ │ ├── TableViewWithEditingCommands.storyboard │ │ │ │ ├── TableViewWithEditingCommandsViewController.swift │ │ │ │ ├── UIImageView+Extensions.swift │ │ │ │ └── User.swift │ │ │ ├── UIPickerViewExample/ │ │ │ │ ├── CustomPickerViewAdapterExampleViewController.swift │ │ │ │ ├── SimplePickerViewExampleViewController.swift │ │ │ │ └── SimpleUIPickerViewExample.storyboard │ │ │ ├── WikipediaImageSearch/ │ │ │ │ ├── ViewModels/ │ │ │ │ │ └── SearchResultViewModel.swift │ │ │ │ ├── Views/ │ │ │ │ │ ├── CollectionViewImageCell.swift │ │ │ │ │ ├── WikipediaImageCell.xib │ │ │ │ │ ├── WikipediaSearchCell.swift │ │ │ │ │ ├── WikipediaSearchCell.xib │ │ │ │ │ └── WikipediaSearchViewController.swift │ │ │ │ ├── WikipediaAPI/ │ │ │ │ │ ├── WikipediaAPI.swift │ │ │ │ │ ├── WikipediaPage.swift │ │ │ │ │ └── WikipediaSearchResult.swift │ │ │ │ └── WikipediaSearch.storyboard │ │ │ └── macOS simple example/ │ │ │ └── IntroductionExampleViewController.swift │ │ ├── Feedbacks.swift │ │ ├── Images.xcassets/ │ │ │ ├── AppIcon.appiconset/ │ │ │ │ └── Contents.json │ │ │ └── ReactiveExtensionsLogo.imageset/ │ │ │ └── Contents.json │ │ ├── Info-iOS.plist │ │ ├── Info-macOS.plist │ │ ├── Lenses.swift │ │ ├── Observable+Extensions.swift │ │ ├── Operators.swift │ │ ├── RxExample.xcdatamodeld/ │ │ │ ├── .xccurrentversion │ │ │ └── RxExample.xcdatamodel/ │ │ │ └── contents │ │ ├── Services/ │ │ │ ├── ActivityIndicator.swift │ │ │ ├── DownloadableImage.swift │ │ │ ├── GeolocationService.swift │ │ │ ├── HtmlParsing.swift │ │ │ ├── ImageService.swift │ │ │ ├── PseudoRandomGenerator.swift │ │ │ ├── Randomizer.swift │ │ │ ├── Reachability.swift │ │ │ ├── ReachabilityService.swift │ │ │ ├── UIImage+Extensions.swift │ │ │ ├── UIImageView+DownloadableImage.swift │ │ │ └── Wireframe.swift │ │ ├── String+URL.swift │ │ ├── Version.swift │ │ ├── ViewController.swift │ │ ├── iOS/ │ │ │ ├── AppDelegate.swift │ │ │ ├── BaseNavigationController.swift │ │ │ ├── LaunchScreen.xib │ │ │ ├── Main.storyboard │ │ │ ├── RootViewController.swift │ │ │ └── UITableView+Extensions.swift │ │ └── macOS/ │ │ ├── AppDelegate.swift │ │ └── Main.storyboard │ ├── RxExample-iOSTests/ │ │ ├── CLLocationManager+RxTests.swift │ │ ├── Info.plist │ │ ├── Mocks/ │ │ │ ├── MockGitHubAPI.swift │ │ │ ├── MockWireframe.swift │ │ │ ├── NotImplementedStubs.swift │ │ │ └── ValidationResult+Equatable.swift │ │ ├── RxExample_iOSTests.swift │ │ ├── RxTest.swift │ │ ├── TestScheduler+MarbleTests.swift │ │ └── UIImagePickerController+RxTests.swift │ ├── RxExample-iOSUITests/ │ │ ├── FlowTests.swift │ │ └── Info.plist │ ├── RxExample-macOSUITests/ │ │ ├── Info.plist │ │ └── RxExample_macOSUITests.swift │ └── RxExample.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ └── contents.xcworkspacedata │ └── xcshareddata/ │ └── xcschemes/ │ ├── RxExample-iOS.xcscheme │ ├── RxExample-iOSTests.xcscheme │ ├── RxExample-iOSUITests.xcscheme │ ├── RxExample-macOS.xcscheme │ └── RxExample-macOSUITests.xcscheme ├── RxRelay/ │ ├── BehaviorRelay.swift │ ├── Info.plist │ ├── Observable+Bind.swift │ ├── PublishRelay.swift │ ├── ReplayRelay.swift │ └── Utils.swift ├── RxSwift/ │ ├── AnyObserver.swift │ ├── Binder.swift │ ├── Cancelable.swift │ ├── Concurrency/ │ │ ├── AsyncLock.swift │ │ ├── Lock.swift │ │ ├── LockOwnerType.swift │ │ ├── SynchronizedDisposeType.swift │ │ ├── SynchronizedOnType.swift │ │ └── SynchronizedUnsubscribeType.swift │ ├── ConnectableObservableType.swift │ ├── Date+Dispatch.swift │ ├── Disposable.swift │ ├── Disposables/ │ │ ├── AnonymousDisposable.swift │ │ ├── BinaryDisposable.swift │ │ ├── BooleanDisposable.swift │ │ ├── CompositeDisposable.swift │ │ ├── Disposables.swift │ │ ├── DisposeBag.swift │ │ ├── DisposeBase.swift │ │ ├── NopDisposable.swift │ │ ├── RefCountDisposable.swift │ │ ├── ScheduledDisposable.swift │ │ ├── SerialDisposable.swift │ │ ├── SingleAssignmentDisposable.swift │ │ └── SubscriptionDisposable.swift │ ├── Errors.swift │ ├── Event.swift │ ├── Extensions/ │ │ └── Bag+Rx.swift │ ├── GroupedObservable.swift │ ├── ImmediateSchedulerType.swift │ ├── Info.plist │ ├── Observable+Concurrency.swift │ ├── Observable.swift │ ├── ObservableConvertibleType.swift │ ├── ObservableType+Extensions.swift │ ├── ObservableType.swift │ ├── Observables/ │ │ ├── AddRef.swift │ │ ├── Amb.swift │ │ ├── AsMaybe.swift │ │ ├── AsSingle.swift │ │ ├── Buffer.swift │ │ ├── Catch.swift │ │ ├── CombineLatest+Collection.swift │ │ ├── CombineLatest+arity.swift │ │ ├── CombineLatest+arity.tt │ │ ├── CombineLatest.swift │ │ ├── CompactMap.swift │ │ ├── Concat.swift │ │ ├── Create.swift │ │ ├── Debounce.swift │ │ ├── Debug.swift │ │ ├── Decode.swift │ │ ├── DefaultIfEmpty.swift │ │ ├── Deferred.swift │ │ ├── Delay.swift │ │ ├── DelaySubscription.swift │ │ ├── Dematerialize.swift │ │ ├── DistinctUntilChanged.swift │ │ ├── Do.swift │ │ ├── ElementAt.swift │ │ ├── Empty.swift │ │ ├── Enumerated.swift │ │ ├── Error.swift │ │ ├── Filter.swift │ │ ├── First.swift │ │ ├── Generate.swift │ │ ├── GroupBy.swift │ │ ├── Just.swift │ │ ├── Map.swift │ │ ├── Materialize.swift │ │ ├── Merge.swift │ │ ├── Multicast.swift │ │ ├── Never.swift │ │ ├── ObserveOn.swift │ │ ├── Optional.swift │ │ ├── Producer.swift │ │ ├── Range.swift │ │ ├── Reduce.swift │ │ ├── Repeat.swift │ │ ├── RetryWhen.swift │ │ ├── Sample.swift │ │ ├── Scan.swift │ │ ├── Sequence.swift │ │ ├── ShareReplayScope.swift │ │ ├── SingleAsync.swift │ │ ├── Sink.swift │ │ ├── Skip.swift │ │ ├── SkipUntil.swift │ │ ├── SkipWhile.swift │ │ ├── StartWith.swift │ │ ├── SubscribeOn.swift │ │ ├── Switch.swift │ │ ├── SwitchIfEmpty.swift │ │ ├── Take.swift │ │ ├── TakeLast.swift │ │ ├── TakeWithPredicate.swift │ │ ├── Throttle.swift │ │ ├── Timeout.swift │ │ ├── Timer.swift │ │ ├── ToArray.swift │ │ ├── Using.swift │ │ ├── Window.swift │ │ ├── WithLatestFrom.swift │ │ ├── WithUnretained.swift │ │ ├── Zip+Collection.swift │ │ ├── Zip+arity.swift │ │ ├── Zip+arity.tt │ │ └── Zip.swift │ ├── ObserverType.swift │ ├── Observers/ │ │ ├── AnonymousObserver.swift │ │ ├── ObserverBase.swift │ │ └── TailRecursiveSink.swift │ ├── Reactive.swift │ ├── Rx.swift │ ├── RxMutableBox.swift │ ├── SchedulerType.swift │ ├── Schedulers/ │ │ ├── ConcurrentDispatchQueueScheduler.swift │ │ ├── ConcurrentMainScheduler.swift │ │ ├── CurrentThreadScheduler.swift │ │ ├── HistoricalScheduler.swift │ │ ├── HistoricalSchedulerTimeConverter.swift │ │ ├── Internal/ │ │ │ ├── DispatchQueueConfiguration.swift │ │ │ ├── InvocableScheduledItem.swift │ │ │ ├── InvocableType.swift │ │ │ ├── ScheduledItem.swift │ │ │ └── ScheduledItemType.swift │ │ ├── MainScheduler.swift │ │ ├── OperationQueueScheduler.swift │ │ ├── RecursiveScheduler.swift │ │ ├── SchedulerServices+Emulation.swift │ │ ├── SerialDispatchQueueScheduler.swift │ │ ├── VirtualTimeConverterType.swift │ │ └── VirtualTimeScheduler.swift │ ├── Subjects/ │ │ ├── AsyncSubject.swift │ │ ├── BehaviorSubject.swift │ │ ├── PublishSubject.swift │ │ ├── ReplaySubject.swift │ │ └── SubjectType.swift │ ├── SwiftSupport/ │ │ └── SwiftSupport.swift │ └── Traits/ │ ├── Infallible/ │ │ ├── Infallible+CombineLatest+Collection.swift │ │ ├── Infallible+CombineLatest+arity.swift │ │ ├── Infallible+CombineLatest+arity.tt │ │ ├── Infallible+Concurrency.swift │ │ ├── Infallible+Create.swift │ │ ├── Infallible+Debug.swift │ │ ├── Infallible+Operators.swift │ │ ├── Infallible+Zip+arity.swift │ │ ├── Infallible+Zip+arity.tt │ │ ├── Infallible.swift │ │ └── ObservableConvertibleType+Infallible.swift │ └── PrimitiveSequence/ │ ├── Completable+AndThen.swift │ ├── Completable.swift │ ├── Maybe.swift │ ├── ObservableType+PrimitiveSequence.swift │ ├── PrimitiveSequence+Concurrency.swift │ ├── PrimitiveSequence+Zip+arity.swift │ ├── PrimitiveSequence+Zip+arity.tt │ ├── PrimitiveSequence.swift │ └── Single.swift ├── RxTest/ │ ├── Any+Equatable.swift │ ├── ColdObservable.swift │ ├── Event+Equatable.swift │ ├── HotObservable.swift │ ├── Info.plist │ ├── Recorded+Event.swift │ ├── Recorded.swift │ ├── RxTest.swift │ ├── Schedulers/ │ │ ├── TestScheduler.swift │ │ └── TestSchedulerVirtualTimeConverter.swift │ ├── Subscription.swift │ ├── TestableObservable.swift │ ├── TestableObserver.swift │ └── XCTest+Rx.swift ├── Sources/ │ ├── AllTestz/ │ │ └── main.swift │ ├── RxCocoa/ │ │ └── PrivacyInfo.xcprivacy │ ├── RxCocoaRuntime/ │ │ ├── PrivacyInfo.xcprivacy │ │ └── include/ │ │ ├── RxCocoaRuntime.h │ │ ├── _RX.h │ │ ├── _RXDelegateProxy.h │ │ ├── _RXKVOObserver.h │ │ └── _RXObjCRuntime.h │ ├── RxRelay/ │ │ └── PrivacyInfo.xcprivacy │ └── RxSwift/ │ └── PrivacyInfo.xcprivacy ├── Tests/ │ ├── Benchmarks/ │ │ ├── Benchmarks.swift │ │ └── Info.plist │ ├── Info.plist │ ├── MessageProcessingStage.swift │ ├── Microoptimizations/ │ │ ├── Info.plist │ │ ├── PerformanceTools.swift │ │ └── main.swift │ ├── Recorded+Timeless.swift │ ├── Resources.swift │ ├── RxBlockingTests/ │ │ └── Observable+BlockingTest.swift │ ├── RxCocoaTests/ │ │ ├── ControlEventTests.swift │ │ ├── ControlPropertyTests.swift │ │ ├── DelegateProxyTest+Cocoa.swift │ │ ├── DelegateProxyTest+UIKit.swift │ │ ├── DelegateProxyTest+WebKit.swift │ │ ├── DelegateProxyTest.swift │ │ ├── Driver+Test.swift │ │ ├── ExampleTests.swift │ │ ├── Infallible+BindTests.swift │ │ ├── KVOObservableTests.swift │ │ ├── NSButton+RxTests.swift │ │ ├── NSControl+RxTests.swift │ │ ├── NSLayoutConstraint+RxTests.swift │ │ ├── NSObject+RxTests.swift │ │ ├── NSSlider+RxTests.swift │ │ ├── NSTextField+RxTests.swift │ │ ├── NSTextView+RxTests.swift │ │ ├── NSView+RxTests.swift │ │ ├── NotificationCenterTests.swift │ │ ├── Observable+BindTests.swift │ │ ├── ObservableConvertibleType+SharedSequence.swift │ │ ├── RXObjCRuntime+Testing.h │ │ ├── RXObjCRuntime+Testing.m │ │ ├── RuntimeStateSnapshot.swift │ │ ├── RxObjCRuntimeState.swift │ │ ├── RxTest+Controls.swift │ │ ├── RxTest-iOS-Bridging-Header.h │ │ ├── RxTest-macOS-Bridging-Header.h │ │ ├── RxTest-tvOS-Bridging-Header.h │ │ ├── SentMessageTest.swift │ │ ├── SharedSequence+ConcurrencyTests.swift │ │ ├── SharedSequence+Extensions.swift │ │ ├── SharedSequence+OperatorTest.swift │ │ ├── SharedSequence+Test.swift │ │ ├── Signal+Test.swift │ │ ├── TestImplementations/ │ │ │ └── SectionedViewDataSourceMock.swift │ │ ├── UIActivityIndicatorView+RxTests.swift │ │ ├── UIAlertAction+RxTests.swift │ │ ├── UIApplication+RxTests.swift │ │ ├── UIBarButtonItem+RxTests.swift │ │ ├── UIButton+RxTests.swift │ │ ├── UICollectionView+RxTests.swift │ │ ├── UIControl+RxTests.swift │ │ ├── UIDatePicker+RxTests.swift │ │ ├── UIGestureRecognizer+RxTests.swift │ │ ├── UILabel+RxTests.swift │ │ ├── UINavigationController+RxTests.swift │ │ ├── UINavigationItem+RxTests.swift.swift │ │ ├── UIPageControl+RxTest.swift │ │ ├── UIPickerView+RxTests.swift │ │ ├── UIProgressView+RxTests.swift │ │ ├── UIScrollView+RxTests.swift │ │ ├── UISearchBar+RxTests.swift │ │ ├── UISearchController+RxTests.swift │ │ ├── UISegmentedControl+RxTests.swift │ │ ├── UISlider+RxTests.swift │ │ ├── UIStepper+RxTests.swift │ │ ├── UISwitch+RxTests.swift │ │ ├── UITabBar+RxTests.swift │ │ ├── UITabBarController+RxTests.swift │ │ ├── UITabBarItem+RxTests.swift │ │ ├── UITableView+RxTests.swift │ │ ├── UITextField+RxTests.swift │ │ ├── UITextView+RxTests.swift │ │ ├── UIView+RxTests.swift │ │ ├── UIViewController+RxTests.swift │ │ └── WKWebView+RxTests.swift │ ├── RxRelayTests/ │ │ ├── Observable+RelayBindTests.swift │ │ └── ReplayRelayTests.swift │ ├── RxSwiftTests/ │ │ ├── Anomalies.swift │ │ ├── AssumptionsTest.swift │ │ ├── AsyncSubjectTests.swift │ │ ├── Atomic+Overrides.swift │ │ ├── AtomicTests.swift │ │ ├── BagTest.swift │ │ ├── BehaviorSubjectTest.swift │ │ ├── Binder+Tests.swift │ │ ├── Completable+AndThen.swift │ │ ├── CompletableTest.swift │ │ ├── CurrentThreadSchedulerTest.swift │ │ ├── DisposableTest.swift │ │ ├── DisposeBagTest.swift │ │ ├── Event+Test.swift │ │ ├── HistoricalSchedulerTest.swift │ │ ├── Infallible+CombineLatestTests+arity.swift │ │ ├── Infallible+ConcurrencyTests.swift │ │ ├── Infallible+Tests.swift │ │ ├── MainSchedulerTests.swift │ │ ├── MaybeTest.swift │ │ ├── Observable+AmbTests.swift │ │ ├── Observable+BufferTests.swift │ │ ├── Observable+CatchTests.swift │ │ ├── Observable+CombineLatestTests+arity.swift │ │ ├── Observable+CombineLatestTests+arity.tt │ │ ├── Observable+CombineLatestTests.swift │ │ ├── Observable+CompactMapTests.swift │ │ ├── Observable+ConcatTests.swift │ │ ├── Observable+ConcurrencyTests.swift │ │ ├── Observable+DebugTests.swift │ │ ├── Observable+DecodeTests.swift │ │ ├── Observable+DefaultIfEmpty.swift │ │ ├── Observable+DelaySubscriptionTests.swift │ │ ├── Observable+DelayTests.swift │ │ ├── Observable+DematerializeTests.swift │ │ ├── Observable+DistinctUntilChangedTests.swift │ │ ├── Observable+DoOnTests.swift │ │ ├── Observable+ElementAtTests.swift │ │ ├── Observable+EnumeratedTests.swift │ │ ├── Observable+FilterTests.swift │ │ ├── Observable+GenerateTests.swift │ │ ├── Observable+GroupByTests.swift │ │ ├── Observable+JustTests.swift │ │ ├── Observable+MapTests.swift │ │ ├── Observable+MaterializeTests.swift │ │ ├── Observable+MergeTests.swift │ │ ├── Observable+MulticastTests.swift │ │ ├── Observable+ObserveOnTests.swift │ │ ├── Observable+OptionalTests.swift │ │ ├── Observable+PrimitiveSequenceTest.swift │ │ ├── Observable+RangeTests.swift │ │ ├── Observable+ReduceTests.swift │ │ ├── Observable+RepeatTests.swift │ │ ├── Observable+RetryWhenTests.swift │ │ ├── Observable+SampleTests.swift │ │ ├── Observable+ScanTests.swift │ │ ├── Observable+SequenceTests.swift │ │ ├── Observable+ShareReplayScopeTests.swift │ │ ├── Observable+SingleTests.swift │ │ ├── Observable+SkipTests.swift │ │ ├── Observable+SkipUntilTests.swift │ │ ├── Observable+SkipWhileTests.swift │ │ ├── Observable+SubscribeOnTests.swift │ │ ├── Observable+SubscriptionTest.swift │ │ ├── Observable+SwitchIfEmptyTests.swift │ │ ├── Observable+SwitchTests.swift │ │ ├── Observable+TakeLastTests.swift │ │ ├── Observable+TakeTests.swift │ │ ├── Observable+TakeUntilTests.swift │ │ ├── Observable+TakeWhileTests.swift │ │ ├── Observable+Tests.swift │ │ ├── Observable+ThrottleTests.swift │ │ ├── Observable+TimeoutTests.swift │ │ ├── Observable+TimerTests.swift │ │ ├── Observable+ToArrayTests.swift │ │ ├── Observable+UsingTests.swift │ │ ├── Observable+WindowTests.swift │ │ ├── Observable+WithLatestFromTests.swift │ │ ├── Observable+WithUnretainedTests.swift │ │ ├── Observable+ZipTests+arity.swift │ │ ├── Observable+ZipTests+arity.tt │ │ ├── Observable+ZipTests.swift │ │ ├── ObservableType+SubscriptionTests.swift │ │ ├── ObserverTests.swift │ │ ├── PrimitiveSequence+ConcurrencyTests.swift │ │ ├── PrimitiveSequenceTest+zip+arity.swift │ │ ├── PrimitiveSequenceTest+zip+arity.tt │ │ ├── PublishSubjectTest.swift │ │ ├── QueueTests.swift │ │ ├── Reactive+Tests.swift │ │ ├── RecursiveLockTest.swift │ │ ├── ReplaySubjectTest.swift │ │ ├── SchedulerTests.swift │ │ ├── SharingSchedulerTests.swift │ │ ├── SingleTest.swift │ │ ├── SubjectConcurrencyTest.swift │ │ ├── Synchronized.swift │ │ ├── TestImplementations/ │ │ │ ├── ElementIndexPair.swift │ │ │ ├── EquatableArray.swift │ │ │ ├── Mocks/ │ │ │ │ ├── BackgroundThreadPrimitiveHotObservable.swift │ │ │ │ ├── MainThreadPrimitiveHotObservable.swift │ │ │ │ ├── MockDisposable.swift │ │ │ │ ├── MySubject.swift │ │ │ │ ├── Observable.Extensions.swift │ │ │ │ ├── PrimitiveHotObservable.swift │ │ │ │ ├── PrimitiveMockObserver.swift │ │ │ │ └── TestConnectableObservable.swift │ │ │ ├── Observable+Extensions.swift │ │ │ └── TestVirtualScheduler.swift │ │ └── VirtualSchedulerTest.swift │ ├── RxTest.swift │ ├── TestErrors.swift │ └── XCTest+AllTests.swift ├── Version.xcconfig ├── assets/ │ ├── CNAME.txt │ └── LICENSE.txt ├── default.profraw ├── docs/ │ ├── Classes/ │ │ ├── AsyncSubject.html │ │ ├── BehaviorSubject.html │ │ ├── BooleanDisposable.html │ │ ├── CompositeDisposable.html │ │ ├── ConcurrentDispatchQueueScheduler.html │ │ ├── ConcurrentMainScheduler.html │ │ ├── ConnectableObservable.html │ │ ├── CurrentThreadScheduler.html │ │ ├── DisposeBag/ │ │ │ └── DisposableBuilder.html │ │ ├── DisposeBag.html │ │ ├── HistoricalScheduler.html │ │ ├── MainScheduler.html │ │ ├── Observable.html │ │ ├── OperationQueueScheduler.html │ │ ├── PublishSubject.html │ │ ├── RefCountDisposable.html │ │ ├── ReplaySubject.html │ │ ├── ScheduledDisposable.html │ │ ├── SerialDispatchQueueScheduler.html │ │ ├── SerialDisposable.html │ │ ├── SingleAssignmentDisposable.html │ │ └── VirtualTimeScheduler.html │ ├── Enums/ │ │ ├── CompletableEvent.html │ │ ├── Event.html │ │ ├── Hooks.html │ │ ├── InfallibleEvent.html │ │ ├── MaybeEvent.html │ │ ├── Resources.html │ │ ├── RxError.html │ │ ├── SingleEvent.html │ │ ├── SubjectLifetimeScope.html │ │ ├── TakeBehavior.html │ │ ├── TakeUntilBehavior.html │ │ └── VirtualTimeComparison.html │ ├── Extensions/ │ │ └── AsyncSequence.html │ ├── Other Classes.html │ ├── Other Enums.html │ ├── Other Extensions.html │ ├── Other Global Variables.html │ ├── Other Protocols.html │ ├── Other Structs.html │ ├── Other Typealiases.html │ ├── Protocols/ │ │ ├── Cancelable.html │ │ ├── ConnectableObservableType.html │ │ ├── DataDecoder.html │ │ ├── Disposable.html │ │ ├── EventConvertible.html │ │ ├── ImmediateSchedulerType.html │ │ ├── InfallibleType.html │ │ ├── ObservableConvertibleType.html │ │ ├── ObservableType.html │ │ ├── ObserverType.html │ │ ├── PrimitiveSequenceType.html │ │ ├── ReactiveCompatible.html │ │ ├── SchedulerType.html │ │ ├── SubjectType.html │ │ └── VirtualTimeConverterType.html │ ├── RxSwift/ │ │ ├── Disposables.html │ │ ├── Schedulers.html │ │ ├── Subjects.html │ │ ├── Traits/ │ │ │ ├── Infallible.html │ │ │ └── PrimitiveSequence.html │ │ └── Traits.html │ ├── RxSwift.html │ ├── Structs/ │ │ ├── AnyObserver.html │ │ ├── Binder.html │ │ ├── Disposables.html │ │ ├── GroupedObservable.html │ │ ├── HistoricalSchedulerTimeConverter.html │ │ ├── Infallible.html │ │ ├── PrimitiveSequence.html │ │ ├── Reactive.html │ │ └── Resources.html │ ├── css/ │ │ ├── highlight.css │ │ └── jazzy.css │ ├── index.html │ ├── js/ │ │ ├── jazzy.js │ │ ├── jazzy.search.js │ │ └── typeahead.jquery.js │ ├── search.json │ └── undocumented.json ├── mise.toml └── scripts/ ├── all-tests.sh ├── common.sh ├── make-xcframeworks.sh ├── package-spm.swift ├── profile-build-times.sh ├── swiftlint.sh ├── test-linux.sh ├── update-jazzy-config.rb ├── update-jazzy-docs.sh ├── validate-headers.swift ├── validate-markdown.sh └── validate-playgrounds.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorConfig ================================================ # editorconfig.org root = true [*] indent_style = space indent_size = 4 trim_trailing_whitespace = true insert_final_newline = true ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ :warning: If you don't have something to report in the following format, it will probably be easier and faster to ask in the [slack channel](http://slack.rxswift.org/) first. :warning: :warning: Please take you time to fill in the fields below. If we aren't provided with this basic information about your issue we probably won't be able to help you and there won't be much we can do except to close the issue :( :warning: *If you still want to report issue, please delete above statements before submitting an issue.* **Short description of the issue**: _description here_ **Expected outcome**: _what you expect to happen goes here_ **What actually happens**: _what actually happens goes here_ **Self contained code example that reproduces the issue**: ```swift code goes here // If we can't get a self contained code example that reproduces the issue, there is a big chance we won't be able // to help you because there is not much we can do. // // `Self contained code example` means: // // * that we should be able to just run the provided code without changing it. // * that it will reproduce the issue upon running ``` **RxSwift/RxCocoa/RxBlocking/RxTest version/commit** _version or commit here_ **Platform/Environment** - [ ] iOS - [ ] macOS - [ ] tvOS - [ ] watchOS - [ ] playgrounds **How easy is to reproduce? (chances of successful reproduce after running the self contained code)** - [ ] easy, 100% repro - [ ] sometimes, 10%-100% - [ ] hard, 2% - 10% - [ ] extremely hard, %0 - 2% **Xcode version**: ``` Xcode version goes here ``` :warning: Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. :warning: **Installation method**: - [ ] Swift Package Manager - [ ] Carthage - [ ] Git submodules **I have multiple versions of Xcode installed**: (so we can know if this is a potential cause of your issue) - [ ] yes (which ones) - [ ] no **Level of RxSwift knowledge**: (this is so we can understand your level of knowledge and formulate the response in an appropriate manner) - [ ] just starting - [ ] I have a small code base - [ ] I have a significant code base ================================================ FILE: .github/workflows/tests.yml ================================================ name: RxSwift on: push: branches: - "main" pull_request: workflow_dispatch: jobs: xcode26: name: "Xcode 26" runs-on: macos-latest strategy: fail-fast: false matrix: environment: [iOS, iOS-Example, Unix, watchOS, tvOS, macCatalyst, SPM] steps: - uses: actions/checkout@v3 - name: Select Xcode 26 run: sudo xcode-select -s /Applications/Xcode_26.2.app - name: Run Tests run: CI=1 ./scripts/all-tests.sh "${{ matrix.environment }}" xcode16: name: "Xcode 16" runs-on: macos-15 strategy: fail-fast: false matrix: environment: [iOS, iOS-Example, Unix, watchOS, tvOS, SPM] steps: - uses: actions/checkout@v3 - name: Select Xcode 16 run: sudo xcode-select -s /Applications/Xcode_16.4.app - name: Run Tests run: CI=1 ./scripts/all-tests.sh "${{ matrix.environment }}" linux: name: "Build (Android)" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: "Build Swift Package on Android" uses: skiptools/swift-android-action@v2 with: run-tests: false # We're having some issues with the Linux tests, so we're disabling them for now. # Hopefully we'll be able to fix and re-enable them soon. # Even more hopefully that I won't git blame this comment in the future and see it was 5 years ago :) # Some more info on part of the breakage is here: https://forums.swift.org/t/swift-6-0-regression-cannot-inherit-from-some-foundation-classes-on-linux-because-it-has-overridable-members-that-could-not-be-loaded/74794 # linux: # name: "Test (Linux)" # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v3 # - name: Run tests # run: CI=1 ./scripts/all-tests.sh "Unix" ================================================ FILE: .gitignore ================================================ # Xcode # build/ Build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata *.xccheckout *.moved-aside DerivedData *.hmap *.ipa *.xcuserstate *.o .swiftpm/ docs/docsets *.xcframework timeline.xctimeline .vscode # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts Carthage/Build # Various .DS_Store # Linux *.swp *.swo # Swift Package Manager .build/ Packages/ .swiftpm # AppCode .idea ================================================ FILE: .jazzy.yml ================================================ --- custom_categories: - name: RxCocoa/Common children: - ControlTarget - DelegateProxy - DelegateProxyType - Infallible+Bind - Observable+Bind - RxCocoaObjCRuntimeError+Extensions - RxTarget - SectionedViewDataSourceType - TextInput - name: RxCocoa/Foundation children: - KVORepresentable+CoreGraphics - KVORepresentable+Swift - KVORepresentable - NSObject+Rx+KVORepresentable - NSObject+Rx+RawRepresentable - NSObject+Rx - NotificationCenter+Rx - URLSession+Rx - name: RxCocoa/Platform children: - DispatchQueue+Extensions - name: RxCocoa children: - RxCocoa - name: RxCocoa/Traits children: - ControlEvent - ControlProperty - name: RxCocoa/Traits/Driver children: - BehaviorRelay+Driver - ControlEvent+Driver - ControlProperty+Driver - Driver+Subscription - Driver - Infallible+Driver - ObservableConvertibleType+Driver - name: RxCocoa/Traits/SharedSequence children: - ObservableConvertibleType+SharedSequence - SchedulerType+SharedSequence - SharedSequence+Concurrency - SharedSequence+Operators+arity - SharedSequence+Operators - SharedSequence - name: RxCocoa/Traits/Signal children: - ControlEvent+Signal - ObservableConvertibleType+Signal - PublishRelay+Signal - Signal+Subscription - Signal - name: RxCocoa/iOS/DataSources children: - RxCollectionViewReactiveArrayDataSource - RxPickerViewAdapter - RxTableViewReactiveArrayDataSource - name: RxCocoa/iOS/Events children: - ItemEvents - name: RxCocoa/iOS children: - NSTextStorage+Rx - UIActivityIndicatorView+Rx - UIApplication+Rx - UIBarButtonItem+Rx - UIButton+Rx - UICollectionView+Rx - UIControl+Rx - UIDatePicker+Rx - UIGestureRecognizer+Rx - UINavigationController+Rx - UIPickerView+Rx - UIRefreshControl+Rx - UIScrollView+Rx - UISearchBar+Rx - UISearchController+Rx - UISegmentedControl+Rx - UISlider+Rx - UIStepper+Rx - UISwitch+Rx - UITabBar+Rx - UITabBarController+Rx - UITableView+Rx - UITextField+Rx - UITextView+Rx - WKWebView+Rx - name: RxCocoa/iOS/Protocols children: - RxCollectionViewDataSourceType - RxPickerViewDataSourceType - RxTableViewDataSourceType - name: RxCocoa/iOS/Proxies children: - RxCollectionViewDataSourcePrefetchingProxy - RxCollectionViewDataSourceProxy - RxCollectionViewDelegateProxy - RxNavigationControllerDelegateProxy - RxPickerViewDataSourceProxy - RxPickerViewDelegateProxy - RxScrollViewDelegateProxy - RxSearchBarDelegateProxy - RxSearchControllerDelegateProxy - RxTabBarControllerDelegateProxy - RxTabBarDelegateProxy - RxTableViewDataSourcePrefetchingProxy - RxTableViewDataSourceProxy - RxTableViewDelegateProxy - RxTextStorageDelegateProxy - RxTextViewDelegateProxy - RxWKNavigationDelegateProxy - name: RxCocoa/macOS children: - NSButton+Rx - NSControl+Rx - NSSlider+Rx - NSTextField+Rx - NSTextView+Rx - NSView+Rx - name: RxRelay children: - BehaviorRelay - Observable+Bind - PublishRelay - ReplayRelay - Utils - name: RxSwift children: - AnyObserver - Binder - Cancelable - ConnectableObservableType - Date+Dispatch - Disposable - Errors - Event - GroupedObservable - ImmediateSchedulerType - Observable+Concurrency - Observable - ObservableConvertibleType - ObservableType+Extensions - ObservableType - ObserverType - Reactive - Rx - RxMutableBox - SchedulerType - name: RxSwift/Concurrency children: - AsyncLock - Lock - LockOwnerType - SynchronizedDisposeType - SynchronizedOnType - SynchronizedUnsubscribeType - name: RxSwift/Disposables children: - AnonymousDisposable - BinaryDisposable - BooleanDisposable - CompositeDisposable - Disposables - DisposeBag - DisposeBase - NopDisposable - RefCountDisposable - ScheduledDisposable - SerialDisposable - SingleAssignmentDisposable - SubscriptionDisposable - name: RxSwift/Extensions children: - Bag+Rx - name: RxSwift/Observables children: - AddRef - Amb - AsMaybe - AsSingle - Buffer - Catch - CombineLatest+Collection - CombineLatest+arity - CombineLatest - CompactMap - Concat - Create - Debounce - Debug - Decode - DefaultIfEmpty - Deferred - Delay - DelaySubscription - Dematerialize - DistinctUntilChanged - Do - ElementAt - Empty - Enumerated - Error - Filter - First - Generate - GroupBy - Just - Map - Materialize - Merge - Multicast - Never - ObserveOn - Optional - Producer - Range - Reduce - Repeat - RetryWhen - Sample - Scan - Sequence - ShareReplayScope - SingleAsync - Sink - Skip - SkipUntil - SkipWhile - StartWith - SubscribeOn - Switch - SwitchIfEmpty - Take - TakeLast - TakeWithPredicate - Throttle - Timeout - Timer - ToArray - Using - Window - WithLatestFrom - WithUnretained - Zip+Collection - Zip+arity - Zip - name: RxSwift/Observers children: - AnonymousObserver - ObserverBase - TailRecursiveSink - name: RxSwift/Platform children: - AtomicInt - DispatchQueue+Extensions - Platform.Darwin - Platform.Linux - RecursiveLock - name: RxSwift/Platform/DataStructures children: - Bag - InfiniteSequence - PriorityQueue - Queue - name: RxSwift/Schedulers children: - ConcurrentDispatchQueueScheduler - ConcurrentMainScheduler - CurrentThreadScheduler - HistoricalScheduler - HistoricalSchedulerTimeConverter - MainScheduler - OperationQueueScheduler - RecursiveScheduler - SchedulerServices+Emulation - SerialDispatchQueueScheduler - VirtualTimeConverterType - VirtualTimeScheduler - name: RxSwift/Schedulers/Internal children: - DispatchQueueConfiguration - InvocableScheduledItem - InvocableType - ScheduledItem - ScheduledItemType - name: RxSwift/Subjects children: - AsyncSubject - BehaviorSubject - PublishSubject - ReplaySubject - SubjectType - name: RxSwift/SwiftSupport children: - SwiftSupport - name: RxSwift/Traits/Infallible children: - Infallible+CombineLatest+Collection - Infallible+CombineLatest+arity - Infallible+Concurrency - Infallible+Create - Infallible+Debug - Infallible+Operators - Infallible+Zip+arity - Infallible - ObservableConvertibleType+Infallible - name: RxSwift/Traits/PrimitiveSequence children: - Completable+AndThen - Completable - Maybe - ObservableType+PrimitiveSequence - PrimitiveSequence+Concurrency - PrimitiveSequence+Zip+arity - PrimitiveSequence - Single ================================================ FILE: .ruby-version ================================================ 3.3.0 ================================================ FILE: .swift-version ================================================ 6.1 ================================================ FILE: .swiftformat ================================================ --ifdef no-indent --wrap-arguments before-first --commas inline --doc-comments preserve --exclude Sources/AllTestz/main.swift,RxTest/HotObservable.swift,Tests/RxSwiftTests/BagTest.swift ================================================ FILE: .swiftlint.yml ================================================ included: - RxSwift - RxCocoa - RxTest - RxBlocking opt_in_rules: - overridden_super_call - private_outlet - prohibited_super_call - first_where - closure_spacing - unneeded_parentheses_in_closure_argument - redundant_nil_coalescing - pattern_matching_keywords - explicit_init - contains_over_first_not_nil disabled_rules: - line_length - trailing_whitespace - type_name - identifier_name - vertical_whitespace - trailing_newline - opening_brace - large_tuple - file_length - comma - colon - private_over_fileprivate - force_cast - force_try - function_parameter_count - statement_position - legacy_hashing - todo - operator_whitespace - type_body_length - function_body_length - cyclomatic_complexity ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting one of the project maintainers https://github.com/ReactiveX/RxSwift/graphs/contributors. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ ================================================ FILE: CONTRIBUTING.md ================================================ ## Contributing to RxSwift Thank you for your interest in RxSwift! There are multiple ways you can contribute to this project. We welcome contributions in all areas, with special attention to: * [Issue fixes](#issue-fixes) * [Performance improvements](#performance-improvements) * [Documentation improvements](#documentation-improvements) * [New operators](#new-operators) (**read carefully!**) Please take the time to carefully read the following guide. These rules help make the best out of your time, the code reviewer's time and the general consistency of the project. ### General rules All contributions are handled via Pull Requests (PRs). Your PR _must_ target the `[main](https://github.com/ReactiveX/RxSwift/tree/main)` branch. This is the place where we aggregate all upcoming changes for the next release of RxSwift. Moreover, your PR _must_ pass all tests and provide a meaningful description of what it is about. We have bots looking at PRs and enforcing these rules. Before submitting a pull request please make sure **`./scripts/all-tests.sh`** is passing (exits with 0), otherwise we won't be able to pull your code. To be able to run `./scripts/all-tests.sh`, you'll need to install [xcbeautify](https://github.com/cpisciotta/xcbeautify). `brew install xcbeautify` Once the tests pass, you can push your feature branch to your clone of the repository, then open a pull request. There are some best practices that will be followed during the development of this project for common good ([Gitflow](http://nvie.com/posts/a-successful-git-branching-model/) branching model). Don't forget to update `CHANGELOG.md` before pushing your PR. While text may be re-worded before release, but it'll help tracking the changes. Quick checklist summary before submitting a PR: * 🔎 Make sure tests are added or updated to accommodate your changes. We do not accept any addition that come without tests. When possible, add tests to verify bug fixes and prevent future regressions. * 📖 Check that you provided a CHANGELOG entry documenting your changes (except for documentation improvements) * 👌 Verify that tests pass * 👍 Push it! ### Slack channel Many of the RxSwift Community contributors interact on the [RxSwift Slack](https://rxswift.slack.com). It is a good starting place to exchange ideas and talk about your planned contributions to RxSwift. A good first step would be to join the slack, in particular the `#community` channel. ### Issue fixes Fixing issues is a good way to start contributing and getting used to the large codebase in project! You may want to look at outstanding [reported issues](https://github.com/ReactiveX/RxSwift/issues), or maybe you bumped into an issue that you found. In the latter case, please make sure you first open an issue in the [issue tracker](https://github.com/ReactiveX/RxSwift/issues) and indicate that you're working on a fix. This will give a chance to other contributors to chime in, and help tracking who's working on what in order to avoid duplicate work. Once you believe the issue is fixed, make sure the tests pass (see above) then open a Pull Request. Congratulations on contributing a fix! We love receiving new bug fixes and your help is very much welcomed. ### Performance improvements We take performance very much to heart. RxSwift is at the core of some large products, and is a moderately complex framework with a lot of code. Performance improvements are always welcome! If you identified a bottleneck, please make sure you follow the performance fix procedure: * Prepare a reproducible case that highlights the performance issue, if possible. At least, the case should provide a testable timing result. * Submit a PR with a fix that provides a measurable performance improvement * Think hard about all the use cases! Threading and concurrency are important to think about when it comes to performance, make sure your fix doesn't come with a performance regression in some use cases. As previously highlighted, discussing the matter via an issue is a preferred starting point. This will allow other contributors to join and express their point of view, allowing for a smooth glide from problem description to resolution. Thanks for caring about performance! RxSwift is a crucial component of many applications and performance issues can have a wide impact. ### Documentation improvements RxSwift is a complex project. Reactive programming in general is a lot about explaining the concepts, classes and operators. If you spotted a place where documentation could be improved (be in it-line documentation of project markdown pages), please feel free to submit a documentation improvement PR. We very much need a documentation that is as good, as as up-to-date as possible! We understand the need for foreign language documentation. Unfortunately, due to the scope and breadth of the project it's a tough promise to keep up-to-date documentation in other languages than English. Moreover, all contributors only have English as a common language on the project. Therefore, and to keep the project as maintainable as possible, we only accept documentation changes and improvements provided in English. If you're looking at providing a translation of the in-line documentation, please make sure you have the resources and time to keep it updated as the framework changes. We care a lot about the quality of both the code and its documentation, over the long term. Maintaining a foreign language translation is a longtime commitment that should not be taken lightly. Thank you for your interest in helping with documentation! Your contributions will make the life of other developers easier. ### New operators If you're thinking about adding new operators to RxSwift, please make sure you discuss them via an [issue](https://github.com/ReactiveX/RxSwift/issues) first. RxSwift is a large project, and we're trying to keep its core as compact as possible. We understand the desire to fulfill various kinds of needs, and want to make sure the core serves the majority of developers. Any operator you need may also be needed by others! But not all operators belong to the RxSwift core. The [RxSwift Community](https://github.com/RxSwiftCommunity/) is home to many projects that may be a better recipient for the improvements you want to bring. In some cases, you may even find that your specific problem is addressed by one of the RxSwiftCommunity project! Some operators, even though available in the core of other ReactiveX implementations, may be left out of the RxSwift code. Some of them can go into the [RxSwiftExt](https://github.com/RxSwiftCommunity/RxSwiftExt) project, others can be hosted in one of the many satellite community projects. In any case, feel free to discuss your need in an [issue](https://github.com/ReactiveX/RxSwift/issues) ! The RxSwift Community is all about helping and interacting with fellow developers, and we very much welcome ## Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: - (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or - (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or - (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. - (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. *Wording of statement copied from [elinux.org](http://elinux.org/Developer_Certificate_Of_Origin)* ================================================ FILE: Dangerfile ================================================ # Warn about develop branch warn("Please target PRs to `develop` branch") if github.branch_for_base != "develop" # Sometimes it's a README fix, or something like that - which isn't relevant for # including in a project's CHANGELOG for example declared_trivial = github.pr_title.include? "#trivial" # Make it more obvious that a PR is a work in progress and shouldn't be merged yet warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]" # Warn no CHANGELOG warn("No CHANGELOG changes made") if git.lines_of_code > 50 && !git.modified_files.include?("CHANGELOG.md") && !declared_trivial # Warn summary on pull request if github.pr_body.length < 5 warn "Please provide a summary in the Pull Request description" end # If these are all empty something has gone wrong, better to raise it in a comment if git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty? fail "This PR has no changes at all, this is likely a developer issue." end # Warn when there is a big PR warn("Big PR") if git.lines_of_code > 500 ================================================ FILE: Documentation/ComparisonWithOtherLibraries.md ================================================ # Comparison with other libraries This section attempts to compare RxSwift with other known and popular alternatives. The best part about reactive programming is that most of the concepts you'll learn from either of these frameworks are entirely applicable to RxSwift, and vice-versa, with only relatively minor framework-specific concepts and naming conventions. ## Apple's Combine Combine is Apple's own implementation of the [Reactive Streams](https://www.reactive-streams.org) standard. The main differences to consider are that Combine uses typed errors, and supports backpressure. Its huge downside is that it's closed source, limited to iOS 13 and up, and does not support Linux as of today. It also does not have its own testing framework like RxTest or RxBlocking, and doesn't have its own UIKit-supporting framework such as RxCocoa, since it is more aimed towards SwiftUI. Some of these issues have been addressed by community projects such as [CombineCocoa](https://github.com/CombineCommunity/CombineCocoa), [combine-schedulers](https://github.com/pointfreeco/combine-schedulers) and [CombineExpectations](https://github.com/groue/CombineExpectations). It is also (as of 2020) a relatively young and not as battle-tested as RxSwift or ReactiveSwift which are around for over half a decade. If you're interested in using Combine for your relatively modern codebase while still using your RxSwift codebase, you can leverage [RxCombine](https://github.com/CombineCommunity/RxCombine), a community project which aims to provide interoperability between Combine and RxSwift. ## ReactiveSwift RxSwift is somewhat similar to ReactiveSwift since ReactiveSwift borrows a large number of concepts from Rx. One of the main goals of this project was to create a significantly simpler interface that is more aligned with other Rx implementations, offers a richer concurrency model, offers more optimization opportunities and is more aligned with built-in Swift error handling mechanisms. We've also decided to only rely on the Swift/llvm compiler and not introduce any external dependencies. Probably the main difference between these projects is in their approach in building abstractions. The main goal of RxSwift project is to provide environment-agnostic compositional computation glue abstracted in the form of observable sequences. We then aim to improve the experience of using RxSwift on specific platforms. To do this, RxCocoa uses generic computations to build more practical abstractions and wrap Foundation/Cocoa/UIKit frameworks. That means that other libraries give context and semantics to the generic computation engine RxSwift provides such as `Driver`, `Signal`, `ControlProperty`, `ControlEvent`s and more. One of the benefits to representing all of these abstractions as a single concept - ​_observable sequences_​ - is that all computation abstractions built on top of them are also composable in the same fundamental way. They all follow the same contract and implement the same interface. It is also easy to create flexible subscription (resource) sharing strategies or use one of the built-in ones: `share`, `publish`, `multicast` ... This library also offers a fine-tunable concurrency model. If concurrent schedulers are used, observable sequence operators will preserve sequence properties. The same observable sequence operators will also know how to detect and optimally use known serial schedulers. ReactiveSwift has a more limited concurrency model and only allows serial schedulers. Multithreaded programming is really hard and detecting non-trivial loops is even harder. That's why all operators are built in a fault tolerant way. Even if element generation occurs during element processing (recursion), operators will try to handle that situation and prevent deadlocks. This means that in the worst possible case programming error will cause stack overflow, but users won't have to manually kill the app, and you will get a crash report in error reporting systems so you can find and fix the problem. ================================================ FILE: Documentation/DesignRationale.md ================================================ Design Rationale ================ ## Why error type isn't generic ```Swift enum Event { case next(Element) // next element of a sequence case error(Error) // sequence failed with error case completed // sequence terminated successfully } ``` Let's discuss the pros and cons of `Error` being generic. If you have a generic error type, you create additional impedance mismatch between two observables. Let's say you have: `Observable` and `Observable` There isn't much you can do with them without figuring out what the resulting error type will be. Will it be `E1`, `E2` or some new `E3` maybe? So, you would need a new set of operators just to solve that impedance mismatch. This hurts composition properties, and Rx isn't concerned with why a sequence fails, it just usually forwards failures further down the observable chain. There is an additional problem that, in some cases, operators might fail due to some internal error, in which case you wouldn't be able to construct a resulting error and report failure. But OK, let's ignore that and assume we can use that to model sequences that don't error out. Could it be useful for that purpose? Well yes, it potentially could be, but let's consider why you would want to use sequences that don't error out. One obvious application would be for permanent streams in the UI layer that drive the entire UI. When you consider that case, it's not really sufficient to only use the compiler to prove that sequences don't error out, you also need to prove other properties. For instance, those elements are observed on `MainScheduler`. What you really need is a generic way to prove traits for observable sequences. There are a lot of properties you could be interested in. For example: * sequence terminates in finite time (server side) * sequence contains only one element (if you are running some computation) * sequence doesn't error out, never terminates and elements are delivered on main scheduler (UI) * sequence doesn't error out, never terminates and elements are delivered on main scheduler, and has refcounted sharing (UI) * sequence doesn't error out, never terminates and elements are delivered on specific background scheduler (audio engine) What you really want is a general compiler-enforced system of traits for observable sequences, and a set of invariant operators for those wanted properties. A good analogy would be: ``` 1, 3.14, e, 2.79, 1 + 1i <-> Observable 1m/s, 1T, 5kg, 1.3 pounds <-> Errorless observable, UI observable, Finite observable ... ``` There are many ways to do such a thing in Swift by either using composition or inheritance of observables. An additional benefit of using a unit system is that you can prove that UI code is executing on the same scheduler and thus use lockless operators for all transformations. Since RxSwift already doesn't have locks for single sequence operations, and all of the locks that do exist are in stateful components (e.g. UI), there are practically no locks in RxSwift code, which allows for such details to be compiler enforced. There really is no benefit to using typed `Error`s that couldn't be achieved in other cleaner ways while preserving Rx compositional semantics. ================================================ FILE: Documentation/ExampleApp.md ================================================ ## RxExamples To run the example app: * Open `Rx.xcworkspace` * Choose one of example schemes (RxExample-iOS, RxExample-macOS) and hit `Run`. ================================================ FILE: Documentation/Examples.md ================================================ Examples ======== 1. [Reactive values](#reactive-values) 1. [Simple UI bindings](#simple-ui-bindings) 1. [Automatic input validation](#automatic-input-validation) 1. [more examples](../RxExample) 1. [Playgrounds](Playgrounds.md) ## Reactive values First, let's start with some imperative code. The purpose of this example is to bind the identifier `c` to a value calculated from `a` and `b` if some condition is satisfied. Here is the imperative code that calculates the value of `c`: ```swift // this is standard imperative code var c: String var a = 1 // this will only assign the value `1` to `a` once var b = 2 // this will only assign the value `2` to `b` once if a + b >= 0 { c = "\(a + b) is positive" // this will only assign the value to `c` once } ``` The value of `c` is now `3 is positive`. However, if we change the value of `a` to `4`, `c` will still contain the old value. ```swift a = 4 // `c` will still be equal to "3 is positive" which is not good // we want `c` to be equal to "6 is positive" since 4 + 2 = 6 ``` This is not the desired behavior. This is the improved logic using RxSwift: ```swift let a /*: Observable*/ = BehaviorRelay(value: 1) // a = 1 let b /*: Observable*/ = BehaviorRelay(value: 2) // b = 2 // Combines latest values of relays `a` and `b` using `+` let c = Observable.combineLatest(a, b) { $0 + $1 } .filter { $0 >= 0 } // if `a + b >= 0` is true, `a + b` is passed to the map operator .map { "\($0) is positive" } // maps `a + b` to "\(a + b) is positive" // Since the initial values are a = 1 and b = 2 // 1 + 2 = 3 which is >= 0, so `c` is initially equal to "3 is positive" // To pull values out of the Rx `Observable` `c`, subscribe to values from `c`. // `subscribe(onNext:)` means subscribe to the next (fresh) values of `c`. // That also includes the initial value "3 is positive". c.subscribe(onNext: { print($0) }) // prints: "3 is positive" // Now, let's increase the value of `a` a.accept(4) // prints: 6 is positive // The sum of the latest values, `4` and `2`, is now `6`. // Since this is `>= 0`, the `map` operator produces "6 is positive" // and that result is "assigned" to `c`. // Since the value of `c` changed, `{ print($0) }` will get called, // and "6 is positive" will be printed. // Now, let's change the value of `b` b.accept(-8) // doesn't print anything // The sum of the latest values, `4 + (-8)`, is `-4`. // Since this is not `>= 0`, `map` doesn't get executed. // This means that `c` still contains "6 is positive" // Since `c` hasn't been updated, a new "next" value hasn't been produced, // and `{ print($0) }` won't be called. ``` ## Simple UI bindings * Instead of binding to Relays, let's bind to `UITextField` values using the `rx.text` property. * Next, `map` the `String` into an `Int` and determine if the number is prime using an async API. * If the text is changed before the async call completes, a new async call will replace it via `concat`. * Bind the results to a `UILabel`. ```swift let subscription/*: Disposable */ = primeTextField.rx.text.orEmpty // type is Observable .map { WolframAlphaIsPrime(Int($0) ?? 0) } // type is Observable> .concat() // type is Observable .map { "number \($0.n) is prime? \($0.isPrime)" } // type is Observable .bind(to: resultLabel.rx.text) // return Disposable that can be used to unbind everything // This will set `resultLabel.text` to "number 43 is prime? true" after // server call completes. You manually trigger a control event since those are // the UIKit events RxCocoa observes internally. primeTextField.text = "43" primeTextField.sendActions(for: .editingDidEnd) // ... // to unbind everything, just call subscription.dispose() ``` All of the operators used in this example are the same operators used in the first example with relays. There's nothing special about it. ## Automatic input validation If you are new to Rx, the next example will probably be a little overwhelming at first. However, it's here to demonstrate how RxSwift code looks in the real-world. This example contains complex async UI validation logic with progress notifications. All operations are canceled the moment `disposeBag` is deallocated. Let's give it a shot. ```swift enum Availability { case available(message: String) case taken(message: String) case invalid(message: String) case pending(message: String) var message: String { switch self { case .available(let message), .taken(let message), .invalid(let message), .pending(let message): return message } } } // bind UI control values directly // use username from `usernameOutlet` as username values source self.usernameOutlet.rx.text .map { username -> Observable in // synchronous validation, nothing special here guard let username = username, !username.isEmpty else { // Convenience for constructing synchronous result. // In case there is mixed synchronous and asynchronous code inside the same // method, this will construct an async result that is resolved immediately. return Observable.just(.invalid(message: "Username can't be empty.")) } // ... // User interfaces should probably show some state while async operations // are executing. let loadingValue = Availability.pending(message: "Checking availability ...") // This will fire a server call to check if the username already exists. // Its type is `Observable` return API.usernameAvailable(username) .map { available in if available { return .available(message: "Username available") } else { return .taken(message: "Username already taken") } } // use `loadingValue` until server responds .startWith(loadingValue) } // Since we now have `Observable>` // we need to somehow return to a simple `Observable`. // We could use the `concat` operator from the second example, but we really // want to cancel pending asynchronous operations if a new username is provided. // That's what `switchLatest` does. .switchLatest() // Now we need to bind that to the user interface somehow. // Good old `subscribe(onNext:)` can do that. // That's the end of `Observable` chain. .subscribe(onNext: { [weak self] validity in self?.errorLabel.textColor = validationColor(validity) self?.errorLabel.text = validity.message }) // This will produce a `Disposable` object that can unbind everything and cancel // pending async operations. // Instead of doing it manually, which is tedious, // let's dispose everything automagically upon view controller dealloc. .disposed(by: disposeBag) ``` It doesn't get any simpler than that. There are [more examples](../RxExample) in the repository, so feel free to check them out. They include examples on how to use Rx in the context of MVVM pattern or without it. ================================================ FILE: Documentation/GettingStarted.md ================================================ Getting Started =============== This project tries to be consistent with [ReactiveX.io](http://reactivex.io/). The general cross platform documentation and tutorials should also be valid in case of `RxSwift`. 1. [Observables aka Sequences](#observables-aka-sequences) 1. [Disposing](#disposing) 1. [Implicit `Observable` guarantees](#implicit-observable-guarantees) 1. [Creating your first `Observable` (aka observable sequence)](#creating-your-own-observable-aka-observable-sequence) 1. [Creating an `Observable` that performs work](#creating-an-observable-that-performs-work) 1. [Sharing subscription and `share` operator](#sharing-subscription-and-share-operator) 1. [Operators](#operators) 1. [Custom operators](#custom-operators) 1. [Infallible](#infallible) 1. [Playgrounds](#playgrounds) 1. [Error handling](#error-handling) 1. [Debugging Compile Errors](#debugging-compile-errors) 1. [Debugging](#debugging) 1. [Enabling Debug Mode](#enabling-debug-mode) 1. [Debugging memory leaks](#debugging-memory-leaks) 1. [KVO](#kvo) 1. [UI layer tips](#ui-layer-tips) 1. [Making HTTP requests](#making-http-requests) 1. [RxDataSources](#rxdatasources) 1. [Driver](Traits.md#driver) 1. [Traits: Driver, Single, Maybe, Completable](Traits.md) 1. [Examples](Examples.md) # Observables aka Sequences ## Basics The [equivalence](MathBehindRx.md) of observer pattern (`Observable` sequence) and normal sequences (`Sequence`) is the most important thing to understand about Rx. **Every `Observable` sequence is just a sequence. The key advantage for an `Observable` vs Swift's `Sequence` is that it can also receive elements asynchronously. This is the kernel of RxSwift, documentation from here is about ways that we expand on that idea.** * `Observable`(`ObservableType`) is equivalent to `Sequence` * `ObservableType.subscribe` method is equivalent to `Sequence.makeIterator` method. * Observer (callback) needs to be passed to `ObservableType.subscribe` method to receive sequence elements instead of calling `next()` on the returned iterator. Sequences are a simple, familiar concept that is **easy to visualize**. People are creatures with huge visual cortexes. When we can visualize a concept easily, it's a lot easier to reason about it. We can lift a lot of the cognitive load from trying to simulate event state machines inside every Rx operator onto high level operations over sequences. If we don't use Rx but model asynchronous systems, that probably means our code is full of state machines and transient states that we need to simulate instead of abstracting away. Lists and sequences are probably one of the first concepts mathematicians and programmers learn. Here is a sequence of numbers: ``` --1--2--3--4--5--6--| // terminates normally ``` Another sequence, with characters: ``` --a--b--a--a--a---d---X // terminates with error ``` Some sequences are finite while others are infinite, like a sequence of button taps: ``` ---tap-tap-------tap---> ``` These are called marble diagrams. There are more marble diagrams at [rxmarbles.com](http://rxmarbles.com). If we were to specify sequence grammar as a regular expression it would look like: **next\* (error | completed)?** This describes the following: * **Sequences can have 0 or more elements.** * **Once an `error` or `completed` event is received, the sequence cannot produce any other element.** Sequences in Rx are described by a push interface (aka callback). ```swift enum Event { case next(Element) // next element of a sequence case error(Swift.Error) // sequence failed with error case completed // sequence terminated successfully } class Observable { func subscribe(_ observer: Observer) -> Disposable } protocol ObserverType { func on(_ event: Event) } ``` **When a sequence sends the `completed` 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 the returned subscription.** If a sequence terminates in finite time, not calling `dispose` or not using `disposed(by: disposeBag)` won't cause any permanent resource leaks. However, those resources will be used until the sequence completes, either by finishing production of elements or returning an error. If a sequence does not terminate on its own, such as with a series of button taps, resources will be allocated permanently unless `dispose` is called manually, automatically inside of a `disposeBag`, with the `takeUntil` operator, or in some other way. **Using dispose bags or `takeUntil` operator is a robust way of making sure resources are cleaned up. We recommend using them in production even if the sequences will terminate in finite time.** If you are curious why `Swift.Error` isn't generic, you can find the explanation [here](DesignRationale.md#why-error-type-isnt-generic). ## Disposing There is one additional way an observed sequence can terminate. When we are done with a sequence and we want to release all of the resources allocated to compute the upcoming elements, we can call `dispose` on a subscription. Here is an example with the `interval` operator. ```swift let scheduler = SerialDispatchQueueScheduler(qos: .default) let subscription = Observable.interval(.milliseconds(300), scheduler: scheduler) .subscribe { event in print(event) } Thread.sleep(forTimeInterval: 2.0) subscription.dispose() ``` This will print: ``` 0 1 2 3 4 5 ``` Note that you usually do not want to manually call `dispose`; this is only an educational example. Calling dispose manually is usually a bad code smell. There are better ways to dispose of subscriptions such as `DisposeBag`, the `takeUntil` operator, or some other mechanism. So can this code print something after the `dispose` call is executed? The answer is: it depends. * If the `scheduler` is a **serial scheduler** (ex. `MainScheduler`) and `dispose` is called **on the same serial scheduler**, the answer is **no**. * Otherwise it is **yes**. You can find out more about schedulers [here](Schedulers.md). You simply have two processes happening in parallel. * one is producing elements * the other is disposing of the subscription The question "Can something be printed after?" does not even make sense in the case that those processes are on different schedulers. A few more examples just to be sure (`observeOn` is explained [here](Schedulers.md)). In case we have something like: ```swift let subscription = Observable.interval(.milliseconds(300), scheduler: scheduler) .observe(on: MainScheduler.instance) .subscribe { event in print(event) } // .... subscription.dispose() // called from main thread ``` **After the `dispose` call returns, nothing will be printed. That is guaranteed.** Also, in this case: ```swift let subscription = Observable.interval(.milliseconds(300), scheduler: scheduler) .observe(on: MainScheduler.instance) .subscribe { event in print(event) } // ... subscription.dispose() // executing on same `serialScheduler` ``` **After the `dispose` call returns, nothing will be printed. That is guaranteed.** ### Dispose Bags Dispose bags are used to return ARC like behavior to RX. When a `DisposeBag` is deallocated, it will call `dispose` on each of the added disposables. It does not have a `dispose` method and therefore does not allow calling explicit dispose on purpose. If immediate cleanup is required, we can just create a new bag. ```swift self.disposeBag = DisposeBag() ``` This will clear old references and cause disposal of resources. If that explicit manual disposal is still wanted, use `CompositeDisposable`. **It has the wanted behavior but once that `dispose` method is called, it will immediately dispose any newly added disposable.** ### Take until Additional way to automatically dispose subscription on dealloc is to use `takeUntil` operator. ```swift sequence .take(until: self.rx.deallocated) .subscribe { print($0) } ``` ## Implicit `Observable` guarantees There is also a couple of additional guarantees that all sequence producers (`Observable`s) must honor. It doesn't matter on which thread they produce elements, but if they generate one element and send it to the observer `observer.on(.next(nextElement))`, they can't send next element until `observer.on` method has finished execution. Producers also cannot send terminating `.completed` or `.error` in case `.next` event hasn't finished. In short, consider this example: ```swift someObservable .subscribe { (e: Event) in print("Event processing started") // processing print("Event processing ended") } ``` This will always print: ``` Event processing started Event processing ended Event processing started Event processing ended Event processing started Event processing ended ``` It can never print: ``` Event processing started Event processing started Event processing ended Event processing ended ``` ## Creating your own `Observable` (aka observable sequence) There is one crucial thing to understand about observables. **When an observable is created, it doesn't perform any work simply because it has been created.** It is true that `Observable` can generate elements in many ways. Some of them cause side effects and some of them tap into existing running processes like tapping into mouse events, etc. **However, if you just call a method that returns an `Observable`, no sequence generation is performed and there are no side effects. `Observable` just defines how the sequence is generated and what parameters are used for element generation. Sequence generation starts when `subscribe` method is called.** E.g. Let's say you have a method with similar prototype: ```swift func searchWikipedia(searchTerm: String) -> Observable {} ``` ```swift let searchForMe = searchWikipedia("me") // no requests are performed, no work is being done, no URL requests were fired let cancel = searchForMe // sequence generation starts now, URL requests are fired .subscribe(onNext: { results in print(results) }) ``` There are a lot of ways to create your own `Observable` sequence. The easiest way is probably to use the `create` function. RxSwift provides a method that creates a sequence which returns one element upon subscription. That method is called `just`. Let's write our own implementation of it: *This is the actual implementation* ```swift func myJust(_ element: E) -> Observable { return Observable.create { observer in observer.on(.next(element)) observer.on(.completed) return Disposables.create() } } myJust(0) .subscribe(onNext: { n in print(n) }) ``` This will print: ``` 0 ``` Not bad. So what is the `create` function? It's just a convenience method that enables you to easily implement `subscribe` method using Swift closures. Like `subscribe` method it takes one argument, `observer`, and returns disposable. Sequence implemented this way is actually synchronous. It will generate elements and terminate before `subscribe` call returns disposable representing subscription. Because of that it doesn't really matter what disposable it returns, process of generating elements can't be interrupted. When generating synchronous sequences, the usual disposable to return is singleton instance of `NopDisposable`. Lets now create an observable that returns elements from an array. *This is the actual implementation* ```swift func myFrom(_ sequence: [E]) -> Observable { return Observable.create { observer in for element in sequence { observer.on(.next(element)) } observer.on(.completed) return Disposables.create() } } let stringCounter = myFrom(["first", "second"]) print("Started ----") // first time stringCounter .subscribe(onNext: { n in print(n) }) print("----") // again stringCounter .subscribe(onNext: { n in print(n) }) print("Ended ----") ``` This will print: ``` Started ---- first second ---- first second Ended ---- ``` ## Creating an `Observable` that performs work Ok, now something more interesting. Let's create that `interval` operator that was used in previous examples. *This is equivalent of actual implementation for dispatch queue schedulers* ```swift func myInterval(_ interval: DispatchTimeInterval) -> Observable { return Observable.create { observer in print("Subscribed") let timer = DispatchSource.makeTimerSource(queue: DispatchQueue.global()) timer.schedule(deadline: DispatchTime.now() + interval, repeating: interval) let cancel = Disposables.create { print("Disposed") timer.cancel() } var next = 0 timer.setEventHandler { if cancel.isDisposed { return } observer.on(.next(next)) next += 1 } timer.resume() return cancel } } ``` ```swift let counter = myInterval(.milliseconds(100)) print("Started ----") let subscription = counter .subscribe(onNext: { n in print(n) }) Thread.sleep(forTimeInterval: 0.5) subscription.dispose() print("Ended ----") ``` This will print ``` Started ---- Subscribed 0 1 2 3 4 Disposed Ended ---- ``` What if you would write ```swift let counter = myInterval(.milliseconds(100)) print("Started ----") let subscription1 = counter .subscribe(onNext: { n in print("First \(n)") }) let subscription2 = counter .subscribe(onNext: { n in print("Second \(n)") }) Thread.sleep(forTimeInterval: 0.5) subscription1.dispose() print("Disposed") Thread.sleep(forTimeInterval: 0.5) subscription2.dispose() print("Disposed") print("Ended ----") ``` This would print: ``` Started ---- Subscribed Subscribed First 0 Second 0 First 1 Second 1 First 2 Second 2 First 3 Second 3 First 4 Second 4 Disposed Second 5 Second 6 Second 7 Second 8 Second 9 Disposed Ended ---- ``` **Every subscriber upon subscription usually generates it's own separate sequence of elements. Operators are stateless by default. There are vastly more stateless operators than stateful ones.** ## Sharing subscription and `share` operator But what if you want that multiple observers share events (elements) from only one subscription? There are two things that need to be defined. * How to handle past elements that have been received before the new subscriber was interested in observing them (replay latest only, replay all, replay last n) * How to decide when to fire that shared subscription (refCount, manual or some other algorithm) The usual choice is a combination of `replay(1).refCount()`, aka `share(replay: 1)`. ```swift let counter = myInterval(.milliseconds(100)) .share(replay: 1) print("Started ----") let subscription1 = counter .subscribe(onNext: { n in print("First \(n)") }) let subscription2 = counter .subscribe(onNext: { n in print("Second \(n)") }) Thread.sleep(forTimeInterval: 0.5) subscription1.dispose() Thread.sleep(forTimeInterval: 0.5) subscription2.dispose() print("Ended ----") ``` This will print ``` Started ---- Subscribed First 0 Second 0 First 1 Second 1 First 2 Second 2 First 3 Second 3 First 4 Second 4 Second 5 Second 6 Second 7 Second 8 Second 9 Disposed Ended ---- ``` Notice how now there is only one `Subscribed` and `Disposed` event. Behavior for URL observables is equivalent. This is how HTTP requests are wrapped in Rx. It's pretty much the same pattern like the `interval` operator. ```swift extension Reactive where Base: URLSession { public func response(request: URLRequest) -> Observable<(response: HTTPURLResponse, data: Data)> { return Observable.create { observer in let task = self.base.dataTask(with: request) { (data, response, error) in 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 { task.cancel() } } } } ``` ## Operators There are numerous operators implemented in RxSwift. Marble diagrams for all operators can be found on [ReactiveX.io](http://reactivex.io/) Almost all operators are demonstrated in [Playgrounds](../Rx.playground). To use playgrounds please open `Rx.xcworkspace`, build `RxSwift-macOS` scheme and then open playgrounds in `Rx.xcworkspace` tree view. In case you need an operator, and don't know how to find it there is a [decision tree of operators](http://reactivex.io/documentation/operators.html#tree). ### Custom operators There are two ways how you can create custom operators. #### Easy way All of the internal code uses highly optimized versions of operators, so they aren't the best tutorial material. That's why it's highly encouraged to use standard operators. Fortunately there is an easier way to create operators. Creating new operators is actually all about creating observables, and previous chapter already describes how to do that. Lets see how an unoptimized map operator can be implemented. ```swift extension ObservableType { func myMap(transform: @escaping (Element) -> R) -> Observable { return Observable.create { observer in let subscription = self.subscribe { e in switch e { case .next(let value): let result = transform(value) observer.on(.next(result)) case .error(let error): observer.on(.error(error)) case .completed: observer.on(.completed) } } return subscription } } } ``` So now you can use your own map: ```swift let subscription = myInterval(.milliseconds(100)) .myMap { e in return "This is simply \(e)" } .subscribe(onNext: { n in print(n) }) ``` This will print: ``` Subscribed This is simply 0 This is simply 1 This is simply 2 This is simply 3 This is simply 4 This is simply 5 This is simply 6 This is simply 7 This is simply 8 ... ``` ## Infallible `Infallible` is another flavor of `Observable` which is identical to it, but is guaranteed to never fail and thus cannot emit errors. This means that when creating your own `Infallible` (Using `Infallible.create` or one of the methods mentioned in [Creating your first `Observable`](#creating-your-own-observable-aka-observable-sequence)), you will not be allowed to emit errors. `Infallible` is useful when you want to statically model and guarantee a stream of values that is known to never fail, but don't want to commit to using `MainScheduler` and don't want to implicitly use `share()` to share resources and side-effects, such as the case in [`Driver` and `Signal`](Traits.md#rxcocoa-traits). ### Life happens So what if it's just too hard to solve some cases with custom operators? You can exit the Rx monad, perform actions in imperative world, and then tunnel results to Rx again using `Subject`s. This isn't something that should be practiced often, and is a bad code smell, but you can do it. ```swift let magicBeings: Observable = summonFromMiddleEarth() magicBeings .subscribe(onNext: { being in // exit the Rx monad self.doSomeStateMagic(being) }) .disposed(by: disposeBag) // // Mess // let kitten = globalParty( // calculate something in messy world being, UIApplication.delegate.dataSomething.attendees ) kittens.on(.next(kitten)) // send result back to rx // // Another mess // let kittens = BehaviorRelay(value: firstKitten) // again back in Rx monad kittens.asObservable() .map { kitten in return kitten.purr() } // .... ``` Every time you do this, somebody will probably write this code somewhere: ```swift kittens .subscribe(onNext: { kitten in // do something with kitten }) .disposed(by: disposeBag) ``` So please try not to do this. ## Playgrounds If you are unsure how exactly some of the operators work, [playgrounds](../Rx.playground) contain almost all of the operators already prepared with small examples that illustrate their behavior. **To use playgrounds please open Rx.xcworkspace, build RxSwift-macOS scheme and then open playgrounds in Rx.xcworkspace tree view.** **To view the results of the examples in the playgrounds, please open the `Assistant Editor`. You can open `Assistant Editor` by clicking on `View > Assistant Editor > Show Assistant Editor`** ## Error handling There are two error mechanisms. ### Asynchronous error handling mechanism in observables Error handling is pretty straightforward. If one sequence terminates with error, then all of the dependent sequences will terminate with error. It's usual short circuit logic. You can recover from failure of observable by using `catch` operator. There are various overloads that enable you to specify recovery in great detail. There is also `retry` operator that enables retries in case of errored sequence. ### Hooks and Default error handling RxSwift offers a global Hook that provides a default error handling mechanism for cases when you don't provide your own `onError` handler. Set `Hooks.defaultErrorHandler` with your own closure to decide how to deal with unhandled errors in your system, if you need that option. For example, sending the stacktrace or untracked-error to your analytics system. By default, `Hooks.defaultErrorHandler` simply prints the received error in `DEBUG` mode, and does nothing in `RELEASE`. However, you can add additional configurations to this behavior. In order to enable detailed callstack logging, set `Hooks.recordCallStackOnError` flag to `true`. By default, this will return the current `Thread.callStackSymbols` in `DEBUG` mode, and will track an empty stack trace in `RELEASE`. You may customize this behavior by overriding `Hooks.customCaptureSubscriptionCallstack` with your own implementation. ## Debugging Compile Errors When writing elegant RxSwift/RxCocoa code, you are probably relying heavily on compiler to deduce types of `Observable`s. This is one of the reasons why Swift is awesome, but it can also be frustrating sometimes. ```swift images = word .filter { $0.containsString("important") } .flatMap { word in return self.api.loadFlickrFeed("karate") .catchError { error in return just(JSON(1)) } } ``` If compiler reports that there is an error somewhere in this expression, I would suggest first annotating return types. ```swift images = word .filter { s -> Bool in s.containsString("important") } .flatMap { word -> Observable in return self.api.loadFlickrFeed("karate") .catchError { error -> Observable in return just(JSON(1)) } } ``` If that doesn't work, you can continue adding more type annotations until you've localized the error. ```swift images = word .filter { (s: String) -> Bool in s.containsString("important") } .flatMap { (word: String) -> Observable in return self.api.loadFlickrFeed("karate") .catchError { (error: Error) -> Observable in return just(JSON(1)) } } ``` **I would suggest first annotating return types and arguments of closures.** Usually after you have fixed the error, you can remove the type annotations to clean up your code again. ## Debugging Using debugger alone is useful, but usually using `debug` operator will be more efficient. `debug` operator will print out all events to standard output and you can add also label those events. `debug` acts like a probe. Here is an example of using it: ```swift let subscription = myInterval(.milliseconds(100)) .debug("my probe") .map { e in return "This is simply \(e)" } .subscribe(onNext: { n in print(n) }) Thread.sleepForTimeInterval(0.5) subscription.dispose() ``` will print ``` [my probe] subscribed Subscribed [my probe] -> Event next(Box(0)) This is simply 0 [my probe] -> Event next(Box(1)) This is simply 1 [my probe] -> Event next(Box(2)) This is simply 2 [my probe] -> Event next(Box(3)) This is simply 3 [my probe] -> Event next(Box(4)) This is simply 4 [my probe] dispose Disposed ``` You can also easily create your version of the `debug` operator. ```swift extension ObservableType { public func myDebug(identifier: String) -> Observable { return Observable.create { observer in print("subscribed \(identifier)") let subscription = self.subscribe { e in print("event \(identifier) \(e)") switch e { case .next(let value): observer.on(.next(value)) case .error(let error): observer.on(.error(error)) case .completed: observer.on(.completed) } } return Disposables.create { print("disposing \(identifier)") subscription.dispose() } } } } ``` ### Enabling Debug Mode In order to [Debug memory leaks using `RxSwift.Resources`](#debugging-memory-leaks) or [Log all HTTP requests automatically](#logging-http-traffic), you have to enable Debug Mode. In order to enable debug mode, a `TRACE_RESOURCES` flag must be added to the RxSwift target build settings, under _Other Swift Flags_. For further discussion and instructions on how to set the `TRACE_RESOURCES` flag for Cocoapods & Carthage, see [#378](https://github.com/ReactiveX/RxSwift/issues/378) ### Debugging memory leaks In debug mode Rx tracks all allocated resources in a global variable `Resources.total`. In case you want to have some resource leak detection logic, the simplest method is just printing out `RxSwift.Resources.total` periodically to output. ```swift /* add somewhere in func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) */ _ = Observable.interval(.seconds(1), scheduler: MainScheduler.instance) .subscribe(onNext: { _ in print("Resource count \(RxSwift.Resources.total)") }) ``` Most efficient way to test for memory leaks is: * navigate to your screen and use it * navigate back * observe initial resource count * navigate second time to your screen and use it * navigate back * observe final resource count In case there is a difference in resource count between initial and final resource counts, there might be a memory leak somewhere. The reason why 2 navigations are suggested is because first navigation forces loading of lazy resources. ## KVO KVO is an Objective-C mechanism. That means that it wasn't built with type safety in mind. This project tries to solve some of the problems. There are two built in ways this library supports KVO. ```swift // KVO extension Reactive where Base: NSObject { public func observe(type: E.Type, _ keyPath: String, options: KeyValueObservingOptions, retainSelf: Bool = true) -> Observable {} } #if !DISABLE_SWIZZLING // KVO extension Reactive where Base: NSObject { public func observeWeakly(type: E.Type, _ keyPath: String, options: KeyValueObservingOptions) -> Observable {} } #endif ``` Example how to observe frame of `UIView`. **WARNING: UIKit isn't KVO compliant, but this will work.** ```swift view .rx.observe(CGRect.self, "frame") .subscribe(onNext: { frame in ... }) ``` or ```swift view .rx.observeWeakly(CGRect.self, "frame") .subscribe(onNext: { frame in ... }) ``` ### `rx.observe` `rx.observe` is more performant because it's just a simple wrapper around KVO mechanism, but it has more limited usage scenarios * 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. E.g. ```swift self.rx.observe(CGRect.self, "view.frame", retainSelf: false) ``` ### `rx.observeWeakly` `rx.observeWeakly` is somewhat slower than `rx.observe` because it has to handle object deallocation in case of weak references. It can be used in all cases where `rx.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 E.g. ```swift someSuspiciousViewController.rx.observeWeakly(Bool.self, "behavingOk") ``` ### Observing structs KVO is an Objective-C mechanism so it relies heavily on `NSValue`. **RxCocoa has built in support for KVO observing of `CGRect`, `CGSize` and `CGPoint` structs.** When observing some other structures it is necessary to extract those structures from `NSValue` manually. [Here](../RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift) are examples how to extend KVO observing mechanism and `rx.observe*` methods for other structs by implementing `KVORepresentable` protocol. ## UI layer tips There are certain things that your `Observable`s need to satisfy in the UI layer when binding to UIKit controls. ### Threading `Observable`s need to send values on `MainScheduler`(UIThread). That's just a normal UIKit/Cocoa requirement. It is usually a good idea for your APIs to return results on `MainScheduler`. In case you try to bind something to UI from background thread, in **Debug** build RxCocoa will usually throw an exception to inform you of that. To fix this you need to add `observeOn(MainScheduler.instance)`. **URLSession extensions don't return result on `MainScheduler` by default.** ### Errors You can't bind failure to UIKit controls because that is undefined behavior. If you don't know if `Observable` can fail, you can ensure it can't fail using `catchErrorJustReturn(valueThatIsReturnedWhenErrorHappens)`, **but after an error happens the underlying sequence will still complete**. If the wanted behavior is for underlying sequence to continue producing elements, some version of `retry` operator is needed. ### Sharing subscription You usually want to share subscription in the UI layer. You don't want to make separate HTTP calls to bind the same data to multiple UI elements. Let's say you have something like this: ```swift let searchResults = searchText .throttle(.milliseconds(300), scheduler: MainScheduler.instance) .distinctUntilChanged() .flatMapLatest { query in API.getSearchResults(query) .retry(3) .startWith([]) // clears results on new search term .catchErrorJustReturn([]) } .share(replay: 1) // <- notice the `share` operator ``` What you usually want is to share search results once calculated. That is what `share` means. **It is usually a good rule of thumb in the UI layer to add `share` at the end of transformation chain because you really want to share calculated results. You don't want to fire separate HTTP connections when binding `searchResults` to multiple UI elements.** **Also take a look at `Driver` unit. It is designed to transparently wrap those `share` calls, make sure elements are observed on main UI thread and that no error can be bound to UI.** ## Making HTTP requests Making http requests is one of the first things people try. You first need to build `URLRequest` object that represents the work that needs to be done. Request determines is it a GET request, or a POST request, what is the request body, query parameters ... This is how you can create a simple GET request ```swift let req = URLRequest(url: URL(string: "http://en.wikipedia.org/w/api.php?action=parse&page=Pizza&format=json")) ``` If you want to just execute that request outside of composition with other observables, this is what needs to be done. ```swift let responseJSON = URLSession.shared.rx.json(request: req) // no requests will be performed up to this point // `responseJSON` is just a description how to fetch the response let cancelRequest = responseJSON // this will fire the request .subscribe(onNext: { json in print(json) }) Thread.sleep(forTimeInterval: 3.0) // if you want to cancel request after 3 seconds have passed just call cancelRequest.dispose() ``` **URLSession extensions don't return result on `MainScheduler` by default.** In case you want a more low level access to response, you can use: ```swift URLSession.shared.rx.response(myURLRequest) .debug("my request") // this will print out information to console .flatMap { (data: NSData, response: URLResponse) -> Observable in if let response = response as? HTTPURLResponse { if 200 ..< 300 ~= response.statusCode { return just(transform(data)) } else { return Observable.error(yourNSError) } } else { rxFatalError("response = nil") return Observable.error(yourNSError) } } .subscribe { event in print(event) // if error happened, this will also print out error to console } ``` ### Logging HTTP traffic RxCocoa will log all HTTP request info to the console by default when run in debug mode. You may overwrite the `URLSession.rx.shouldLogRequest` closure to define which requests should and shouldn't be logged. ```swift URLSession.rx.shouldLogRequest = { request in // Only log requests to reactivex.org return request.url?.host == "reactivex.org" || request.url?.host == "www.reactivex.org" } ``` ## RxDataSources ... is a set of classes that implement fully functional reactive data sources for `UITableView`s and `UICollectionView`s. RxDataSources are bundled [here](https://github.com/RxSwiftCommunity/RxDataSources). Fully functional demonstration how to use them is included in the [RxExample](../RxExample) project. ================================================ FILE: Documentation/HotAndColdObservables.md ================================================ Hot and Cold Observables ======================== IMHO, I would suggest to more think of this as property of sequences and not separate types because they are represented by the same abstraction that fits them perfectly, `Observable` sequence. This is a definition from ReactiveX.io > When does an Observable begin emitting its sequence of items? It depends on the Observable. A “hot” Observable may begin emitting items as soon as it is created, and so any observer who later subscribes to that Observable may start observing the sequence somewhere in the middle. A “cold” Observable, on the other hand, waits until an observer subscribes to it before it begins to emit items, and so such an observer is guaranteed to see the whole sequence from the beginning. | Hot Observables | Cold observables | |---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------| | ... are sequences | ... are sequences | | Use resources ("produce heat") no matter if there is any observer subscribed. | Don't use resources (don't produce heat) until observer subscribes. | | Variables / properties / constants, tap coordinates, mouse coordinates, UI control values, current time | Async operations, HTTP Connections, TCP connections, streams | | Usually contains ~ N elements | Usually contains ~ 1 element | | Sequence elements are produced no matter if there is any observer subscribed. | Sequence elements are produced only if there is a subscribed observer. | | Sequence computation resources are usually shared between all of the subscribed observers. | Sequence computation resources are usually allocated per subscribed observer. | | Usually stateful | Usually stateless | ================================================ FILE: Documentation/MathBehindRx.md ================================================ Math Behind Rx ============== ## Duality between Observer and Iterator / Enumerator / Generator / Sequences There is a duality between the observer and generator patterns. This is what enables us to transition from the async callback world to the synchronous world of sequence transformations. In short, the enumerator and observer patterns both describe sequences. It's fairly obvious why the enumerator defines a sequence, but the observer is slightly more complicated. There is, however, a pretty simple example that doesn't require a lot of mathematical knowledge. Assume that you are observing the position of your mouse cursor on screen at given times. Over time, these mouse positions form a sequence. This is, in essence, an observable sequence. There are two basic ways elements of a sequence can be accessed: * Push interface - Observer (observed elements over time make a sequence) * Pull interface - Iterator / Enumerator / Generator You can also see a more formal explanation in this video: * [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://www.youtube.com/watch?v=looJcaeboBY) ================================================ FILE: Documentation/NewFeatureRequestTemplate.md ================================================ **Please copy the following template [here](https://github.com/ReactiveX/RxSwift/issues/new) and fill in the missing fields so we can help you as soon as possible.** ``` *Short description of missing functionality*: E.g. I want this library to implement xxx operator. *Short code example of how you would like to use the API*: code goes here *The reason why I need this functionality*: E.g. I was trying to .... *Code I have right now*: code snippet that demonstrates how you've attempted to solve the problem ``` ================================================ FILE: Documentation/Playgrounds.md ================================================ ## Playgrounds To use playgrounds: * Open `Rx.xcworkspace` * Build the `RxSwift` scheme on `My Mac`. * Open `Rx` playground in the `Rx.xcworkspace` tree view. * Choose `View > Debug Area > Show Debug Area` ================================================ FILE: Documentation/Schedulers.md ================================================ # Schedulers 1. [Serial vs Concurrent Schedulers](#serial-vs-concurrent-schedulers) 1. [Custom schedulers](#custom-schedulers) 1. [Builtin schedulers](#builtin-schedulers) Schedulers abstract away the mechanism for performing work. Different mechanisms for performing work include the current thread, dispatch queues, operation queues, new threads, thread pools, and run loops. There are two main operators that work with schedulers, `observeOn` and `subscribeOn`. If you want to perform work on a different scheduler just use `observeOn(scheduler)` operator. You would usually use `observeOn` a lot more often than `subscribeOn`. In case `observeOn` isn't explicitly specified, work will be performed on whichever thread/scheduler elements are generated. Example of using the `observeOn` operator: ```swift sequence1 .observeOn(backgroundScheduler) .map { n in print("This is performed on the background scheduler") } .observeOn(MainScheduler.instance) .map { n in print("This is performed on the main scheduler") } ``` If you want to start sequence generation (`subscribe` method) and call dispose on a specific scheduler, use `subscribeOn(scheduler)`. In case `subscribeOn` isn't explicitly specified, the `subscribe` closure (closure passed to `Observable.create`) will be called on the same thread/scheduler on which `subscribe(onNext:)` or `subscribe` is called. In case `subscribeOn` isn't explicitly specified, the `dispose` method will be called on the same thread/scheduler that initiated disposing. In short, if no explicit scheduler is chosen, those methods will be called on current thread/scheduler. ## Serial vs Concurrent Schedulers Since schedulers can really be anything, and all operators that transform sequences need to preserve additional [implicit guarantees](GettingStarted.md#implicit-observable-guarantees), it is important what kind of schedulers are you creating. In case the scheduler is concurrent, Rx's `observeOn` and `subscribeOn` operators will make sure everything works perfectly. If you use some scheduler that Rx can prove is serial, it will be able to perform additional optimizations. So far it only performs those optimizations for dispatch queue schedulers. In case of serial dispatch queue schedulers, `observeOn` is optimized to just a simple `dispatch_async` call. ## Custom schedulers Besides current schedulers, you can write your own schedulers. If you just want to describe who needs to perform work immediately, you can create your own scheduler by implementing the `ImmediateScheduler` protocol. ```swift public protocol ImmediateScheduler { func schedule(state: StateType, action: (/*ImmediateScheduler,*/ StateType) -> RxResult) -> RxResult } ``` If you want to create a new scheduler that supports time based operations, then you'll need to implement the `Scheduler` protocol: ```swift public protocol Scheduler: ImmediateScheduler { associatedtype TimeInterval associatedtype Time var now : Time { get } func scheduleRelative(state: StateType, dueTime: TimeInterval, action: (StateType) -> RxResult) -> RxResult } ``` In case the scheduler only has periodic scheduling capabilities, you can inform Rx by implementing the `PeriodicScheduler` protocol: ```swift public protocol PeriodicScheduler : Scheduler { func schedulePeriodic(state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> RxResult } ``` In case the scheduler doesn't support `PeriodicScheduling` capabilities, Rx will emulate periodic scheduling transparently. ## Builtin schedulers Rx can use all types of schedulers, but it can also perform some additional optimizations if it has proof that scheduler is serial. These are the currently supported schedulers: ### CurrentThreadScheduler (Serial scheduler) Schedules units of work on the current thread. This is the default scheduler for operators that generate elements. This scheduler is also sometimes called a "trampoline scheduler". If `CurrentThreadScheduler.instance.schedule(state) { }` is called for the first time on some thread, the scheduled action will be executed immediately and a hidden queue will be created where all recursively scheduled actions will be temporarily enqueued. If some parent frame on the call stack is already running `CurrentThreadScheduler.instance.schedule(state) { }`, the scheduled action will be enqueued and executed when the currently running action and all previously enqueued actions have finished executing. ### MainScheduler (Serial scheduler) Abstracts work that needs to be performed on `MainThread`. In case `schedule` methods are called from main thread, it will perform the action immediately without scheduling. This scheduler is usually used to perform UI work. ### SerialDispatchQueueScheduler (Serial scheduler) Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. It will make sure that even if a concurrent dispatch queue is passed, it's transformed into a serial one. Serial schedulers enable certain optimizations for `observeOn`. The main scheduler is an instance of `SerialDispatchQueueScheduler`. ### ConcurrentDispatchQueueScheduler (Concurrent scheduler) 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 the background. ### OperationQueueScheduler (Concurrent scheduler) 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 the background and you want to fine tune concurrent processing using `maxConcurrentOperationCount`. ================================================ FILE: Documentation/Subjects.md ================================================ # Subjects All of behave exactly the same like described [here](http://reactivex.io/documentation/subject.html) ## Relays RxRelay provides three kinds of Relays: `PublishRelay`, `BehaviorRelay` and `ReplayRelay`. They behave exactly like their parallel `Subject`s, with two changes: - Relays never complete. - Relays never emit errors. In essence, Relays only emit `.next` events, and never terminate. ================================================ FILE: Documentation/SwiftConcurrency.md ================================================ ## Swift Concurrency Swift 5.5 introduced a new long-awaited concurrency model for Swift, using the new `async`/`await` syntax. Starting with RxSwift 6.5, you can `await` on your `Observable`s and other reactive units as if they were async operations or sequences, and you can also convert `async` pieces of work into `Observable`s. ### `await`ing values emitted by `Observable` There are three variations to `await`ing values emitted by `Observable`s - depending on the amount of values a trait emits, and whether or not it's throwing. The three variations are: awaiting a sequence, awaiting a non-throwing sequence, or awaiting a single value. #### Awaiting a throwing sequence `Observable`s by default may emit an error. As such, in the `async`/`await` world - they may _throw_ an error. You can iterate over the entirety of an `Observable`'s life time and elements like so: ```swift do { for try await value in observable.values { print("Got a value:", value) } } catch { print("Got an error:", error) } ``` Note that the `Observable` must complete, or the async task will suspend and never resume back to the parent task. #### Awaiting a non-throwing sequence `Infallible`, `Driver`, and `Signal` are all guaranteed to never emit errors (as opposed to `Observable`), so you may directly iterate over their values without worrying about catching any errors: ```swift for await value in infallible.values { print("Got a value:", value) } ``` #### Awaiting a single value As opposed to the possibly-infinite sequences above, primitive sequences are guaranteed to only emit zero or one values. In those cases, you can simply await their value directly: ```swift let value1 = try await single.value // Element let value2 = try await maybe.value // Element? let value3 = try await completable.value // Void ``` > **Note**: If a `Maybe` completes without emitting a value, it returns `nil` instead. A `Completable`, on the other hand, simply returns `Void` to note it finished its work. ### Wrapping an `async` Task as an `Observable` If you already have an `AsyncSequence`-conforming asynchronous sequence at hand (such as an `AsyncStream`), you can bridge it back to the Rx world by simply using `asObservable()`: ```swift let stream = AsyncStream { ... } stream.asObservable() .subscribe( onNext: { ... }, onError: { ... } ) ``` ### Wrapping an `async` result as a `Single` If you already have an async piece of work that returns a single result you wish to await, you can bridge it back to the Rx world by using `Single.create`, a special overload which takes an `async throws` closure where you can simply await your async work: ```swift func doIncredibleWork() async throws -> AmazingResponse { ... } let single = Single.create { try await doIncredibleWork() } // Single ``` ================================================ FILE: Documentation/Tips.md ================================================ Tips ==== * Always strive to model your systems or their parts as pure functions. Those pure functions can be tested easily and can be used to modify operator behaviors. * When you are using Rx, first try to compose built-in operators. * If using some combination of operators often, create your convenience operators. e.g. ```swift extension ObservableType where E: MaybeCool { public func coolElements() -> Observable { return filter { e -> Bool in return e.isCool } } } ``` * Rx operators are as general as possible, but there will always be edge cases that will be hard to model. In those cases you can just create your own operator and possibly use one of the built-in operators as a reference. * Always use operators to compose subscriptions. **Avoid nesting subscribe calls at all cost. This is a code smell.** ```swift textField.rx.text.subscribe(onNext: { text in performURLRequest(text).subscribe(onNext: { result in ... }) .disposed(by: disposeBag) }) .disposed(by: disposeBag) ``` **Preferred way of chaining disposables by using operators.** ```swift textField.rx.text .flatMapLatest { text in // Assuming this doesn't fail and returns result on main scheduler, // otherwise `catchError` and `observeOn(MainScheduler.instance)` can be used to // correct this. return performURLRequest(text) } ... .disposed(by: disposeBag) // only one top most disposable ``` ================================================ FILE: Documentation/Traits.md ================================================ Traits (formerly Units) ===== This document will try to describe what traits are, why they are a useful concept, and how to use and create them. * [General](#general) * [Why](#why) * [How they work](#how-they-work) * [RxSwift traits](#rxswift-traits) * [Single](#single) * [Creating a Single](#creating-a-single) * [Completable](#completable) * [Creating a Completable](#creating-a-completable) * [Maybe](#maybe) * [Creating a Maybe](#creating-a-maybe) * [RxCocoa traits](#rxcocoa-traits) * [Driver](#driver) * [Why is it named Driver](#why-is-it-named-driver) * [Practical usage example](#practical-usage-example) * [Signal](#signal) * [ControlProperty / ControlEvent](#controlproperty--controlevent) ## General ### Why Swift has a powerful type system that can be used to improve the correctness and stability of applications and make using Rx a more intuitive and straightforward experience. Traits help communicate and ensure observable sequence properties across interface boundaries, as well as provide contextual meaning, syntactical sugar and target more specific use-cases when compared to a raw Observable, which could be used in any context. **For that reason, Traits are entirely optional. You are free to use raw Observable sequences everywhere in your program as all core RxSwift/RxCocoa APIs support them.** _**Note:** Some of the Traits described in this document (such as `Driver`) are specific only to the [RxCocoa](https://github.com/ReactiveX/RxSwift/tree/main/RxCocoa) project, while some are part of the general [RxSwift](https://github.com/ReactiveX/RxSwift) project. However, the same principles could easily be implemented in other Rx implementations, if necessary. There is no private API magic needed._ ### How they work Traits are simply a wrapper struct with a single read-only Observable sequence property. ```swift struct Single { let source: Observable } struct Driver { let source: Observable } ... ``` You can think of them as a kind of builder pattern implementation for Observable sequences. When a Trait is built, calling `.asObservable()` will transform it back into a vanilla observable sequence. --- ## RxSwift traits ### Single A Single is a variation of Observable that, instead of emitting a series of elements, is always guaranteed to emit either _a single element_ or _an error_. * Emits exactly one element, or an error. * Doesn't share side effects. One common use case for using Single is for performing HTTP Requests that could only return a response or an error, but a Single can be used to model any case where you only care for a single element, and not for an infinite stream of elements. #### Creating a Single Creating a Single is similar to creating an Observable. A simple example would look like this: ```swift func getRepo(_ repo: String) -> Single<[String: Any]> { return Single<[String: Any]>.create { single in let task = URLSession.shared.dataTask(with: URL(string: "https://api.github.com/repos/\(repo)")!) { data, _, error in if let error = error { single(.failure(error)) return } guard let data = data, let json = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves), let result = json as? [String: Any] else { single(.failure(DataError.cantParseJSON)) return } single(.success(result)) } task.resume() return Disposables.create { task.cancel() } } } ``` After which you could use it in the following way: ```swift getRepo("ReactiveX/RxSwift") .subscribe { event in switch event { case .success(let json): print("JSON: ", json) case .failure(let error): print("Error: ", error) } } .disposed(by: disposeBag) ``` Or by using `subscribe(onSuccess:onError:)` as follows: ```swift getRepo("ReactiveX/RxSwift") .subscribe(onSuccess: { json in print("JSON: ", json) }, onError: { error in print("Error: ", error) }) .disposed(by: disposeBag) ``` The subscription uses Swift `Result` enumeration which could be either `.success` containing an element of the Single's type, or `.failure` containing an error. No further events would be emitted beyond the first one. It's also possible using `.asSingle()` on a raw Observable sequence to transform it into a Single. ### Completable A Completable is a variation of Observable that can only _complete_ or _emit an error_. It is guaranteed to not emit any elements. * Emits zero elements. * Emits a completion event, or an error. * Doesn't share side effects. A useful use case for Completable would be to model any case where we only care for the fact an operation has completed, but don't care about a element resulted by that completion. You could compare it to using an `Observable` that can't emit elements. #### Creating a Completable Creating a Completable is similar to creating an Observable. A simple example would look like this: ```swift func cacheLocally() -> Completable { return Completable.create { completable in // Store some data locally ... ... guard success else { completable(.error(CacheError.failedCaching)) return Disposables.create {} } completable(.completed) return Disposables.create {} } } ``` After which you could use it in the following way: ```swift cacheLocally() .subscribe { completable in switch completable { case .completed: print("Completed with no error") case .error(let error): print("Completed with an error: \(error.localizedDescription)") } } .disposed(by: disposeBag) ``` Or by using `subscribe(onCompleted:onError:)` as follows: ```swift cacheLocally() .subscribe(onCompleted: { print("Completed with no error") }, onError: { error in print("Completed with an error: \(error.localizedDescription)") }) .disposed(by: disposeBag) ``` The subscription provides a `CompletableEvent` enumeration which could be either `.completed` - indicating the operation completed with no errors, or `.error`. No further events would be emitted beyond the first one. ### Maybe A Maybe is a variation of Observable that is right in between a Single and a Completable. It can either emit a single element, complete without emitting an element, or emit an error. **Note:** Any of these three events would terminate the Maybe, meaning - a Maybe that completed can't also emit an element, and a Maybe that emitted an element can't also send a Completion event. * Emits either a completed event, a single element or an error. * Doesn't share side effects. You could use Maybe to model any operation that **could** emit an element, but doesn't necessarily **have to** emit an element. #### Creating a Maybe Creating a Maybe is similar to creating an Observable. A simple example would look like this: ```swift func generateString() -> Maybe { return Maybe.create { maybe in maybe(.success("RxSwift")) // OR maybe(.completed) // OR maybe(.error(error)) return Disposables.create {} } } ``` After which you could use it in the following way: ```swift generateString() .subscribe { maybe in switch maybe { case .success(let element): print("Completed with element \(element)") case .completed: print("Completed with no element") case .error(let error): print("Completed with an error \(error.localizedDescription)") } } .disposed(by: disposeBag) ``` Or by using `subscribe(onSuccess:onError:onCompleted:)` as follows: ```swift generateString() .subscribe(onSuccess: { element in print("Completed with element \(element)") }, onError: { error in print("Completed with an error \(error.localizedDescription)") }, onCompleted: { print("Completed with no element") }) .disposed(by: disposeBag) ``` It's also possible using `.asMaybe()` on a raw Observable sequence to transform it into a `Maybe`. --- ## RxCocoa traits ### Driver This is the most elaborate trait. Its intention is to provide an intuitive way to write reactive code in the UI layer, or for any case where you want to model a stream of data _Driving_ your application. * Can't error out. * Observe occurs on main scheduler. * Shares side effects (`share(replay: 1, scope: .whileConnected)`). #### Why is it named Driver Its intended use case was to model sequences that drive your application. E.g. * Drive UI from CoreData model. * Drive UI using values from other UI elements (bindings). ... Like normal operating system drivers, in case a sequence errors out, your application will stop responding to user input. It is also extremely important that those elements are observed on the main thread because UI elements and application logic are usually not thread safe. Also, a `Driver` builds an observable sequence that shares side effects. E.g. #### Practical usage example This is a typical beginner example. ```swift let results = query.rx.text .throttle(.milliseconds(300), scheduler: MainScheduler.instance) .flatMapLatest { query in fetchAutoCompleteItems(query) } results .map { "\($0.count)" } .bind(to: resultCount.rx.text) .disposed(by: disposeBag) results .bind(to: resultsTableView.rx.items(cellIdentifier: "Cell")) { (_, result, cell) in cell.textLabel?.text = "\(result)" } .disposed(by: disposeBag) ``` The intended behavior of this code was to: * Throttle user input. * Contact server and fetch a list of user results (once per query). * Bind the results to two UI elements: results table view and a label that displays the number of results. So, what are the problems with this code?: * If the `fetchAutoCompleteItems` observable sequence errors out (connection failed or parsing error), this error would unbind everything and the UI wouldn't respond any more to new queries. * If `fetchAutoCompleteItems` returns results on some background thread, results would be bound to UI elements from a background thread which could cause non-deterministic crashes. * Results are bound to two UI elements, which means that for each user query, two HTTP requests would be made, one for each UI element, which is not the intended behavior. A more appropriate version of the code would look like this: ```swift let results = query.rx.text .throttle(.milliseconds(300), scheduler: MainScheduler.instance) .flatMapLatest { query in fetchAutoCompleteItems(query) .observeOn(MainScheduler.instance) // results are returned on MainScheduler .catchErrorJustReturn([]) // in the worst case, errors are handled } .share(replay: 1) // HTTP requests are shared and results replayed // to all UI elements results .map { "\($0.count)" } .bind(to: resultCount.rx.text) .disposed(by: disposeBag) results .bind(to: resultsTableView.rx.items(cellIdentifier: "Cell")) { (_, result, cell) in cell.textLabel?.text = "\(result)" } .disposed(by: disposeBag) ``` Making sure all of these requirements are properly handled in large systems can be challenging, but there is a simpler way of using the compiler and traits to prove these requirements are met. The following code looks almost the same: ```swift let results = query.rx.text.asDriver() // This converts a normal sequence into a `Driver` sequence. .throttle(.milliseconds(300), scheduler: MainScheduler.instance) .flatMapLatest { query in fetchAutoCompleteItems(query) .asDriver(onErrorJustReturn: []) // Builder just needs info about what to return in case of error. } results .map { "\($0.count)" } .drive(resultCount.rx.text) // If there is a `drive` method available instead of `bind(to:)`, .disposed(by: disposeBag) // that means that the compiler has proven that all properties // are satisfied. results .drive(resultsTableView.rx.items(cellIdentifier: "Cell")) { (_, result, cell) in cell.textLabel?.text = "\(result)" } .disposed(by: disposeBag) ``` So what is happening here? This first `asDriver` method converts the `ControlProperty` trait to a `Driver` trait. ```swift query.rx.text.asDriver() ``` Notice that there wasn't anything special that needed to be done. `Driver` has all of the properties of the `ControlProperty` trait, plus some more. The underlying observable sequence is just wrapped as a `Driver` trait, and that's it. The second change is: ```swift .asDriver(onErrorJustReturn: []) ``` Any observable sequence can be converted to `Driver` trait, as long as it satisfies 3 properties: * Can't error out. * Observe on main scheduler. * Sharing side effects (`share(replay: 1, scope: .whileConnected)`). So how do you make sure those properties are satisfied? Just use normal Rx operators. `asDriver(onErrorJustReturn: [])` is equivalent to following code. ```swift let safeSequence = xs .observeOn(MainScheduler.instance) // observe events on main scheduler .catchErrorJustReturn(onErrorJustReturn) // can't error out .share(replay: 1, scope: .whileConnected) // side effects sharing return Driver(raw: safeSequence) // wrap it up ``` The final piece is using `drive` instead of using `bind(to:)`. `drive` is defined only on the `Driver` trait. This means that if you see `drive` somewhere in code, that observable sequence can never error out and it observes on the main thread, which is safe for binding to a UI element. Note however that, theoretically, someone could still define a `drive` method to work on `ObservableType` or some other interface, so to be extra safe, creating a temporary definition with `let results: Driver<[Results]> = ...` before binding to UI elements would be necessary for complete proof. However, we'll leave it up to the reader to decide whether this is a realistic scenario or not. ### Signal A `Signal` is similar to `Driver` with one difference, it does **not** replay the latest event on subscription, but subscribers still share the sequence's computational resources. It can be considered a builder pattern to model Imperative Events in a Reactive way as part of your application. A `Signal`: * Can't error out. * Delivers events on Main Scheduler. * Shares computational resources (`share(scope: .whileConnected)`). * Does NOT replay elements on subscription. ## ControlProperty / ControlEvent ### ControlProperty Trait for `Observable`/`ObservableType` that represents a property of UI element. Sequence of values only represents initial control value and user initiated value changes. Programmatic value changes won't be reported. It's properties are: - it never fails - `share(replay: 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 events is being subscribed on main scheduler (`subscribeOn(ConcurrentMainScheduler.instance)` behavior). #### Practical usage example We can find very good practical examples in the `UISearchBar+Rx` and in the `UISegmentedControl+Rx`: ```swift extension Reactive where Base: UISearchBar { /// 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) } } ``` ```swift extension Reactive where Base: UISegmentedControl { /// Reactive wrapper for `selectedSegmentIndex` property. public var selectedSegmentIndex: ControlProperty { value } /// Reactive wrapper for `selectedSegmentIndex` property. public var value: ControlProperty { return UIControl.rx.value( self.base, getter: { segmentedControl in segmentedControl.selectedSegmentIndex }, setter: { segmentedControl, value in segmentedControl.selectedSegmentIndex = value } ) } } ``` ### ControlEvent Trait for `Observable`/`ObservableType` that represents an event on a 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). #### Practical usage example This is a typical case example in which you can use it: ```swift public extension Reactive where Base: UIViewController { /// Reactive wrapper for `viewDidLoad` message `UIViewController:viewDidLoad:`. public var viewDidLoad: ControlEvent { let source = self.methodInvoked(#selector(Base.viewDidLoad)).map { _ in } return ControlEvent(events: source) } } ``` And in the `UICollectionView+Rx` we can found it in this way: ```swift extension Reactive where Base: UICollectionView { /// Reactive wrapper for `delegate` message `collectionView:didSelectItemAtIndexPath:`. public var itemSelected: ControlEvent { let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didSelectItemAt:))) .map { a in return a[1] as! IndexPath } return ControlEvent(events: source) } } ``` ================================================ FILE: Documentation/UnitTests.md ================================================ Unit Tests ========== ## Testing custom operators RxSwift uses `RxTest` for all operator tests, located in the AllTests-* target inside the project `Rx.xcworkspace`. This is an example of a typical `RxSwift` operator unit test: ```swift func testMap_Range() { // Initializes test scheduler. // Test scheduler implements virtual time that is // detached from local machine clock. // This enables running the simulation as fast as possible // and proving that all events have been handled. let scheduler = TestScheduler(initialClock: 0) // Creates a mock hot observable sequence. // The sequence will emit events at designated // times, no matter if there are observers subscribed or not. // (that's what hot means). // This observable sequence will also record all subscriptions // made during its lifetime (`subscriptions` property). let xs = scheduler.createHotObservable([ .next(150, 1), // first argument is virtual time, second argument is element value .next(210, 0), .next(220, 1), .next(230, 2), .next(240, 4), .completed(300) // virtual time when completed is sent ]) // `start` method will by default: // * Run the simulation and record all events // using observer referenced by `res`. // * Subscribe at virtual time 200 // * Dispose subscription at virtual time 1000 let res = scheduler.start { xs.map { $0 * 2 } } let correctMessages = Recorded.events( .next(210, 0 * 2), .next(220, 1 * 2), .next(230, 2 * 2), .next(240, 4 * 2), .completed(300) ) let correctSubscriptions = [ Subscription(200, 300) ] XCTAssertEqual(res.events, correctMessages) XCTAssertEqual(xs.subscriptions, correctSubscriptions) } ``` In the case of non-terminating sequences where you don't necessarily care about the event times, You may also use `RxTest`'s `XCTAssertRecordedElements` to assert specific elements have been emitted. A terminating stop event (e.g. `completed` or `error`) will cause the test to fail. ```swift func testElementsEmitted() { let scheduler = TestScheduler(initialClock: 0) let xs = scheduler.createHotObservable([ .next(210, "RxSwift"), .next(220, "is"), .next(230, "pretty"), .next(240, "awesome") ]) let res = scheduler.start { xs.asObservable() } XCTAssertRecordedElements(res.events, ["RxSwift", "is", "pretty", "awesome"]) } ``` ## Testing operator compositions (view models, components) Examples of how to test operator compositions are contained inside `Rx.xcworkspace` > `RxExample-iOSTests` target. It's easy to define `RxTest` extensions so you can write your tests in a readable way. Provided examples inside `RxExample-iOSTests` are just suggestions on how you can write those extensions, but there are a lot of possibilities on how to write those tests. ```swift // expected events and test data let ( usernameEvents, passwordEvents, repeatedPasswordEvents, loginTapEvents, expectedValidatedUsernameEvents, expectedSignupEnabledEvents ) = ( scheduler.parseEventsAndTimes("e---u1----u2-----u3-----------------", values: stringValues).first!, scheduler.parseEventsAndTimes("e----------------------p1-----------", values: stringValues).first!, scheduler.parseEventsAndTimes("e---------------------------p2---p1-", values: stringValues).first!, scheduler.parseEventsAndTimes("------------------------------------", values: events).first!, scheduler.parseEventsAndTimes("e---v--f--v--f---v--o----------------", values: validations).first!, scheduler.parseEventsAndTimes("f--------------------------------t---", values: booleans).first! ) ``` ## Integration tests It is also possible to write integration tests by using `RxBlocking` operators. Using `RxBlocking`'s `toBlocking()` method, you can block the current thread and wait for the sequence to complete, allowing you to synchronously access its result. A simple way to test the result of your sequence is using the `toArray` method. It will return an array of all elements emitted once a sequence has completed successfully, or `throw` if an error caused the sequence to terminate. ```swift let result = try fetchResource(location) .toBlocking() .toArray() XCTAssertEqual(result, expectedResult) ``` Another option would be to use the `materialize` operator which lets you more granularly examine your sequence. It will return a `MaterializedSequenceResult` enumeration that could be either `.completed` along with the emitted elements if the sequence completed successfully, or `failed` if the sequence terminated with an error, along with the emitted error. ```swift let result = try fetchResource(location) .toBlocking() .materialize() // For testing the results or error in the case of terminating with error switch result { case .completed: XCTFail("Expected result to complete with error, but result was successful.") case .failed(let elements, let error): XCTAssertEqual(elements, expectedResult) XCTAssertErrorEqual(error, expectedError) } // For testing the results in the case of termination with completion switch result { case .completed(let elements): XCTAssertEqual(elements, expectedResult) case .failed(_, let error): XCTFail("Expected result to complete without error, but received \(error).") } ``` ================================================ FILE: Documentation/Warnings.md ================================================ Warnings ======== ### Unused disposable (unused-disposable) The following is valid for the `subscribe*`, `bind*` and `drive*` family of functions that return `Disposable`. You will receive a warning for doing something such as this: ```Swift let xs: Observable .... xs .filter { ... } .map { ... } .switchLatest() .subscribe(onNext: { ... }, onError: { ... }) ``` The `subscribe` function returns a subscription `Disposable` that can be used to cancel computation and free resources. However, not using it (and thus not disposing it) will result in an error. The preferred way of terminating these fluent calls is by using a `DisposeBag`, either through chaining a call to `.disposed(by: disposeBag)` or by adding the disposable directly to the bag. ```Swift let xs: Observable .... let disposeBag = DisposeBag() xs .filter { ... } .map { ... } .switchLatest() .subscribe(onNext: { ... }, onError: { ... }) .disposed(by: disposeBag) // <--- note `.disposed(by:)` ``` When `disposeBag` gets deallocated, the disposables contained within it will be automatically disposed as well. In the case where `xs` terminates in a predictable way with either a `Completed` or `Error` message, not handling the subscription `Disposable` won't leak any resources. However, even in this case, using a dispose bag is still the preferred way to handle subscription disposables. It ensures that element computation is always terminated at a predictable moment, and makes your code robust and future proof because resources will be properly disposed even if the implementation of `xs` changes. Another way to make sure subscriptions and resources are tied to the lifetime of some object is by using the `takeUntil` operator. ```Swift let xs: Observable .... let someObject: NSObject ... _ = xs .filter { ... } .map { ... } .switchLatest() .takeUntil(someObject.deallocated) // <-- note the `takeUntil` operator .subscribe(onNext: { ... }, onError: { ... }) ``` If ignoring the subscription `Disposable` is the desired behavior, this is how to silence the compiler warning. ```Swift let xs: Observable .... _ = xs // <-- note the underscore .filter { ... } .map { ... } .switchLatest() .subscribe(onNext: { ... }, onError: { ... }) ``` ### Unused observable sequence (unused-observable) You will receive a warning for doing something such as this: ```Swift let xs: Observable .... xs .filter { ... } .map { ... } ``` This code defines an observable sequence that is filtered and mapped from the `xs` sequence but then ignores the result. Since this code just defines an observable sequence and then ignores it, it doesn't actually do anything. Your intention was probably to either store the observable sequence definition and use it later ... ```Swift let xs: Observable .... let ys = xs // <--- names definition as `ys` .filter { ... } .map { ... } ``` ... or start computation based on that definition ```Swift let xs: Observable .... let disposeBag = DisposeBag() xs .filter { ... } .map { ... } .subscribe(onNext: { nextElement in // <-- note the `subscribe*` method // use the element print(nextElement) }) .disposed(by: disposeBag) ``` ================================================ FILE: Documentation/Why.md ================================================ ## Why **Rx enables building apps in a declarative way.** ### Bindings ```swift Observable.combineLatest(firstName.rx.text, lastName.rx.text) { $0 + " " + $1 } .map { "Greetings, \($0)" } .bind(to: greetingLabel.rx.text) ``` This also works with `UITableView`s and `UICollectionView`s. ```swift viewModel .rows .bind(to: resultsTableView.rx.items(cellIdentifier: "WikipediaSearchCell", cellType: WikipediaSearchCell.self)) { (_, viewModel, cell) in cell.title = viewModel.title cell.url = viewModel.url } .disposed(by: disposeBag) ``` **Official suggestion is to always use `.disposed(by: disposeBag)` even though that's not necessary for simple bindings.** ### Retries It would be great if APIs wouldn't fail, but unfortunately they do. Let's say there is an API method: ```swift func doSomethingIncredible(forWho: String) throws -> IncredibleThing ``` If you are using this function as it is, it's really hard to do retries in case it fails. Not to mention complexities modeling [exponential backoffs](https://en.wikipedia.org/wiki/Exponential_backoff). Sure it's possible, but the code would probably contain a lot of transient states that you really don't care about, and it wouldn't be reusable. Ideally, you would want to capture the essence of retrying, and to be able to apply it to any operation. This is how you can do simple retries with Rx ```swift doSomethingIncredible("me") .retry(3) ``` You can also easily create custom retry operators. ### Delegates Instead of doing the tedious and non-expressive: ```swift public func scrollViewDidScroll(scrollView: UIScrollView) { [weak self] // what scroll view is this bound to? self?.leftPositionConstraint.constant = scrollView.contentOffset.x } ``` ... write ```swift self.resultsTableView .rx.contentOffset .map { $0.x } .bind(to: self.leftPositionConstraint.rx.constant) ``` ### KVO Instead of: ``` `TickTock` was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. ``` and ```objc -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context ``` Use [`rx.observe` and `rx.observeWeakly`](GettingStarted.md#kvo) This is how they can be used: ```swift view.rx.observe(CGRect.self, "frame") .subscribe(onNext: { frame in print("Got new frame \(frame)") }) .disposed(by: disposeBag) ``` or ```swift someSuspiciousViewController .rx.observeWeakly(Bool.self, "behavingOk") .subscribe(onNext: { behavingOk in print("Cats can purr? \(behavingOk)") }) .disposed(by: disposeBag) ``` ### Notifications Instead of using: ```swift @available(iOS 4.0, *) public func addObserverForName(name: String?, object obj: AnyObject?, queue: NSOperationQueue?, usingBlock block: (NSNotification) -> Void) -> NSObjectProtocol ``` ... just write ```swift NotificationCenter.default .rx.notification(NSNotification.Name.UITextViewTextDidBeginEditing, object: myTextView) .map { /*do something with data*/ } .... ``` ### Transient state There are also a lot of problems with transient state when writing async programs. A typical example is an autocomplete search box. If you were to write the autocomplete code without Rx, the first problem that probably needs to be solved is when `c` in `abc` is typed, and there is a pending request for `ab`, the pending request gets canceled. OK, that shouldn't be too hard to solve, you just create an additional variable to hold reference to the pending request. The next problem is if the request fails, you need to do that messy retry logic. But OK, a couple more fields that capture the number of retries that need to be cleaned up. It would be great if the program would wait for some time before firing a request to the server. After all, we don't want to spam our servers in case somebody is in the process of typing something very long. An additional timer field maybe? There is also a question of what needs to be shown on screen while that search is executing, and also what needs to be shown in case we fail even with all of the retries. Writing all of this and properly testing it would be tedious. This is that same logic written with Rx. ```swift searchTextField.rx.text .throttle(.milliseconds(300), scheduler: MainScheduler.instance) .distinctUntilChanged() .flatMapLatest { query in API.getSearchResults(query) .retry(3) .startWith([]) // clears results on new search term .catchErrorJustReturn([]) } .subscribe(onNext: { results in // bind to ui }) .disposed(by: disposeBag) ``` There are no additional flags or fields required. Rx takes care of all that transient mess. ### Compositional disposal Let's assume that there is a scenario where you want to display blurred images in a table view. First, the images should be fetched from a URL, then decoded and then blurred. It would also be nice if that entire process could be canceled if a cell exits the visible table view area since bandwidth and processor time for blurring are expensive. It would also be nice if we didn't just immediately start to fetch an image once the cell enters the visible area since, if user swipes really fast, there could be a lot of requests fired and canceled. It would be also nice if we could limit the number of concurrent image operations because, again, blurring images is an expensive operation. This is how we can do it using Rx: ```swift // this is a conceptual solution let imageSubscription = imageURLs .throttle(.milliseconds(200), scheduler: MainScheduler.instance) .flatMapLatest { imageURL in API.fetchImage(imageURL) } .observeOn(operationScheduler) .map { imageData in return decodeAndBlurImage(imageData) } .observeOn(MainScheduler.instance) .subscribe(onNext: { blurredImage in imageView.image = blurredImage }) .disposed(by: reuseDisposeBag) ``` This code will do all that and, when `imageSubscription` is disposed, it will cancel all dependent async operations and make sure no rogue image is bound to the UI. ### Aggregating network requests What if you need to fire two requests and aggregate results when they have both finished? Well, there is of course the `zip` operator ```swift let userRequest: Observable = API.getUser("me") let friendsRequest: Observable<[Friend]> = API.getFriends("me") Observable.zip(userRequest, friendsRequest) { user, friends in return (user, friends) } .subscribe(onNext: { user, friends in // bind them to the user interface }) .disposed(by: disposeBag) ``` So what if those APIs return results on a background thread, and binding has to happen on the main UI thread? There is `observeOn`. ```swift let userRequest: Observable = API.getUser("me") let friendsRequest: Observable<[Friend]> = API.getFriends("me") Observable.zip(userRequest, friendsRequest) { user, friends in return (user, friends) } .observeOn(MainScheduler.instance) .subscribe(onNext: { user, friends in // bind them to the user interface }) .disposed(by: disposeBag) ``` There are many more practical use cases where Rx really shines. ### State Languages that allow mutation make it easy to access global state and mutate it. Uncontrolled mutations of shared global state can easily cause [combinatorial explosion](https://en.wikipedia.org/wiki/Combinatorial_explosion#Computing). But on the other hand, when used in a smart way, imperative languages can enable writing more efficient code closer to hardware. The usual way to battle combinatorial explosion is to keep state as simple as possible, and use [unidirectional data flows](https://developer.apple.com/videos/play/wwdc2014-229) to model derived data. This is where Rx really shines. Rx is that sweet spot between functional and imperative worlds. It enables you to use immutable definitions and pure functions to process snapshots of mutable state in a reliable composable way. So what are some practical examples? ### Easy integration What if you need to create your own observable? It's pretty easy. This code is taken from RxCocoa and that's all you need to wrap HTTP requests with `URLSession` ```swift extension Reactive where Base: URLSession { public func response(request: URLRequest) -> Observable<(Data, HTTPURLResponse)> { return Observable.create { observer in let task = self.base.dataTask(with: request) { (data, response, error) in 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(data, httpResponse)) observer.on(.completed) } task.resume() return Disposables.create(with: task.cancel) } } } ``` ### Benefits In short, using Rx will make your code: * Composable <- Because Rx is composition's nickname * Reusable <- Because it's composable * Declarative <- Because definitions are immutable and only data changes * Understandable and concise <- Raising the level of abstraction and removing transient states * Stable <- Because Rx code is thoroughly unit tested * Less stateful <- Because you are modeling applications as unidirectional data flows * Without leaks <- Because resource management is easy ### It's not all or nothing It is usually a good idea to model as much of your application as possible using Rx. But what if you don't know all of the operators and whether or not there even exists some operator that models your particular case? Well, all of the Rx operators are based on math and should be intuitive. The good news is that about 10-15 operators cover most typical use cases. And that list already includes some of the familiar ones like `map`, `filter`, `zip`, `observeOn`, ... There is a huge list of [all Rx operators](http://reactivex.io/documentation/operators.html). For each operator, there is a [marble diagram](http://reactivex.io/documentation/operators/retry.html) that helps to explain how it works. But what if you need some operator that isn't on that list? Well, you can make your own operator. What if creating that kind of operator is really hard for some reason, or you have some legacy stateful piece of code that you need to work with? Well, you've got yourself in a mess, but you can [jump out of Rx monads](GettingStarted.md#life-happens) easily, process the data, and return back into it. ================================================ FILE: Gemfile ================================================ source 'https://rubygems.org' gem 'danger' ================================================ FILE: LICENSE.md ================================================ **The MIT License** **Copyright © 2015 Shai Mishali, 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. ================================================ FILE: Makefile ================================================ format: mise x swiftformat -- swiftformat . ================================================ FILE: Package.swift ================================================ // swift-tools-version:5.5 import Foundation import PackageDescription func isTargetingDarwin() -> Bool { // Check if building for Android or other non-Darwin platforms if (ProcessInfo.processInfo.environment["ANDROID_DATA"] != nil) || (ProcessInfo.processInfo.environment["ANDROID_ROOT"] != nil) { return false } #if canImport(Darwin) return true #else return false #endif } let buildTests = false let targetsDarwin = isTargetingDarwin() extension Product { static func allTests() -> [Product] { if buildTests { [.executable(name: "AllTestz", targets: ["AllTestz"])] } else { [] } } static func rxCocoaProducts() -> [Product] { if targetsDarwin { [ .library(name: "RxCocoa", targets: ["RxCocoa"]), .library(name: "RxCocoa-Dynamic", type: .dynamic, targets: ["RxCocoa"]) ] } else { [] } } } extension Target { static func rxTarget(name: String, dependencies: [Target.Dependency]) -> Target { .target( name: name, dependencies: dependencies, resources: [.copy("PrivacyInfo.xcprivacy")] ) } } extension Target { static func rxCocoa() -> [Target] { if !targetsDarwin { [] } else { [ .target( name: "RxCocoa", dependencies: [ "RxSwift", "RxRelay", .target(name: "RxCocoaRuntime", condition: .when(platforms: [.iOS, .macOS, .tvOS, .watchOS])) ], resources: [.copy("PrivacyInfo.xcprivacy")] ) ] } } static func rxCocoaRuntime() -> [Target] { if !targetsDarwin { [] } else { [ .target( name: "RxCocoaRuntime", dependencies: ["RxSwift"], resources: [.copy("PrivacyInfo.xcprivacy")] ) ] } } static func allTests() -> [Target] { if buildTests { [.target(name: "AllTestz", dependencies: ["RxSwift", "RxCocoa", "RxBlocking", "RxTest"])] } else { [] } } } let package = Package( name: "RxSwift", platforms: [.iOS(.v9), .macOS(.v10_10), .watchOS(.v3), .tvOS(.v9)], products: ([ [ .library(name: "RxSwift", targets: ["RxSwift"]), .library(name: "RxRelay", targets: ["RxRelay"]), .library(name: "RxBlocking", targets: ["RxBlocking"]), .library(name: "RxTest", targets: ["RxTest"]), .library(name: "RxSwift-Dynamic", type: .dynamic, targets: ["RxSwift"]), .library(name: "RxRelay-Dynamic", type: .dynamic, targets: ["RxRelay"]), .library(name: "RxBlocking-Dynamic", type: .dynamic, targets: ["RxBlocking"]), .library(name: "RxTest-Dynamic", type: .dynamic, targets: ["RxTest"]) ], Product.rxCocoaProducts(), Product.allTests() ] as [[Product]]).flatMap(\.self), targets: ([ [ .rxTarget(name: "RxSwift", dependencies: []) ], Target.rxCocoa(), Target.rxCocoaRuntime(), [ .rxTarget(name: "RxRelay", dependencies: ["RxSwift"]), .target(name: "RxBlocking", dependencies: ["RxSwift"]), .target(name: "RxTest", dependencies: ["RxSwift"]) ], Target.allTests() ] as [[Target]]).flatMap(\.self), swiftLanguageVersions: [.v5] ) ================================================ FILE: Package@swift-5.9.swift ================================================ // swift-tools-version:5.9 import Foundation import PackageDescription func isTargetingDarwin() -> Bool { // Check if building for Android or other non-Darwin platforms if (ProcessInfo.processInfo.environment["ANDROID_DATA"] != nil) || (ProcessInfo.processInfo.environment["ANDROID_ROOT"] != nil) { return false } #if canImport(Darwin) return true #else return false #endif } let buildTests = false let targetsDarwin = isTargetingDarwin() extension Product { static func allTests() -> [Product] { if buildTests { [.executable(name: "AllTestz", targets: ["AllTestz"])] } else { [] } } static func rxCocoaProducts() -> [Product] { if targetsDarwin { [ .library(name: "RxCocoa", targets: ["RxCocoa"]), .library(name: "RxCocoa-Dynamic", type: .dynamic, targets: ["RxCocoa"]) ] } else { [] } } } extension Target { static func rxTarget(name: String, dependencies: [Target.Dependency]) -> Target { .target( name: name, dependencies: dependencies, resources: [.copy("PrivacyInfo.xcprivacy")] ) } } extension Target { static func rxCocoa() -> [Target] { if !targetsDarwin { [] } else { [ .target( name: "RxCocoa", dependencies: [ "RxSwift", "RxRelay", .target(name: "RxCocoaRuntime", condition: .when(platforms: [.iOS, .macCatalyst, .macOS, .tvOS, .watchOS, .visionOS])) ], resources: [.copy("PrivacyInfo.xcprivacy")] ) ] } } static func rxCocoaRuntime() -> [Target] { if !targetsDarwin { [] } else { [ .target( name: "RxCocoaRuntime", dependencies: ["RxSwift"], resources: [.copy("PrivacyInfo.xcprivacy")] ) ] } } static func allTests() -> [Target] { if buildTests { [.target(name: "AllTestz", dependencies: ["RxSwift", "RxCocoa", "RxBlocking", "RxTest"])] } else { [] } } } let package = Package( name: "RxSwift", platforms: [.iOS(.v12), .macOS(.v10_13), .watchOS(.v4), .tvOS(.v12), .visionOS(.v1)], products: ([ [ .library(name: "RxSwift", targets: ["RxSwift"]), .library(name: "RxRelay", targets: ["RxRelay"]), .library(name: "RxBlocking", targets: ["RxBlocking"]), .library(name: "RxTest", targets: ["RxTest"]), .library(name: "RxSwift-Dynamic", type: .dynamic, targets: ["RxSwift"]), .library(name: "RxRelay-Dynamic", type: .dynamic, targets: ["RxRelay"]), .library(name: "RxBlocking-Dynamic", type: .dynamic, targets: ["RxBlocking"]), .library(name: "RxTest-Dynamic", type: .dynamic, targets: ["RxTest"]) ], Product.rxCocoaProducts(), Product.allTests() ] as [[Product]]).flatMap { $0 }, targets: ([ [ .rxTarget(name: "RxSwift", dependencies: []) ], Target.rxCocoa(), Target.rxCocoaRuntime(), [ .rxTarget(name: "RxRelay", dependencies: ["RxSwift"]), .target(name: "RxBlocking", dependencies: ["RxSwift"]), .target(name: "RxTest", dependencies: ["RxSwift"]) ], Target.allTests() ] as [[Target]]).flatMap { $0 }, swiftLanguageVersions: [.v5] ) ================================================ FILE: Platform/AtomicInt.swift ================================================ // // AtomicInt.swift // Platform // // Created by Krunoslav Zaher on 10/28/18. // Copyright © 2018 Krunoslav Zaher. All rights reserved. // import CoreFoundation // This CoreFoundation import can be dropped when this issue is resolved: // https://github.com/swiftlang/swift-corelibs-foundation/pull/5122 import Foundation final class AtomicInt: NSLock, @unchecked Sendable { fileprivate var value: Int32 init(_ value: Int32 = 0) { self.value = value } } @discardableResult @inline(__always) func add(_ this: AtomicInt, _ value: Int32) -> Int32 { this.lock() let oldValue = this.value this.value += value this.unlock() return oldValue } @discardableResult @inline(__always) func sub(_ this: AtomicInt, _ value: Int32) -> Int32 { this.lock() let oldValue = this.value this.value -= value this.unlock() return oldValue } @discardableResult @inline(__always) func fetchOr(_ this: AtomicInt, _ mask: Int32) -> Int32 { this.lock() let oldValue = this.value this.value |= mask this.unlock() return oldValue } @inline(__always) func load(_ this: AtomicInt) -> Int32 { this.lock() let oldValue = this.value this.unlock() return oldValue } @discardableResult @inline(__always) func increment(_ this: AtomicInt) -> Int32 { add(this, 1) } @discardableResult @inline(__always) func decrement(_ this: AtomicInt) -> Int32 { sub(this, 1) } @inline(__always) func isFlagSet(_ this: AtomicInt, _ mask: Int32) -> Bool { (load(this) & mask) != 0 } ================================================ FILE: Platform/DataStructures/Bag.swift ================================================ // // 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 and 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) private var _nextKey: BagKey = .init(rawValue: 0) // data // first fill inline variables var _key0: BagKey? var _value0: T? // then fill "array dictionary" var _pairs = ContiguousArray() // last is sparse dictionary var _dictionary: [BagKey: T]? 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 where _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 { "\(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 { 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 { func hash(into hasher: inout Hasher) { hasher.combine(rawValue) } } func == (lhs: BagKey, rhs: BagKey) -> Bool { lhs.rawValue == rhs.rawValue } ================================================ FILE: Platform/DataStructures/InfiniteSequence.swift ================================================ // // 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 Iterator = AnyIterator private let repeatedValue: Element init(repeatedValue: Element) { self.repeatedValue = repeatedValue } func makeIterator() -> Iterator { let repeatedValue = repeatedValue return AnyIterator { repeatedValue } } } ================================================ FILE: Platform/DataStructures/PriorityQueue.swift ================================================ // // 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 private var elements = [Element]() init(hasHigherPriority: @escaping (Element, Element) -> Bool, isEqual: @escaping (Element, Element) -> Bool) { self.hasHigherPriority = hasHigherPriority self.isEqual = isEqual } mutating func enqueue(_ element: Element) { elements.append(element) bubbleToHigherPriority(elements.count - 1) } func peek() -> Element? { elements.first } var isEmpty: Bool { 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 { elements.swapAt(index, elements.count - 1) } _ = 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 } elements.swapAt(unbalancedIndex, parentIndex) 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 } elements.swapAt(highestPriorityIndex, unbalancedIndex) unbalancedIndex = highestPriorityIndex } } } extension PriorityQueue: CustomDebugStringConvertible { var debugDescription: String { elements.debugDescription } } ================================================ FILE: Platform/DataStructures/Queue.swift ================================================ // // 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 innerCount = 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 { count == 0 } /// - returns: Number of elements inside queue. var count: Int { innerCount } /// - returns: Element in front of a list of elements to `dequeue`. func peek() -> T { precondition(count > 0) return storage[dequeueIndex]! } private mutating func resizeTo(_ size: Int) { var newStorage = ContiguousArray(repeating: nil, count: size) let count = count let dequeueIndex = 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] innerCount = 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 innerCount += 1 if pushNextIndex >= storage.count { pushNextIndex -= storage.count } } private mutating func dequeueElementOnly() -> T { precondition(count > 0) let index = dequeueIndex defer { storage[index] = nil innerCount -= 1 } return storage[index]! } /// Dequeues element or throws an exception in case queue is empty. /// /// - returns: Dequeued element. mutating func dequeue() -> T? { if 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 innerCount = count return AnyIterator { if innerCount == 0 { return nil } defer { innerCount -= 1 i += 1 } if i >= storage.count { i -= storage.count } return storage[i] } } } ================================================ FILE: Platform/DispatchQueue+Extensions.swift ================================================ // // 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 { DispatchQueue.getSpecific(key: token) != nil } } ================================================ FILE: Platform/Platform.Darwin.swift ================================================ // // Platform.Darwin.swift // Platform // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if canImport(Darwin) import Darwin import Foundation extension Thread { static func setThreadLocalStorageValue(_ value: (some AnyObject)?, 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 } } #endif ================================================ FILE: Platform/Platform.Linux.swift ================================================ // // Platform.Linux.swift // Platform // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if !canImport(Darwin) import Foundation extension Thread { static func setThreadLocalStorageValue(_ value: (some AnyObject)?, forKey key: String) { if let newValue = value { Thread.current.threadDictionary[key] = newValue } else { Thread.current.threadDictionary[key] = nil } } static func getThreadLocalStorageValueForKey(_ key: String) -> T? { let currentThread = Thread.current let threadDictionary = currentThread.threadDictionary return threadDictionary[key] as? T } } #endif ================================================ FILE: Platform/RecursiveLock.swift ================================================ // // RecursiveLock.swift // Platform // // Created by Krunoslav Zaher on 12/18/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation #if TRACE_RESOURCES class RecursiveLock: NSRecursiveLock, @unchecked Sendable { 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 ================================================ FILE: Preprocessor/Preprocessor/main.swift ================================================ // // main.swift // Preprocessor // // Created by Krunoslav Zaher on 4/22/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation if CommandLine.argc != 3 { print("./Preprocessor ") exit(-1) } let sourceFilesRoot = CommandLine.arguments[1] let derivedData = CommandLine.arguments[2] let fileManager = FileManager() func escape(value: String) -> String { let escapedString = value.replacingOccurrences(of: "\n", with: "\\n") let escapedString1 = escapedString.replacingOccurrences(of: "\r", with: "\\r") let escapedString2 = escapedString1.replacingOccurrences(of: "\"", with: "\\\"") return "\"\(escapedString2)\"" } func processFile(path: String, outputPath: String) -> String { let url = URL(fileURLWithPath: path) let rawContent = try! Data(contentsOf: url) let content = String(data: rawContent, encoding: String.Encoding.utf8) guard let components = content?.components(separatedBy: "<%") else { return "" } var functionContentComponents: [String] = [] functionContentComponents.append("var components: [String] = [\"// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \\n\"]\n") functionContentComponents.append("components.append(\(escape(value: components[0])))\n") for codePlusSuffix in components[1 ..< components.count] { let codePlusSuffixSeparated = codePlusSuffix.components(separatedBy: "%>") if codePlusSuffixSeparated.count != 2 { fatalError("Error in \(path) near \(codePlusSuffix)") } let code = codePlusSuffixSeparated[0] let suffix = codePlusSuffixSeparated[1] if code.hasPrefix("=") { functionContentComponents.append("components.append(String(\(String(code[code.index(after: code.startIndex) ..< code.endIndex]))))\n") } else { functionContentComponents.append("\(code)\n") } functionContentComponents.append("components.append(\(escape(value: suffix)));\n") } functionContentComponents.append("try! components.joined(separator:\"\").write(toFile:\"\(outputPath)\", atomically: false, encoding: String.Encoding.utf8)") return functionContentComponents.joined(separator: "") } func runCommand(path: String) { _ = ProcessInfo().processIdentifier let process = Process() process.launchPath = "/bin/bash" process.arguments = ["-c", "xcrun swift \"\(path)\""] process.launch() process.waitUntilExit() if process.terminationReason != .exit { exit(-1) } } let files = try fileManager.subpathsOfDirectory(atPath: sourceFilesRoot) var generateAllFiles = ["// Generated code\n", "import Foundation\n"] for file in files { if ((file as NSString).pathExtension) != "tt" { continue } print(file) let path = (sourceFilesRoot as NSString).appendingPathComponent(file as String) let endIndex = path.index(before: path.index(before: path.index(before: path.endIndex))) let outputPath = String(path[path.startIndex ..< endIndex]) + ".swift" generateAllFiles.append("_ = { () -> Void in\n\(processFile(path: path, outputPath: outputPath))\n}()\n") } let script = generateAllFiles.joined(separator: "") let scriptPath = (derivedData as NSString).appendingPathComponent("_preprocessor.sh") do { try script.write(toFile: scriptPath, atomically: true, encoding: String.Encoding.utf8) } catch _ {} runCommand(path: scriptPath) ================================================ FILE: Preprocessor/Preprocessor.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ C811087B1AF5114D001C13E4 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C811087A1AF5114D001C13E4 /* main.swift */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ C81108751AF5114D001C13E4 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = /usr/share/man/man1/; dstSubfolderSpec = 0; files = ( ); runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ C81108771AF5114D001C13E4 /* Preprocessor */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Preprocessor; sourceTree = BUILT_PRODUCTS_DIR; }; C811087A1AF5114D001C13E4 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = main.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ C81108741AF5114D001C13E4 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ C811086E1AF5114D001C13E4 = { isa = PBXGroup; children = ( C81108791AF5114D001C13E4 /* Preprocessor */, C81108781AF5114D001C13E4 /* Products */, ); sourceTree = ""; }; C81108781AF5114D001C13E4 /* Products */ = { isa = PBXGroup; children = ( C81108771AF5114D001C13E4 /* Preprocessor */, ); name = Products; sourceTree = ""; }; C81108791AF5114D001C13E4 /* Preprocessor */ = { isa = PBXGroup; children = ( C811087A1AF5114D001C13E4 /* main.swift */, ); path = Preprocessor; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ C81108761AF5114D001C13E4 /* Preprocessor */ = { isa = PBXNativeTarget; buildConfigurationList = C811087E1AF5114D001C13E4 /* Build configuration list for PBXNativeTarget "Preprocessor" */; buildPhases = ( C81108731AF5114D001C13E4 /* Sources */, C81108741AF5114D001C13E4 /* Frameworks */, C81108751AF5114D001C13E4 /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = Preprocessor; productName = Preprocessor; productReference = C81108771AF5114D001C13E4 /* Preprocessor */; productType = "com.apple.product-type.tool"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ C811086F1AF5114D001C13E4 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 1250; ORGANIZATIONNAME = "Krunoslav Zaher"; TargetAttributes = { C81108761AF5114D001C13E4 = { CreatedOnToolsVersion = 6.3; LastSwiftMigration = 1020; }; }; }; buildConfigurationList = C81108721AF5114D001C13E4 /* Build configuration list for PBXProject "Preprocessor" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = C811086E1AF5114D001C13E4; productRefGroup = C81108781AF5114D001C13E4 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( C81108761AF5114D001C13E4 /* Preprocessor */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ C81108731AF5114D001C13E4 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C811087B1AF5114D001C13E4 /* main.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ C811087C1AF5114D001C13E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; 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; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; }; name = Debug; }; C811087D1AF5114D001C13E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; 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; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; }; name = Release; }; C811087F1AF5114D001C13E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; }; name = Debug; }; C81108801AF5114D001C13E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C81108721AF5114D001C13E4 /* Build configuration list for PBXProject "Preprocessor" */ = { isa = XCConfigurationList; buildConfigurations = ( C811087C1AF5114D001C13E4 /* Debug */, C811087D1AF5114D001C13E4 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C811087E1AF5114D001C13E4 /* Build configuration list for PBXNativeTarget "Preprocessor" */ = { isa = XCConfigurationList; buildConfigurations = ( C811087F1AF5114D001C13E4 /* Debug */, C81108801AF5114D001C13E4 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = C811086F1AF5114D001C13E4 /* Project object */; } ================================================ FILE: Preprocessor/Preprocessor.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Preprocessor/Preprocessor.xcodeproj/xcshareddata/xcschemes/Preprocessor.xcscheme ================================================ ================================================ FILE: Preprocessor/README.md ================================================ ## RxSwift KISS code generator. RxSwift code is partially machine generated. It converts *.tt files into generated *.swift files. There are multiple reasons why that is the case. * Performance * Consistency * Removes burden from developers (me :) * It's fun To see how it in action, take a look at CombineLatest+arity.tt CombineLatest+arity.swift ``` // // CombineLatest.tt.swift // RxSwift // // Created by Krunoslav Zaher on 4/22/15. // Copyright (c) 2015 Krunoslav Zaher. All rights reserved. // import Foundation <% for i in 2 ... 10 { %> // <%= i %> public func combineLatestOrDie<<%= ", ".join(map(1...i) { "E\($0)" }) %>, R> (<%= ", ".join(map(1...i) { "source\($0): Observable" }) %>, resultSelector: (<%= ", ".join(map(1...i) { "E\($0)" }) %>) -> Result) -> Observable { return CombineLatest<%= i %>( <%= ", ".join(map(1...i) { "source\($0): source\($0)" }) %>, resultSelector: resultSelector ) } public func combineLatest<<%= ", ".join(map(1...i) { "E\($0)" }) %>, R> (<%= ", ".join(map(1...i) { "source\($0): Observable" }) %>, resultSelector: (<%= ", ".join(map(1...i) { "E\($0)" }) %>) -> R) -> Observable { return CombineLatest<%= i %>( <%= ", ".join(map(1...i) { "source\($0): source\($0)" }) %>, resultSelector: { success(resultSelector(<%= ", ".join(map(0..)) } ) } ``` to ``` // This file is autogenerated. // Take a look at `Preprocessor` target in RxSwift project // // CombineLatest.tt.swift // RxSwift // // Created by Krunoslav Zaher on 4/22/15. // Copyright (c) 2015 Krunoslav Zaher. All rights reserved. // import Foundation // 2 public func combineLatestOrDie (source1: Observable, source2: Observable, resultSelector: (E1, E2) -> Result) -> Observable { return CombineLatest2( source1: source1, source2: source2, resultSelector: resultSelector ) } public func combineLatest (source1: Observable, source2: Observable, resultSelector: (E1, E2) -> R) -> Observable { return CombineLatest2( source1: source1, source2: source2, resultSelector: { success(resultSelector($0, $1)) } ) } ``` It's pretty generic, I'm thinking of extracting it as a separate project. ================================================ FILE: README.md ================================================

RxSwift Logo
Build Status Supported Platforms: iOS, macOS, tvOS, watchOS & Linux

Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable` interface, which lets you broadcast and subscribe to values and other events from an `Observable` stream. RxSwift is the Swift-specific implementation of the [Reactive Extensions](http://reactivex.io) standard.

RxSwift Observable Example of a price constantly changing and updating the app's UI

While this version aims to stay true to the original spirit and naming conventions of Rx, this project also aims to provide a true Swift-first API for Rx APIs. Cross platform documentation can be found on [ReactiveX.io](http://reactivex.io/). Like other Rx implementations, RxSwift's intention is to enable easy composition of asynchronous operations and streams of data in the form of `Observable` objects and a suite of methods to transform and compose these pieces of asynchronous work. KVO observation, async operations, UI Events and other streams of data 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?](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Why.md) * [the basics, getting started with RxSwift](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/GettingStarted.md) * [traits](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, and `ControlProperty` ... and why do they exist? * [testing](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/UnitTests.md) * [tips and common errors](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Tips.md) * [debugging](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/GettingStarted.md#debugging) * [the math behind Rx](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/MathBehindRx.md) * [what are hot and cold observable sequences?](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/HotAndColdObservables.md) ###### ... install * Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation) ###### ... hack around * with the example app. [Running Example App](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/ExampleApp.md) * with operators in playgrounds. [Playgrounds](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Playgrounds.md) ###### ... interact * All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences.
[Join Slack Channel](http://slack.rxswift.org) * Report a problem using the library. [Open an Issue With Bug Template](https://github.com/ReactiveX/RxSwift/blob/main/.github/ISSUE_TEMPLATE.md) * Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md) * Help out [Check out contribution guide](https://github.com/ReactiveX/RxSwift/blob/main/CONTRIBUTING.md) ###### ... compare * [with Combine and ReactiveSwift](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/ComparisonWithOtherLibraries.md). ###### ... understand the structure RxSwift is as compositional as the asynchronous work it drives. The core unit is RxSwift itself, while other dependencies can be added for UI Work, testing, and more. It comprises five separate components depending on each other in the following way: ```none ┌──────────────┐ ┌──────────────┐ │ RxCocoa ├────▶ RxRelay │ └───────┬──────┘ └──────┬───────┘ │ │ ┌───────▼──────────────────▼───────┐ │ RxSwift │ └───────▲──────────────────▲───────┘ │ │ ┌───────┴──────┐ ┌──────┴───────┐ │ RxTest │ │ RxBlocking │ └──────────────┘ └──────────────┘ ``` * **RxSwift**: The core of RxSwift, providing the Rx standard as (mostly) defined by [ReactiveX](https://reactivex.io). It has no other dependencies. * **RxCocoa**: Provides Cocoa-specific capabilities for general iOS/macOS/watchOS & tvOS app development, such as Shared Sequences, Traits, and much more. It depends on both `RxSwift` and `RxRelay`. * **RxRelay**: Provides `PublishRelay`, `BehaviorRelay` and `ReplayRelay`, three [simple wrappers around Subjects](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Subjects.md#relays). It depends on `RxSwift`. * **RxTest** and **RxBlocking**: Provides testing capabilities for Rx-based systems. It depends on `RxSwift`. ## Usage
Here's an example In Action
Define search for GitHub repositories ...
let searchResults = searchBar.rx.text.orEmpty
    .throttle(.milliseconds(300), scheduler: MainScheduler.instance)
    .distinctUntilChanged()
    .flatMapLatest { query -> Observable<[Repository]> in
        if query.isEmpty {
            return .just([])
        }
        return searchGitHub(query)
            .catchAndReturn([])
    }
    .observe(on: 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)
## Installation RxSwift doesn't contain any external dependencies. These are currently the supported installation options: ### Manual Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app ### XCFrameworks Each release starting with RxSwift 6 includes `*.xcframework` framework binaries. Simply drag the needed framework binaries to your **Frameworks, Libraries, and Embedded Content** section under your target's **General** tab. XCFrameworks instructions > [!TIP] > RxSwift's xcframework(s) are signed with an Apple Developer account, and you can always verify the Team Name: Shai Mishali > > XCFrameworks Signing Team Name Validation ### [Carthage](https://github.com/Carthage/Carthage) Add this to `Cartfile` ``` github "ReactiveX/RxSwift" "6.10.0" ``` ```bash $ carthage update ``` #### Carthage as a Static Library Carthage defaults to building RxSwift as a Dynamic Library. If you wish to build RxSwift as a Static Library using Carthage you may use the script below to manually modify the framework type before building with Carthage: ```bash carthage update RxSwift --platform iOS --no-build sed -i -e 's/MACH_O_TYPE = mh_dylib/MACH_O_TYPE = staticlib/g' Carthage/Checkouts/RxSwift/Rx.xcodeproj/project.pbxproj carthage build RxSwift --platform iOS ``` ### [Swift Package Manager](https://github.com/swiftlang/swift-package-manager) > **Note**: There is a critical cross-dependency bug affecting many projects including RxSwift in Swift Package Manager. We've [filed a bug (SR-12303)](https://bugs.swift.org/browse/SR-12303) in early 2020 but have no answer yet. Your mileage may vary. A partial workaround can be found [here](https://github.com/ReactiveX/RxSwift/issues/2127#issuecomment-717830502). Create a `Package.swift` file. ```swift // swift-tools-version:5.0 import PackageDescription let package = Package( name: "RxProject", dependencies: [ .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0")) ], targets: [ .target(name: "RxProject", dependencies: ["RxSwift", .product(name: "RxCocoa", package: "RxSwift")]), ] ) ``` ```bash $ swift build ``` To build or test a module with RxTest dependency, set `TEST=1`. ```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`, `RxCocoa` and `RxRelay` 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-reactive-programming-with-swift) * [RxSwift: Debunking the myth of hard (YouTube)](https://www.youtube.com/watch?v=GdvLP0ZAhhc) * [Boxue.io RxSwift Online Course](https://boxueio.com/series/rxswift-101) (Chinese 🇨🇳) * [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://youtu.be/-8Y1-lE6NSA) * [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/) ================================================ FILE: Rx.playground/Pages/Combining_Operators.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Combination Operators Operators that combine multiple source `Observable`s into a single `Observable`. ## `startWith` Emits the specified sequence of elements before beginning to emit the elements from the source `Observable`. [More info](http://reactivex.io/documentation/operators/startwith.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/startwith.png) */ example("startWith") { let disposeBag = DisposeBag() Observable.of("🐶", "🐱", "🐭", "🐹") .startWith("1️⃣") .startWith("2️⃣") .startWith("3️⃣", "🅰️", "🅱️") .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: > As this example demonstrates, `startWith` can be chained on a last-in-first-out basis, i.e., each successive `startWith`'s elements will be prepended before the prior `startWith`'s elements. ---- ## `merge` Combines elements from source `Observable` sequences into a single new `Observable` sequence, and will emit each element as it is emitted by each source `Observable` sequence. [More info](http://reactivex.io/documentation/operators/merge.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/merge.png) */ example("merge") { let disposeBag = DisposeBag() let subject1 = PublishSubject() let subject2 = PublishSubject() Observable.of(subject1, subject2) .merge() .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) subject1.onNext("🅰️") subject1.onNext("🅱️") subject2.onNext("①") subject2.onNext("②") subject1.onNext("🆎") subject2.onNext("③") } /*: ---- ## `zip` Combines up to 8 source `Observable` sequences into a single new `Observable` sequence, and will emit from the combined `Observable` sequence the elements from each of the source `Observable` sequences at the corresponding index. [More info](http://reactivex.io/documentation/operators/zip.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/zip.png) */ example("zip") { let disposeBag = DisposeBag() let stringSubject = PublishSubject() let intSubject = PublishSubject() Observable.zip(stringSubject, intSubject) { stringElement, intElement in "\(stringElement) \(intElement)" } .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) stringSubject.onNext("🅰️") stringSubject.onNext("🅱️") intSubject.onNext(1) intSubject.onNext(2) stringSubject.onNext("🆎") intSubject.onNext(3) } /*: ---- ## `combineLatest` Combines up to 8 source `Observable` sequences into a single new `Observable` sequence, and will begin emitting from the combined `Observable` sequence the latest elements of each source `Observable` sequence once all source sequences have emitted at least one element, and also when any of the source `Observable` sequences emits a new element. [More info](http://reactivex.io/documentation/operators/combinelatest.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/combinelatest.png) */ example("combineLatest") { let disposeBag = DisposeBag() let stringSubject = PublishSubject() let intSubject = PublishSubject() Observable.combineLatest(stringSubject, intSubject) { stringElement, intElement in "\(stringElement) \(intElement)" } .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) stringSubject.onNext("🅰️") stringSubject.onNext("🅱️") intSubject.onNext(1) intSubject.onNext(2) stringSubject.onNext("🆎") } //: There is also a variant of `combineLatest` that takes an `Array` (or any other collection of `Observable` sequences): example("Array.combineLatest") { let disposeBag = DisposeBag() let stringObservable = Observable.just("❤️") let fruitObservable = Observable.from(["🍎", "🍐", "🍊"]) let animalObservable = Observable.of("🐶", "🐱", "🐭", "🐹") Observable.combineLatest([stringObservable, fruitObservable, animalObservable]) { "\($0[0]) \($0[1]) \($0[2])" } .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: > Because the `combineLatest` variant that takes a collection passes an array of values to the selector function, it requires that all source `Observable` sequences are of the same type. ---- ## `switchLatest` Transforms the elements emitted by an `Observable` sequence into `Observable` sequences, and emits elements from the most recent inner `Observable` sequence. [More info](http://reactivex.io/documentation/operators/switch.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/switch.png) */ example("switchLatest") { let disposeBag = DisposeBag() let subject1 = BehaviorSubject(value: "⚽️") let subject2 = BehaviorSubject(value: "🍎") let subjectsSubject = BehaviorSubject(value: subject1) subjectsSubject.asObservable() .switchLatest() .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) subject1.onNext("🏈") subject1.onNext("🏀") subjectsSubject.onNext(subject2) subject1.onNext("⚾️") subject2.onNext("🍐") } /*: > In this example, adding ⚾️ onto `subject1` after adding `subject2` to `subjectsSubject` has no effect, because only the most recent inner `Observable` sequence (`subject2`) will emit elements. ---- ## `withLatestFrom` Merges two observable sequences into one observable sequence by combining each element from the first source with the latest element from the second source, if any. */ example("withLatestFrom") { let disposeBag = DisposeBag() let foodSubject = PublishSubject() let drinksSubject = PublishSubject() foodSubject.asObservable() .withLatestFrom(drinksSubject) { "\($0) + \($1)" } .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) foodSubject.onNext("🥗") drinksSubject.onNext("☕️") foodSubject.onNext("🥐") drinksSubject.onNext("🍷") foodSubject.onNext("🍔") foodSubject.onNext("🍟") drinksSubject.onNext("🍾") } /*: > In this example 🥗 is not printed because `drinksSubject` did not emit any values before 🥗 was received. The last drink (🍾) will be printed whenever `foodSubject` will emit another event. */ //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Connectable_Operators.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift playgroundShouldContinueIndefinitely() /*: # Connectable Operators Connectable `Observable` sequences resembles ordinary `Observable` sequences, except that they not begin emitting elements when subscribed to, but instead, only when their `connect()` method is called. In this way, you can wait for all intended subscribers to subscribe to a connectable `Observable` sequence before it begins emitting elements. > Within each example on this page is a commented-out method. Uncomment that method to run the example, and then comment it out again to stop running the example. # Before learning about connectable operators, let's take a look at an example of a non-connectable operator: */ func sampleWithoutConnectableOperators() { printExampleHeader(#function) let interval = Observable.interval(.seconds(1), scheduler: MainScheduler.instance) _ = interval .subscribe(onNext: { print("Subscription: 1, Event: \($0)") }) delay(5) { _ = interval .subscribe(onNext: { print("Subscription: 2, Event: \($0)") }) } } // sampleWithoutConnectableOperators() // ⚠️ Uncomment to run this example; comment to stop running /*: > `interval` creates an `Observable` sequence that emits elements after each `period`, on the specified scheduler. [More info](http://reactivex.io/documentation/operators/interval.html) ![](http://reactivex.io/documentation/operators/images/interval.c.png) ---- ## `publish` Converts the source `Observable` sequence into a connectable sequence. [More info](http://reactivex.io/documentation/operators/publish.html) ![](http://reactivex.io/documentation/operators/images/publishConnect.c.png) */ func sampleWithPublish() { printExampleHeader(#function) let intSequence = Observable.interval(.seconds(1), scheduler: MainScheduler.instance) .publish() _ = intSequence .subscribe(onNext: { print("Subscription 1:, Event: \($0)") }) delay(2) { _ = intSequence.connect() } delay(4) { _ = intSequence .subscribe(onNext: { print("Subscription 2:, Event: \($0)") }) } delay(6) { _ = intSequence .subscribe(onNext: { print("Subscription 3:, Event: \($0)") }) } } // sampleWithPublish() // ⚠️ Uncomment to run this example; comment to stop running //: > Schedulers are an abstraction of mechanisms for performing work, such as on specific threads or dispatch queues. [More info](https://github.com/ReactiveX/RxSwift/blob/master/Documentation/Schedulers.md) /*: ---- ## `replay` Converts the source `Observable` sequence into a connectable sequence, and will replay `bufferSize` number of previous emissions to each new subscriber. [More info](http://reactivex.io/documentation/operators/replay.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/replay.png) */ func sampleWithReplayBuffer() { printExampleHeader(#function) let intSequence = Observable.interval(.seconds(1), scheduler: MainScheduler.instance) .replay(5) _ = intSequence .subscribe(onNext: { print("Subscription 1:, Event: \($0)") }) delay(2) { _ = intSequence.connect() } delay(4) { _ = intSequence .subscribe(onNext: { print("Subscription 2:, Event: \($0)") }) } delay(8) { _ = intSequence .subscribe(onNext: { print("Subscription 3:, Event: \($0)") }) } } // sampleWithReplayBuffer() // ⚠️ Uncomment to run this example; comment to stop running /*: ---- ## `multicast` Converts the source `Observable` sequence into a connectable sequence, and broadcasts its emissions via the specified `subject`. */ func sampleWithMulticast() { printExampleHeader(#function) let subject = PublishSubject() _ = subject .subscribe(onNext: { print("Subject: \($0)") }) let intSequence = Observable.interval(.seconds(1), scheduler: MainScheduler.instance) .multicast(subject) _ = intSequence .subscribe(onNext: { print("\tSubscription 1:, Event: \($0)") }) delay(2) { _ = intSequence.connect() } delay(4) { _ = intSequence .subscribe(onNext: { print("\tSubscription 2:, Event: \($0)") }) } delay(6) { _ = intSequence .subscribe(onNext: { print("\tSubscription 3:, Event: \($0)") }) } } // sampleWithMulticast() // ⚠️ Uncomment to run this example; comment to stop running //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Creating_and_Subscribing_to_Observables.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Creating and Subscribing to `Observable`s There are several ways to create and subscribe to `Observable` sequences. ## never Creates a sequence that never terminates and never emits any events. [More info](http://reactivex.io/documentation/operators/empty-never-throw.html) */ example("never") { let disposeBag = DisposeBag() let neverSequence = Observable.never() let neverSequenceSubscription = neverSequence .subscribe { _ in print("This will never be printed") } neverSequenceSubscription.disposed(by: disposeBag) } /*: ---- ## empty Creates an empty `Observable` sequence that only emits a Completed event. [More info](http://reactivex.io/documentation/operators/empty-never-throw.html) */ example("empty") { let disposeBag = DisposeBag() Observable.empty() .subscribe { event in print(event) } .disposed(by: disposeBag) } /*: > This example also introduces chaining together creating and subscribing to an `Observable` sequence. ---- ## just Creates an `Observable` sequence with a single element. [More info](http://reactivex.io/documentation/operators/just.html) */ example("just") { let disposeBag = DisposeBag() Observable.just("🔴") .subscribe { event in print(event) } .disposed(by: disposeBag) } /*: ---- ## of Creates an `Observable` sequence with a fixed number of elements. */ example("of") { let disposeBag = DisposeBag() Observable.of("🐶", "🐱", "🐭", "🐹") .subscribe(onNext: { element in print(element) }) .disposed(by: disposeBag) } /*: > This example also introduces using the `subscribe(onNext:)` convenience method. Unlike `subscribe(_:)`, which subscribes an _event_ handler for all event types (Next, Error, and Completed), `subscribe(onNext:)` subscribes an _element_ handler that will ignore Error and Completed events and only produce Next event elements. There are also `subscribe(onError:)` and `subscribe(onCompleted:)` convenience methods, should you only want to subscribe to those event types. And there is a `subscribe(onNext:onError:onCompleted:onDisposed:)` method, which allows you to react to one or more event types and when the subscription is terminated for any reason, or disposed, in a single call: ``` someObservable.subscribe( onNext: { print("Element:", $0) }, onError: { print("Error:", $0) }, onCompleted: { print("Completed") }, onDisposed: { print("Disposed") } ) ``` ---- ## from Creates an `Observable` sequence from a `Sequence`, such as an `Array`, `Dictionary`, or `Set`. */ example("from") { let disposeBag = DisposeBag() Observable.from(["🐶", "🐱", "🐭", "🐹"]) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: > This example also demonstrates using the default argument name `$0` instead of explicitly naming the argument. ---- ## create Creates a custom `Observable` sequence. [More info](http://reactivex.io/documentation/operators/create.html) */ example("create") { let disposeBag = DisposeBag() let myJust = { (element: String) -> Observable in return Observable.create { observer in observer.on(.next(element)) observer.on(.completed) return Disposables.create() } } myJust("🔴") .subscribe { print($0) } .disposed(by: disposeBag) } /*: ---- ## range Creates an `Observable` sequence that emits a range of sequential integers and then terminates. [More info](http://reactivex.io/documentation/operators/range.html) */ example("range") { let disposeBag = DisposeBag() Observable.range(start: 1, count: 10) .subscribe { print($0) } .disposed(by: disposeBag) } /*: ---- ## repeatElement Creates an `Observable` sequence that emits the given element indefinitely. [More info](http://reactivex.io/documentation/operators/repeat.html) */ example("repeatElement") { let disposeBag = DisposeBag() Observable.repeatElement("🔴") .take(3) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: > This example also introduces using the `take` operator to return a specified number of elements from the start of a sequence. ---- ## generate Creates an `Observable` sequence that generates values for as long as the provided condition evaluates to `true`. */ example("generate") { let disposeBag = DisposeBag() Observable.generate( initialState: 0, condition: { $0 < 3 }, iterate: { $0 + 1 } ) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## deferred Creates a new `Observable` sequence for each subscriber. [More info](http://reactivex.io/documentation/operators/defer.html) */ example("deferred") { let disposeBag = DisposeBag() var count = 1 let deferredSequence = Observable.deferred { print("Creating \(count)") count += 1 return Observable.create { observer in print("Emitting...") observer.onNext("🐶") observer.onNext("🐱") observer.onNext("🐵") return Disposables.create() } } deferredSequence .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) deferredSequence .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## error Creates an `Observable` sequence that emits no items and immediately terminates with an error. */ example("error") { let disposeBag = DisposeBag() Observable.error(TestError.test) .subscribe { print($0) } .disposed(by: disposeBag) } /*: ---- ## doOn Invokes a side-effect action for each emitted event and returns (passes through) the original event. [More info](http://reactivex.io/documentation/operators/do.html) */ example("doOn") { let disposeBag = DisposeBag() Observable.of("🍎", "🍐", "🍊", "🍋") .do(onNext: { print("Intercepted:", $0) }, afterNext: { print("Intercepted after:", $0) }, onError: { print("Intercepted error:", $0) }, afterError: { print("Intercepted after error:", $0) }, onCompleted: { print("Completed") }, afterCompleted: { print("After completed") }) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } //: > There are also `doOnNext(_:)`, `doOnError(_:)`, and `doOnCompleted(_:)` convenience methods to intercept those specific events, and `doOn(onNext:onError:onCompleted:)` to intercept one or more events in a single call. //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Debugging_Operators.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Debugging Operators Operators to help debug Rx code. ## `debug` Prints out all subscriptions, events, and disposals. */ example("debug") { let disposeBag = DisposeBag() var count = 1 let sequenceThatErrors = Observable.create { observer in observer.onNext("🍎") observer.onNext("🍐") observer.onNext("🍊") if count < 5 { observer.onError(TestError.test) print("Error encountered") count += 1 } observer.onNext("🐶") observer.onNext("🐱") observer.onNext("🐭") observer.onCompleted() return Disposables.create() } sequenceThatErrors .retry(3) .debug() .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `RxSwift.Resources.total` Provides a count of all Rx resource allocations, which is useful for detecting leaks during development. */ #if NOT_IN_PLAYGROUND #else example("RxSwift.Resources.total") { print(RxSwift.Resources.total) let disposeBag = DisposeBag() print(RxSwift.Resources.total) let subject = BehaviorSubject(value: "🍎") let subscription1 = subject.subscribe(onNext: { print($0) }) print(RxSwift.Resources.total) let subscription2 = subject.subscribe(onNext: { print($0) }) print(RxSwift.Resources.total) subscription1.dispose() print(RxSwift.Resources.total) subscription2.dispose() print(RxSwift.Resources.total) } print(RxSwift.Resources.total) #endif //: > `RxSwift.Resources.total` is not enabled by default, and should generally not be enabled in Release builds. [Click here](Enable_RxSwift.Resources.total) for instructions on how to enable it. //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Enable_RxSwift.Resources.total.xcplaygroundpage/Contents.swift ================================================ //: [Back](@previous) /*: Follow these instructions to enable `RxSwift.Resources.total` in your project: # **CocoaPods** 1. Add a `post_install` hook to your Podfile, e.g.: ``` target 'AppTarget' do pod 'RxSwift' end post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'RxSwift' target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['-D', 'TRACE_RESOURCES'] end end end end end ``` 2. Run `pod update`. 3. Build project (**Product** → **Build**). # **Carthage** 1. Run `carthage build --configuration Debug`. 2. Build project (**Product** → **Build**). */ ================================================ FILE: Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Error Handling Operators Operators that help to recover from error notifications from an Observable. ## `catchErrorJustReturn` Recovers from an Error event by returning an `Observable` sequence that emits a single element and then terminates. [More info](http://reactivex.io/documentation/operators/catch.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/catch.png) */ example("catchErrorJustReturn") { let disposeBag = DisposeBag() let sequenceThatFails = PublishSubject() sequenceThatFails .catchAndReturn("😊") .subscribe { print($0) } .disposed(by: disposeBag) sequenceThatFails.onNext("😬") sequenceThatFails.onNext("😨") sequenceThatFails.onNext("😡") sequenceThatFails.onNext("🔴") sequenceThatFails.onError(TestError.test) } /*: ---- ## `catchError` Recovers from an Error event by switching to the provided recovery `Observable` sequence. [More info](http://reactivex.io/documentation/operators/catch.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/catch.png) */ example("catchError") { let disposeBag = DisposeBag() let sequenceThatFails = PublishSubject() let recoverySequence = PublishSubject() sequenceThatFails .catch { print("Error:", $0) return recoverySequence } .subscribe { print($0) } .disposed(by: disposeBag) sequenceThatFails.onNext("😬") sequenceThatFails.onNext("😨") sequenceThatFails.onNext("😡") sequenceThatFails.onNext("🔴") sequenceThatFails.onError(TestError.test) recoverySequence.onNext("😊") } /*: ---- ## `retry` Recovers repeatedly Error events by resubscribing to the `Observable` sequence, indefinitely. [More info](http://reactivex.io/documentation/operators/retry.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/retry.png) */ example("retry") { let disposeBag = DisposeBag() var count = 1 let sequenceThatErrors = Observable.create { observer in observer.onNext("🍎") observer.onNext("🍐") observer.onNext("🍊") if count == 1 { observer.onError(TestError.test) print("Error encountered") count += 1 } observer.onNext("🐶") observer.onNext("🐱") observer.onNext("🐭") observer.onCompleted() return Disposables.create() } sequenceThatErrors .retry() .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `retry(_:)` Recovers repeatedly from Error events by resubscribing to the `Observable` sequence, up to `maxAttemptCount` number of retries. [More info](http://reactivex.io/documentation/operators/retry.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/retry.png) */ example("retry maxAttemptCount") { let disposeBag = DisposeBag() var count = 1 let sequenceThatErrors = Observable.create { observer in observer.onNext("🍎") observer.onNext("🍐") observer.onNext("🍊") if count < 5 { observer.onError(TestError.test) print("Error encountered") count += 1 } observer.onNext("🐶") observer.onNext("🐱") observer.onNext("🐭") observer.onCompleted() return Disposables.create() } sequenceThatErrors .retry(3) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Filtering_and_Conditional_Operators.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Filtering and Conditional Operators Operators that selectively emit elements from a source `Observable` sequence. ## `filter` Emits only those elements from an `Observable` sequence that meet the specified condition. [More info](http://reactivex.io/documentation/operators/filter.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/filter.png) */ example("filter") { let disposeBag = DisposeBag() Observable.of( "🐱", "🐰", "🐶", "🐸", "🐱", "🐰", "🐹", "🐸", "🐱" ) .filter { $0 == "🐱" } .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `distinctUntilChanged` Suppresses sequential duplicate elements emitted by an `Observable` sequence. [More info](http://reactivex.io/documentation/operators/distinct.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/distinct.png) */ example("distinctUntilChanged") { let disposeBag = DisposeBag() Observable.of("🐱", "🐷", "🐱", "🐱", "🐱", "🐵", "🐱") .distinctUntilChanged() .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `elementAt` Emits only the element at the specified index of all elements emitted by an `Observable` sequence. [More info](http://reactivex.io/documentation/operators/elementat.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/elementat.png) */ example("elementAt") { let disposeBag = DisposeBag() Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .element(at: 3) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `single` Emits only the first element (or the first element that meets a condition) emitted by an `Observable` sequence. Will throw an error if the `Observable` sequence does not emit exactly one element. */ example("single") { let disposeBag = DisposeBag() Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .single() .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } example("single with conditions") { let disposeBag = DisposeBag() Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .single { $0 == "🐸" } .subscribe { print($0) } .disposed(by: disposeBag) Observable.of("🐱", "🐰", "🐶", "🐱", "🐰", "🐶") .single { $0 == "🐰" } .subscribe { print($0) } .disposed(by: disposeBag) Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .single { $0 == "🔵" } .subscribe { print($0) } .disposed(by: disposeBag) } /*: ---- ## `take` Emits only the specified number of elements from the beginning of an `Observable` sequence. [More info](http://reactivex.io/documentation/operators/take.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/take.png) */ example("take") { let disposeBag = DisposeBag() Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .take(3) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `takeLast` Emits only the specified number of elements from the end of an `Observable` sequence. [More info](http://reactivex.io/documentation/operators/takelast.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/takelast.png) */ example("takeLast") { let disposeBag = DisposeBag() Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .takeLast(3) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `takeWhile` Emits elements from the beginning of an `Observable` sequence as long as the specified condition evaluates to `true`. [More info](http://reactivex.io/documentation/operators/takewhile.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/takewhile.png) */ example("takeWhile") { let disposeBag = DisposeBag() Observable.of(1, 2, 3, 4, 5, 6) .take(while: { $0 < 4 }) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `takeUntil` Emits elements from a source `Observable` sequence until a reference `Observable` sequence emits an element. [More info](http://reactivex.io/documentation/operators/takeuntil.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/takeuntil.png) */ example("takeUntil") { let disposeBag = DisposeBag() let sourceSequence = PublishSubject() let referenceSequence = PublishSubject() sourceSequence .take(until: referenceSequence) .subscribe { print($0) } .disposed(by: disposeBag) sourceSequence.onNext("🐱") sourceSequence.onNext("🐰") sourceSequence.onNext("🐶") referenceSequence.onNext("🔴") sourceSequence.onNext("🐸") sourceSequence.onNext("🐷") sourceSequence.onNext("🐵") } /*: ---- ## `skip` Suppresses emitting the specified number of elements from the beginning of an `Observable` sequence. [More info](http://reactivex.io/documentation/operators/skip.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/skip.png) */ example("skip") { let disposeBag = DisposeBag() Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .skip(2) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `skipWhile` Suppresses emitting the elements from the beginning of an `Observable` sequence that meet the specified condition. [More info](http://reactivex.io/documentation/operators/skipwhile.html) ![](http://reactivex.io/documentation/operators/images/skipWhile.c.png) */ example("skipWhile") { let disposeBag = DisposeBag() Observable.of(1, 2, 3, 4, 5, 6) .skip(while: { $0 < 4 }) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `skipWhileWithIndex` Suppresses emitting the elements from the beginning of an `Observable` sequence that meet the specified condition, and emits the remaining elements. The closure is also passed each element's index. */ example("skipWhileWithIndex") { let disposeBag = DisposeBag() Observable.of("🐱", "🐰", "🐶", "🐸", "🐷", "🐵") .enumerated() .skip(while: { $0.index < 3 }) .map(\.element) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `skipUntil` Suppresses emitting the elements from a source `Observable` sequence until a reference `Observable` sequence emits an element. [More info](http://reactivex.io/documentation/operators/skipuntil.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/skipuntil.png) */ example("skipUntil") { let disposeBag = DisposeBag() let sourceSequence = PublishSubject() let referenceSequence = PublishSubject() sourceSequence .skip(until: referenceSequence) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) sourceSequence.onNext("🐱") sourceSequence.onNext("🐰") sourceSequence.onNext("🐶") referenceSequence.onNext("🔴") sourceSequence.onNext("🐸") sourceSequence.onNext("🐷") sourceSequence.onNext("🐵") } //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) */ import RxSwift /*: # Introduction ## Why use RxSwift? A vast majority of the code we write involves responding to external events. When a user manipulates a control, we need to write an `@IBAction` handler to respond. We need to observe notifications to detect when the keyboard changes position. We must provide closures to execute when URL sessions respond with data. And we use KVO to detect changes to variables. All of these various systems makes our code needlessly complex. Wouldn't it be better if there was one consistent system that handled all of our call/response code? Rx is such a system. RxSwift is the official implementation of [Reactive Extensions](http://reactivex.io) (aka Rx), which exist for [most major languages and platforms](http://reactivex.io/languages.html). */ /*: ## Concepts **Every `Observable` instance is just a sequence.** The key advantage for an `Observable` sequence vs. Swift's `Sequence` is that it can also receive elements asynchronously. _This is the essence of RxSwift._ Everything else expands upon this concept. * An `Observable` (`ObservableType`) is equivalent to a `Sequence`. * The `ObservableType.subscribe(_:)` method is equivalent to `Sequence.makeIterator()`. * `ObservableType.subscribe(_:)` takes an observer (`ObserverType`) parameter, which will be subscribed to automatically receive sequence events and elements emitted by the `Observable`, instead of manually calling `next()` on the returned generator. */ /*: If an `Observable` emits a next event (`Event.next(Element)`), it can continue to emit more events. However, if the `Observable` emits either an error event (`Event.error(ErrorType)`) or a completed event (`Event.completed`), the `Observable` sequence cannot emit additional events to the subscriber. Sequence grammar explains this more concisely: `next* (error | completed)?` And this can also be explained more visually using diagrams: `--1--2--3--4--5--6--|----> // "|" = Terminates normally` `--a--b--c--d--e--f--X----> // "X" = Terminates with an error` `--tap--tap----------tap--> // "|" = Continues indefinitely, such as a sequence of button taps` > These diagrams are called marble diagrams. You can learn more about them at [RxMarbles.com](http://rxmarbles.com). */ /*: ### Observables and observers (aka subscribers) `Observable`s will not execute their subscription closure unless there is a subscriber. In the following example, the closure of the `Observable` will never be executed, because there are no subscribers: */ example("Observable with no subscribers") { _ = Observable.create { observerOfString -> Disposable in print("This will never be printed") observerOfString.on(.next("😬")) observerOfString.on(.completed) return Disposables.create() } } /*: ---- In the following example, the closure will be executed when `subscribe(_:)` is called: */ example("Observable with subscriber") { _ = Observable.create { observerOfString in print("Observable created") observerOfString.on(.next("😉")) observerOfString.on(.completed) return Disposables.create() } .subscribe { event in print(event) } } /*: > Don't concern yourself with the details of how these `Observable`s were created in these examples. We'll get into that [next](@next). # > `subscribe(_:)` returns a `Disposable` instance that represents a disposable resource such as a subscription. It was ignored in the previous simple example, but it should normally be properly handled. This usually means adding it to a `DisposeBag` instance. All examples going forward will include proper handling, because, well, practice makes _permanent_ 🙂. You can learn more about this in the [Disposing section](https://github.com/ReactiveX/RxSwift/blob/master/Documentation/GettingStarted.md#disposing) of the [Getting Started guide](https://github.com/ReactiveX/RxSwift/blob/master/Documentation/GettingStarted.md). */ //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Mathematical and Aggregate Operators Operators that operate on the entire sequence of items emitted by an `Observable`. ## `toArray` Converts an `Observable` sequence into an array, emits that array as a new single-element `Observable` sequence, and then terminates. [More info](http://reactivex.io/documentation/operators/to.html) ![](http://reactivex.io/documentation/operators/images/to.c.png) */ example("toArray") { let disposeBag = DisposeBag() Observable.range(start: 1, count: 10) .toArray() .subscribe { print($0) } .disposed(by: disposeBag) } /*: ---- ## `reduce` Begins with an initial seed value, and then applies an accumulator closure to all elements emitted by an `Observable` sequence, and returns the aggregate result as a single-element `Observable` sequence. [More info](http://reactivex.io/documentation/operators/reduce.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/reduce.png) */ example("reduce") { let disposeBag = DisposeBag() Observable.of(10, 100, 1000) .reduce(1, accumulator: +) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `concat` Joins elements from inner `Observable` sequences of an `Observable` sequence in a sequential manner, waiting for each sequence to terminate successfully before emitting elements from the next sequence. [More info](http://reactivex.io/documentation/operators/concat.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/concat.png) */ example("concat") { let disposeBag = DisposeBag() let subject1 = BehaviorSubject(value: "🍎") let subject2 = BehaviorSubject(value: "🐶") let subjectsSubject = BehaviorSubject(value: subject1) subjectsSubject.asObservable() .concat() .subscribe { print($0) } .disposed(by: disposeBag) subject1.onNext("🍐") subject1.onNext("🍊") subjectsSubject.onNext(subject2) subject2.onNext("I would be ignored") subject2.onNext("🐱") subject1.onCompleted() subject2.onNext("🐭") } //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/Table_of_Contents.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- ## Table of Contents: 1. [Introduction](Introduction) 1. [Creating and Subscribing to Observables](Creating_and_Subscribing_to_Observables) 1. [Working with Subjects](Working_with_Subjects) 1. [Combining Operators](Combining_Operators) 1. [Transforming Operators](Transforming_Operators) 1. [Filtering and Conditional Operators](Filtering_and_Conditional_Operators) 1. [Mathematical and Aggregate Operators](Mathematical_and_Aggregate_Operators) 1. [Connectable Operators](Connectable_Operators) 1. [Error Handling Operators](Error_Handling_Operators) 1. [Debugging Operators](Debugging_Operators) */ //: [Next](@next) ================================================ FILE: Rx.playground/Pages/Transforming_Operators.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Transforming Operators Operators that transform Next event elements emitted by an `Observable` sequence. ## `map` Applies a transforming closure to elements emitted by an `Observable` sequence, and returns a new `Observable` sequence of the transformed elements. [More info](http://reactivex.io/documentation/operators/map.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/map.png) */ example("map") { let disposeBag = DisposeBag() Observable.of(1, 2, 3) .map { $0 * $0 } .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } /*: ---- ## `flatMap` and `flatMapLatest` Transforms the elements emitted by an `Observable` sequence into `Observable` sequences, and merges the emissions from both `Observable` sequences into a single `Observable` sequence. This is also useful when, for example, when you have an `Observable` sequence that itself emits `Observable` sequences, and you want to be able to react to new emissions from either `Observable` sequence. The difference between `flatMap` and `flatMapLatest` is, `flatMapLatest` will only emit elements from the most recent inner `Observable` sequence. [More info](http://reactivex.io/documentation/operators/flatmap.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/flatmap.png) */ example("flatMap and flatMapLatest") { let disposeBag = DisposeBag() struct Player { init(score: Int) { self.score = BehaviorSubject(value: score) } let score: BehaviorSubject } let 👦🏻 = Player(score: 80) let 👧🏼 = Player(score: 90) let player = BehaviorSubject(value: 👦🏻) player.asObservable() .flatMap { $0.score.asObservable() } // Change flatMap to flatMapLatest and observe change in printed output .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) 👦🏻.score.onNext(85) player.onNext(👧🏼) 👦🏻.score.onNext(95) // Will be printed when using flatMap, but will not be printed when using flatMapLatest 👧🏼.score.onNext(100) } /*: > In this example, using `flatMap` may have unintended consequences. After assigning 👧🏼 to `player.value`, `👧🏼.score` will begin to emit elements, but the previous inner `Observable` sequence (`👦🏻.score`) will also still emit elements. By changing `flatMap` to `flatMapLatest`, only the most recent inner `Observable` sequence (`👧🏼.score`) will emit elements, i.e., setting `👦🏻.score.value` to `95` has no effect. # > `flatMapLatest` is actually a combination of the `map` and `switchLatest` operators. */ /*: ---- ## `scan` Begins with an initial seed value, and then applies an accumulator closure to each element emitted by an `Observable` sequence, and returns each intermediate result as a single-element `Observable` sequence. [More info](http://reactivex.io/documentation/operators/scan.html) ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/scan.png) */ example("scan") { let disposeBag = DisposeBag() Observable.of(10, 100, 1000) .scan(1) { aggregateValue, newValue in aggregateValue + newValue } .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) } //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Pages/TryYourself.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). */ import RxSwift /*: # Try Yourself It's time to play with Rx 🎉 */ playgroundShouldContinueIndefinitely() example("Try yourself") { // let disposeBag = DisposeBag() _ = Observable.just("Hello, RxSwift!") .debug("Observable") .subscribe() // .disposed(by: disposeBag) // If dispose bag is used instead, sequence will terminate on scope exit } ================================================ FILE: Rx.playground/Pages/Working_with_Subjects.xcplaygroundpage/Contents.swift ================================================ /*: > # IMPORTANT: To use **Rx.playground**: 1. Open **Rx.xcworkspace**. 1. Build the **RxExample-macOS** scheme (**Product** → **Build**). 1. Open **Rx** playground in the **Project navigator** (under RxExample project). 1. Show the Debug Area (**View** → **Debug Area** → **Show Debug Area**). ---- [Previous](@previous) - [Table of Contents](Table_of_Contents) */ import RxSwift /*: # Working with Subjects A Subject is a sort of bridge or proxy that is available in some implementations of Rx that acts as both an observer and `Observable`. Because it is an observer, it can subscribe to one or more `Observable`s, and because it is an `Observable`, it can pass through the items it observes by reemitting them, and it can also emit new items. [More info](http://reactivex.io/documentation/subject.html) */ extension ObservableType { /** Add observer with `id` and print each emitted event. - parameter id: an identifier for the subscription. */ func addObserver(_ id: String) -> Disposable { subscribe { print("Subscription:", id, "Event:", $0) } } } func writeSequenceToConsole(name: String, sequence: some ObservableType) -> Disposable { sequence.subscribe { event in print("Subscription: \(name), event: \(event)") } } /*: ## PublishSubject Broadcasts new events to all observers as of their time of the subscription. ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/publishsubject.png "PublishSubject") */ example("PublishSubject") { let disposeBag = DisposeBag() let subject = PublishSubject() subject.addObserver("1").disposed(by: disposeBag) subject.onNext("🐶") subject.onNext("🐱") subject.addObserver("2").disposed(by: disposeBag) subject.onNext("🅰️") subject.onNext("🅱️") } /*: > This example also introduces using the `onNext(_:)` convenience method, equivalent to `on(.next(_:)`, which causes a new Next event to be emitted to subscribers with the provided `element`. There are also `onError(_:)` and `onCompleted()` convenience methods, equivalent to `on(.error(_:))` and `on(.completed)`, respectively. ---- ## ReplaySubject Broadcasts new events to all subscribers, and the specified `bufferSize` number of previous events to new subscribers. ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/replaysubject.png) */ example("ReplaySubject") { let disposeBag = DisposeBag() let subject = ReplaySubject.create(bufferSize: 1) subject.addObserver("1").disposed(by: disposeBag) subject.onNext("🐶") subject.onNext("🐱") subject.addObserver("2").disposed(by: disposeBag) subject.onNext("🅰️") subject.onNext("🅱️") } /*: ---- ## BehaviorSubject Broadcasts new events to all subscribers, and the most recent (or initial) value to new subscribers. ![](https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/MarbleDiagrams/png/behaviorsubject.png) */ example("BehaviorSubject") { let disposeBag = DisposeBag() let subject = BehaviorSubject(value: "🔴") subject.addObserver("1").disposed(by: disposeBag) subject.onNext("🐶") subject.onNext("🐱") subject.addObserver("2").disposed(by: disposeBag) subject.onNext("🅰️") subject.onNext("🅱️") subject.addObserver("3").disposed(by: disposeBag) subject.onNext("🍐") subject.onNext("🍊") } /*: > Notice what's missing in these previous examples? A Completed event. `PublishSubject`, `ReplaySubject`, and `BehaviorSubject` do not automatically emit Completed events when they are about to be disposed of. */ //: [Next](@next) - [Table of Contents](Table_of_Contents) ================================================ FILE: Rx.playground/Sources/SupportCode.swift ================================================ import Dispatch /** Encloses each code example in its own scope. Prints a `description` header and then executes the `action` closure. - parameter description: example description - parameter action: `Void` closure */ public func example(_ description: String, action: () -> Void) { printExampleHeader(description) action() } public func printExampleHeader(_ description: String) { print("\n--- \(description) example ---") } public enum TestError: Swift.Error { case test } /** Executes `closure` on main thread after `delay` seconds. - parameter delay: time in seconds to wait before executing `closure` - parameter closure: `Void` closure */ public func delay(_ delay: Double, closure: @escaping () -> Void) { DispatchQueue.main.asyncAfter(deadline: .now() + delay) { closure() } } #if NOT_IN_PLAYGROUND public func playgroundShouldContinueIndefinitely() {} #else import PlaygroundSupport public func playgroundShouldContinueIndefinitely() { PlaygroundPage.current.needsIndefiniteExecution = true } #endif ================================================ FILE: Rx.playground/SupportCode.remap ================================================ [ ] ================================================ FILE: Rx.playground/contents.xcplayground ================================================ ================================================ FILE: Rx.playground/playground.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Rx.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 55; objects = { /* Begin PBXBuildFile section */ 033C2EF61D081C460050C015 /* UIScrollView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033C2EF41D081B2A0050C015 /* UIScrollView+RxTests.swift */; }; 0BA949671E224B7E0036DD06 /* AsyncSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BA949661E224B7E0036DD06 /* AsyncSubject.swift */; }; 0BA9496C1E224B9C0036DD06 /* AsyncSubjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BA9496B1E224B9C0036DD06 /* AsyncSubjectTests.swift */; }; 0BA9496D1E224B9C0036DD06 /* AsyncSubjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BA9496B1E224B9C0036DD06 /* AsyncSubjectTests.swift */; }; 0BA9496E1E224B9C0036DD06 /* AsyncSubjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BA9496B1E224B9C0036DD06 /* AsyncSubjectTests.swift */; }; 1AF67DA21CED420A00C310FA /* PublishSubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF67DA11CED420A00C310FA /* PublishSubjectTest.swift */; }; 1AF67DA31CED427D00C310FA /* PublishSubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF67DA11CED420A00C310FA /* PublishSubjectTest.swift */; }; 1AF67DA41CED427D00C310FA /* PublishSubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF67DA11CED420A00C310FA /* PublishSubjectTest.swift */; }; 1AF67DA61CED430100C310FA /* ReplaySubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF67DA51CED430100C310FA /* ReplaySubjectTest.swift */; }; 1AF67DA71CED430100C310FA /* ReplaySubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF67DA51CED430100C310FA /* ReplaySubjectTest.swift */; }; 1AF67DA81CED430100C310FA /* ReplaySubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF67DA51CED430100C310FA /* ReplaySubjectTest.swift */; }; 1D858B6629E57EE900CD6814 /* Infallible+CombineLatest+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D858B6529E57EE900CD6814 /* Infallible+CombineLatest+Collection.swift */; }; 1E3079AC21FB52330072A7E6 /* AtomicTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E3079AB21FB52330072A7E6 /* AtomicTests.swift */; }; 1E3079AD21FB52330072A7E6 /* AtomicTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E3079AB21FB52330072A7E6 /* AtomicTests.swift */; }; 1E3079AE21FB52330072A7E6 /* AtomicTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E3079AB21FB52330072A7E6 /* AtomicTests.swift */; }; 1E3EDF65226356A000B631B9 /* Date+Dispatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E3EDF64226356A000B631B9 /* Date+Dispatch.swift */; }; 1E9DA0C522006858000EB80A /* Synchronized.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E9DA0C422006858000EB80A /* Synchronized.swift */; }; 1E9DA0C622006858000EB80A /* Synchronized.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E9DA0C422006858000EB80A /* Synchronized.swift */; }; 1E9DA0C722006858000EB80A /* Synchronized.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E9DA0C422006858000EB80A /* Synchronized.swift */; }; 25F6ECBC1F48C366008552FA /* Maybe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25F6ECBB1F48C366008552FA /* Maybe.swift */; }; 25F6ECBE1F48C373008552FA /* Completable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25F6ECBD1F48C373008552FA /* Completable.swift */; }; 25F6ECC01F48C37C008552FA /* Single.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25F6ECBF1F48C37C008552FA /* Single.swift */; }; 271A97441CFC9F7B00D64125 /* UIViewController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271A97421CFC99FE00D64125 /* UIViewController+RxTests.swift */; }; 4583D8231FE94BBA00AA1BB1 /* Recorded+Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4583D8211FE94BB100AA1BB1 /* Recorded+Event.swift */; }; 4C5213AA225D41E60079FC77 /* CompactMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5213A9225D41E60079FC77 /* CompactMap.swift */; }; 4C5213AE225E224F0079FC77 /* Observable+CompactMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5213AB225E20350079FC77 /* Observable+CompactMapTests.swift */; }; 4C5213AF225E22500079FC77 /* Observable+CompactMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5213AB225E20350079FC77 /* Observable+CompactMapTests.swift */; }; 4C5213B0225E22510079FC77 /* Observable+CompactMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5213AB225E20350079FC77 /* Observable+CompactMapTests.swift */; }; 4C8DE0E220D54545003E2D8A /* DisposeBagTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8DE0E120D54545003E2D8A /* DisposeBagTest.swift */; }; 4C8DE0E320D54545003E2D8A /* DisposeBagTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8DE0E120D54545003E2D8A /* DisposeBagTest.swift */; }; 4C8DE0E420D54545003E2D8A /* DisposeBagTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8DE0E120D54545003E2D8A /* DisposeBagTest.swift */; }; 504540C924196D960098665F /* WKWebView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504540C824196D960098665F /* WKWebView+Rx.swift */; }; 504540CB24196EB10098665F /* WKWebView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504540CA24196EB10098665F /* WKWebView+RxTests.swift */; }; 504540CC24196EB10098665F /* WKWebView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504540CA24196EB10098665F /* WKWebView+RxTests.swift */; }; 504540D0241971E80098665F /* DelegateProxyTest+WebKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504540CF241971E70098665F /* DelegateProxyTest+WebKit.swift */; }; 504540D1241971E80098665F /* DelegateProxyTest+WebKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504540CF241971E70098665F /* DelegateProxyTest+WebKit.swift */; }; 54700CA01CE37E1800EF3A8F /* UINavigationItem+RxTests.swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54700C9E1CE37D1000EF3A8F /* UINavigationItem+RxTests.swift.swift */; }; 54700CA11CE37E1900EF3A8F /* UINavigationItem+RxTests.swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54700C9E1CE37D1000EF3A8F /* UINavigationItem+RxTests.swift.swift */; }; 601AE3DA1EE24E4F00617386 /* SwiftSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 601AE3D91EE24E4F00617386 /* SwiftSupport.swift */; }; 6A7D2CD423BBDBDC0038576E /* ReplayRelayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A7D2CD323BBDBDC0038576E /* ReplayRelayTests.swift */; }; 6A7D2CD523BBDBDC0038576E /* ReplayRelayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A7D2CD323BBDBDC0038576E /* ReplayRelayTests.swift */; }; 6A7D2CD623BBDBDC0038576E /* ReplayRelayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A7D2CD323BBDBDC0038576E /* ReplayRelayTests.swift */; }; 6A94254A23AFC2F300B7A24C /* ReplayRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A94254923AFC2F300B7A24C /* ReplayRelay.swift */; }; 78067D1125164938007CB7EE /* NSTextView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927A78C82117BCB400A45638 /* NSTextView+RxTests.swift */; }; 7846F56624F83AF400A39919 /* Infallible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7846F56524F83AF400A39919 /* Infallible.swift */; }; 786DED6324F83DE5008C4FAC /* ObservableConvertibleType+Infallible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786DED6224F83DE5008C4FAC /* ObservableConvertibleType+Infallible.swift */; }; 786DED6924F8415B008C4FAC /* Infallible+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786DED6824F8415B008C4FAC /* Infallible+Zip+arity.swift */; }; 786DED6C24F844BC008C4FAC /* Infallible+CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786DED6B24F844BC008C4FAC /* Infallible+CombineLatest+arity.swift */; }; 786DED6E24F84623008C4FAC /* Infallible+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786DED6D24F84623008C4FAC /* Infallible+Operators.swift */; }; 786DED7024F847BF008C4FAC /* Infallible+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786DED6F24F847BF008C4FAC /* Infallible+Create.swift */; }; 786DED7224F849F3008C4FAC /* Infallible+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 786DED7124F849F3008C4FAC /* Infallible+Bind.swift */; }; 788DCE5D24CB8249005B8F8C /* Decode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 788DCE5C24CB8249005B8F8C /* Decode.swift */; }; 788DCE5F24CB8512005B8F8C /* Observable+DecodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 788DCE5E24CB8512005B8F8C /* Observable+DecodeTests.swift */; }; 788DCE6024CB8512005B8F8C /* Observable+DecodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 788DCE5E24CB8512005B8F8C /* Observable+DecodeTests.swift */; }; 788DCE6124CB8512005B8F8C /* Observable+DecodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 788DCE5E24CB8512005B8F8C /* Observable+DecodeTests.swift */; }; 78B6157523B69F49009C2AD9 /* Binder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E65EFA1F6E91D1004478C3 /* Binder.swift */; }; 78B6157723B6A035009C2AD9 /* Binder+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78B6157623B6A035009C2AD9 /* Binder+Tests.swift */; }; 78C385CE25685076005E39B3 /* Infallible+BindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78C385CD25685076005E39B3 /* Infallible+BindTests.swift */; }; 78C385CF25685076005E39B3 /* Infallible+BindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78C385CD25685076005E39B3 /* Infallible+BindTests.swift */; }; 78C385EB256859DC005E39B3 /* Infallible+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78C385EA256859DC005E39B3 /* Infallible+Tests.swift */; }; 78C385EC256859DC005E39B3 /* Infallible+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78C385EA256859DC005E39B3 /* Infallible+Tests.swift */; }; 78F2D93E24C8D35700D13F0C /* RxWKNavigationDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504540CD2419701D0098665F /* RxWKNavigationDelegateProxy.swift */; }; 7EDBAEB41C89B1A6006CBE67 /* UITabBarItem+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */; }; 7EDBAEC31C89BCB9006CBE67 /* UITabBarItem+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */; }; 7F600F411C5D0C6E00535B1D /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */; }; 819C2F091F2FBC7F009104B6 /* First.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819C2F081F2FBC7F009104B6 /* First.swift */; }; 842A5A2C1C357F92003568D5 /* NSTextStorage+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */; }; 844BC8AC1CE4FA6300F5C7CB /* RxPickerViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BC8AA1CE4FA5600F5C7CB /* RxPickerViewDelegateProxy.swift */; }; 844BC8B41CE4FD7500F5C7CB /* UIPickerView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BC8B31CE4FD7500F5C7CB /* UIPickerView+Rx.swift */; }; 844BC8BB1CE5024500F5C7CB /* UIPickerView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BC8B71CE5023200F5C7CB /* UIPickerView+RxTests.swift */; }; 846436E31C9AF65B0035B40D /* RxSearchControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846436E11C9AF64C0035B40D /* RxSearchControllerDelegateProxy.swift */; }; 84C225A31C33F00B008724EC /* RxTextStorageDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C225A21C33F00B008724EC /* RxTextStorageDelegateProxy.swift */; }; 84E4D3921C9AFD3400ADFDC9 /* UISearchController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E4D3901C9AFCD500ADFDC9 /* UISearchController+Rx.swift */; }; 84E4D3961C9B011000ADFDC9 /* UISearchController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E4D3951C9B011000ADFDC9 /* UISearchController+RxTests.swift */; }; 88718CFE1CE5D80000D88D60 /* UITabBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88718CFD1CE5D80000D88D60 /* UITabBar+Rx.swift */; }; 88718D011CE5DE2600D88D60 /* UITabBar+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88718D001CE5DE2500D88D60 /* UITabBar+RxTests.swift */; }; 88718D021CE5DE2600D88D60 /* UITabBar+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88718D001CE5DE2500D88D60 /* UITabBar+RxTests.swift */; }; 88D98F2E1CE7549A00D50457 /* RxTabBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88D98F2D1CE7549A00D50457 /* RxTabBarDelegateProxy.swift */; }; 914FCD671CCDB82E0058B304 /* UIPageControl+RxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 914FCD661CCDB82E0058B304 /* UIPageControl+RxTest.swift */; }; 914FCD681CCDB82E0058B304 /* UIPageControl+RxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 914FCD661CCDB82E0058B304 /* UIPageControl+RxTest.swift */; }; 9BA1CBD31C0F7D550044B50A /* UIActivityIndicatorView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BA1CBD11C0F7C0A0044B50A /* UIActivityIndicatorView+Rx.swift */; }; A20CC6C9259F3FE700370AE3 /* WithUnretained.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20CC6C8259F3FE700370AE3 /* WithUnretained.swift */; }; A20CC6EA259F40A100370AE3 /* Observable+WithUnretainedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20CC6D4259F408100370AE3 /* Observable+WithUnretainedTests.swift */; }; A20CC6F5259F40A100370AE3 /* Observable+WithUnretainedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20CC6D4259F408100370AE3 /* Observable+WithUnretainedTests.swift */; }; A20CC6F6259F40A200370AE3 /* Observable+WithUnretainedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20CC6D4259F408100370AE3 /* Observable+WithUnretainedTests.swift */; }; A2690E7D22688CAE0032C00E /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C809396D1B8A71760088E94D /* RxCocoa.framework */; }; A2690E7E22688CAE0032C00E /* RxBlocking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8093BC71B8A71F00088E94D /* RxBlocking.framework */; }; A2690E7F22688CAE0032C00E /* RxTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C88FA50C1C25C44800CCFEA4 /* RxTest.framework */; }; A2690E8022688CAE0032C00E /* RxRelay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2897D53225CA1E7004EA481 /* RxRelay.framework */; }; A2690E8122688CB50032C00E /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8A56AD71AD7424700B4673B /* RxSwift.framework */; }; A2690E8222688CB50032C00E /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C809396D1B8A71760088E94D /* RxCocoa.framework */; }; A2690E8322688CB50032C00E /* RxBlocking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8093BC71B8A71F00088E94D /* RxBlocking.framework */; }; A2690E8422688CB50032C00E /* RxTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C88FA50C1C25C44800CCFEA4 /* RxTest.framework */; }; A2690E8522688CB50032C00E /* RxRelay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2897D53225CA1E7004EA481 /* RxRelay.framework */; }; A2690E8622688CB80032C00E /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8A56AD71AD7424700B4673B /* RxSwift.framework */; }; A2690E8722688CB80032C00E /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C809396D1B8A71760088E94D /* RxCocoa.framework */; }; A2690E8822688CB80032C00E /* RxBlocking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8093BC71B8A71F00088E94D /* RxBlocking.framework */; }; A2690E8922688CB80032C00E /* RxTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C88FA50C1C25C44800CCFEA4 /* RxTest.framework */; }; A2690E8A22688CB80032C00E /* RxRelay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2897D53225CA1E7004EA481 /* RxRelay.framework */; }; A2897D57225CA236004EA481 /* PublishRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B0F7101F530CA700548EBE /* PublishRelay.swift */; }; A2897D58225CA236004EA481 /* BehaviorRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C8BCCE1F8944B800501D4D /* BehaviorRelay.swift */; }; A2897D62225CA3F3004EA481 /* Observable+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2897D61225CA3F3004EA481 /* Observable+Bind.swift */; }; A2897D66225D0182004EA481 /* PublishRelay+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2897D65225D0182004EA481 /* PublishRelay+Signal.swift */; }; A2897D69225D023A004EA481 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2897D68225D023A004EA481 /* Utils.swift */; }; A2FD4E9D225D050A00288525 /* Observable+RelayBindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2FD4E9B225D04FF00288525 /* Observable+RelayBindTests.swift */; }; A2FD4E9E225D050B00288525 /* Observable+RelayBindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2FD4E9B225D04FF00288525 /* Observable+RelayBindTests.swift */; }; A2FD4E9F225D050B00288525 /* Observable+RelayBindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2FD4E9B225D04FF00288525 /* Observable+RelayBindTests.swift */; }; A520FFF71F0D258E00573734 /* RxPickerViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A520FFF61F0D258E00573734 /* RxPickerViewDataSourceType.swift */; }; A520FFFC1F0D291500573734 /* RxPickerViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = A520FFFB1F0D291500573734 /* RxPickerViewDataSourceProxy.swift */; }; A5CD038A1F1660F40005A376 /* RxPickerViewAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CD03891F1660F40005A376 /* RxPickerViewAdapter.swift */; }; B44D73EC1EE6D4A300EBFBE8 /* UIViewController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271A97421CFC99FE00D64125 /* UIViewController+RxTests.swift */; }; B562478F203515DD00D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */; }; B5624794203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */; }; C801DE361F6EAD3C008DB060 /* SingleTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE351F6EAD3C008DB060 /* SingleTest.swift */; }; C801DE371F6EAD3C008DB060 /* SingleTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE351F6EAD3C008DB060 /* SingleTest.swift */; }; C801DE381F6EAD3C008DB060 /* SingleTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE351F6EAD3C008DB060 /* SingleTest.swift */; }; C801DE3A1F6EAD48008DB060 /* MaybeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE391F6EAD48008DB060 /* MaybeTest.swift */; }; C801DE3B1F6EAD48008DB060 /* MaybeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE391F6EAD48008DB060 /* MaybeTest.swift */; }; C801DE3C1F6EAD48008DB060 /* MaybeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE391F6EAD48008DB060 /* MaybeTest.swift */; }; C801DE3E1F6EAD57008DB060 /* CompletableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE3D1F6EAD57008DB060 /* CompletableTest.swift */; }; C801DE3F1F6EAD57008DB060 /* CompletableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE3D1F6EAD57008DB060 /* CompletableTest.swift */; }; C801DE401F6EAD57008DB060 /* CompletableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE3D1F6EAD57008DB060 /* CompletableTest.swift */; }; C801DE451F6EBB32008DB060 /* ObservableType+PrimitiveSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE411F6EBB29008DB060 /* ObservableType+PrimitiveSequence.swift */; }; C801DE4A1F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE491F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift */; }; C801DE4B1F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE491F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift */; }; C801DE4C1F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE491F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift */; }; C8091C4E1FAA345C001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8091C4D1FAA345C001DB32A /* ObservableConvertibleType+SharedSequence.swift */; }; C8091C531FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8091C521FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift */; }; C8091C541FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8091C521FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift */; }; C8091C551FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8091C521FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift */; }; C8091C571FAA39C1001DB32A /* ControlEvent+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8091C561FAA39C1001DB32A /* ControlEvent+Signal.swift */; }; C8093CC51B8A72BE0088E94D /* Cancelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C491B8A72BE0088E94D /* Cancelable.swift */; }; C8093CC71B8A72BE0088E94D /* AsyncLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C4B1B8A72BE0088E94D /* AsyncLock.swift */; }; C8093CC91B8A72BE0088E94D /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C4C1B8A72BE0088E94D /* Lock.swift */; }; C8093CCB1B8A72BE0088E94D /* ConnectableObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C4D1B8A72BE0088E94D /* ConnectableObservableType.swift */; }; C8093CD31B8A72BE0088E94D /* Disposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C521B8A72BE0088E94D /* Disposable.swift */; }; C8093CD51B8A72BE0088E94D /* AnonymousDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C541B8A72BE0088E94D /* AnonymousDisposable.swift */; }; C8093CD71B8A72BE0088E94D /* BinaryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C551B8A72BE0088E94D /* BinaryDisposable.swift */; }; C8093CDB1B8A72BE0088E94D /* CompositeDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C571B8A72BE0088E94D /* CompositeDisposable.swift */; }; C8093CDD1B8A72BE0088E94D /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C581B8A72BE0088E94D /* DisposeBag.swift */; }; C8093CDF1B8A72BE0088E94D /* DisposeBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C591B8A72BE0088E94D /* DisposeBase.swift */; }; C8093CE51B8A72BE0088E94D /* NopDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */; }; C8093CE71B8A72BE0088E94D /* ScheduledDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5D1B8A72BE0088E94D /* ScheduledDisposable.swift */; }; C8093CEB1B8A72BE0088E94D /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C5F1B8A72BE0088E94D /* SerialDisposable.swift */; }; C8093CED1B8A72BE0088E94D /* SingleAssignmentDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C601B8A72BE0088E94D /* SingleAssignmentDisposable.swift */; }; C8093CF31B8A72BE0088E94D /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C631B8A72BE0088E94D /* Errors.swift */; }; C8093CF51B8A72BE0088E94D /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C641B8A72BE0088E94D /* Event.swift */; }; C8093CF71B8A72BE0088E94D /* ImmediateSchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */; }; C8093CFB1B8A72BE0088E94D /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */; }; C8093CFD1B8A72BE0088E94D /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C681B8A72BE0088E94D /* Observable.swift */; }; C8093D651B8A72BE0088E94D /* ObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093C9E1B8A72BE0088E94D /* ObservableType.swift */; }; C8093D691B8A72BE0088E94D /* AnyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CA01B8A72BE0088E94D /* AnyObserver.swift */; }; C8093D6B1B8A72BE0088E94D /* AnonymousObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CA21B8A72BE0088E94D /* AnonymousObserver.swift */; }; C8093D731B8A72BE0088E94D /* ObserverBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CA61B8A72BE0088E94D /* ObserverBase.swift */; }; C8093D791B8A72BE0088E94D /* TailRecursiveSink.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CA91B8A72BE0088E94D /* TailRecursiveSink.swift */; }; C8093D7D1B8A72BE0088E94D /* ObserverType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CAB1B8A72BE0088E94D /* ObserverType.swift */; }; C8093D851B8A72BE0088E94D /* Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CAF1B8A72BE0088E94D /* Rx.swift */; }; C8093D871B8A72BE0088E94D /* RxMutableBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */; }; C8093D8D1B8A72BE0088E94D /* SchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB31B8A72BE0088E94D /* SchedulerType.swift */; }; C8093D8F1B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB51B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift */; }; C8093D931B8A72BE0088E94D /* MainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB71B8A72BE0088E94D /* MainScheduler.swift */; }; C8093D951B8A72BE0088E94D /* OperationQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB81B8A72BE0088E94D /* OperationQueueScheduler.swift */; }; C8093D971B8A72BE0088E94D /* RecursiveScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB91B8A72BE0088E94D /* RecursiveScheduler.swift */; }; C8093D9B1B8A72BE0088E94D /* SchedulerServices+Emulation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CBB1B8A72BE0088E94D /* SchedulerServices+Emulation.swift */; }; C8093D9D1B8A72BE0088E94D /* SerialDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CBC1B8A72BE0088E94D /* SerialDispatchQueueScheduler.swift */; }; C8093D9F1B8A72BE0088E94D /* BehaviorSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CBE1B8A72BE0088E94D /* BehaviorSubject.swift */; }; C8093DA11B8A72BE0088E94D /* PublishSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CBF1B8A72BE0088E94D /* PublishSubject.swift */; }; C8093DA31B8A72BE0088E94D /* ReplaySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CC01B8A72BE0088E94D /* ReplaySubject.swift */; }; C8093DA51B8A72BE0088E94D /* SubjectType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CC11B8A72BE0088E94D /* SubjectType.swift */; }; C8093EE11B8A732E0088E94D /* DelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093E8B1B8A732E0088E94D /* DelegateProxy.swift */; }; C8093EE31B8A732E0088E94D /* DelegateProxyType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093E8C1B8A732E0088E94D /* DelegateProxyType.swift */; }; C8093EFD1B8A732E0088E94D /* RxTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093E9C1B8A732E0088E94D /* RxTarget.swift */; }; C8093F5E1B8A73A20088E94D /* ObservableConvertibleType+Blocking.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093F581B8A73A20088E94D /* ObservableConvertibleType+Blocking.swift */; }; C80D338F1B91EF9E0014629D /* Observable+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80D338E1B91EF9E0014629D /* Observable+Bind.swift */; }; C80EEC341D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */; }; C8165ACB21891BBF00494BEF /* AtomicInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8165ACA21891BBF00494BEF /* AtomicInt.swift */; }; C8165ACD21891BE400494BEF /* AtomicInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8165ACC21891BE400494BEF /* AtomicInt.swift */; }; C8165AD521891DBF00494BEF /* AtomicInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8165AD421891DBE00494BEF /* AtomicInt.swift */; }; C8165AD621891DBF00494BEF /* AtomicInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8165AD421891DBE00494BEF /* AtomicInt.swift */; }; C8165AD721891DBF00494BEF /* AtomicInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8165AD421891DBE00494BEF /* AtomicInt.swift */; }; C81A097D1E6C27A100900B3B /* Observable+ZipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81A097C1E6C27A100900B3B /* Observable+ZipTests.swift */; }; C81A097E1E6C27A100900B3B /* Observable+ZipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81A097C1E6C27A100900B3B /* Observable+ZipTests.swift */; }; C81A097F1E6C27A100900B3B /* Observable+ZipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81A097C1E6C27A100900B3B /* Observable+ZipTests.swift */; }; C81A09871E6C702700900B3B /* PrimitiveSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81A09861E6C702700900B3B /* PrimitiveSequence.swift */; }; C81B6AAA1DB2C15C0047CF86 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81B6AA81DB2C15C0047CF86 /* Platform.Darwin.swift */; }; C81B6AAB1DB2C15C0047CF86 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81B6AA81DB2C15C0047CF86 /* Platform.Darwin.swift */; }; C81B6AAC1DB2C15C0047CF86 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81B6AA81DB2C15C0047CF86 /* Platform.Darwin.swift */; }; C81B6AAD1DB2C15C0047CF86 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81B6AA91DB2C15C0047CF86 /* Platform.Linux.swift */; }; C81B6AAE1DB2C15C0047CF86 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81B6AA91DB2C15C0047CF86 /* Platform.Linux.swift */; }; C81B6AAF1DB2C15C0047CF86 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81B6AA91DB2C15C0047CF86 /* Platform.Linux.swift */; }; C820A82C1EB4DA5900D431BC /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7E61EB4DA5900D431BC /* Map.swift */; }; C820A8301EB4DA5900D431BC /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7E71EB4DA5900D431BC /* Switch.swift */; }; C820A8341EB4DA5900D431BC /* Delay.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7E81EB4DA5900D431BC /* Delay.swift */; }; C820A8381EB4DA5900D431BC /* Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7E91EB4DA5900D431BC /* Timeout.swift */; }; C820A83C1EB4DA5900D431BC /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7EA1EB4DA5900D431BC /* Window.swift */; }; C820A8401EB4DA5900D431BC /* Buffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7EB1EB4DA5900D431BC /* Buffer.swift */; }; C820A8441EB4DA5900D431BC /* DelaySubscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7EC1EB4DA5900D431BC /* DelaySubscription.swift */; }; C820A8481EB4DA5900D431BC /* Skip.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7ED1EB4DA5900D431BC /* Skip.swift */; }; C820A84C1EB4DA5900D431BC /* Take.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7EE1EB4DA5900D431BC /* Take.swift */; }; C820A8501EB4DA5900D431BC /* Timer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7EF1EB4DA5900D431BC /* Timer.swift */; }; C820A8541EB4DA5900D431BC /* Sample.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F01EB4DA5900D431BC /* Sample.swift */; }; C820A8581EB4DA5900D431BC /* Debounce.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F11EB4DA5900D431BC /* Debounce.swift */; }; C820A85C1EB4DA5A00D431BC /* Throttle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F21EB4DA5900D431BC /* Throttle.swift */; }; C820A8601EB4DA5A00D431BC /* Generate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F31EB4DA5900D431BC /* Generate.swift */; }; C820A8641EB4DA5A00D431BC /* GroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F41EB4DA5900D431BC /* GroupBy.swift */; }; C820A8681EB4DA5A00D431BC /* SingleAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F51EB4DA5900D431BC /* SingleAsync.swift */; }; C820A86C1EB4DA5A00D431BC /* ElementAt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F61EB4DA5900D431BC /* ElementAt.swift */; }; C820A8701EB4DA5A00D431BC /* Merge.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F71EB4DA5900D431BC /* Merge.swift */; }; C820A8741EB4DA5A00D431BC /* SkipWhile.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F81EB4DA5900D431BC /* SkipWhile.swift */; }; C820A8781EB4DA5A00D431BC /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7F91EB4DA5900D431BC /* TakeLast.swift */; }; C820A8801EB4DA5A00D431BC /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7FB1EB4DA5900D431BC /* Filter.swift */; }; C820A8841EB4DA5A00D431BC /* Dematerialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7FC1EB4DA5900D431BC /* Dematerialize.swift */; }; C820A8881EB4DA5A00D431BC /* Materialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7FD1EB4DA5900D431BC /* Materialize.swift */; }; C820A88C1EB4DA5A00D431BC /* DefaultIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7FE1EB4DA5900D431BC /* DefaultIfEmpty.swift */; }; C820A8901EB4DA5A00D431BC /* Scan.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A7FF1EB4DA5900D431BC /* Scan.swift */; }; C820A8941EB4DA5A00D431BC /* RetryWhen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8001EB4DA5900D431BC /* RetryWhen.swift */; }; C820A8981EB4DA5A00D431BC /* Catch.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8011EB4DA5900D431BC /* Catch.swift */; }; C820A89C1EB4DA5A00D431BC /* StartWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8021EB4DA5900D431BC /* StartWith.swift */; }; C820A8A01EB4DA5A00D431BC /* Do.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8031EB4DA5900D431BC /* Do.swift */; }; C820A8A41EB4DA5A00D431BC /* DistinctUntilChanged.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8041EB4DA5900D431BC /* DistinctUntilChanged.swift */; }; C820A8A81EB4DA5A00D431BC /* WithLatestFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8051EB4DA5900D431BC /* WithLatestFrom.swift */; }; C820A8AC1EB4DA5A00D431BC /* Amb.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8061EB4DA5900D431BC /* Amb.swift */; }; C820A8B01EB4DA5A00D431BC /* SkipUntil.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8071EB4DA5900D431BC /* SkipUntil.swift */; }; C820A8B41EB4DA5A00D431BC /* TakeWithPredicate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8081EB4DA5900D431BC /* TakeWithPredicate.swift */; }; C820A8B81EB4DA5A00D431BC /* Concat.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8091EB4DA5900D431BC /* Concat.swift */; }; C820A8BC1EB4DA5A00D431BC /* SwitchIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A80A1EB4DA5900D431BC /* SwitchIfEmpty.swift */; }; C820A8C01EB4DA5A00D431BC /* Zip+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A80B1EB4DA5900D431BC /* Zip+Collection.swift */; }; C820A8C41EB4DA5A00D431BC /* CombineLatest+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A80C1EB4DA5900D431BC /* CombineLatest+Collection.swift */; }; C820A8C81EB4DA5A00D431BC /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A80D1EB4DA5900D431BC /* Debug.swift */; }; C820A8CC1EB4DA5A00D431BC /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A80E1EB4DA5900D431BC /* Optional.swift */; }; C820A8D01EB4DA5A00D431BC /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A80F1EB4DA5900D431BC /* Sequence.swift */; }; C820A8D41EB4DA5A00D431BC /* Range.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8101EB4DA5900D431BC /* Range.swift */; }; C820A8D81EB4DA5A00D431BC /* Using.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8111EB4DA5900D431BC /* Using.swift */; }; C820A8DC1EB4DA5A00D431BC /* Repeat.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8121EB4DA5900D431BC /* Repeat.swift */; }; C820A8E01EB4DA5A00D431BC /* Deferred.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8131EB4DA5900D431BC /* Deferred.swift */; }; C820A8E41EB4DA5A00D431BC /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8141EB4DA5900D431BC /* Error.swift */; }; C820A8E81EB4DA5A00D431BC /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8151EB4DA5900D431BC /* Just.swift */; }; C820A8EC1EB4DA5A00D431BC /* Never.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8161EB4DA5900D431BC /* Never.swift */; }; C820A8F01EB4DA5A00D431BC /* Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8171EB4DA5900D431BC /* Empty.swift */; }; C820A8F41EB4DA5A00D431BC /* Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8181EB4DA5900D431BC /* Create.swift */; }; C820A8F81EB4DA5A00D431BC /* SubscribeOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8191EB4DA5900D431BC /* SubscribeOn.swift */; }; C820A8FC1EB4DA5A00D431BC /* ObserveOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A81A1EB4DA5900D431BC /* ObserveOn.swift */; }; C820A9081EB4DA5A00D431BC /* Multicast.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A81D1EB4DA5900D431BC /* Multicast.swift */; }; C820A9101EB4DA5A00D431BC /* Reduce.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A81F1EB4DA5900D431BC /* Reduce.swift */; }; C820A9141EB4DA5A00D431BC /* ToArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8201EB4DA5900D431BC /* ToArray.swift */; }; C820A9181EB4DA5A00D431BC /* AsMaybe.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8211EB4DA5900D431BC /* AsMaybe.swift */; }; C820A91C1EB4DA5A00D431BC /* AsSingle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8221EB4DA5900D431BC /* AsSingle.swift */; }; C820A9201EB4DA5A00D431BC /* AddRef.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8231EB4DA5900D431BC /* AddRef.swift */; }; C820A9241EB4DA5A00D431BC /* CombineLatest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8241EB4DA5900D431BC /* CombineLatest.swift */; }; C820A9281EB4DA5A00D431BC /* CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8251EB4DA5900D431BC /* CombineLatest+arity.swift */; }; C820A9301EB4DA5A00D431BC /* Producer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8271EB4DA5900D431BC /* Producer.swift */; }; C820A9341EB4DA5A00D431BC /* Sink.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8281EB4DA5900D431BC /* Sink.swift */; }; C820A9381EB4DA5A00D431BC /* Zip.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8291EB4DA5900D431BC /* Zip.swift */; }; C820A93C1EB4DA5A00D431BC /* Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A82A1EB4DA5900D431BC /* Zip+arity.swift */; }; C820A94A1EB4E75E00D431BC /* Observable+AmbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9491EB4E75E00D431BC /* Observable+AmbTests.swift */; }; C820A94B1EB4E75E00D431BC /* Observable+AmbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9491EB4E75E00D431BC /* Observable+AmbTests.swift */; }; C820A94C1EB4E75E00D431BC /* Observable+AmbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9491EB4E75E00D431BC /* Observable+AmbTests.swift */; }; C820A94E1EB4EC3C00D431BC /* Observable+ReduceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A94D1EB4EC3C00D431BC /* Observable+ReduceTests.swift */; }; C820A94F1EB4EC3C00D431BC /* Observable+ReduceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A94D1EB4EC3C00D431BC /* Observable+ReduceTests.swift */; }; C820A9501EB4EC3C00D431BC /* Observable+ReduceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A94D1EB4EC3C00D431BC /* Observable+ReduceTests.swift */; }; C820A9521EB4ECC000D431BC /* Observable+ToArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9511EB4ECC000D431BC /* Observable+ToArrayTests.swift */; }; C820A9531EB4ECC000D431BC /* Observable+ToArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9511EB4ECC000D431BC /* Observable+ToArrayTests.swift */; }; C820A9541EB4ECC000D431BC /* Observable+ToArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9511EB4ECC000D431BC /* Observable+ToArrayTests.swift */; }; C820A9561EB4ED7C00D431BC /* Observable+MulticastTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9551EB4ED7C00D431BC /* Observable+MulticastTests.swift */; }; C820A9571EB4ED7C00D431BC /* Observable+MulticastTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9551EB4ED7C00D431BC /* Observable+MulticastTests.swift */; }; C820A9581EB4ED7C00D431BC /* Observable+MulticastTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9551EB4ED7C00D431BC /* Observable+MulticastTests.swift */; }; C820A9621EB4EFD300D431BC /* Observable+ObserveOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9611EB4EFD300D431BC /* Observable+ObserveOnTests.swift */; }; C820A9631EB4EFD300D431BC /* Observable+ObserveOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9611EB4EFD300D431BC /* Observable+ObserveOnTests.swift */; }; C820A9641EB4EFD300D431BC /* Observable+ObserveOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9611EB4EFD300D431BC /* Observable+ObserveOnTests.swift */; }; C820A9661EB4F39500D431BC /* Observable+SubscribeOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9651EB4F39500D431BC /* Observable+SubscribeOnTests.swift */; }; C820A9671EB4F39500D431BC /* Observable+SubscribeOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9651EB4F39500D431BC /* Observable+SubscribeOnTests.swift */; }; C820A9681EB4F39500D431BC /* Observable+SubscribeOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9651EB4F39500D431BC /* Observable+SubscribeOnTests.swift */; }; C820A96A1EB4F64800D431BC /* Observable+JustTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9691EB4F64800D431BC /* Observable+JustTests.swift */; }; C820A96B1EB4F64800D431BC /* Observable+JustTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9691EB4F64800D431BC /* Observable+JustTests.swift */; }; C820A96C1EB4F64800D431BC /* Observable+JustTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9691EB4F64800D431BC /* Observable+JustTests.swift */; }; C820A96E1EB4F7AC00D431BC /* Observable+SequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A96D1EB4F7AC00D431BC /* Observable+SequenceTests.swift */; }; C820A96F1EB4F7AC00D431BC /* Observable+SequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A96D1EB4F7AC00D431BC /* Observable+SequenceTests.swift */; }; C820A9701EB4F7AC00D431BC /* Observable+SequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A96D1EB4F7AC00D431BC /* Observable+SequenceTests.swift */; }; C820A9721EB4F84000D431BC /* Observable+OptionalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9711EB4F84000D431BC /* Observable+OptionalTests.swift */; }; C820A9731EB4F84000D431BC /* Observable+OptionalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9711EB4F84000D431BC /* Observable+OptionalTests.swift */; }; C820A9741EB4F84000D431BC /* Observable+OptionalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9711EB4F84000D431BC /* Observable+OptionalTests.swift */; }; C820A9761EB4F92100D431BC /* Observable+GenerateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9751EB4F92100D431BC /* Observable+GenerateTests.swift */; }; C820A9771EB4F92100D431BC /* Observable+GenerateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9751EB4F92100D431BC /* Observable+GenerateTests.swift */; }; C820A9781EB4F92100D431BC /* Observable+GenerateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9751EB4F92100D431BC /* Observable+GenerateTests.swift */; }; C820A97A1EB4FA0800D431BC /* Observable+RangeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9791EB4FA0800D431BC /* Observable+RangeTests.swift */; }; C820A97B1EB4FA0800D431BC /* Observable+RangeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9791EB4FA0800D431BC /* Observable+RangeTests.swift */; }; C820A97C1EB4FA0800D431BC /* Observable+RangeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9791EB4FA0800D431BC /* Observable+RangeTests.swift */; }; C820A97E1EB4FA5A00D431BC /* Observable+RepeatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A97D1EB4FA5A00D431BC /* Observable+RepeatTests.swift */; }; C820A97F1EB4FA5A00D431BC /* Observable+RepeatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A97D1EB4FA5A00D431BC /* Observable+RepeatTests.swift */; }; C820A9801EB4FA5A00D431BC /* Observable+RepeatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A97D1EB4FA5A00D431BC /* Observable+RepeatTests.swift */; }; C820A9821EB4FB0400D431BC /* Observable+UsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9811EB4FB0400D431BC /* Observable+UsingTests.swift */; }; C820A9831EB4FB0400D431BC /* Observable+UsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9811EB4FB0400D431BC /* Observable+UsingTests.swift */; }; C820A9841EB4FB0400D431BC /* Observable+UsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9811EB4FB0400D431BC /* Observable+UsingTests.swift */; }; C820A9861EB4FB5B00D431BC /* Observable+DebugTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9851EB4FB5B00D431BC /* Observable+DebugTests.swift */; }; C820A9871EB4FB5B00D431BC /* Observable+DebugTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9851EB4FB5B00D431BC /* Observable+DebugTests.swift */; }; C820A9881EB4FB5B00D431BC /* Observable+DebugTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9851EB4FB5B00D431BC /* Observable+DebugTests.swift */; }; C820A98A1EB4FBD600D431BC /* Observable+CatchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9891EB4FBD600D431BC /* Observable+CatchTests.swift */; }; C820A98B1EB4FBD600D431BC /* Observable+CatchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9891EB4FBD600D431BC /* Observable+CatchTests.swift */; }; C820A98C1EB4FBD600D431BC /* Observable+CatchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9891EB4FBD600D431BC /* Observable+CatchTests.swift */; }; C820A98E1EB4FCC400D431BC /* Observable+SwitchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A98D1EB4FCC400D431BC /* Observable+SwitchTests.swift */; }; C820A98F1EB4FCC400D431BC /* Observable+SwitchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A98D1EB4FCC400D431BC /* Observable+SwitchTests.swift */; }; C820A9901EB4FCC400D431BC /* Observable+SwitchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A98D1EB4FCC400D431BC /* Observable+SwitchTests.swift */; }; C820A9921EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9911EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift */; }; C820A9931EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9911EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift */; }; C820A9941EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9911EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift */; }; C820A9961EB4FF7000D431BC /* Observable+ConcatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9951EB4FF7000D431BC /* Observable+ConcatTests.swift */; }; C820A9971EB4FF7000D431BC /* Observable+ConcatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9951EB4FF7000D431BC /* Observable+ConcatTests.swift */; }; C820A9981EB4FF7000D431BC /* Observable+ConcatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9951EB4FF7000D431BC /* Observable+ConcatTests.swift */; }; C820A99A1EB5001C00D431BC /* Observable+MergeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9991EB5001C00D431BC /* Observable+MergeTests.swift */; }; C820A99B1EB5001C00D431BC /* Observable+MergeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9991EB5001C00D431BC /* Observable+MergeTests.swift */; }; C820A99C1EB5001C00D431BC /* Observable+MergeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9991EB5001C00D431BC /* Observable+MergeTests.swift */; }; C820A9A21EB5011700D431BC /* Observable+TakeUntilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A11EB5011700D431BC /* Observable+TakeUntilTests.swift */; }; C820A9A31EB5011700D431BC /* Observable+TakeUntilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A11EB5011700D431BC /* Observable+TakeUntilTests.swift */; }; C820A9A41EB5011700D431BC /* Observable+TakeUntilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A11EB5011700D431BC /* Observable+TakeUntilTests.swift */; }; C820A9A61EB5056C00D431BC /* Observable+SkipUntilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A51EB5056C00D431BC /* Observable+SkipUntilTests.swift */; }; C820A9A71EB5056C00D431BC /* Observable+SkipUntilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A51EB5056C00D431BC /* Observable+SkipUntilTests.swift */; }; C820A9A81EB5056C00D431BC /* Observable+SkipUntilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A51EB5056C00D431BC /* Observable+SkipUntilTests.swift */; }; C820A9AA1EB505A800D431BC /* Observable+WithLatestFromTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A91EB505A800D431BC /* Observable+WithLatestFromTests.swift */; }; C820A9AB1EB505A800D431BC /* Observable+WithLatestFromTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A91EB505A800D431BC /* Observable+WithLatestFromTests.swift */; }; C820A9AC1EB505A800D431BC /* Observable+WithLatestFromTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9A91EB505A800D431BC /* Observable+WithLatestFromTests.swift */; }; C820A9AE1EB5073E00D431BC /* Observable+FilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9AD1EB5073E00D431BC /* Observable+FilterTests.swift */; }; C820A9AF1EB5073E00D431BC /* Observable+FilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9AD1EB5073E00D431BC /* Observable+FilterTests.swift */; }; C820A9B01EB5073E00D431BC /* Observable+FilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9AD1EB5073E00D431BC /* Observable+FilterTests.swift */; }; C820A9B21EB507D300D431BC /* Observable+TakeWhileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B11EB507D300D431BC /* Observable+TakeWhileTests.swift */; }; C820A9B31EB507D300D431BC /* Observable+TakeWhileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B11EB507D300D431BC /* Observable+TakeWhileTests.swift */; }; C820A9B41EB507D300D431BC /* Observable+TakeWhileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B11EB507D300D431BC /* Observable+TakeWhileTests.swift */; }; C820A9B61EB5081400D431BC /* Observable+MapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B51EB5081400D431BC /* Observable+MapTests.swift */; }; C820A9B71EB5081400D431BC /* Observable+MapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B51EB5081400D431BC /* Observable+MapTests.swift */; }; C820A9B81EB5081400D431BC /* Observable+MapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B51EB5081400D431BC /* Observable+MapTests.swift */; }; C820A9BA1EB5097700D431BC /* Observable+TakeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B91EB5097700D431BC /* Observable+TakeTests.swift */; }; C820A9BB1EB5097700D431BC /* Observable+TakeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B91EB5097700D431BC /* Observable+TakeTests.swift */; }; C820A9BC1EB5097700D431BC /* Observable+TakeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9B91EB5097700D431BC /* Observable+TakeTests.swift */; }; C820A9BE1EB509B500D431BC /* Observable+TakeLastTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9BD1EB509B500D431BC /* Observable+TakeLastTests.swift */; }; C820A9BF1EB509B500D431BC /* Observable+TakeLastTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9BD1EB509B500D431BC /* Observable+TakeLastTests.swift */; }; C820A9C01EB509B500D431BC /* Observable+TakeLastTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9BD1EB509B500D431BC /* Observable+TakeLastTests.swift */; }; C820A9C21EB509FC00D431BC /* Observable+SkipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C11EB509FC00D431BC /* Observable+SkipTests.swift */; }; C820A9C31EB509FC00D431BC /* Observable+SkipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C11EB509FC00D431BC /* Observable+SkipTests.swift */; }; C820A9C41EB509FC00D431BC /* Observable+SkipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C11EB509FC00D431BC /* Observable+SkipTests.swift */; }; C820A9C61EB50A4200D431BC /* Observable+SkipWhileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C51EB50A4200D431BC /* Observable+SkipWhileTests.swift */; }; C820A9C71EB50A4200D431BC /* Observable+SkipWhileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C51EB50A4200D431BC /* Observable+SkipWhileTests.swift */; }; C820A9C81EB50A4200D431BC /* Observable+SkipWhileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C51EB50A4200D431BC /* Observable+SkipWhileTests.swift */; }; C820A9CA1EB50A7100D431BC /* Observable+ElementAtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C91EB50A7100D431BC /* Observable+ElementAtTests.swift */; }; C820A9CB1EB50A7100D431BC /* Observable+ElementAtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C91EB50A7100D431BC /* Observable+ElementAtTests.swift */; }; C820A9CC1EB50A7100D431BC /* Observable+ElementAtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9C91EB50A7100D431BC /* Observable+ElementAtTests.swift */; }; C820A9CE1EB50AD400D431BC /* Observable+SingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9CD1EB50AD400D431BC /* Observable+SingleTests.swift */; }; C820A9CF1EB50AD400D431BC /* Observable+SingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9CD1EB50AD400D431BC /* Observable+SingleTests.swift */; }; C820A9D01EB50AD400D431BC /* Observable+SingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9CD1EB50AD400D431BC /* Observable+SingleTests.swift */; }; C820A9D21EB50B0900D431BC /* Observable+GroupByTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D11EB50B0900D431BC /* Observable+GroupByTests.swift */; }; C820A9D31EB50B0900D431BC /* Observable+GroupByTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D11EB50B0900D431BC /* Observable+GroupByTests.swift */; }; C820A9D41EB50B0900D431BC /* Observable+GroupByTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D11EB50B0900D431BC /* Observable+GroupByTests.swift */; }; C820A9D61EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D51EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift */; }; C820A9D71EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D51EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift */; }; C820A9D81EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D51EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift */; }; C820A9DA1EB50CAA00D431BC /* Observable+DoOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D91EB50CAA00D431BC /* Observable+DoOnTests.swift */; }; C820A9DB1EB50CAA00D431BC /* Observable+DoOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D91EB50CAA00D431BC /* Observable+DoOnTests.swift */; }; C820A9DC1EB50CAA00D431BC /* Observable+DoOnTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9D91EB50CAA00D431BC /* Observable+DoOnTests.swift */; }; C820A9DE1EB50CF800D431BC /* Observable+ThrottleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9DD1EB50CF800D431BC /* Observable+ThrottleTests.swift */; }; C820A9DF1EB50CF800D431BC /* Observable+ThrottleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9DD1EB50CF800D431BC /* Observable+ThrottleTests.swift */; }; C820A9E01EB50CF800D431BC /* Observable+ThrottleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9DD1EB50CF800D431BC /* Observable+ThrottleTests.swift */; }; C820A9E21EB50D6C00D431BC /* Observable+SampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E11EB50D6C00D431BC /* Observable+SampleTests.swift */; }; C820A9E31EB50D6C00D431BC /* Observable+SampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E11EB50D6C00D431BC /* Observable+SampleTests.swift */; }; C820A9E41EB50D6C00D431BC /* Observable+SampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E11EB50D6C00D431BC /* Observable+SampleTests.swift */; }; C820A9E61EB50DB900D431BC /* Observable+TimerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E51EB50DB900D431BC /* Observable+TimerTests.swift */; }; C820A9E71EB50DB900D431BC /* Observable+TimerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E51EB50DB900D431BC /* Observable+TimerTests.swift */; }; C820A9E81EB50DB900D431BC /* Observable+TimerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E51EB50DB900D431BC /* Observable+TimerTests.swift */; }; C820A9EA1EB50E3400D431BC /* Observable+RetryWhenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E91EB50E3400D431BC /* Observable+RetryWhenTests.swift */; }; C820A9EB1EB50E3400D431BC /* Observable+RetryWhenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E91EB50E3400D431BC /* Observable+RetryWhenTests.swift */; }; C820A9EC1EB50E3400D431BC /* Observable+RetryWhenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9E91EB50E3400D431BC /* Observable+RetryWhenTests.swift */; }; C820A9EE1EB50EA100D431BC /* Observable+ScanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9ED1EB50EA100D431BC /* Observable+ScanTests.swift */; }; C820A9EF1EB50EA100D431BC /* Observable+ScanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9ED1EB50EA100D431BC /* Observable+ScanTests.swift */; }; C820A9F01EB50EA100D431BC /* Observable+ScanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9ED1EB50EA100D431BC /* Observable+ScanTests.swift */; }; C820A9F21EB5109300D431BC /* Observable+DefaultIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9F11EB5109300D431BC /* Observable+DefaultIfEmpty.swift */; }; C820A9F31EB5109300D431BC /* Observable+DefaultIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9F11EB5109300D431BC /* Observable+DefaultIfEmpty.swift */; }; C820A9F41EB5109300D431BC /* Observable+DefaultIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9F11EB5109300D431BC /* Observable+DefaultIfEmpty.swift */; }; C820A9FA1EB510D500D431BC /* Observable+MaterializeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9F91EB510D500D431BC /* Observable+MaterializeTests.swift */; }; C820A9FB1EB510D500D431BC /* Observable+MaterializeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9F91EB510D500D431BC /* Observable+MaterializeTests.swift */; }; C820A9FC1EB510D500D431BC /* Observable+MaterializeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9F91EB510D500D431BC /* Observable+MaterializeTests.swift */; }; C820A9FE1EB5110E00D431BC /* Observable+DematerializeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9FD1EB5110E00D431BC /* Observable+DematerializeTests.swift */; }; C820A9FF1EB5110E00D431BC /* Observable+DematerializeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9FD1EB5110E00D431BC /* Observable+DematerializeTests.swift */; }; C820AA001EB5110E00D431BC /* Observable+DematerializeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9FD1EB5110E00D431BC /* Observable+DematerializeTests.swift */; }; C820AA021EB5134000D431BC /* Observable+DelaySubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA011EB5134000D431BC /* Observable+DelaySubscriptionTests.swift */; }; C820AA031EB5134000D431BC /* Observable+DelaySubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA011EB5134000D431BC /* Observable+DelaySubscriptionTests.swift */; }; C820AA041EB5134000D431BC /* Observable+DelaySubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA011EB5134000D431BC /* Observable+DelaySubscriptionTests.swift */; }; C820AA061EB5139C00D431BC /* Observable+BufferTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA051EB5139C00D431BC /* Observable+BufferTests.swift */; }; C820AA071EB5139C00D431BC /* Observable+BufferTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA051EB5139C00D431BC /* Observable+BufferTests.swift */; }; C820AA081EB5139C00D431BC /* Observable+BufferTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA051EB5139C00D431BC /* Observable+BufferTests.swift */; }; C820AA0A1EB513C800D431BC /* Observable+WindowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA091EB513C800D431BC /* Observable+WindowTests.swift */; }; C820AA0B1EB513C800D431BC /* Observable+WindowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA091EB513C800D431BC /* Observable+WindowTests.swift */; }; C820AA0C1EB513C800D431BC /* Observable+WindowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA091EB513C800D431BC /* Observable+WindowTests.swift */; }; C820AA0E1EB5140100D431BC /* Observable+TimeoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA0D1EB5140100D431BC /* Observable+TimeoutTests.swift */; }; C820AA0F1EB5140100D431BC /* Observable+TimeoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA0D1EB5140100D431BC /* Observable+TimeoutTests.swift */; }; C820AA101EB5140100D431BC /* Observable+TimeoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA0D1EB5140100D431BC /* Observable+TimeoutTests.swift */; }; C820AA121EB5145200D431BC /* Observable+DelayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA111EB5145200D431BC /* Observable+DelayTests.swift */; }; C820AA131EB5145200D431BC /* Observable+DelayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA111EB5145200D431BC /* Observable+DelayTests.swift */; }; C820AA141EB5145200D431BC /* Observable+DelayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820AA111EB5145200D431BC /* Observable+DelayTests.swift */; }; C822BACA1DB4058000F98810 /* Event+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822BAC51DB4048F00F98810 /* Event+Test.swift */; }; C822BACB1DB4058000F98810 /* Event+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822BAC51DB4048F00F98810 /* Event+Test.swift */; }; C822BACC1DB4058100F98810 /* Event+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822BAC51DB4048F00F98810 /* Event+Test.swift */; }; C822BACE1DB424EC00F98810 /* Reactive+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822BACD1DB424EC00F98810 /* Reactive+Tests.swift */; }; C822BACF1DB424EC00F98810 /* Reactive+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822BACD1DB424EC00F98810 /* Reactive+Tests.swift */; }; C822BAD01DB424EC00F98810 /* Reactive+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822BACD1DB424EC00F98810 /* Reactive+Tests.swift */; }; C82A336B1E2C3343003A6044 /* PerformanceTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E8BA701E2C18AE00A4AC2C /* PerformanceTools.swift */; }; C82A336D1E2C3344003A6044 /* PerformanceTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E8BA701E2C18AE00A4AC2C /* PerformanceTools.swift */; }; C82FF0EF1F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF0EE1F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift */; }; C82FF0F01F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF0EE1F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift */; }; C82FF0F11F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF0EE1F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift */; }; C8323A8E1E33FD5200CC0C7F /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8323A8D1E33FD5200CC0C7F /* Resources.swift */; }; C8323A8F1E33FD5200CC0C7F /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8323A8D1E33FD5200CC0C7F /* Resources.swift */; }; C8323A901E33FD5200CC0C7F /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8323A8D1E33FD5200CC0C7F /* Resources.swift */; }; C834F6C21DB394E100C29244 /* Observable+BlockingTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C834F6C11DB394E100C29244 /* Observable+BlockingTest.swift */; }; C834F6C31DB394E100C29244 /* Observable+BlockingTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C834F6C11DB394E100C29244 /* Observable+BlockingTest.swift */; }; C834F6C41DB394E100C29244 /* Observable+BlockingTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C834F6C11DB394E100C29244 /* Observable+BlockingTest.swift */; }; C834F6C61DB3950600C29244 /* NSControl+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C834F6C51DB3950600C29244 /* NSControl+RxTests.swift */; }; C83508C81C386F6F0027C24C /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8A56AD71AD7424700B4673B /* RxSwift.framework */; }; C835092E1C38706E0027C24C /* ControlEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508DD1C38706D0027C24C /* ControlEventTests.swift */; }; C835092F1C38706E0027C24C /* ControlPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508DE1C38706D0027C24C /* ControlPropertyTests.swift */; }; C83509311C38706E0027C24C /* DelegateProxyTest+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E01C38706D0027C24C /* DelegateProxyTest+UIKit.swift */; }; C83509321C38706E0027C24C /* DelegateProxyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E11C38706D0027C24C /* DelegateProxyTest.swift */; }; C83509351C38706E0027C24C /* KVOObservableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E41C38706D0027C24C /* KVOObservableTests.swift */; }; C83509361C38706E0027C24C /* NSLayoutConstraint+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E51C38706D0027C24C /* NSLayoutConstraint+RxTests.swift */; }; C83509371C38706E0027C24C /* NotificationCenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E61C38706D0027C24C /* NotificationCenterTests.swift */; }; C83509381C38706E0027C24C /* NSObject+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E71C38706D0027C24C /* NSObject+RxTests.swift */; }; C835093A1C38706E0027C24C /* RuntimeStateSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E91C38706D0027C24C /* RuntimeStateSnapshot.swift */; }; C835093B1C38706E0027C24C /* RXObjCRuntime+Testing.m in Sources */ = {isa = PBXBuildFile; fileRef = C83508EB1C38706D0027C24C /* RXObjCRuntime+Testing.m */; }; C835093C1C38706E0027C24C /* RxObjCRuntimeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508EC1C38706D0027C24C /* RxObjCRuntimeState.swift */; }; C835093D1C38706E0027C24C /* SentMessageTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F01C38706D0027C24C /* SentMessageTest.swift */; }; C835093E1C38706E0027C24C /* UIView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F11C38706D0027C24C /* UIView+RxTests.swift */; }; C835093F1C38706E0027C24C /* ElementIndexPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F41C38706D0027C24C /* ElementIndexPair.swift */; }; C83509401C38706E0027C24C /* EquatableArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F51C38706D0027C24C /* EquatableArray.swift */; }; C83509411C38706E0027C24C /* BackgroundThreadPrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F71C38706D0027C24C /* BackgroundThreadPrimitiveHotObservable.swift */; }; C83509421C38706E0027C24C /* MainThreadPrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F81C38706D0027C24C /* MainThreadPrimitiveHotObservable.swift */; }; C83509431C38706E0027C24C /* MockDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F91C38706D0027C24C /* MockDisposable.swift */; }; C83509441C38706E0027C24C /* MySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FA1C38706D0027C24C /* MySubject.swift */; }; C83509451C38706E0027C24C /* Observable.Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FB1C38706D0027C24C /* Observable.Extensions.swift */; }; C83509461C38706E0027C24C /* PrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FC1C38706D0027C24C /* PrimitiveHotObservable.swift */; }; C83509471C38706E0027C24C /* PrimitiveMockObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FD1C38706D0027C24C /* PrimitiveMockObserver.swift */; }; C83509481C38706E0027C24C /* TestConnectableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FE1C38706D0027C24C /* TestConnectableObservable.swift */; }; C83509491C38706E0027C24C /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FF1C38706D0027C24C /* Observable+Extensions.swift */; }; C835094A1C38706E0027C24C /* TestVirtualScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509001C38706D0027C24C /* TestVirtualScheduler.swift */; }; C835094B1C38706E0027C24C /* Observable+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509021C38706D0027C24C /* Observable+Tests.swift */; }; C835094C1C38706E0027C24C /* AssumptionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509031C38706D0027C24C /* AssumptionsTest.swift */; }; C835094D1C38706E0027C24C /* BagTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509041C38706D0027C24C /* BagTest.swift */; }; C835094E1C38706E0027C24C /* BehaviorSubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509051C38706D0027C24C /* BehaviorSubjectTest.swift */; }; C835094F1C38706E0027C24C /* CurrentThreadSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509061C38706D0027C24C /* CurrentThreadSchedulerTest.swift */; }; C83509501C38706E0027C24C /* DisposableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509071C38706D0027C24C /* DisposableTest.swift */; }; C83509511C38706E0027C24C /* HistoricalSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509081C38706D0027C24C /* HistoricalSchedulerTest.swift */; }; C83509521C38706E0027C24C /* MainSchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509091C38706D0027C24C /* MainSchedulerTests.swift */; }; C83509581C38706E0027C24C /* Observable+CombineLatestTests+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835090F1C38706D0027C24C /* Observable+CombineLatestTests+arity.swift */; }; C835095A1C38706E0027C24C /* Observable+ZipTests+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509111C38706D0027C24C /* Observable+ZipTests+arity.swift */; }; C835095F1C38706E0027C24C /* Observable+SubscriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509161C38706D0027C24C /* Observable+SubscriptionTest.swift */; }; C83509611C38706E0027C24C /* ObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509181C38706D0027C24C /* ObserverTests.swift */; }; C83509621C38706E0027C24C /* QueueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509191C38706D0027C24C /* QueueTests.swift */; }; C83509631C38706E0027C24C /* SubjectConcurrencyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835091A1C38706D0027C24C /* SubjectConcurrencyTest.swift */; }; C83509651C38706E0027C24C /* VirtualSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835091C1C38706D0027C24C /* VirtualSchedulerTest.swift */; }; C835097E1C38726E0027C24C /* RxMutableBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */; }; C83509B81C38750D0027C24C /* ControlEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508DD1C38706D0027C24C /* ControlEventTests.swift */; }; C83509B91C38750D0027C24C /* ControlPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508DE1C38706D0027C24C /* ControlPropertyTests.swift */; }; C83509BC1C38750D0027C24C /* ControlEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508DD1C38706D0027C24C /* ControlEventTests.swift */; }; C83509BD1C38750D0027C24C /* ControlPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508DE1C38706D0027C24C /* ControlPropertyTests.swift */; }; C83509BE1C3875100027C24C /* DelegateProxyTest+Cocoa.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508DF1C38706D0027C24C /* DelegateProxyTest+Cocoa.swift */; }; C83509BF1C3875220027C24C /* DelegateProxyTest+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E01C38706D0027C24C /* DelegateProxyTest+UIKit.swift */; }; C83509C01C3875220027C24C /* DelegateProxyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E11C38706D0027C24C /* DelegateProxyTest.swift */; }; C83509C31C3875220027C24C /* KVOObservableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E41C38706D0027C24C /* KVOObservableTests.swift */; }; C83509C41C3875220027C24C /* NSLayoutConstraint+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E51C38706D0027C24C /* NSLayoutConstraint+RxTests.swift */; }; C83509C51C3875220027C24C /* NotificationCenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E61C38706D0027C24C /* NotificationCenterTests.swift */; }; C83509C61C3875220027C24C /* NSObject+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E71C38706D0027C24C /* NSObject+RxTests.swift */; }; C83509C81C3875230027C24C /* DelegateProxyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E11C38706D0027C24C /* DelegateProxyTest.swift */; }; C83509CB1C3875230027C24C /* KVOObservableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E41C38706D0027C24C /* KVOObservableTests.swift */; }; C83509CC1C3875230027C24C /* NSLayoutConstraint+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E51C38706D0027C24C /* NSLayoutConstraint+RxTests.swift */; }; C83509CD1C3875230027C24C /* NotificationCenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E61C38706D0027C24C /* NotificationCenterTests.swift */; }; C83509CE1C3875230027C24C /* NSObject+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E71C38706D0027C24C /* NSObject+RxTests.swift */; }; C83509CF1C3875260027C24C /* NSView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E81C38706D0027C24C /* NSView+RxTests.swift */; }; C83509D01C38752E0027C24C /* RuntimeStateSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E91C38706D0027C24C /* RuntimeStateSnapshot.swift */; }; C83509D11C38752E0027C24C /* RuntimeStateSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508E91C38706D0027C24C /* RuntimeStateSnapshot.swift */; }; C83509D21C3875380027C24C /* RXObjCRuntime+Testing.m in Sources */ = {isa = PBXBuildFile; fileRef = C83508EB1C38706D0027C24C /* RXObjCRuntime+Testing.m */; }; C83509D31C3875390027C24C /* RXObjCRuntime+Testing.m in Sources */ = {isa = PBXBuildFile; fileRef = C83508EB1C38706D0027C24C /* RXObjCRuntime+Testing.m */; }; C83509D41C38753C0027C24C /* RxObjCRuntimeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508EC1C38706D0027C24C /* RxObjCRuntimeState.swift */; }; C83509D51C38753E0027C24C /* RxObjCRuntimeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508EC1C38706D0027C24C /* RxObjCRuntimeState.swift */; }; C83509D61C3875420027C24C /* SentMessageTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F01C38706D0027C24C /* SentMessageTest.swift */; }; C83509D81C3875420027C24C /* SentMessageTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F01C38706D0027C24C /* SentMessageTest.swift */; }; C83509DA1C38754C0027C24C /* ElementIndexPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F41C38706D0027C24C /* ElementIndexPair.swift */; }; C83509DB1C38754C0027C24C /* EquatableArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F51C38706D0027C24C /* EquatableArray.swift */; }; C83509DC1C38754C0027C24C /* ElementIndexPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F41C38706D0027C24C /* ElementIndexPair.swift */; }; C83509DD1C38754C0027C24C /* EquatableArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F51C38706D0027C24C /* EquatableArray.swift */; }; C83509DE1C38754F0027C24C /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FF1C38706D0027C24C /* Observable+Extensions.swift */; }; C83509DF1C38754F0027C24C /* TestVirtualScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509001C38706D0027C24C /* TestVirtualScheduler.swift */; }; C83509E01C3875500027C24C /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FF1C38706D0027C24C /* Observable+Extensions.swift */; }; C83509E11C3875500027C24C /* TestVirtualScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509001C38706D0027C24C /* TestVirtualScheduler.swift */; }; C83509E21C3875580027C24C /* BackgroundThreadPrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F71C38706D0027C24C /* BackgroundThreadPrimitiveHotObservable.swift */; }; C83509E31C3875580027C24C /* MainThreadPrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F81C38706D0027C24C /* MainThreadPrimitiveHotObservable.swift */; }; C83509E41C3875580027C24C /* MockDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F91C38706D0027C24C /* MockDisposable.swift */; }; C83509E51C3875580027C24C /* MySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FA1C38706D0027C24C /* MySubject.swift */; }; C83509E61C3875580027C24C /* Observable.Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FB1C38706D0027C24C /* Observable.Extensions.swift */; }; C83509E71C3875580027C24C /* PrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FC1C38706D0027C24C /* PrimitiveHotObservable.swift */; }; C83509E81C3875580027C24C /* PrimitiveMockObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FD1C38706D0027C24C /* PrimitiveMockObserver.swift */; }; C83509E91C3875580027C24C /* TestConnectableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FE1C38706D0027C24C /* TestConnectableObservable.swift */; }; C83509EA1C3875580027C24C /* BackgroundThreadPrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F71C38706D0027C24C /* BackgroundThreadPrimitiveHotObservable.swift */; }; C83509EB1C3875580027C24C /* MainThreadPrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F81C38706D0027C24C /* MainThreadPrimitiveHotObservable.swift */; }; C83509EC1C3875580027C24C /* MockDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F91C38706D0027C24C /* MockDisposable.swift */; }; C83509ED1C3875580027C24C /* MySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FA1C38706D0027C24C /* MySubject.swift */; }; C83509EE1C3875580027C24C /* Observable.Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FB1C38706D0027C24C /* Observable.Extensions.swift */; }; C83509EF1C3875580027C24C /* PrimitiveHotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FC1C38706D0027C24C /* PrimitiveHotObservable.swift */; }; C83509F01C3875580027C24C /* PrimitiveMockObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FD1C38706D0027C24C /* PrimitiveMockObserver.swift */; }; C83509F11C3875580027C24C /* TestConnectableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508FE1C38706D0027C24C /* TestConnectableObservable.swift */; }; C83509F21C38755D0027C24C /* Observable+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509021C38706D0027C24C /* Observable+Tests.swift */; }; C83509F31C38755D0027C24C /* AssumptionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509031C38706D0027C24C /* AssumptionsTest.swift */; }; C83509F41C38755D0027C24C /* BagTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509041C38706D0027C24C /* BagTest.swift */; }; C83509F51C38755D0027C24C /* BehaviorSubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509051C38706D0027C24C /* BehaviorSubjectTest.swift */; }; C83509F61C38755D0027C24C /* CurrentThreadSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509061C38706D0027C24C /* CurrentThreadSchedulerTest.swift */; }; C83509F71C38755D0027C24C /* DisposableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509071C38706D0027C24C /* DisposableTest.swift */; }; C83509F81C38755D0027C24C /* HistoricalSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509081C38706D0027C24C /* HistoricalSchedulerTest.swift */; }; C83509F91C38755D0027C24C /* MainSchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509091C38706D0027C24C /* MainSchedulerTests.swift */; }; C83509FF1C38755D0027C24C /* Observable+CombineLatestTests+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835090F1C38706D0027C24C /* Observable+CombineLatestTests+arity.swift */; }; C8350A001C38755E0027C24C /* Observable+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509021C38706D0027C24C /* Observable+Tests.swift */; }; C8350A011C38755E0027C24C /* AssumptionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509031C38706D0027C24C /* AssumptionsTest.swift */; }; C8350A021C38755E0027C24C /* BagTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509041C38706D0027C24C /* BagTest.swift */; }; C8350A031C38755E0027C24C /* BehaviorSubjectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509051C38706D0027C24C /* BehaviorSubjectTest.swift */; }; C8350A041C38755E0027C24C /* CurrentThreadSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509061C38706D0027C24C /* CurrentThreadSchedulerTest.swift */; }; C8350A051C38755E0027C24C /* DisposableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509071C38706D0027C24C /* DisposableTest.swift */; }; C8350A061C38755E0027C24C /* HistoricalSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509081C38706D0027C24C /* HistoricalSchedulerTest.swift */; }; C8350A071C38755E0027C24C /* MainSchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509091C38706D0027C24C /* MainSchedulerTests.swift */; }; C8350A0D1C38755E0027C24C /* Observable+CombineLatestTests+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835090F1C38706D0027C24C /* Observable+CombineLatestTests+arity.swift */; }; C8350A0E1C3875630027C24C /* Observable+ZipTests+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509111C38706D0027C24C /* Observable+ZipTests+arity.swift */; }; C8350A0F1C3875630027C24C /* Observable+ZipTests+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509111C38706D0027C24C /* Observable+ZipTests+arity.swift */; }; C8350A131C38756A0027C24C /* Observable+SubscriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509161C38706D0027C24C /* Observable+SubscriptionTest.swift */; }; C8350A151C38756A0027C24C /* ObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509181C38706D0027C24C /* ObserverTests.swift */; }; C8350A161C38756A0027C24C /* QueueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509191C38706D0027C24C /* QueueTests.swift */; }; C8350A171C38756A0027C24C /* SubjectConcurrencyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835091A1C38706D0027C24C /* SubjectConcurrencyTest.swift */; }; C8350A191C38756A0027C24C /* VirtualSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835091C1C38706D0027C24C /* VirtualSchedulerTest.swift */; }; C8350A1D1C38756B0027C24C /* Observable+SubscriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509161C38706D0027C24C /* Observable+SubscriptionTest.swift */; }; C8350A1F1C38756B0027C24C /* ObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509181C38706D0027C24C /* ObserverTests.swift */; }; C8350A201C38756B0027C24C /* QueueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83509191C38706D0027C24C /* QueueTests.swift */; }; C8350A211C38756B0027C24C /* SubjectConcurrencyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835091A1C38706D0027C24C /* SubjectConcurrencyTest.swift */; }; C8350A231C38756B0027C24C /* VirtualSchedulerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C835091C1C38706D0027C24C /* VirtualSchedulerTest.swift */; }; C8350A2A1C3875B50027C24C /* RxMutableBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */; }; C8350A2B1C3875B60027C24C /* RxMutableBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */; }; C8353CDC1DA19BA000BE3F5C /* MessageProcessingStage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CDB1DA19BA000BE3F5C /* MessageProcessingStage.swift */; }; C8353CDD1DA19BA000BE3F5C /* MessageProcessingStage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CDB1DA19BA000BE3F5C /* MessageProcessingStage.swift */; }; C8353CDE1DA19BA000BE3F5C /* MessageProcessingStage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CDB1DA19BA000BE3F5C /* MessageProcessingStage.swift */; }; C8353CE61DA19BC500BE3F5C /* Recorded+Timeless.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE01DA19BC500BE3F5C /* Recorded+Timeless.swift */; }; C8353CE71DA19BC500BE3F5C /* Recorded+Timeless.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE01DA19BC500BE3F5C /* Recorded+Timeless.swift */; }; C8353CE81DA19BC500BE3F5C /* Recorded+Timeless.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE01DA19BC500BE3F5C /* Recorded+Timeless.swift */; }; C8353CE91DA19BC500BE3F5C /* TestErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE11DA19BC500BE3F5C /* TestErrors.swift */; }; C8353CEA1DA19BC500BE3F5C /* TestErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE11DA19BC500BE3F5C /* TestErrors.swift */; }; C8353CEB1DA19BC500BE3F5C /* TestErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE11DA19BC500BE3F5C /* TestErrors.swift */; }; C8353CEC1DA19BC500BE3F5C /* XCTest+AllTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE21DA19BC500BE3F5C /* XCTest+AllTests.swift */; }; C8353CED1DA19BC500BE3F5C /* XCTest+AllTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE21DA19BC500BE3F5C /* XCTest+AllTests.swift */; }; C8353CEE1DA19BC500BE3F5C /* XCTest+AllTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8353CE21DA19BC500BE3F5C /* XCTest+AllTests.swift */; }; C8379EF41D1DD326003EF8FC /* UIButton+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8379EF31D1DD326003EF8FC /* UIButton+RxTests.swift */; }; C8379EF51D1DD326003EF8FC /* UIButton+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8379EF31D1DD326003EF8FC /* UIButton+RxTests.swift */; }; C83D73BC1C1DBAEE003DC470 /* InvocableScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83D73B41C1DBAEE003DC470 /* InvocableScheduledItem.swift */; }; C83D73C01C1DBAEE003DC470 /* InvocableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83D73B51C1DBAEE003DC470 /* InvocableType.swift */; }; C83D73C41C1DBAEE003DC470 /* ScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83D73B61C1DBAEE003DC470 /* ScheduledItem.swift */; }; C83D73C81C1DBAEE003DC470 /* ScheduledItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83D73B71C1DBAEE003DC470 /* ScheduledItemType.swift */; }; C83E397F2189066F001F4F0E /* NSButton+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781911DB823B500B2029A /* NSButton+Rx.swift */; }; C83E39802189066F001F4F0E /* NSControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781921DB823B500B2029A /* NSControl+Rx.swift */; }; C83E39822189066F001F4F0E /* NSSlider+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781941DB823B500B2029A /* NSSlider+Rx.swift */; }; C83E39832189066F001F4F0E /* NSTextField+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781951DB823B500B2029A /* NSTextField+Rx.swift */; }; C83E39842189066F001F4F0E /* NSView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781961DB823B500B2029A /* NSView+Rx.swift */; }; C83E39852189066F001F4F0E /* NSTextView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927A78B621179FFD00A45638 /* NSTextView+Rx.swift */; }; C849BE2B1BAB5D070019AD27 /* ObservableConvertibleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849BE2A1BAB5D070019AD27 /* ObservableConvertibleType.swift */; }; C84CB1721C3876B800EB63CC /* UIView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83508F11C38706D0027C24C /* UIView+RxTests.swift */; }; C84CC54E1BDCF48200E06A64 /* LockOwnerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84CC54D1BDCF48200E06A64 /* LockOwnerType.swift */; }; C84CC5531BDCF49300E06A64 /* SynchronizedOnType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84CC5521BDCF49300E06A64 /* SynchronizedOnType.swift */; }; C84CC55D1BDD010800E06A64 /* SynchronizedUnsubscribeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84CC55C1BDD010800E06A64 /* SynchronizedUnsubscribeType.swift */; }; C84CC5621BDD037900E06A64 /* SynchronizedDisposeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84CC5611BDD037900E06A64 /* SynchronizedDisposeType.swift */; }; C84CC5671BDD08A500E06A64 /* SubscriptionDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84CC5661BDD08A500E06A64 /* SubscriptionDisposable.swift */; }; C85217E91E3374970015DD38 /* GroupedObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85217E81E3374970015DD38 /* GroupedObservable.swift */; }; C85217EE1E33C8E60015DD38 /* PerformanceTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E8BA701E2C18AE00A4AC2C /* PerformanceTools.swift */; }; C85217F31E33ECA00015DD38 /* PerformanceTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E8BA701E2C18AE00A4AC2C /* PerformanceTools.swift */; }; C85217F71E33FBBE0015DD38 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85217F61E33FBBE0015DD38 /* RecursiveLock.swift */; }; C85217FC1E33FBFB0015DD38 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85217FB1E33FBFB0015DD38 /* RecursiveLock.swift */; }; C85218011E33FC160015DD38 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85218001E33FC160015DD38 /* RecursiveLock.swift */; }; C85218021E33FC160015DD38 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85218001E33FC160015DD38 /* RecursiveLock.swift */; }; C85218031E33FC160015DD38 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85218001E33FC160015DD38 /* RecursiveLock.swift */; }; C85218051E33FCA50015DD38 /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85218041E33FCA50015DD38 /* Resources.swift */; }; C8550B4B1D95A41400A6FCFE /* Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8550B4A1D95A41400A6FCFE /* Reactive.swift */; }; C8561B661DFE1169005E97F1 /* ExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8561B651DFE1169005E97F1 /* ExampleTests.swift */; }; C85B01691DB2ACAF006043C3 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85B01671DB2ACAF006043C3 /* Platform.Darwin.swift */; }; C85B016D1DB2ACAF006043C3 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85B01681DB2ACAF006043C3 /* Platform.Linux.swift */; }; C85E6FBE1F53025700C5681E /* SchedulerType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85E6FBD1F53025700C5681E /* SchedulerType+SharedSequence.swift */; }; C85E6FC21F5305E300C5681E /* Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85E6FBB1F52FF4F00C5681E /* Signal.swift */; }; C86781701DB8129E00B2029A /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = C867816C1DB8129E00B2029A /* Bag.swift */; }; C86781741DB8129E00B2029A /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C867816D1DB8129E00B2029A /* InfiniteSequence.swift */; }; C86781781DB8129E00B2029A /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = C867816E1DB8129E00B2029A /* PriorityQueue.swift */; }; C867817C1DB8129E00B2029A /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = C867816F1DB8129E00B2029A /* Queue.swift */; }; C86781831DB8143A00B2029A /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781821DB8143A00B2029A /* Bag.swift */; }; C86781881DB814AD00B2029A /* Bag+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781871DB814AD00B2029A /* Bag+Rx.swift */; }; C86B1E221D42BF5200130546 /* SchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86B1E211D42BF5200130546 /* SchedulerTests.swift */; }; C86B1E231D42BF5200130546 /* SchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86B1E211D42BF5200130546 /* SchedulerTests.swift */; }; C86B1E241D42BF5200130546 /* SchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86B1E211D42BF5200130546 /* SchedulerTests.swift */; }; C8802DD41F8CD47F001D677E /* UIControl+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8802DD31F8CD47F001D677E /* UIControl+RxTests.swift */; }; C88254161B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F11B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift */; }; C88254171B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F21B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift */; }; C88254181B8A752B00B02D69 /* ItemEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F41B8A752B00B02D69 /* ItemEvents.swift */; }; C882541A1B8A752B00B02D69 /* RxCollectionViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F71B8A752B00B02D69 /* RxCollectionViewDataSourceType.swift */; }; C882541B1B8A752B00B02D69 /* RxTableViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253F81B8A752B00B02D69 /* RxTableViewDataSourceType.swift */; }; C882541E1B8A752B00B02D69 /* RxCollectionViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253FC1B8A752B00B02D69 /* RxCollectionViewDataSourceProxy.swift */; }; C882541F1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253FD1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift */; }; C88254201B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253FE1B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift */; }; C88254211B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88253FF1B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift */; }; C88254221B8A752B00B02D69 /* RxTableViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254001B8A752B00B02D69 /* RxTableViewDataSourceProxy.swift */; }; C88254231B8A752B00B02D69 /* RxTableViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254011B8A752B00B02D69 /* RxTableViewDelegateProxy.swift */; }; C88254241B8A752B00B02D69 /* RxTextViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254021B8A752B00B02D69 /* RxTextViewDelegateProxy.swift */; }; C88254271B8A752B00B02D69 /* UIBarButtonItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254051B8A752B00B02D69 /* UIBarButtonItem+Rx.swift */; }; C88254281B8A752B00B02D69 /* UIButton+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254061B8A752B00B02D69 /* UIButton+Rx.swift */; }; C88254291B8A752B00B02D69 /* UICollectionView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254071B8A752B00B02D69 /* UICollectionView+Rx.swift */; }; C882542A1B8A752B00B02D69 /* UIControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254081B8A752B00B02D69 /* UIControl+Rx.swift */; }; C882542B1B8A752B00B02D69 /* UIDatePicker+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254091B8A752B00B02D69 /* UIDatePicker+Rx.swift */; }; C882542C1B8A752B00B02D69 /* UIGestureRecognizer+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C882540A1B8A752B00B02D69 /* UIGestureRecognizer+Rx.swift */; }; C882542F1B8A752B00B02D69 /* UIScrollView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C882540D1B8A752B00B02D69 /* UIScrollView+Rx.swift */; }; C88254301B8A752B00B02D69 /* UISearchBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C882540E1B8A752B00B02D69 /* UISearchBar+Rx.swift */; }; C88254311B8A752B00B02D69 /* UISegmentedControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C882540F1B8A752B00B02D69 /* UISegmentedControl+Rx.swift */; }; C88254321B8A752B00B02D69 /* UISlider+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254101B8A752B00B02D69 /* UISlider+Rx.swift */; }; C88254331B8A752B00B02D69 /* UISwitch+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254111B8A752B00B02D69 /* UISwitch+Rx.swift */; }; C88254341B8A752B00B02D69 /* UITableView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254121B8A752B00B02D69 /* UITableView+Rx.swift */; }; C88254351B8A752B00B02D69 /* UITextField+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254131B8A752B00B02D69 /* UITextField+Rx.swift */; }; C88254361B8A752B00B02D69 /* UITextView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88254141B8A752B00B02D69 /* UITextView+Rx.swift */; }; C8845AD41EDB4C9900B36836 /* ShareReplayScope.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8845AD31EDB4C9900B36836 /* ShareReplayScope.swift */; }; C8845ADA1EDB607800B36836 /* Observable+ShareReplayScopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8845AD91EDB607800B36836 /* Observable+ShareReplayScopeTests.swift */; }; C8845ADB1EDB607800B36836 /* Observable+ShareReplayScopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8845AD91EDB607800B36836 /* Observable+ShareReplayScopeTests.swift */; }; C8845ADC1EDB607800B36836 /* Observable+ShareReplayScopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8845AD91EDB607800B36836 /* Observable+ShareReplayScopeTests.swift */; }; C88E296B1BEB712E001CCB92 /* RunLoopLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88E296A1BEB712E001CCB92 /* RunLoopLock.swift */; }; C88F76811CE5341700D5A014 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88F76801CE5341700D5A014 /* TextInput.swift */; }; C89046581DC5F6F70041C7D8 /* UISearchBar+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B2908C1C94D6C500E923D0 /* UISearchBar+RxTests.swift */; }; C8941BDF1BD5695C00A0E874 /* BlockingObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8941BDE1BD5695C00A0E874 /* BlockingObservable.swift */; }; C8941BE41BD56B0700A0E874 /* BlockingObservable+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8941BE31BD56B0700A0E874 /* BlockingObservable+Operators.swift */; }; C896A68B1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */; }; C896A68C1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */; }; C896A68D1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */; }; C89814781E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89814771E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift */; }; C898147E1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C898147D1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift */; }; C898147F1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C898147D1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift */; }; C89814801E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C898147D1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift */; }; C89AB1731DAAC1680065FBE6 /* ControlTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1711DAAC1680065FBE6 /* ControlTarget.swift */; }; C89AB1A61DAAC25A0065FBE6 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1A51DAAC25A0065FBE6 /* RxCocoaObjCRuntimeError+Extensions.swift */; }; C89AB1C61DAAC3350065FBE6 /* ControlEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1AB1DAAC3350065FBE6 /* ControlEvent.swift */; }; C89AB1CA1DAAC3350065FBE6 /* ControlProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1AC1DAAC3350065FBE6 /* ControlProperty.swift */; }; C89AB1CE1DAAC3350065FBE6 /* ControlEvent+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1AE1DAAC3350065FBE6 /* ControlEvent+Driver.swift */; }; C89AB1D21DAAC3350065FBE6 /* ControlProperty+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1AF1DAAC3350065FBE6 /* ControlProperty+Driver.swift */; }; C89AB1D61DAAC3350065FBE6 /* Driver+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B01DAAC3350065FBE6 /* Driver+Subscription.swift */; }; C89AB1DA1DAAC3350065FBE6 /* Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B11DAAC3350065FBE6 /* Driver.swift */; }; C89AB1DE1DAAC3350065FBE6 /* ObservableConvertibleType+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B21DAAC3350065FBE6 /* ObservableConvertibleType+Driver.swift */; }; C89AB1EA1DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B61DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift */; }; C89AB1F21DAAC3350065FBE6 /* SharedSequence+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B81DAAC3350065FBE6 /* SharedSequence+Operators.swift */; }; C89AB1F61DAAC3350065FBE6 /* SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B91DAAC3350065FBE6 /* SharedSequence.swift */; }; C89AB2021DAAC3350065FBE6 /* KVORepresentable+CoreGraphics.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1BD1DAAC3350065FBE6 /* KVORepresentable+CoreGraphics.swift */; }; C89AB2061DAAC3350065FBE6 /* KVORepresentable+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1BE1DAAC3350065FBE6 /* KVORepresentable+Swift.swift */; }; C89AB20A1DAAC3350065FBE6 /* KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1BF1DAAC3350065FBE6 /* KVORepresentable.swift */; }; C89AB2121DAAC3350065FBE6 /* NotificationCenter+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1C11DAAC3350065FBE6 /* NotificationCenter+Rx.swift */; }; C89AB2161DAAC3350065FBE6 /* NSObject+Rx+KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1C21DAAC3350065FBE6 /* NSObject+Rx+KVORepresentable.swift */; }; C89AB21A1DAAC3350065FBE6 /* NSObject+Rx+RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1C31DAAC3350065FBE6 /* NSObject+Rx+RawRepresentable.swift */; }; C89AB21E1DAAC3350065FBE6 /* NSObject+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1C41DAAC3350065FBE6 /* NSObject+Rx.swift */; }; C89AB2221DAAC3350065FBE6 /* URLSession+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1C51DAAC3350065FBE6 /* URLSession+Rx.swift */; }; C89AB2271DAAC33F0065FBE6 /* RxCocoa.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB2261DAAC33F0065FBE6 /* RxCocoa.swift */; }; C89AB2381DAAC3A60065FBE6 /* _RX.m in Sources */ = {isa = PBXBuildFile; fileRef = C89AB22D1DAAC3A60065FBE6 /* _RX.m */; }; C89AB2401DAAC3A60065FBE6 /* _RXDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C89AB22F1DAAC3A60065FBE6 /* _RXDelegateProxy.m */; }; C89AB2481DAAC3A60065FBE6 /* _RXKVOObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = C89AB2311DAAC3A60065FBE6 /* _RXKVOObserver.m */; }; C89AB2501DAAC3A60065FBE6 /* _RXObjCRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = C89AB2331DAAC3A60065FBE6 /* _RXObjCRuntime.m */; }; C89AB25A1DAACC580065FBE6 /* _RX.h in Headers */ = {isa = PBXBuildFile; fileRef = C89AB2551DAACC580065FBE6 /* _RX.h */; settings = {ATTRIBUTES = (Public, ); }; }; C89AB25E1DAACC580065FBE6 /* _RXDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = C89AB2561DAACC580065FBE6 /* _RXDelegateProxy.h */; settings = {ATTRIBUTES = (Public, ); }; }; C89AB2621DAACC580065FBE6 /* _RXKVOObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C89AB2571DAACC580065FBE6 /* _RXKVOObserver.h */; settings = {ATTRIBUTES = (Public, ); }; }; C89AB2661DAACC580065FBE6 /* _RXObjCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = C89AB2581DAACC580065FBE6 /* _RXObjCRuntime.h */; settings = {ATTRIBUTES = (Public, ); }; }; C89AB2791DAACE490065FBE6 /* RxCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = C89AB2781DAACE490065FBE6 /* RxCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; }; C89CFA0C1DAAB4670079D23B /* RxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA0B1DAAB4670079D23B /* RxTest.swift */; }; C89CFA0D1DAAB4670079D23B /* RxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA0B1DAAB4670079D23B /* RxTest.swift */; }; C89CFA0E1DAAB4670079D23B /* RxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA0B1DAAB4670079D23B /* RxTest.swift */; }; C89CFA1E1DAABBE20079D23B /* Any+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA101DAABBE20079D23B /* Any+Equatable.swift */; }; C89CFA221DAABBE20079D23B /* ColdObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA111DAABBE20079D23B /* ColdObservable.swift */; }; C89CFA261DAABBE20079D23B /* Event+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA121DAABBE20079D23B /* Event+Equatable.swift */; }; C89CFA2A1DAABBE20079D23B /* HotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA131DAABBE20079D23B /* HotObservable.swift */; }; C89CFA321DAABBE20079D23B /* Recorded.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA151DAABBE20079D23B /* Recorded.swift */; }; C89CFA361DAABBE20079D23B /* RxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA161DAABBE20079D23B /* RxTest.swift */; }; C89CFA3A1DAABBE20079D23B /* TestScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA181DAABBE20079D23B /* TestScheduler.swift */; }; C89CFA3E1DAABBE20079D23B /* TestSchedulerVirtualTimeConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA191DAABBE20079D23B /* TestSchedulerVirtualTimeConverter.swift */; }; C89CFA421DAABBE20079D23B /* Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA1A1DAABBE20079D23B /* Subscription.swift */; }; C89CFA461DAABBE20079D23B /* TestableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA1B1DAABBE20079D23B /* TestableObservable.swift */; }; C89CFA4A1DAABBE20079D23B /* TestableObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA1C1DAABBE20079D23B /* TestableObserver.swift */; }; C89CFA4E1DAABBE20079D23B /* XCTest+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89CFA1D1DAABBE20079D23B /* XCTest+Rx.swift */; }; C8A53AE01F09178700490535 /* Completable+AndThen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A53ADF1F09178700490535 /* Completable+AndThen.swift */; }; C8A53AE51F09292A00490535 /* Completable+AndThen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A53AE41F09292A00490535 /* Completable+AndThen.swift */; }; C8A53AE61F09292A00490535 /* Completable+AndThen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A53AE41F09292A00490535 /* Completable+AndThen.swift */; }; C8A53AE71F09292A00490535 /* Completable+AndThen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A53AE41F09292A00490535 /* Completable+AndThen.swift */; }; C8A81CA01E05E82C0008DEF4 /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A81C9F1E05E82C0008DEF4 /* DispatchQueue+Extensions.swift */; }; C8A9B6F41DAD752200C9B027 /* Observable+BindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A9B6F31DAD752200C9B027 /* Observable+BindTests.swift */; }; C8A9B6F51DAD752200C9B027 /* Observable+BindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A9B6F31DAD752200C9B027 /* Observable+BindTests.swift */; }; C8A9B6F61DAD752200C9B027 /* Observable+BindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A9B6F31DAD752200C9B027 /* Observable+BindTests.swift */; }; C8ADC18E2200F9B000B611D4 /* Atomic+Overrides.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8ADC18D2200F9B000B611D4 /* Atomic+Overrides.swift */; }; C8ADC18F2200F9B000B611D4 /* Atomic+Overrides.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8ADC18D2200F9B000B611D4 /* Atomic+Overrides.swift */; }; C8ADC1902200F9B000B611D4 /* Atomic+Overrides.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8ADC18D2200F9B000B611D4 /* Atomic+Overrides.swift */; }; C8B0F70D1F530A1700548EBE /* SharingSchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B0F70C1F530A1700548EBE /* SharingSchedulerTests.swift */; }; C8B0F70E1F530A1700548EBE /* SharingSchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B0F70C1F530A1700548EBE /* SharingSchedulerTests.swift */; }; C8B0F70F1F530A1700548EBE /* SharingSchedulerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B0F70C1F530A1700548EBE /* SharingSchedulerTests.swift */; }; C8B0F7221F53135100548EBE /* ObservableConvertibleType+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B0F7211F53135100548EBE /* ObservableConvertibleType+Signal.swift */; }; C8B144FB1BD2D44500267DCE /* ConcurrentMainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B144FA1BD2D44500267DCE /* ConcurrentMainScheduler.swift */; }; C8B290891C94D64600E923D0 /* RxTest+Controls.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B290841C94D55600E923D0 /* RxTest+Controls.swift */; }; C8B2908A1C94D64700E923D0 /* RxTest+Controls.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B290841C94D55600E923D0 /* RxTest+Controls.swift */; }; C8B2908B1C94D64700E923D0 /* RxTest+Controls.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B290841C94D55600E923D0 /* RxTest+Controls.swift */; }; C8BAA78D1E34F8D400EEC727 /* RecursiveLockTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BAA78C1E34F8D400EEC727 /* RecursiveLockTest.swift */; }; C8BAA78E1E34F8D400EEC727 /* RecursiveLockTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BAA78C1E34F8D400EEC727 /* RecursiveLockTest.swift */; }; C8BAA78F1E34F8D400EEC727 /* RecursiveLockTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BAA78C1E34F8D400EEC727 /* RecursiveLockTest.swift */; }; C8BF34CB1C2E426800416CAE /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BF34C91C2E426800416CAE /* Platform.Darwin.swift */; }; C8BF34CF1C2E426800416CAE /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BF34CA1C2E426800416CAE /* Platform.Linux.swift */; }; C8C217D51CB7100E0038A2E6 /* UITableView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C217D41CB7100E0038A2E6 /* UITableView+RxTests.swift */; }; C8C217D71CB710200038A2E6 /* UICollectionView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C217D61CB710200038A2E6 /* UICollectionView+RxTests.swift */; }; C8C3DA0F1B939767004D233E /* CurrentThreadScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C3DA0E1B939767004D233E /* CurrentThreadScheduler.swift */; }; C8C4F15D1DE9CAEE00003FA7 /* UIBarButtonItem+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F15C1DE9CAEE00003FA7 /* UIBarButtonItem+RxTests.swift */; }; C8C4F15F1DE9CC5B00003FA7 /* UISwitch+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F15E1DE9CC5B00003FA7 /* UISwitch+RxTests.swift */; }; C8C4F1611DE9CD1600003FA7 /* UILabel+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1601DE9CD1600003FA7 /* UILabel+RxTests.swift */; }; C8C4F1631DE9D0A800003FA7 /* UIProgressView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1621DE9D0A800003FA7 /* UIProgressView+RxTests.swift */; }; C8C4F1651DE9D3FB00003FA7 /* UIGestureRecognizer+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1641DE9D3FB00003FA7 /* UIGestureRecognizer+RxTests.swift */; }; C8C4F1671DE9D44600003FA7 /* UISegmentedControl+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1661DE9D44600003FA7 /* UISegmentedControl+RxTests.swift */; }; C8C4F1691DE9D48F00003FA7 /* UIActivityIndicatorView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1681DE9D48F00003FA7 /* UIActivityIndicatorView+RxTests.swift */; }; C8C4F16B1DE9D4C100003FA7 /* UIAlertAction+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F16A1DE9D4C100003FA7 /* UIAlertAction+RxTests.swift */; }; C8C4F16D1DE9D4F400003FA7 /* UIDatePicker+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F16C1DE9D4F400003FA7 /* UIDatePicker+RxTests.swift */; }; C8C4F16F1DE9D5E000003FA7 /* UISlider+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F16E1DE9D5E000003FA7 /* UISlider+RxTests.swift */; }; C8C4F1711DE9D68000003FA7 /* UIStepper+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1701DE9D68000003FA7 /* UIStepper+RxTests.swift */; }; C8C4F1731DE9D7A300003FA7 /* NSTextField+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1721DE9D7A300003FA7 /* NSTextField+RxTests.swift */; }; C8C4F1751DE9D80A00003FA7 /* NSSlider+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1741DE9D80A00003FA7 /* NSSlider+RxTests.swift */; }; C8C4F1771DE9D84900003FA7 /* NSButton+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1761DE9D84900003FA7 /* NSButton+RxTests.swift */; }; C8C4F1781DE9DF0200003FA7 /* UIActivityIndicatorView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1681DE9D48F00003FA7 /* UIActivityIndicatorView+RxTests.swift */; }; C8C4F1791DE9DF0200003FA7 /* UIAlertAction+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F16A1DE9D4C100003FA7 /* UIAlertAction+RxTests.swift */; }; C8C4F17A1DE9DF0200003FA7 /* UIBarButtonItem+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F15C1DE9CAEE00003FA7 /* UIBarButtonItem+RxTests.swift */; }; C8C4F17B1DE9DF0200003FA7 /* UICollectionView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C217D61CB710200038A2E6 /* UICollectionView+RxTests.swift */; }; C8C4F17C1DE9DF0200003FA7 /* UIDatePicker+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F16C1DE9D4F400003FA7 /* UIDatePicker+RxTests.swift */; }; C8C4F17D1DE9DF0200003FA7 /* UIGestureRecognizer+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1641DE9D3FB00003FA7 /* UIGestureRecognizer+RxTests.swift */; }; C8C4F17E1DE9DF0200003FA7 /* UILabel+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1601DE9CD1600003FA7 /* UILabel+RxTests.swift */; }; C8C4F1801DE9DF0200003FA7 /* UIProgressView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1621DE9D0A800003FA7 /* UIProgressView+RxTests.swift */; }; C8C4F1811DE9DF0200003FA7 /* UIScrollView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033C2EF41D081B2A0050C015 /* UIScrollView+RxTests.swift */; }; C8C4F1831DE9DF0200003FA7 /* UISearchController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E4D3951C9B011000ADFDC9 /* UISearchController+RxTests.swift */; }; C8C4F1841DE9DF0200003FA7 /* UISegmentedControl+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1661DE9D44600003FA7 /* UISegmentedControl+RxTests.swift */; }; C8C4F1851DE9DF0200003FA7 /* UISlider+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F16E1DE9D5E000003FA7 /* UISlider+RxTests.swift */; }; C8C4F1861DE9DF0200003FA7 /* UIStepper+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F1701DE9D68000003FA7 /* UIStepper+RxTests.swift */; }; C8C4F1871DE9DF0200003FA7 /* UISwitch+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C4F15E1DE9CC5B00003FA7 /* UISwitch+RxTests.swift */; }; C8C4F1881DE9DF0200003FA7 /* UITableView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C217D41CB7100E0038A2E6 /* UITableView+RxTests.swift */; }; C8C4F18A1DE9DFA400003FA7 /* UISearchBar+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8B2908C1C94D6C500E923D0 /* UISearchBar+RxTests.swift */; }; C8C8BCD41F89459300501D4D /* BehaviorRelay+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C8BCD31F89459300501D4D /* BehaviorRelay+Driver.swift */; }; C8D132441C42D15E00B59FFF /* SectionedViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D132431C42D15E00B59FFF /* SectionedViewDataSourceType.swift */; }; C8D970CE1F5324D90058F2FE /* Signal+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970CD1F5324D90058F2FE /* Signal+Subscription.swift */; }; C8D970E31F532FD30058F2FE /* Signal+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DC1F532FD10058F2FE /* Signal+Test.swift */; }; C8D970E41F532FD30058F2FE /* Signal+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DC1F532FD10058F2FE /* Signal+Test.swift */; }; C8D970E51F532FD30058F2FE /* Signal+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DC1F532FD10058F2FE /* Signal+Test.swift */; }; C8D970E61F532FD30058F2FE /* SharedSequence+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DD1F532FD10058F2FE /* SharedSequence+Test.swift */; }; C8D970E71F532FD30058F2FE /* SharedSequence+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DD1F532FD10058F2FE /* SharedSequence+Test.swift */; }; C8D970E81F532FD30058F2FE /* SharedSequence+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DD1F532FD10058F2FE /* SharedSequence+Test.swift */; }; C8D970E91F532FD30058F2FE /* Driver+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DE1F532FD20058F2FE /* Driver+Test.swift */; }; C8D970EA1F532FD30058F2FE /* Driver+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DE1F532FD20058F2FE /* Driver+Test.swift */; }; C8D970EB1F532FD30058F2FE /* Driver+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970DE1F532FD20058F2FE /* Driver+Test.swift */; }; C8D970EC1F532FD30058F2FE /* SectionedViewDataSourceMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E01F532FD20058F2FE /* SectionedViewDataSourceMock.swift */; }; C8D970ED1F532FD30058F2FE /* SectionedViewDataSourceMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E01F532FD20058F2FE /* SectionedViewDataSourceMock.swift */; }; C8D970EF1F532FD30058F2FE /* SharedSequence+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E11F532FD20058F2FE /* SharedSequence+Extensions.swift */; }; C8D970F01F532FD30058F2FE /* SharedSequence+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E11F532FD20058F2FE /* SharedSequence+Extensions.swift */; }; C8D970F11F532FD30058F2FE /* SharedSequence+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E11F532FD20058F2FE /* SharedSequence+Extensions.swift */; }; C8D970F21F532FD30058F2FE /* SharedSequence+OperatorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E21F532FD30058F2FE /* SharedSequence+OperatorTest.swift */; }; C8D970F31F532FD30058F2FE /* SharedSequence+OperatorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E21F532FD30058F2FE /* SharedSequence+OperatorTest.swift */; }; C8D970F41F532FD30058F2FE /* SharedSequence+OperatorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D970E21F532FD30058F2FE /* SharedSequence+OperatorTest.swift */; }; C8E390631F379041004FC993 /* Enumerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E390621F379041004FC993 /* Enumerated.swift */; }; C8E390681F379386004FC993 /* Observable+EnumeratedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E390671F379386004FC993 /* Observable+EnumeratedTests.swift */; }; C8E390691F379386004FC993 /* Observable+EnumeratedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E390671F379386004FC993 /* Observable+EnumeratedTests.swift */; }; C8E3906A1F379386004FC993 /* Observable+EnumeratedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E390671F379386004FC993 /* Observable+EnumeratedTests.swift */; }; C8E8BA5A1E2C181A00A4AC2C /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8A56AD71AD7424700B4673B /* RxSwift.framework */; }; C8E8BA641E2C186200A4AC2C /* Benchmarks.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E8BA621E2C186200A4AC2C /* Benchmarks.swift */; }; C8E8BA721E2C18AE00A4AC2C /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8E8BA6F1E2C18AE00A4AC2C /* main.swift */; }; C8F03F411DBB98DB00AECC4C /* Anomalies.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F03F401DBB98DB00AECC4C /* Anomalies.swift */; }; C8F03F421DBB98DB00AECC4C /* Anomalies.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F03F401DBB98DB00AECC4C /* Anomalies.swift */; }; C8F03F431DBB98DB00AECC4C /* Anomalies.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F03F401DBB98DB00AECC4C /* Anomalies.swift */; }; C8F03F4A1DBBAC0A00AECC4C /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F03F491DBBAC0A00AECC4C /* DispatchQueue+Extensions.swift */; }; C8F03F4F1DBBAE9400AECC4C /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F03F4E1DBBAE9400AECC4C /* DispatchQueue+Extensions.swift */; }; C8F03F501DBBAE9400AECC4C /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F03F4E1DBBAE9400AECC4C /* DispatchQueue+Extensions.swift */; }; C8F03F511DBBAE9400AECC4C /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F03F4E1DBBAE9400AECC4C /* DispatchQueue+Extensions.swift */; }; C8F27DC01CE68DA600D5FB4F /* UITextView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F27DB11CE6711600D5FB4F /* UITextView+RxTests.swift */; }; C8F27DC11CE68DA700D5FB4F /* UITextView+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F27DB11CE6711600D5FB4F /* UITextView+RxTests.swift */; }; C8F27DC21CE68DAB00D5FB4F /* UITextField+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F27DAC1CE6710900D5FB4F /* UITextField+RxTests.swift */; }; C8F27DC31CE68DAC00D5FB4F /* UITextField+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F27DAC1CE6710900D5FB4F /* UITextField+RxTests.swift */; }; C8FA89141C30405400CD3A17 /* VirtualTimeConverterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8FA89121C30405400CD3A17 /* VirtualTimeConverterType.swift */; }; C8FA89151C30405400CD3A17 /* VirtualTimeScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8FA89131C30405400CD3A17 /* VirtualTimeScheduler.swift */; }; C8FA89171C30409900CD3A17 /* HistoricalScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8FA89161C30409900CD3A17 /* HistoricalScheduler.swift */; }; C8FA891C1C30412A00CD3A17 /* HistoricalSchedulerTimeConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8FA891B1C30412A00CD3A17 /* HistoricalSchedulerTimeConverter.swift */; }; CB883B401BE24C15000AC2EE /* RefCountDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB883B3F1BE24C15000AC2EE /* RefCountDisposable.swift */; }; CB883B451BE256D4000AC2EE /* BooleanDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB883B441BE256D4000AC2EE /* BooleanDisposable.swift */; }; CD8F7AC527BA9187001574EB /* Infallible+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD8F7AC427BA9187001574EB /* Infallible+Driver.swift */; }; CDDEF16A1D4FB40000CA8546 /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDEF1691D4FB40000CA8546 /* Disposables.swift */; }; D040ADC22D5E408700A1E6B3 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D040ADC12D5E408700A1E6B3 /* PrivacyInfo.xcprivacy */; }; D040ADC42D5E409700A1E6B3 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D040ADC32D5E409700A1E6B3 /* PrivacyInfo.xcprivacy */; }; D040ADC62D5E442300A1E6B3 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D040ADC52D5E442300A1E6B3 /* PrivacyInfo.xcprivacy */; }; D9080ACF1EA05AE0002B433B /* RxNavigationControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9080ACD1EA05A16002B433B /* RxNavigationControllerDelegateProxy.swift */; }; D9080AD41EA05DE9002B433B /* UINavigationController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9080AD21EA05DDF002B433B /* UINavigationController+Rx.swift */; }; D9080AD81EA06189002B433B /* UINavigationController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9080AD71EA06189002B433B /* UINavigationController+RxTests.swift */; }; D9080AD91EA06189002B433B /* UINavigationController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9080AD71EA06189002B433B /* UINavigationController+RxTests.swift */; }; DB08833526FA9834005805BE /* Observable+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB08833426FA9834005805BE /* Observable+Concurrency.swift */; }; DB08833726FB0637005805BE /* SharedSequence+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB08833626FB0637005805BE /* SharedSequence+Concurrency.swift */; }; DB08833A26FB0806005805BE /* SharedSequence+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB08833826FB07CB005805BE /* SharedSequence+ConcurrencyTests.swift */; }; DB08833B26FB080B005805BE /* SharedSequence+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB08833826FB07CB005805BE /* SharedSequence+ConcurrencyTests.swift */; }; DB08833C26FB080B005805BE /* SharedSequence+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB08833826FB07CB005805BE /* SharedSequence+ConcurrencyTests.swift */; }; DB0B922026FB3139005CEED9 /* Observable+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0B921F26FB3139005CEED9 /* Observable+ConcurrencyTests.swift */; }; DB0B922126FB3139005CEED9 /* Observable+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0B921F26FB3139005CEED9 /* Observable+ConcurrencyTests.swift */; }; DB0B922226FB3139005CEED9 /* Observable+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0B921F26FB3139005CEED9 /* Observable+ConcurrencyTests.swift */; }; DB0B922426FB31C1005CEED9 /* PrimitiveSequence+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0B922326FB31C1005CEED9 /* PrimitiveSequence+Concurrency.swift */; }; DB0B922626FB31EF005CEED9 /* Infallible+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0B922526FB31EF005CEED9 /* Infallible+Concurrency.swift */; }; DB0B922926FB3462005CEED9 /* Infallible+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0B922726FB343B005CEED9 /* Infallible+ConcurrencyTests.swift */; }; DB0B922C26FB3569005CEED9 /* PrimitiveSequence+ConcurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0B922A26FB34D3005CEED9 /* PrimitiveSequence+ConcurrencyTests.swift */; }; DB8157D3264941B300164D4B /* UIApplication+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB8157D2264941B200164D4B /* UIApplication+RxTests.swift */; }; DB8157E9264941EB00164D4B /* UIApplication+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB8157E8264941EB00164D4B /* UIApplication+Rx.swift */; }; ECBBA59B1DF8C0BA00DDDC2E /* UITabBarController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBBA59A1DF8C0BA00DDDC2E /* UITabBarController+Rx.swift */; }; ECBBA59E1DF8C0D400DDDC2E /* RxTabBarControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBBA59D1DF8C0D400DDDC2E /* RxTabBarControllerDelegateProxy.swift */; }; ECBBA5A11DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBBA5A01DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift */; }; ECBBA5A21DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBBA5A01DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift */; }; F31F35B01BB4FED800961002 /* UIStepper+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31F35AF1BB4FED800961002 /* UIStepper+Rx.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ A2897D59225CA28F004EA481 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = RxSwift; }; A2897D63225CBD37004EA481 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = A2897CB3225CA1E7004EA481; remoteInfo = RxRelay; }; C83508C91C386F6F0027C24C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = "RxSwift-iOS"; }; C835097A1C3871340027C24C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C88FA4FD1C25C44800CCFEA4; remoteInfo = "RxTest-iOS"; }; C835097C1C3871380027C24C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8093B4B1B8A71F00088E94D; remoteInfo = "RxBlocking-iOS"; }; C83E398621890703001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = RxSwift; }; C83E398821890703001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C80938F51B8A71760088E94D; remoteInfo = RxCocoa; }; C83E398A21890703001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8093B4B1B8A71F00088E94D; remoteInfo = RxBlocking; }; C83E398C21890703001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C88FA4FD1C25C44800CCFEA4; remoteInfo = RxTest; }; C83E398E2189070A001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = RxSwift; }; C83E39902189070A001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C80938F51B8A71760088E94D; remoteInfo = RxCocoa; }; C83E39922189070A001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8093B4B1B8A71F00088E94D; remoteInfo = RxBlocking; }; C83E39942189070A001F4F0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C88FA4FD1C25C44800CCFEA4; remoteInfo = RxTest; }; C872BD1B1BC0529600D7175E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = "RxSwift-iOS"; }; C872BD231BC052B800D7175E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = "RxSwift-iOS"; }; C88FA4FF1C25C44800CCFEA4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = "RxSwift-iOS"; }; C8B52BC5215434D600EAA87C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C80938F51B8A71760088E94D; remoteInfo = "RxCocoa-iOS"; }; C8E8BA5B1E2C181A00A4AC2C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = "RxSwift-iOS"; }; C8E8BA751E2C1BB200A4AC2C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C8A56ACE1AD7424700B4673B /* Project object */; proxyType = 1; remoteGlobalIDString = C80938F51B8A71760088E94D; remoteInfo = "RxCocoa-iOS"; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 033C2EF41D081B2A0050C015 /* UIScrollView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIScrollView+RxTests.swift"; sourceTree = ""; }; 0BA949661E224B7E0036DD06 /* AsyncSubject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncSubject.swift; sourceTree = ""; }; 0BA9496B1E224B9C0036DD06 /* AsyncSubjectTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncSubjectTests.swift; sourceTree = ""; }; 1AF67DA11CED420A00C310FA /* PublishSubjectTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublishSubjectTest.swift; sourceTree = ""; }; 1AF67DA51CED430100C310FA /* ReplaySubjectTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReplaySubjectTest.swift; sourceTree = ""; }; 1D858B6529E57EE900CD6814 /* Infallible+CombineLatest+Collection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+CombineLatest+Collection.swift"; sourceTree = ""; }; 1E3079AB21FB52330072A7E6 /* AtomicTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AtomicTests.swift; sourceTree = ""; }; 1E3EDF64226356A000B631B9 /* Date+Dispatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Dispatch.swift"; sourceTree = ""; }; 1E9DA0C422006858000EB80A /* Synchronized.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Synchronized.swift; sourceTree = ""; }; 25F6ECBB1F48C366008552FA /* Maybe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Maybe.swift; sourceTree = ""; }; 25F6ECBD1F48C373008552FA /* Completable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Completable.swift; sourceTree = ""; }; 25F6ECBF1F48C37C008552FA /* Single.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Single.swift; sourceTree = ""; }; 271A97421CFC99FE00D64125 /* UIViewController+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+RxTests.swift"; sourceTree = ""; }; 4583D8211FE94BB100AA1BB1 /* Recorded+Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Recorded+Event.swift"; sourceTree = ""; }; 4C5213A9225D41E60079FC77 /* CompactMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompactMap.swift; sourceTree = ""; }; 4C5213AB225E20350079FC77 /* Observable+CompactMapTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+CompactMapTests.swift"; sourceTree = ""; }; 4C8DE0E120D54545003E2D8A /* DisposeBagTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisposeBagTest.swift; sourceTree = ""; }; 504540C824196D960098665F /* WKWebView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WKWebView+Rx.swift"; sourceTree = ""; }; 504540CA24196EB10098665F /* WKWebView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WKWebView+RxTests.swift"; sourceTree = ""; }; 504540CD2419701D0098665F /* RxWKNavigationDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxWKNavigationDelegateProxy.swift; sourceTree = ""; }; 504540CF241971E70098665F /* DelegateProxyTest+WebKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DelegateProxyTest+WebKit.swift"; sourceTree = ""; }; 54700C9E1CE37D1000EF3A8F /* UINavigationItem+RxTests.swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationItem+RxTests.swift.swift"; sourceTree = ""; }; 601AE3D91EE24E4F00617386 /* SwiftSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSupport.swift; sourceTree = ""; }; 6A7D2CD323BBDBDC0038576E /* ReplayRelayTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplayRelayTests.swift; sourceTree = ""; }; 6A94254923AFC2F300B7A24C /* ReplayRelay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplayRelay.swift; sourceTree = ""; }; 7846F56524F83AF400A39919 /* Infallible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Infallible.swift; sourceTree = ""; }; 786DED6224F83DE5008C4FAC /* ObservableConvertibleType+Infallible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+Infallible.swift"; sourceTree = ""; }; 786DED6624F84095008C4FAC /* Infallible+Zip+arity.tt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Infallible+Zip+arity.tt"; sourceTree = ""; }; 786DED6824F8415B008C4FAC /* Infallible+Zip+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Infallible+Zip+arity.swift"; sourceTree = ""; }; 786DED6A24F84432008C4FAC /* Infallible+CombineLatest+arity.tt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Infallible+CombineLatest+arity.tt"; sourceTree = ""; }; 786DED6B24F844BC008C4FAC /* Infallible+CombineLatest+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Infallible+CombineLatest+arity.swift"; sourceTree = ""; }; 786DED6D24F84623008C4FAC /* Infallible+Operators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+Operators.swift"; sourceTree = ""; }; 786DED6F24F847BF008C4FAC /* Infallible+Create.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+Create.swift"; sourceTree = ""; }; 786DED7124F849F3008C4FAC /* Infallible+Bind.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+Bind.swift"; sourceTree = ""; }; 788DCE5C24CB8249005B8F8C /* Decode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Decode.swift; sourceTree = ""; }; 788DCE5E24CB8512005B8F8C /* Observable+DecodeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Observable+DecodeTests.swift"; sourceTree = ""; }; 78B6157623B6A035009C2AD9 /* Binder+Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Binder+Tests.swift"; sourceTree = ""; }; 78C385CD25685076005E39B3 /* Infallible+BindTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+BindTests.swift"; sourceTree = ""; }; 78C385EA256859DC005E39B3 /* Infallible+Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+Tests.swift"; sourceTree = ""; }; 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarItem+RxTests.swift"; sourceTree = ""; }; 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIRefreshControl+Rx.swift"; sourceTree = ""; }; 819C2F081F2FBC7F009104B6 /* First.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = First.swift; sourceTree = ""; }; 842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextStorage+Rx.swift"; sourceTree = ""; }; 844BC8AA1CE4FA5600F5C7CB /* RxPickerViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewDelegateProxy.swift; sourceTree = ""; }; 844BC8B31CE4FD7500F5C7CB /* UIPickerView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIPickerView+Rx.swift"; sourceTree = ""; }; 844BC8B71CE5023200F5C7CB /* UIPickerView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIPickerView+RxTests.swift"; sourceTree = ""; }; 846436E11C9AF64C0035B40D /* RxSearchControllerDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxSearchControllerDelegateProxy.swift; sourceTree = ""; }; 84C225A21C33F00B008724EC /* RxTextStorageDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTextStorageDelegateProxy.swift; sourceTree = ""; }; 84E4D3901C9AFCD500ADFDC9 /* UISearchController+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISearchController+Rx.swift"; sourceTree = ""; }; 84E4D3951C9B011000ADFDC9 /* UISearchController+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISearchController+RxTests.swift"; sourceTree = ""; }; 88718CFD1CE5D80000D88D60 /* UITabBar+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UITabBar+Rx.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 88718D001CE5DE2500D88D60 /* UITabBar+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBar+RxTests.swift"; sourceTree = ""; }; 88D98F2D1CE7549A00D50457 /* RxTabBarDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxTabBarDelegateProxy.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 914FCD661CCDB82E0058B304 /* UIPageControl+RxTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIPageControl+RxTest.swift"; sourceTree = ""; }; 927A78B621179FFD00A45638 /* NSTextView+Rx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSTextView+Rx.swift"; sourceTree = ""; }; 927A78C82117BCB400A45638 /* NSTextView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextView+RxTests.swift"; sourceTree = ""; }; 9BA1CBD11C0F7C0A0044B50A /* UIActivityIndicatorView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIActivityIndicatorView+Rx.swift"; sourceTree = ""; }; A111CE961B91C97C00D0DCEE /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A20CC6C8259F3FE700370AE3 /* WithUnretained.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithUnretained.swift; sourceTree = ""; }; A20CC6D4259F408100370AE3 /* Observable+WithUnretainedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Observable+WithUnretainedTests.swift"; sourceTree = ""; }; A2897D53225CA1E7004EA481 /* RxRelay.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxRelay.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A2897D61225CA3F3004EA481 /* Observable+Bind.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Observable+Bind.swift"; sourceTree = ""; }; A2897D65225D0182004EA481 /* PublishRelay+Signal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PublishRelay+Signal.swift"; sourceTree = ""; }; A2897D68225D023A004EA481 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = ""; }; A2FD4E9B225D04FF00288525 /* Observable+RelayBindTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Observable+RelayBindTests.swift"; sourceTree = ""; }; A2FD4EA4225D0A8100288525 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A520FFF61F0D258E00573734 /* RxPickerViewDataSourceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewDataSourceType.swift; sourceTree = ""; }; A520FFFB1F0D291500573734 /* RxPickerViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewDataSourceProxy.swift; sourceTree = ""; }; A5CD03891F1660F40005A376 /* RxPickerViewAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewAdapter.swift; sourceTree = ""; }; B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDataSourcePrefetchingProxy.swift; sourceTree = ""; }; B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewDataSourcePrefetchingProxy.swift; sourceTree = ""; }; C801DE351F6EAD3C008DB060 /* SingleTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleTest.swift; sourceTree = ""; }; C801DE391F6EAD48008DB060 /* MaybeTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaybeTest.swift; sourceTree = ""; }; C801DE3D1F6EAD57008DB060 /* CompletableTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompletableTest.swift; sourceTree = ""; }; C801DE411F6EBB29008DB060 /* ObservableType+PrimitiveSequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ObservableType+PrimitiveSequence.swift"; sourceTree = ""; }; C801DE491F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Observable+PrimitiveSequenceTest.swift"; sourceTree = ""; }; C8091C4D1FAA345C001DB32A /* ObservableConvertibleType+SharedSequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+SharedSequence.swift"; sourceTree = ""; }; C8091C521FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+SharedSequence.swift"; sourceTree = ""; }; C8091C561FAA39C1001DB32A /* ControlEvent+Signal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ControlEvent+Signal.swift"; sourceTree = ""; }; C809396D1B8A71760088E94D /* RxCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C8093BC71B8A71F00088E94D /* RxBlocking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxBlocking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C8093C491B8A72BE0088E94D /* Cancelable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cancelable.swift; sourceTree = ""; }; C8093C4B1B8A72BE0088E94D /* AsyncLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncLock.swift; sourceTree = ""; }; C8093C4C1B8A72BE0088E94D /* Lock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Lock.swift; sourceTree = ""; }; C8093C4D1B8A72BE0088E94D /* ConnectableObservableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectableObservableType.swift; sourceTree = ""; }; C8093C521B8A72BE0088E94D /* Disposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Disposable.swift; sourceTree = ""; }; C8093C541B8A72BE0088E94D /* AnonymousDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnonymousDisposable.swift; sourceTree = ""; }; C8093C551B8A72BE0088E94D /* BinaryDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BinaryDisposable.swift; sourceTree = ""; }; C8093C571B8A72BE0088E94D /* CompositeDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompositeDisposable.swift; sourceTree = ""; }; C8093C581B8A72BE0088E94D /* DisposeBag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisposeBag.swift; sourceTree = ""; }; C8093C591B8A72BE0088E94D /* DisposeBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisposeBase.swift; sourceTree = ""; }; C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NopDisposable.swift; sourceTree = ""; }; C8093C5D1B8A72BE0088E94D /* ScheduledDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduledDisposable.swift; sourceTree = ""; }; C8093C5F1B8A72BE0088E94D /* SerialDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SerialDisposable.swift; sourceTree = ""; }; C8093C601B8A72BE0088E94D /* SingleAssignmentDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleAssignmentDisposable.swift; sourceTree = ""; }; C8093C631B8A72BE0088E94D /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; C8093C641B8A72BE0088E94D /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = ""; }; C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImmediateSchedulerType.swift; sourceTree = ""; }; C8093C661B8A72BE0088E94D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "ObservableType+Extensions.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093C681B8A72BE0088E94D /* Observable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = ""; }; C8093C9E1B8A72BE0088E94D /* ObservableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObservableType.swift; sourceTree = ""; }; C8093CA01B8A72BE0088E94D /* AnyObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AnyObserver.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093CA21B8A72BE0088E94D /* AnonymousObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnonymousObserver.swift; sourceTree = ""; }; C8093CA61B8A72BE0088E94D /* ObserverBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObserverBase.swift; sourceTree = ""; }; C8093CA91B8A72BE0088E94D /* TailRecursiveSink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TailRecursiveSink.swift; sourceTree = ""; }; C8093CAB1B8A72BE0088E94D /* ObserverType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObserverType.swift; sourceTree = ""; }; C8093CAF1B8A72BE0088E94D /* Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Rx.swift; sourceTree = ""; }; C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxMutableBox.swift; sourceTree = ""; }; C8093CB31B8A72BE0088E94D /* SchedulerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulerType.swift; sourceTree = ""; }; C8093CB51B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConcurrentDispatchQueueScheduler.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093CB71B8A72BE0088E94D /* MainScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainScheduler.swift; sourceTree = ""; }; C8093CB81B8A72BE0088E94D /* OperationQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationQueueScheduler.swift; sourceTree = ""; }; C8093CB91B8A72BE0088E94D /* RecursiveScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecursiveScheduler.swift; sourceTree = ""; }; C8093CBB1B8A72BE0088E94D /* SchedulerServices+Emulation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SchedulerServices+Emulation.swift"; sourceTree = ""; }; C8093CBC1B8A72BE0088E94D /* SerialDispatchQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SerialDispatchQueueScheduler.swift; sourceTree = ""; }; C8093CBE1B8A72BE0088E94D /* BehaviorSubject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = BehaviorSubject.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093CBF1B8A72BE0088E94D /* PublishSubject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = PublishSubject.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093CC01B8A72BE0088E94D /* ReplaySubject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ReplaySubject.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093CC11B8A72BE0088E94D /* SubjectType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubjectType.swift; sourceTree = ""; }; C8093E8B1B8A732E0088E94D /* DelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DelegateProxy.swift; sourceTree = ""; }; C8093E8C1B8A732E0088E94D /* DelegateProxyType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateProxyType.swift; sourceTree = ""; }; C8093E9C1B8A732E0088E94D /* RxTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTarget.swift; sourceTree = ""; }; C8093E9D1B8A732E0088E94D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C8093F581B8A73A20088E94D /* ObservableConvertibleType+Blocking.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+Blocking.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093F591B8A73A20088E94D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; C80D338E1B91EF9E0014629D /* Observable+Bind.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "Observable+Bind.swift"; sourceTree = ""; }; C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchQueueConfiguration.swift; sourceTree = ""; }; C8165AC921891B9500494BEF /* AtomicInt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtomicInt.swift; sourceTree = ""; }; C8165ACA21891BBF00494BEF /* AtomicInt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AtomicInt.swift; sourceTree = ""; }; C8165ACC21891BE400494BEF /* AtomicInt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AtomicInt.swift; sourceTree = ""; }; C8165AD421891DBE00494BEF /* AtomicInt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AtomicInt.swift; sourceTree = ""; }; C81A097C1E6C27A100900B3B /* Observable+ZipTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ZipTests.swift"; sourceTree = ""; }; C81A09861E6C702700900B3B /* PrimitiveSequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = PrimitiveSequence.swift; sourceTree = ""; tabWidth = 4; }; C81B6AA81DB2C15C0047CF86 /* Platform.Darwin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Platform.Darwin.swift; sourceTree = ""; }; C81B6AA91DB2C15C0047CF86 /* Platform.Linux.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Platform.Linux.swift; sourceTree = ""; }; C820A7E61EB4DA5900D431BC /* Map.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Map.swift; sourceTree = ""; }; C820A7E71EB4DA5900D431BC /* Switch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = ""; }; C820A7E81EB4DA5900D431BC /* Delay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Delay.swift; sourceTree = ""; }; C820A7E91EB4DA5900D431BC /* Timeout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Timeout.swift; sourceTree = ""; }; C820A7EA1EB4DA5900D431BC /* Window.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Window.swift; sourceTree = ""; }; C820A7EB1EB4DA5900D431BC /* Buffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Buffer.swift; sourceTree = ""; }; C820A7EC1EB4DA5900D431BC /* DelaySubscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelaySubscription.swift; sourceTree = ""; }; C820A7ED1EB4DA5900D431BC /* Skip.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Skip.swift; sourceTree = ""; }; C820A7EE1EB4DA5900D431BC /* Take.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Take.swift; sourceTree = ""; }; C820A7EF1EB4DA5900D431BC /* Timer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Timer.swift; sourceTree = ""; }; C820A7F01EB4DA5900D431BC /* Sample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sample.swift; sourceTree = ""; }; C820A7F11EB4DA5900D431BC /* Debounce.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debounce.swift; sourceTree = ""; }; C820A7F21EB4DA5900D431BC /* Throttle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Throttle.swift; sourceTree = ""; }; C820A7F31EB4DA5900D431BC /* Generate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Generate.swift; sourceTree = ""; }; C820A7F41EB4DA5900D431BC /* GroupBy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupBy.swift; sourceTree = ""; }; C820A7F51EB4DA5900D431BC /* SingleAsync.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleAsync.swift; sourceTree = ""; }; C820A7F61EB4DA5900D431BC /* ElementAt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ElementAt.swift; sourceTree = ""; }; C820A7F71EB4DA5900D431BC /* Merge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Merge.swift; sourceTree = ""; }; C820A7F81EB4DA5900D431BC /* SkipWhile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkipWhile.swift; sourceTree = ""; }; C820A7F91EB4DA5900D431BC /* TakeLast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TakeLast.swift; sourceTree = ""; }; C820A7FB1EB4DA5900D431BC /* Filter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Filter.swift; sourceTree = ""; }; C820A7FC1EB4DA5900D431BC /* Dematerialize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dematerialize.swift; sourceTree = ""; }; C820A7FD1EB4DA5900D431BC /* Materialize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Materialize.swift; sourceTree = ""; }; C820A7FE1EB4DA5900D431BC /* DefaultIfEmpty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultIfEmpty.swift; sourceTree = ""; }; C820A7FF1EB4DA5900D431BC /* Scan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Scan.swift; sourceTree = ""; }; C820A8001EB4DA5900D431BC /* RetryWhen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RetryWhen.swift; sourceTree = ""; }; C820A8011EB4DA5900D431BC /* Catch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Catch.swift; sourceTree = ""; }; C820A8021EB4DA5900D431BC /* StartWith.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartWith.swift; sourceTree = ""; }; C820A8031EB4DA5900D431BC /* Do.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Do.swift; sourceTree = ""; }; C820A8041EB4DA5900D431BC /* DistinctUntilChanged.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DistinctUntilChanged.swift; sourceTree = ""; }; C820A8051EB4DA5900D431BC /* WithLatestFrom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WithLatestFrom.swift; sourceTree = ""; }; C820A8061EB4DA5900D431BC /* Amb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Amb.swift; sourceTree = ""; }; C820A8071EB4DA5900D431BC /* SkipUntil.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkipUntil.swift; sourceTree = ""; }; C820A8081EB4DA5900D431BC /* TakeWithPredicate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TakeWithPredicate.swift; sourceTree = ""; }; C820A8091EB4DA5900D431BC /* Concat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Concat.swift; sourceTree = ""; }; C820A80A1EB4DA5900D431BC /* SwitchIfEmpty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwitchIfEmpty.swift; sourceTree = ""; }; C820A80B1EB4DA5900D431BC /* Zip+Collection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Zip+Collection.swift"; sourceTree = ""; }; C820A80C1EB4DA5900D431BC /* CombineLatest+Collection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CombineLatest+Collection.swift"; sourceTree = ""; }; C820A80D1EB4DA5900D431BC /* Debug.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debug.swift; sourceTree = ""; }; C820A80E1EB4DA5900D431BC /* Optional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Optional.swift; sourceTree = ""; }; C820A80F1EB4DA5900D431BC /* Sequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sequence.swift; sourceTree = ""; }; C820A8101EB4DA5900D431BC /* Range.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Range.swift; sourceTree = ""; }; C820A8111EB4DA5900D431BC /* Using.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Using.swift; sourceTree = ""; }; C820A8121EB4DA5900D431BC /* Repeat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repeat.swift; sourceTree = ""; }; C820A8131EB4DA5900D431BC /* Deferred.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deferred.swift; sourceTree = ""; }; C820A8141EB4DA5900D431BC /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = ""; }; C820A8151EB4DA5900D431BC /* Just.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Just.swift; sourceTree = ""; }; C820A8161EB4DA5900D431BC /* Never.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Never.swift; sourceTree = ""; }; C820A8171EB4DA5900D431BC /* Empty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = ""; }; C820A8181EB4DA5900D431BC /* Create.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Create.swift; sourceTree = ""; }; C820A8191EB4DA5900D431BC /* SubscribeOn.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscribeOn.swift; sourceTree = ""; }; C820A81A1EB4DA5900D431BC /* ObserveOn.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObserveOn.swift; sourceTree = ""; }; C820A81D1EB4DA5900D431BC /* Multicast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Multicast.swift; sourceTree = ""; }; C820A81F1EB4DA5900D431BC /* Reduce.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reduce.swift; sourceTree = ""; }; C820A8201EB4DA5900D431BC /* ToArray.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToArray.swift; sourceTree = ""; }; C820A8211EB4DA5900D431BC /* AsMaybe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsMaybe.swift; sourceTree = ""; }; C820A8221EB4DA5900D431BC /* AsSingle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsSingle.swift; sourceTree = ""; }; C820A8231EB4DA5900D431BC /* AddRef.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddRef.swift; sourceTree = ""; }; C820A8241EB4DA5900D431BC /* CombineLatest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombineLatest.swift; sourceTree = ""; }; C820A8251EB4DA5900D431BC /* CombineLatest+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CombineLatest+arity.swift"; sourceTree = ""; }; C820A8261EB4DA5900D431BC /* CombineLatest+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "CombineLatest+arity.tt"; sourceTree = ""; }; C820A8271EB4DA5900D431BC /* Producer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Producer.swift; sourceTree = ""; }; C820A8281EB4DA5900D431BC /* Sink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sink.swift; sourceTree = ""; }; C820A8291EB4DA5900D431BC /* Zip.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Zip.swift; sourceTree = ""; }; C820A82A1EB4DA5900D431BC /* Zip+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Zip+arity.swift"; sourceTree = ""; }; C820A82B1EB4DA5900D431BC /* Zip+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Zip+arity.tt"; sourceTree = ""; }; C820A9491EB4E75E00D431BC /* Observable+AmbTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+AmbTests.swift"; sourceTree = ""; }; C820A94D1EB4EC3C00D431BC /* Observable+ReduceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ReduceTests.swift"; sourceTree = ""; }; C820A9511EB4ECC000D431BC /* Observable+ToArrayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ToArrayTests.swift"; sourceTree = ""; }; C820A9551EB4ED7C00D431BC /* Observable+MulticastTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+MulticastTests.swift"; sourceTree = ""; }; C820A9611EB4EFD300D431BC /* Observable+ObserveOnTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ObserveOnTests.swift"; sourceTree = ""; }; C820A9651EB4F39500D431BC /* Observable+SubscribeOnTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SubscribeOnTests.swift"; sourceTree = ""; }; C820A9691EB4F64800D431BC /* Observable+JustTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+JustTests.swift"; sourceTree = ""; }; C820A96D1EB4F7AC00D431BC /* Observable+SequenceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SequenceTests.swift"; sourceTree = ""; }; C820A9711EB4F84000D431BC /* Observable+OptionalTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+OptionalTests.swift"; sourceTree = ""; }; C820A9751EB4F92100D431BC /* Observable+GenerateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+GenerateTests.swift"; sourceTree = ""; }; C820A9791EB4FA0800D431BC /* Observable+RangeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+RangeTests.swift"; sourceTree = ""; }; C820A97D1EB4FA5A00D431BC /* Observable+RepeatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+RepeatTests.swift"; sourceTree = ""; }; C820A9811EB4FB0400D431BC /* Observable+UsingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+UsingTests.swift"; sourceTree = ""; }; C820A9851EB4FB5B00D431BC /* Observable+DebugTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DebugTests.swift"; sourceTree = ""; }; C820A9891EB4FBD600D431BC /* Observable+CatchTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+CatchTests.swift"; sourceTree = ""; }; C820A98D1EB4FCC400D431BC /* Observable+SwitchTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SwitchTests.swift"; sourceTree = ""; }; C820A9911EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SwitchIfEmptyTests.swift"; sourceTree = ""; }; C820A9951EB4FF7000D431BC /* Observable+ConcatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ConcatTests.swift"; sourceTree = ""; }; C820A9991EB5001C00D431BC /* Observable+MergeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+MergeTests.swift"; sourceTree = ""; }; C820A9A11EB5011700D431BC /* Observable+TakeUntilTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+TakeUntilTests.swift"; sourceTree = ""; }; C820A9A51EB5056C00D431BC /* Observable+SkipUntilTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SkipUntilTests.swift"; sourceTree = ""; }; C820A9A91EB505A800D431BC /* Observable+WithLatestFromTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+WithLatestFromTests.swift"; sourceTree = ""; }; C820A9AD1EB5073E00D431BC /* Observable+FilterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+FilterTests.swift"; sourceTree = ""; }; C820A9B11EB507D300D431BC /* Observable+TakeWhileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+TakeWhileTests.swift"; sourceTree = ""; }; C820A9B51EB5081400D431BC /* Observable+MapTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+MapTests.swift"; sourceTree = ""; }; C820A9B91EB5097700D431BC /* Observable+TakeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+TakeTests.swift"; sourceTree = ""; }; C820A9BD1EB509B500D431BC /* Observable+TakeLastTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+TakeLastTests.swift"; sourceTree = ""; }; C820A9C11EB509FC00D431BC /* Observable+SkipTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SkipTests.swift"; sourceTree = ""; }; C820A9C51EB50A4200D431BC /* Observable+SkipWhileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SkipWhileTests.swift"; sourceTree = ""; }; C820A9C91EB50A7100D431BC /* Observable+ElementAtTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ElementAtTests.swift"; sourceTree = ""; }; C820A9CD1EB50AD400D431BC /* Observable+SingleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SingleTests.swift"; sourceTree = ""; }; C820A9D11EB50B0900D431BC /* Observable+GroupByTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+GroupByTests.swift"; sourceTree = ""; }; C820A9D51EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DistinctUntilChangedTests.swift"; sourceTree = ""; }; C820A9D91EB50CAA00D431BC /* Observable+DoOnTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DoOnTests.swift"; sourceTree = ""; }; C820A9DD1EB50CF800D431BC /* Observable+ThrottleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ThrottleTests.swift"; sourceTree = ""; }; C820A9E11EB50D6C00D431BC /* Observable+SampleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SampleTests.swift"; sourceTree = ""; }; C820A9E51EB50DB900D431BC /* Observable+TimerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+TimerTests.swift"; sourceTree = ""; }; C820A9E91EB50E3400D431BC /* Observable+RetryWhenTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+RetryWhenTests.swift"; sourceTree = ""; }; C820A9ED1EB50EA100D431BC /* Observable+ScanTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ScanTests.swift"; sourceTree = ""; }; C820A9F11EB5109300D431BC /* Observable+DefaultIfEmpty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DefaultIfEmpty.swift"; sourceTree = ""; }; C820A9F91EB510D500D431BC /* Observable+MaterializeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+MaterializeTests.swift"; sourceTree = ""; }; C820A9FD1EB5110E00D431BC /* Observable+DematerializeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DematerializeTests.swift"; sourceTree = ""; }; C820AA011EB5134000D431BC /* Observable+DelaySubscriptionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DelaySubscriptionTests.swift"; sourceTree = ""; }; C820AA051EB5139C00D431BC /* Observable+BufferTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+BufferTests.swift"; sourceTree = ""; }; C820AA091EB513C800D431BC /* Observable+WindowTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+WindowTests.swift"; sourceTree = ""; }; C820AA0D1EB5140100D431BC /* Observable+TimeoutTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+TimeoutTests.swift"; sourceTree = ""; }; C820AA111EB5145200D431BC /* Observable+DelayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DelayTests.swift"; sourceTree = ""; }; C822BAC51DB4048F00F98810 /* Event+Test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Event+Test.swift"; sourceTree = ""; }; C822BACD1DB424EC00F98810 /* Reactive+Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Reactive+Tests.swift"; sourceTree = ""; }; C82FF0EE1F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ObservableType+SubscriptionTests.swift"; sourceTree = ""; }; C8323A8D1E33FD5200CC0C7F /* Resources.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Resources.swift; sourceTree = ""; }; C834F6C11DB394E100C29244 /* Observable+BlockingTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+BlockingTest.swift"; sourceTree = ""; }; C834F6C51DB3950600C29244 /* NSControl+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSControl+RxTests.swift"; sourceTree = ""; }; C83508C31C386F6F0027C24C /* AllTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AllTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C83508DD1C38706D0027C24C /* ControlEventTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlEventTests.swift; sourceTree = ""; }; C83508DE1C38706D0027C24C /* ControlPropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlPropertyTests.swift; sourceTree = ""; }; C83508DF1C38706D0027C24C /* DelegateProxyTest+Cocoa.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "DelegateProxyTest+Cocoa.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C83508E01C38706D0027C24C /* DelegateProxyTest+UIKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "DelegateProxyTest+UIKit.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C83508E11C38706D0027C24C /* DelegateProxyTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateProxyTest.swift; sourceTree = ""; }; C83508E41C38706D0027C24C /* KVOObservableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KVOObservableTests.swift; sourceTree = ""; }; C83508E51C38706D0027C24C /* NSLayoutConstraint+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSLayoutConstraint+RxTests.swift"; sourceTree = ""; }; C83508E61C38706D0027C24C /* NotificationCenterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationCenterTests.swift; sourceTree = ""; }; C83508E71C38706D0027C24C /* NSObject+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSObject+RxTests.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C83508E81C38706D0027C24C /* NSView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSView+RxTests.swift"; sourceTree = ""; }; C83508E91C38706D0027C24C /* RuntimeStateSnapshot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RuntimeStateSnapshot.swift; sourceTree = ""; }; C83508EA1C38706D0027C24C /* RXObjCRuntime+Testing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RXObjCRuntime+Testing.h"; sourceTree = ""; }; C83508EB1C38706D0027C24C /* RXObjCRuntime+Testing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RXObjCRuntime+Testing.m"; sourceTree = ""; }; C83508EC1C38706D0027C24C /* RxObjCRuntimeState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxObjCRuntimeState.swift; sourceTree = ""; }; C83508ED1C38706D0027C24C /* RxTest-iOS-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RxTest-iOS-Bridging-Header.h"; sourceTree = ""; }; C83508EE1C38706D0027C24C /* RxTest-macOS-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RxTest-macOS-Bridging-Header.h"; sourceTree = ""; }; C83508EF1C38706D0027C24C /* RxTest-tvOS-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RxTest-tvOS-Bridging-Header.h"; sourceTree = ""; }; C83508F01C38706D0027C24C /* SentMessageTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentMessageTest.swift; sourceTree = ""; }; C83508F11C38706D0027C24C /* UIView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+RxTests.swift"; sourceTree = ""; }; C83508F41C38706D0027C24C /* ElementIndexPair.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ElementIndexPair.swift; sourceTree = ""; }; C83508F51C38706D0027C24C /* EquatableArray.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EquatableArray.swift; sourceTree = ""; }; C83508F71C38706D0027C24C /* BackgroundThreadPrimitiveHotObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackgroundThreadPrimitiveHotObservable.swift; sourceTree = ""; }; C83508F81C38706D0027C24C /* MainThreadPrimitiveHotObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainThreadPrimitiveHotObservable.swift; sourceTree = ""; }; C83508F91C38706D0027C24C /* MockDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockDisposable.swift; sourceTree = ""; }; C83508FA1C38706D0027C24C /* MySubject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MySubject.swift; sourceTree = ""; }; C83508FB1C38706D0027C24C /* Observable.Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Observable.Extensions.swift; sourceTree = ""; }; C83508FC1C38706D0027C24C /* PrimitiveHotObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrimitiveHotObservable.swift; sourceTree = ""; }; C83508FD1C38706D0027C24C /* PrimitiveMockObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrimitiveMockObserver.swift; sourceTree = ""; }; C83508FE1C38706D0027C24C /* TestConnectableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestConnectableObservable.swift; sourceTree = ""; }; C83508FF1C38706D0027C24C /* Observable+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Extensions.swift"; sourceTree = ""; }; C83509001C38706D0027C24C /* TestVirtualScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestVirtualScheduler.swift; sourceTree = ""; }; C83509021C38706D0027C24C /* Observable+Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Tests.swift"; sourceTree = ""; }; C83509031C38706D0027C24C /* AssumptionsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssumptionsTest.swift; sourceTree = ""; }; C83509041C38706D0027C24C /* BagTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BagTest.swift; sourceTree = ""; }; C83509051C38706D0027C24C /* BehaviorSubjectTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BehaviorSubjectTest.swift; sourceTree = ""; }; C83509061C38706D0027C24C /* CurrentThreadSchedulerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentThreadSchedulerTest.swift; sourceTree = ""; }; C83509071C38706D0027C24C /* DisposableTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisposableTest.swift; sourceTree = ""; }; C83509081C38706D0027C24C /* HistoricalSchedulerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoricalSchedulerTest.swift; sourceTree = ""; }; C83509091C38706D0027C24C /* MainSchedulerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainSchedulerTests.swift; sourceTree = ""; }; C835090F1C38706D0027C24C /* Observable+CombineLatestTests+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+CombineLatestTests+arity.swift"; sourceTree = ""; }; C83509101C38706D0027C24C /* Observable+CombineLatestTests+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Observable+CombineLatestTests+arity.tt"; sourceTree = ""; }; C83509111C38706D0027C24C /* Observable+ZipTests+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ZipTests+arity.swift"; sourceTree = ""; }; C83509121C38706D0027C24C /* Observable+ZipTests+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Observable+ZipTests+arity.tt"; sourceTree = ""; }; C83509161C38706D0027C24C /* Observable+SubscriptionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+SubscriptionTest.swift"; sourceTree = ""; }; C83509181C38706D0027C24C /* ObserverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObserverTests.swift; sourceTree = ""; }; C83509191C38706D0027C24C /* QueueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueueTests.swift; sourceTree = ""; }; C835091A1C38706D0027C24C /* SubjectConcurrencyTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubjectConcurrencyTest.swift; sourceTree = ""; }; C835091C1C38706D0027C24C /* VirtualSchedulerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VirtualSchedulerTest.swift; sourceTree = ""; }; C83509841C38740E0027C24C /* AllTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AllTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C83509941C38742C0027C24C /* AllTests-macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AllTests-macOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C8353CDB1DA19BA000BE3F5C /* MessageProcessingStage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageProcessingStage.swift; sourceTree = ""; }; C8353CE01DA19BC500BE3F5C /* Recorded+Timeless.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Recorded+Timeless.swift"; sourceTree = ""; }; C8353CE11DA19BC500BE3F5C /* TestErrors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestErrors.swift; sourceTree = ""; }; C8353CE21DA19BC500BE3F5C /* XCTest+AllTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTest+AllTests.swift"; sourceTree = ""; }; C8379EF31D1DD326003EF8FC /* UIButton+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+RxTests.swift"; sourceTree = ""; }; C83D73B41C1DBAEE003DC470 /* InvocableScheduledItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvocableScheduledItem.swift; sourceTree = ""; }; C83D73B51C1DBAEE003DC470 /* InvocableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvocableType.swift; sourceTree = ""; }; C83D73B61C1DBAEE003DC470 /* ScheduledItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduledItem.swift; sourceTree = ""; }; C83D73B71C1DBAEE003DC470 /* ScheduledItemType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduledItemType.swift; sourceTree = ""; }; C849BE2A1BAB5D070019AD27 /* ObservableConvertibleType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObservableConvertibleType.swift; sourceTree = ""; }; C84CC54D1BDCF48200E06A64 /* LockOwnerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockOwnerType.swift; sourceTree = ""; }; C84CC5521BDCF49300E06A64 /* SynchronizedOnType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronizedOnType.swift; sourceTree = ""; }; C84CC55C1BDD010800E06A64 /* SynchronizedUnsubscribeType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronizedUnsubscribeType.swift; sourceTree = ""; }; C84CC5611BDD037900E06A64 /* SynchronizedDisposeType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronizedDisposeType.swift; sourceTree = ""; }; C84CC5661BDD08A500E06A64 /* SubscriptionDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionDisposable.swift; sourceTree = ""; }; C85217E81E3374970015DD38 /* GroupedObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupedObservable.swift; sourceTree = ""; }; C85217F41E33F9D70015DD38 /* RecursiveLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RecursiveLock.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C85217F61E33FBBE0015DD38 /* RecursiveLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RecursiveLock.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C85217FB1E33FBFB0015DD38 /* RecursiveLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RecursiveLock.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C85218001E33FC160015DD38 /* RecursiveLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RecursiveLock.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C85218041E33FCA50015DD38 /* Resources.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Resources.swift; sourceTree = ""; }; C8550B4A1D95A41400A6FCFE /* Reactive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reactive.swift; sourceTree = ""; }; C8561B651DFE1169005E97F1 /* ExampleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleTests.swift; sourceTree = ""; }; C85B01671DB2ACAF006043C3 /* Platform.Darwin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Platform.Darwin.swift; sourceTree = ""; }; C85B01681DB2ACAF006043C3 /* Platform.Linux.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Platform.Linux.swift; sourceTree = ""; }; C85B01721DB2ACF2006043C3 /* Platform.Darwin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Platform.Darwin.swift; sourceTree = ""; }; C85B01731DB2ACF2006043C3 /* Platform.Linux.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Platform.Linux.swift; sourceTree = ""; }; C85BA04B1C3878740075D68E /* Microoptimizations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Microoptimizations.app; sourceTree = BUILT_PRODUCTS_DIR; }; C85E6FBB1F52FF4F00C5681E /* Signal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Signal.swift; sourceTree = ""; }; C85E6FBD1F53025700C5681E /* SchedulerType+SharedSequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SchedulerType+SharedSequence.swift"; sourceTree = ""; }; C86781471DB8119900B2029A /* Bag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bag.swift; sourceTree = ""; }; C86781481DB8119900B2029A /* InfiniteSequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfiniteSequence.swift; sourceTree = ""; }; C86781491DB8119900B2029A /* PriorityQueue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriorityQueue.swift; sourceTree = ""; }; C867814A1DB8119900B2029A /* Queue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Queue.swift; sourceTree = ""; }; C867816C1DB8129E00B2029A /* Bag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bag.swift; sourceTree = ""; }; C867816D1DB8129E00B2029A /* InfiniteSequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfiniteSequence.swift; sourceTree = ""; }; C867816E1DB8129E00B2029A /* PriorityQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PriorityQueue.swift; sourceTree = ""; }; C867816F1DB8129E00B2029A /* Queue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Queue.swift; sourceTree = ""; }; C86781821DB8143A00B2029A /* Bag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bag.swift; sourceTree = ""; }; C86781871DB814AD00B2029A /* Bag+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Bag+Rx.swift"; sourceTree = ""; }; C86781911DB823B500B2029A /* NSButton+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSButton+Rx.swift"; sourceTree = ""; }; C86781921DB823B500B2029A /* NSControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSControl+Rx.swift"; sourceTree = ""; }; C86781941DB823B500B2029A /* NSSlider+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSSlider+Rx.swift"; sourceTree = ""; }; C86781951DB823B500B2029A /* NSTextField+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextField+Rx.swift"; sourceTree = ""; }; C86781961DB823B500B2029A /* NSView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSView+Rx.swift"; sourceTree = ""; }; C86B1E211D42BF5200130546 /* SchedulerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulerTests.swift; sourceTree = ""; }; C8802DD31F8CD47F001D677E /* UIControl+RxTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+RxTests.swift"; sourceTree = ""; }; C88253F11B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewReactiveArrayDataSource.swift; sourceTree = ""; }; C88253F21B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewReactiveArrayDataSource.swift; sourceTree = ""; }; C88253F41B8A752B00B02D69 /* ItemEvents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemEvents.swift; sourceTree = ""; }; C88253F71B8A752B00B02D69 /* RxCollectionViewDataSourceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDataSourceType.swift; sourceTree = ""; }; C88253F81B8A752B00B02D69 /* RxTableViewDataSourceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewDataSourceType.swift; sourceTree = ""; }; C88253FC1B8A752B00B02D69 /* RxCollectionViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxCollectionViewDataSourceProxy.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C88253FD1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDelegateProxy.swift; sourceTree = ""; }; C88253FE1B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxScrollViewDelegateProxy.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C88253FF1B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxSearchBarDelegateProxy.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C88254001B8A752B00B02D69 /* RxTableViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RxTableViewDataSourceProxy.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C88254011B8A752B00B02D69 /* RxTableViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewDelegateProxy.swift; sourceTree = ""; }; C88254021B8A752B00B02D69 /* RxTextViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTextViewDelegateProxy.swift; sourceTree = ""; }; C88254051B8A752B00B02D69 /* UIBarButtonItem+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UIBarButtonItem+Rx.swift"; sourceTree = ""; }; C88254061B8A752B00B02D69 /* UIButton+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+Rx.swift"; sourceTree = ""; }; C88254071B8A752B00B02D69 /* UICollectionView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UICollectionView+Rx.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C88254081B8A752B00B02D69 /* UIControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UIControl+Rx.swift"; sourceTree = ""; }; C88254091B8A752B00B02D69 /* UIDatePicker+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDatePicker+Rx.swift"; sourceTree = ""; }; C882540A1B8A752B00B02D69 /* UIGestureRecognizer+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIGestureRecognizer+Rx.swift"; sourceTree = ""; }; C882540D1B8A752B00B02D69 /* UIScrollView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UIScrollView+Rx.swift"; sourceTree = ""; }; C882540E1B8A752B00B02D69 /* UISearchBar+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UISearchBar+Rx.swift"; sourceTree = ""; }; C882540F1B8A752B00B02D69 /* UISegmentedControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISegmentedControl+Rx.swift"; sourceTree = ""; }; C88254101B8A752B00B02D69 /* UISlider+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISlider+Rx.swift"; sourceTree = ""; }; C88254111B8A752B00B02D69 /* UISwitch+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISwitch+Rx.swift"; sourceTree = ""; }; C88254121B8A752B00B02D69 /* UITableView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UITableView+Rx.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C88254131B8A752B00B02D69 /* UITextField+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextField+Rx.swift"; sourceTree = ""; }; C88254141B8A752B00B02D69 /* UITextView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UITextView+Rx.swift"; sourceTree = ""; }; C8845AD31EDB4C9900B36836 /* ShareReplayScope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShareReplayScope.swift; sourceTree = ""; }; C8845AD91EDB607800B36836 /* Observable+ShareReplayScopeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+ShareReplayScopeTests.swift"; sourceTree = ""; }; C88E296A1BEB712E001CCB92 /* RunLoopLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopLock.swift; sourceTree = ""; }; C88F76801CE5341700D5A014 /* TextInput.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextInput.swift; sourceTree = ""; }; C88FA50C1C25C44800CCFEA4 /* RxTest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxTest.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C8941BDE1BD5695C00A0E874 /* BlockingObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockingObservable.swift; sourceTree = ""; }; C8941BE31BD56B0700A0E874 /* BlockingObservable+Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "BlockingObservable+Operators.swift"; sourceTree = ""; }; C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+CombineLatestTests.swift"; sourceTree = ""; }; C89814751E75A18A0035949C /* PrimitiveSequence+Zip+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PrimitiveSequence+Zip+arity.tt"; sourceTree = ""; }; C89814771E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PrimitiveSequence+Zip+arity.swift"; sourceTree = ""; }; C898147C1E75A98A0035949C /* PrimitiveSequenceTest+zip+arity.tt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "PrimitiveSequenceTest+zip+arity.tt"; sourceTree = ""; }; C898147D1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PrimitiveSequenceTest+zip+arity.swift"; sourceTree = ""; }; C89AB1711DAAC1680065FBE6 /* ControlTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlTarget.swift; sourceTree = ""; }; C89AB1A51DAAC25A0065FBE6 /* RxCocoaObjCRuntimeError+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RxCocoaObjCRuntimeError+Extensions.swift"; sourceTree = ""; }; C89AB1AB1DAAC3350065FBE6 /* ControlEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlEvent.swift; sourceTree = ""; }; C89AB1AC1DAAC3350065FBE6 /* ControlProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlProperty.swift; sourceTree = ""; }; C89AB1AE1DAAC3350065FBE6 /* ControlEvent+Driver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ControlEvent+Driver.swift"; sourceTree = ""; }; C89AB1AF1DAAC3350065FBE6 /* ControlProperty+Driver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ControlProperty+Driver.swift"; sourceTree = ""; }; C89AB1B01DAAC3350065FBE6 /* Driver+Subscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Driver+Subscription.swift"; sourceTree = ""; }; C89AB1B11DAAC3350065FBE6 /* Driver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Driver.swift; sourceTree = ""; }; C89AB1B21DAAC3350065FBE6 /* ObservableConvertibleType+Driver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+Driver.swift"; sourceTree = ""; }; C89AB1B61DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SharedSequence+Operators+arity.swift"; sourceTree = ""; }; C89AB1B71DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SharedSequence+Operators+arity.tt"; sourceTree = ""; }; C89AB1B81DAAC3350065FBE6 /* SharedSequence+Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SharedSequence+Operators.swift"; sourceTree = ""; }; C89AB1B91DAAC3350065FBE6 /* SharedSequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharedSequence.swift; sourceTree = ""; }; C89AB1BD1DAAC3350065FBE6 /* KVORepresentable+CoreGraphics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "KVORepresentable+CoreGraphics.swift"; sourceTree = ""; }; C89AB1BE1DAAC3350065FBE6 /* KVORepresentable+Swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "KVORepresentable+Swift.swift"; sourceTree = ""; }; C89AB1BF1DAAC3350065FBE6 /* KVORepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KVORepresentable.swift; sourceTree = ""; }; C89AB1C11DAAC3350065FBE6 /* NotificationCenter+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NotificationCenter+Rx.swift"; sourceTree = ""; }; C89AB1C21DAAC3350065FBE6 /* NSObject+Rx+KVORepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSObject+Rx+KVORepresentable.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C89AB1C31DAAC3350065FBE6 /* NSObject+Rx+RawRepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSObject+Rx+RawRepresentable.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C89AB1C41DAAC3350065FBE6 /* NSObject+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSObject+Rx.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C89AB1C51DAAC3350065FBE6 /* URLSession+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "URLSession+Rx.swift"; sourceTree = ""; }; C89AB2261DAAC33F0065FBE6 /* RxCocoa.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCocoa.swift; sourceTree = ""; }; C89AB22D1DAAC3A60065FBE6 /* _RX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RX.m; sourceTree = ""; }; C89AB22F1DAAC3A60065FBE6 /* _RXDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RXDelegateProxy.m; sourceTree = ""; }; C89AB2311DAAC3A60065FBE6 /* _RXKVOObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RXKVOObserver.m; sourceTree = ""; }; C89AB2331DAAC3A60065FBE6 /* _RXObjCRuntime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RXObjCRuntime.m; sourceTree = ""; }; C89AB2551DAACC580065FBE6 /* _RX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RX.h; sourceTree = ""; }; C89AB2561DAACC580065FBE6 /* _RXDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RXDelegateProxy.h; sourceTree = ""; }; C89AB2571DAACC580065FBE6 /* _RXKVOObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RXKVOObserver.h; sourceTree = ""; }; C89AB2581DAACC580065FBE6 /* _RXObjCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RXObjCRuntime.h; sourceTree = ""; }; C89AB2731DAACCE30065FBE6 /* RxCocoaRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RxCocoaRuntime.h; sourceTree = ""; }; C89AB2781DAACE490065FBE6 /* RxCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RxCocoa.h; sourceTree = ""; }; C89CFA0B1DAAB4670079D23B /* RxTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTest.swift; sourceTree = ""; }; C89CFA101DAABBE20079D23B /* Any+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Any+Equatable.swift"; sourceTree = ""; }; C89CFA111DAABBE20079D23B /* ColdObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColdObservable.swift; sourceTree = ""; }; C89CFA121DAABBE20079D23B /* Event+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Event+Equatable.swift"; sourceTree = ""; }; C89CFA131DAABBE20079D23B /* HotObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HotObservable.swift; sourceTree = ""; }; C89CFA141DAABBE20079D23B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C89CFA151DAABBE20079D23B /* Recorded.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Recorded.swift; sourceTree = ""; }; C89CFA161DAABBE20079D23B /* RxTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTest.swift; sourceTree = ""; }; C89CFA181DAABBE20079D23B /* TestScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestScheduler.swift; sourceTree = ""; }; C89CFA191DAABBE20079D23B /* TestSchedulerVirtualTimeConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestSchedulerVirtualTimeConverter.swift; sourceTree = ""; }; C89CFA1A1DAABBE20079D23B /* Subscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Subscription.swift; sourceTree = ""; }; C89CFA1B1DAABBE20079D23B /* TestableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestableObservable.swift; sourceTree = ""; }; C89CFA1C1DAABBE20079D23B /* TestableObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestableObserver.swift; sourceTree = ""; }; C89CFA1D1DAABBE20079D23B /* XCTest+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTest+Rx.swift"; sourceTree = ""; }; C8A53ADF1F09178700490535 /* Completable+AndThen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Completable+AndThen.swift"; sourceTree = ""; }; C8A53AE41F09292A00490535 /* Completable+AndThen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Completable+AndThen.swift"; sourceTree = ""; }; C8A56AD71AD7424700B4673B /* RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C8A81C9F1E05E82C0008DEF4 /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+Extensions.swift"; sourceTree = ""; }; C8A9B6F31DAD752200C9B027 /* Observable+BindTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+BindTests.swift"; sourceTree = ""; }; C8ADC18D2200F9B000B611D4 /* Atomic+Overrides.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Atomic+Overrides.swift"; sourceTree = ""; }; C8B0F70C1F530A1700548EBE /* SharingSchedulerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingSchedulerTests.swift; sourceTree = ""; }; C8B0F7101F530CA700548EBE /* PublishRelay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublishRelay.swift; sourceTree = ""; }; C8B0F7211F53135100548EBE /* ObservableConvertibleType+Signal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ObservableConvertibleType+Signal.swift"; sourceTree = ""; }; C8B144FA1BD2D44500267DCE /* ConcurrentMainScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConcurrentMainScheduler.swift; sourceTree = ""; }; C8B290841C94D55600E923D0 /* RxTest+Controls.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RxTest+Controls.swift"; sourceTree = ""; }; C8B2908C1C94D6C500E923D0 /* UISearchBar+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISearchBar+RxTests.swift"; sourceTree = ""; }; C8BAA78C1E34F8D400EEC727 /* RecursiveLockTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecursiveLockTest.swift; sourceTree = ""; }; C8BF34C91C2E426800416CAE /* Platform.Darwin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Platform.Darwin.swift; sourceTree = ""; }; C8BF34CA1C2E426800416CAE /* Platform.Linux.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Platform.Linux.swift; sourceTree = ""; }; C8C217D41CB7100E0038A2E6 /* UITableView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableView+RxTests.swift"; sourceTree = ""; }; C8C217D61CB710200038A2E6 /* UICollectionView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UICollectionView+RxTests.swift"; sourceTree = ""; }; C8C3DA0E1B939767004D233E /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CurrentThreadScheduler.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8C4F15C1DE9CAEE00003FA7 /* UIBarButtonItem+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIBarButtonItem+RxTests.swift"; sourceTree = ""; }; C8C4F15E1DE9CC5B00003FA7 /* UISwitch+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISwitch+RxTests.swift"; sourceTree = ""; }; C8C4F1601DE9CD1600003FA7 /* UILabel+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+RxTests.swift"; sourceTree = ""; }; C8C4F1621DE9D0A800003FA7 /* UIProgressView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIProgressView+RxTests.swift"; sourceTree = ""; }; C8C4F1641DE9D3FB00003FA7 /* UIGestureRecognizer+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIGestureRecognizer+RxTests.swift"; sourceTree = ""; }; C8C4F1661DE9D44600003FA7 /* UISegmentedControl+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISegmentedControl+RxTests.swift"; sourceTree = ""; }; C8C4F1681DE9D48F00003FA7 /* UIActivityIndicatorView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIActivityIndicatorView+RxTests.swift"; sourceTree = ""; }; C8C4F16A1DE9D4C100003FA7 /* UIAlertAction+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIAlertAction+RxTests.swift"; sourceTree = ""; }; C8C4F16C1DE9D4F400003FA7 /* UIDatePicker+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDatePicker+RxTests.swift"; sourceTree = ""; }; C8C4F16E1DE9D5E000003FA7 /* UISlider+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UISlider+RxTests.swift"; sourceTree = ""; }; C8C4F1701DE9D68000003FA7 /* UIStepper+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIStepper+RxTests.swift"; sourceTree = ""; }; C8C4F1721DE9D7A300003FA7 /* NSTextField+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextField+RxTests.swift"; sourceTree = ""; }; C8C4F1741DE9D80A00003FA7 /* NSSlider+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSSlider+RxTests.swift"; sourceTree = ""; }; C8C4F1761DE9D84900003FA7 /* NSButton+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSButton+RxTests.swift"; sourceTree = ""; }; C8C8BCCE1F8944B800501D4D /* BehaviorRelay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BehaviorRelay.swift; sourceTree = ""; }; C8C8BCD31F89459300501D4D /* BehaviorRelay+Driver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BehaviorRelay+Driver.swift"; sourceTree = ""; }; C8D132431C42D15E00B59FFF /* SectionedViewDataSourceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SectionedViewDataSourceType.swift; sourceTree = ""; }; C8D970CD1F5324D90058F2FE /* Signal+Subscription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Signal+Subscription.swift"; sourceTree = ""; }; C8D970DC1F532FD10058F2FE /* Signal+Test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Signal+Test.swift"; sourceTree = ""; }; C8D970DD1F532FD10058F2FE /* SharedSequence+Test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SharedSequence+Test.swift"; sourceTree = ""; }; C8D970DE1F532FD20058F2FE /* Driver+Test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Driver+Test.swift"; sourceTree = ""; }; C8D970E01F532FD20058F2FE /* SectionedViewDataSourceMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SectionedViewDataSourceMock.swift; sourceTree = ""; }; C8D970E11F532FD20058F2FE /* SharedSequence+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SharedSequence+Extensions.swift"; sourceTree = ""; }; C8D970E21F532FD30058F2FE /* SharedSequence+OperatorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SharedSequence+OperatorTest.swift"; sourceTree = ""; }; C8E390621F379041004FC993 /* Enumerated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Enumerated.swift; sourceTree = ""; }; C8E390671F379386004FC993 /* Observable+EnumeratedTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+EnumeratedTests.swift"; sourceTree = ""; }; C8E65EFA1F6E91D1004478C3 /* Binder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Binder.swift; path = ../../RxSwift/Binder.swift; sourceTree = ""; }; C8E8BA551E2C181A00A4AC2C /* Benchmarks.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Benchmarks.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C8E8BA621E2C186200A4AC2C /* Benchmarks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Benchmarks.swift; sourceTree = ""; }; C8E8BA631E2C186200A4AC2C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C8E8BA6E1E2C18AE00A4AC2C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C8E8BA6F1E2C18AE00A4AC2C /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; C8E8BA701E2C18AE00A4AC2C /* PerformanceTools.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = PerformanceTools.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8F03F401DBB98DB00AECC4C /* Anomalies.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Anomalies.swift; sourceTree = ""; }; C8F03F441DBBA61B00AECC4C /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+Extensions.swift"; sourceTree = ""; }; C8F03F491DBBAC0A00AECC4C /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = SOURCE_ROOT; }; C8F03F4E1DBBAE9400AECC4C /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = SOURCE_ROOT; }; C8F27DAC1CE6710900D5FB4F /* UITextField+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextField+RxTests.swift"; sourceTree = ""; }; C8F27DB11CE6711600D5FB4F /* UITextView+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextView+RxTests.swift"; sourceTree = ""; }; C8FA89121C30405400CD3A17 /* VirtualTimeConverterType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VirtualTimeConverterType.swift; sourceTree = ""; }; C8FA89131C30405400CD3A17 /* VirtualTimeScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VirtualTimeScheduler.swift; sourceTree = ""; }; C8FA89161C30409900CD3A17 /* HistoricalScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoricalScheduler.swift; sourceTree = ""; }; C8FA891B1C30412A00CD3A17 /* HistoricalSchedulerTimeConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoricalSchedulerTimeConverter.swift; sourceTree = ""; }; CB883B3F1BE24C15000AC2EE /* RefCountDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefCountDisposable.swift; sourceTree = ""; }; CB883B441BE256D4000AC2EE /* BooleanDisposable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BooleanDisposable.swift; sourceTree = ""; }; CD8F7AC427BA9187001574EB /* Infallible+Driver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+Driver.swift"; sourceTree = ""; }; CDDEF1691D4FB40000CA8546 /* Disposables.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Disposables.swift; sourceTree = ""; }; D040ADC12D5E408700A1E6B3 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = Sources/RxCocoa/PrivacyInfo.xcprivacy; sourceTree = SOURCE_ROOT; }; D040ADC32D5E409700A1E6B3 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = Sources/RxRelay/PrivacyInfo.xcprivacy; sourceTree = SOURCE_ROOT; }; D040ADC52D5E442300A1E6B3 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = Sources/RxSwift/PrivacyInfo.xcprivacy; sourceTree = SOURCE_ROOT; }; D9080ACD1EA05A16002B433B /* RxNavigationControllerDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxNavigationControllerDelegateProxy.swift; sourceTree = ""; }; D9080AD21EA05DDF002B433B /* UINavigationController+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Rx.swift"; sourceTree = ""; }; D9080AD71EA06189002B433B /* UINavigationController+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+RxTests.swift"; sourceTree = ""; }; DB08833426FA9834005805BE /* Observable+Concurrency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Observable+Concurrency.swift"; sourceTree = ""; }; DB08833626FB0637005805BE /* SharedSequence+Concurrency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SharedSequence+Concurrency.swift"; sourceTree = ""; }; DB08833826FB07CB005805BE /* SharedSequence+ConcurrencyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SharedSequence+ConcurrencyTests.swift"; sourceTree = ""; }; DB0B921F26FB3139005CEED9 /* Observable+ConcurrencyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Observable+ConcurrencyTests.swift"; sourceTree = ""; }; DB0B922326FB31C1005CEED9 /* PrimitiveSequence+Concurrency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PrimitiveSequence+Concurrency.swift"; sourceTree = ""; }; DB0B922526FB31EF005CEED9 /* Infallible+Concurrency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+Concurrency.swift"; sourceTree = ""; }; DB0B922726FB343B005CEED9 /* Infallible+ConcurrencyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Infallible+ConcurrencyTests.swift"; sourceTree = ""; }; DB0B922A26FB34D3005CEED9 /* PrimitiveSequence+ConcurrencyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PrimitiveSequence+ConcurrencyTests.swift"; sourceTree = ""; }; DB8157D2264941B200164D4B /* UIApplication+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIApplication+RxTests.swift"; sourceTree = ""; }; DB8157E8264941EB00164D4B /* UIApplication+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIApplication+Rx.swift"; sourceTree = ""; }; ECBBA59A1DF8C0BA00DDDC2E /* UITabBarController+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarController+Rx.swift"; sourceTree = ""; }; ECBBA59D1DF8C0D400DDDC2E /* RxTabBarControllerDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTabBarControllerDelegateProxy.swift; sourceTree = ""; }; ECBBA5A01DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarController+RxTests.swift"; sourceTree = ""; }; F31F35AF1BB4FED800961002 /* UIStepper+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIStepper+Rx.swift"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ A2897D4E225CA1E7004EA481 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C80939631B8A71760088E94D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C8093BB91B8A71F00088E94D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C83508C01C386F6F0027C24C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( C83508C81C386F6F0027C24C /* RxSwift.framework in Frameworks */, A2690E7D22688CAE0032C00E /* RxCocoa.framework in Frameworks */, A2690E7E22688CAE0032C00E /* RxBlocking.framework in Frameworks */, A2690E7F22688CAE0032C00E /* RxTest.framework in Frameworks */, A2690E8022688CAE0032C00E /* RxRelay.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C83509811C38740E0027C24C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( A2690E8122688CB50032C00E /* RxSwift.framework in Frameworks */, A2690E8222688CB50032C00E /* RxCocoa.framework in Frameworks */, A2690E8322688CB50032C00E /* RxBlocking.framework in Frameworks */, A2690E8422688CB50032C00E /* RxTest.framework in Frameworks */, A2690E8522688CB50032C00E /* RxRelay.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C83509911C38742C0027C24C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( A2690E8622688CB80032C00E /* RxSwift.framework in Frameworks */, A2690E8722688CB80032C00E /* RxCocoa.framework in Frameworks */, A2690E8822688CB80032C00E /* RxBlocking.framework in Frameworks */, A2690E8922688CB80032C00E /* RxTest.framework in Frameworks */, A2690E8A22688CB80032C00E /* RxRelay.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C85BA0481C3878740075D68E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C88FA5051C25C44800CCFEA4 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C8A56AD31AD7424700B4673B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C8E8BA521E2C181A00A4AC2C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( C8E8BA5A1E2C181A00A4AC2C /* RxSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 601AE3D81EE24E3800617386 /* SwiftSupport */ = { isa = PBXGroup; children = ( 601AE3D91EE24E4F00617386 /* SwiftSupport.swift */, ); path = SwiftSupport; sourceTree = ""; }; 786DED6424F83F37008C4FAC /* PrimitiveSequence */ = { isa = PBXGroup; children = ( C81A09861E6C702700900B3B /* PrimitiveSequence.swift */, 25F6ECBF1F48C37C008552FA /* Single.swift */, 25F6ECBB1F48C366008552FA /* Maybe.swift */, 25F6ECBD1F48C373008552FA /* Completable.swift */, C89814751E75A18A0035949C /* PrimitiveSequence+Zip+arity.tt */, C89814771E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift */, C8A53ADF1F09178700490535 /* Completable+AndThen.swift */, C801DE411F6EBB29008DB060 /* ObservableType+PrimitiveSequence.swift */, DB0B922326FB31C1005CEED9 /* PrimitiveSequence+Concurrency.swift */, ); path = PrimitiveSequence; sourceTree = ""; }; 786DED6524F83F49008C4FAC /* Infallible */ = { isa = PBXGroup; children = ( 7846F56524F83AF400A39919 /* Infallible.swift */, 786DED6224F83DE5008C4FAC /* ObservableConvertibleType+Infallible.swift */, 786DED6824F8415B008C4FAC /* Infallible+Zip+arity.swift */, 786DED6624F84095008C4FAC /* Infallible+Zip+arity.tt */, 786DED6A24F84432008C4FAC /* Infallible+CombineLatest+arity.tt */, 786DED6B24F844BC008C4FAC /* Infallible+CombineLatest+arity.swift */, 786DED6D24F84623008C4FAC /* Infallible+Operators.swift */, 786DED6F24F847BF008C4FAC /* Infallible+Create.swift */, DB0B922526FB31EF005CEED9 /* Infallible+Concurrency.swift */, 1D858B6529E57EE900CD6814 /* Infallible+CombineLatest+Collection.swift */, ); path = Infallible; sourceTree = ""; }; A2897CB2225CA1C6004EA481 /* RxRelay */ = { isa = PBXGroup; children = ( C8B0F7101F530CA700548EBE /* PublishRelay.swift */, C8C8BCCE1F8944B800501D4D /* BehaviorRelay.swift */, 6A94254923AFC2F300B7A24C /* ReplayRelay.swift */, A2897D61225CA3F3004EA481 /* Observable+Bind.swift */, A2897D68225D023A004EA481 /* Utils.swift */, A2FD4EA4225D0A8100288525 /* Info.plist */, D040ADC32D5E409700A1E6B3 /* PrivacyInfo.xcprivacy */, ); path = RxRelay; sourceTree = ""; }; A2FD4E9A225D04D600288525 /* RxRelayTests */ = { isa = PBXGroup; children = ( A2FD4E9B225D04FF00288525 /* Observable+RelayBindTests.swift */, 6A7D2CD323BBDBDC0038576E /* ReplayRelayTests.swift */, ); path = RxRelayTests; sourceTree = ""; }; C8093C471B8A72BE0088E94D /* RxSwift */ = { isa = PBXGroup; children = ( C85217E81E3374970015DD38 /* GroupedObservable.swift */, C8093C491B8A72BE0088E94D /* Cancelable.swift */, C8093C4D1B8A72BE0088E94D /* ConnectableObservableType.swift */, C8093C521B8A72BE0088E94D /* Disposable.swift */, C8093C631B8A72BE0088E94D /* Errors.swift */, C8093C641B8A72BE0088E94D /* Event.swift */, C8093C651B8A72BE0088E94D /* ImmediateSchedulerType.swift */, C8093C681B8A72BE0088E94D /* Observable.swift */, DB08833426FA9834005805BE /* Observable+Concurrency.swift */, C8093C671B8A72BE0088E94D /* ObservableType+Extensions.swift */, C849BE2A1BAB5D070019AD27 /* ObservableConvertibleType.swift */, C8093C9E1B8A72BE0088E94D /* ObservableType.swift */, C8093CA01B8A72BE0088E94D /* AnyObserver.swift */, C8093CAB1B8A72BE0088E94D /* ObserverType.swift */, C8550B4A1D95A41400A6FCFE /* Reactive.swift */, C8093CAF1B8A72BE0088E94D /* Rx.swift */, C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */, C8093CB31B8A72BE0088E94D /* SchedulerType.swift */, C8BF34C81C2E426800416CAE /* Platform */, C8093C4A1B8A72BE0088E94D /* Concurrency */, C8093C531B8A72BE0088E94D /* Disposables */, C8093C691B8A72BE0088E94D /* Observables */, C8093CA11B8A72BE0088E94D /* Observers */, C8093CB41B8A72BE0088E94D /* Schedulers */, C8093CBD1B8A72BE0088E94D /* Subjects */, C85106851C2D54B70075150C /* Extensions */, 601AE3D81EE24E3800617386 /* SwiftSupport */, C81A09851E6C701700900B3B /* Traits */, C8093C661B8A72BE0088E94D /* Info.plist */, D040ADC52D5E442300A1E6B3 /* PrivacyInfo.xcprivacy */, 1E3EDF64226356A000B631B9 /* Date+Dispatch.swift */, ); path = RxSwift; sourceTree = ""; }; C8093C4A1B8A72BE0088E94D /* Concurrency */ = { isa = PBXGroup; children = ( C8093C4B1B8A72BE0088E94D /* AsyncLock.swift */, C8093C4C1B8A72BE0088E94D /* Lock.swift */, C84CC54D1BDCF48200E06A64 /* LockOwnerType.swift */, C84CC5521BDCF49300E06A64 /* SynchronizedOnType.swift */, C84CC55C1BDD010800E06A64 /* SynchronizedUnsubscribeType.swift */, C84CC5611BDD037900E06A64 /* SynchronizedDisposeType.swift */, ); path = Concurrency; sourceTree = ""; }; C8093C531B8A72BE0088E94D /* Disposables */ = { isa = PBXGroup; children = ( C8093C541B8A72BE0088E94D /* AnonymousDisposable.swift */, C8093C551B8A72BE0088E94D /* BinaryDisposable.swift */, CB883B441BE256D4000AC2EE /* BooleanDisposable.swift */, C8093C571B8A72BE0088E94D /* CompositeDisposable.swift */, C8093C581B8A72BE0088E94D /* DisposeBag.swift */, C8093C591B8A72BE0088E94D /* DisposeBase.swift */, C84CC5661BDD08A500E06A64 /* SubscriptionDisposable.swift */, C8093C5C1B8A72BE0088E94D /* NopDisposable.swift */, CB883B3F1BE24C15000AC2EE /* RefCountDisposable.swift */, C8093C5D1B8A72BE0088E94D /* ScheduledDisposable.swift */, C8093C5F1B8A72BE0088E94D /* SerialDisposable.swift */, C8093C601B8A72BE0088E94D /* SingleAssignmentDisposable.swift */, CDDEF1691D4FB40000CA8546 /* Disposables.swift */, ); path = Disposables; sourceTree = ""; }; C8093C691B8A72BE0088E94D /* Observables */ = { isa = PBXGroup; children = ( C820A8231EB4DA5900D431BC /* AddRef.swift */, C820A8061EB4DA5900D431BC /* Amb.swift */, C820A8211EB4DA5900D431BC /* AsMaybe.swift */, C820A8221EB4DA5900D431BC /* AsSingle.swift */, C820A7EB1EB4DA5900D431BC /* Buffer.swift */, C820A8011EB4DA5900D431BC /* Catch.swift */, C820A8241EB4DA5900D431BC /* CombineLatest.swift */, C820A8251EB4DA5900D431BC /* CombineLatest+arity.swift */, C820A8261EB4DA5900D431BC /* CombineLatest+arity.tt */, C820A80C1EB4DA5900D431BC /* CombineLatest+Collection.swift */, 4C5213A9225D41E60079FC77 /* CompactMap.swift */, C820A8091EB4DA5900D431BC /* Concat.swift */, C820A8181EB4DA5900D431BC /* Create.swift */, C820A7F11EB4DA5900D431BC /* Debounce.swift */, C820A80D1EB4DA5900D431BC /* Debug.swift */, C820A7FE1EB4DA5900D431BC /* DefaultIfEmpty.swift */, C820A8131EB4DA5900D431BC /* Deferred.swift */, C820A7E81EB4DA5900D431BC /* Delay.swift */, C820A7EC1EB4DA5900D431BC /* DelaySubscription.swift */, C820A7FC1EB4DA5900D431BC /* Dematerialize.swift */, C820A8041EB4DA5900D431BC /* DistinctUntilChanged.swift */, C820A8031EB4DA5900D431BC /* Do.swift */, C820A7F61EB4DA5900D431BC /* ElementAt.swift */, C820A8171EB4DA5900D431BC /* Empty.swift */, C8E390621F379041004FC993 /* Enumerated.swift */, C820A8141EB4DA5900D431BC /* Error.swift */, C820A7FB1EB4DA5900D431BC /* Filter.swift */, 819C2F081F2FBC7F009104B6 /* First.swift */, C820A7F31EB4DA5900D431BC /* Generate.swift */, C820A7F41EB4DA5900D431BC /* GroupBy.swift */, C820A8151EB4DA5900D431BC /* Just.swift */, C820A7E61EB4DA5900D431BC /* Map.swift */, C820A7FD1EB4DA5900D431BC /* Materialize.swift */, C820A7F71EB4DA5900D431BC /* Merge.swift */, C820A81D1EB4DA5900D431BC /* Multicast.swift */, C820A8161EB4DA5900D431BC /* Never.swift */, C820A81A1EB4DA5900D431BC /* ObserveOn.swift */, C820A80E1EB4DA5900D431BC /* Optional.swift */, C820A8271EB4DA5900D431BC /* Producer.swift */, C820A8101EB4DA5900D431BC /* Range.swift */, C820A81F1EB4DA5900D431BC /* Reduce.swift */, C820A8121EB4DA5900D431BC /* Repeat.swift */, C820A8001EB4DA5900D431BC /* RetryWhen.swift */, C820A7F01EB4DA5900D431BC /* Sample.swift */, C820A7FF1EB4DA5900D431BC /* Scan.swift */, C820A80F1EB4DA5900D431BC /* Sequence.swift */, C8845AD31EDB4C9900B36836 /* ShareReplayScope.swift */, C820A7F51EB4DA5900D431BC /* SingleAsync.swift */, C820A8281EB4DA5900D431BC /* Sink.swift */, C820A7ED1EB4DA5900D431BC /* Skip.swift */, C820A8071EB4DA5900D431BC /* SkipUntil.swift */, C820A7F81EB4DA5900D431BC /* SkipWhile.swift */, C820A8021EB4DA5900D431BC /* StartWith.swift */, C820A8191EB4DA5900D431BC /* SubscribeOn.swift */, C820A7E71EB4DA5900D431BC /* Switch.swift */, C820A80A1EB4DA5900D431BC /* SwitchIfEmpty.swift */, C820A7EE1EB4DA5900D431BC /* Take.swift */, C820A7F91EB4DA5900D431BC /* TakeLast.swift */, C820A8081EB4DA5900D431BC /* TakeWithPredicate.swift */, C820A7F21EB4DA5900D431BC /* Throttle.swift */, C820A7E91EB4DA5900D431BC /* Timeout.swift */, C820A7EF1EB4DA5900D431BC /* Timer.swift */, C820A8201EB4DA5900D431BC /* ToArray.swift */, C820A8111EB4DA5900D431BC /* Using.swift */, C820A7EA1EB4DA5900D431BC /* Window.swift */, C820A8051EB4DA5900D431BC /* WithLatestFrom.swift */, C820A8291EB4DA5900D431BC /* Zip.swift */, C820A82A1EB4DA5900D431BC /* Zip+arity.swift */, C820A82B1EB4DA5900D431BC /* Zip+arity.tt */, C820A80B1EB4DA5900D431BC /* Zip+Collection.swift */, 788DCE5C24CB8249005B8F8C /* Decode.swift */, A20CC6C8259F3FE700370AE3 /* WithUnretained.swift */, ); path = Observables; sourceTree = ""; }; C8093CA11B8A72BE0088E94D /* Observers */ = { isa = PBXGroup; children = ( C8093CA21B8A72BE0088E94D /* AnonymousObserver.swift */, C8093CA61B8A72BE0088E94D /* ObserverBase.swift */, C8093CA91B8A72BE0088E94D /* TailRecursiveSink.swift */, ); path = Observers; sourceTree = ""; }; C8093CB41B8A72BE0088E94D /* Schedulers */ = { isa = PBXGroup; children = ( C83D73B21C1DBAEE003DC470 /* Internal */, C8093CB51B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift */, C8B144FA1BD2D44500267DCE /* ConcurrentMainScheduler.swift */, C8C3DA0E1B939767004D233E /* CurrentThreadScheduler.swift */, C8093CB71B8A72BE0088E94D /* MainScheduler.swift */, C8093CB81B8A72BE0088E94D /* OperationQueueScheduler.swift */, C8093CB91B8A72BE0088E94D /* RecursiveScheduler.swift */, C8093CBB1B8A72BE0088E94D /* SchedulerServices+Emulation.swift */, C8093CBC1B8A72BE0088E94D /* SerialDispatchQueueScheduler.swift */, C8FA89121C30405400CD3A17 /* VirtualTimeConverterType.swift */, C8FA89131C30405400CD3A17 /* VirtualTimeScheduler.swift */, C8FA89161C30409900CD3A17 /* HistoricalScheduler.swift */, C8FA891B1C30412A00CD3A17 /* HistoricalSchedulerTimeConverter.swift */, ); path = Schedulers; sourceTree = ""; }; C8093CBD1B8A72BE0088E94D /* Subjects */ = { isa = PBXGroup; children = ( 0BA949661E224B7E0036DD06 /* AsyncSubject.swift */, C8093CBE1B8A72BE0088E94D /* BehaviorSubject.swift */, C8093CBF1B8A72BE0088E94D /* PublishSubject.swift */, C8093CC01B8A72BE0088E94D /* ReplaySubject.swift */, C8093CC11B8A72BE0088E94D /* SubjectType.swift */, ); path = Subjects; sourceTree = ""; }; C8093E801B8A732E0088E94D /* RxCocoa */ = { isa = PBXGroup; children = ( C89AB2781DAACE490065FBE6 /* RxCocoa.h */, C89AB2261DAAC33F0065FBE6 /* RxCocoa.swift */, C8A81C9E1E05E82C0008DEF4 /* Platform */, C89AB1AA1DAAC3350065FBE6 /* Traits */, C8093E811B8A732E0088E94D /* Common */, C89AB1BC1DAAC3350065FBE6 /* Foundation */, C88253EE1B8A752B00B02D69 /* iOS */, C86781901DB823B500B2029A /* macOS */, C89AB22B1DAAC3A60065FBE6 /* Runtime */, C8093E9D1B8A732E0088E94D /* Info.plist */, D040ADC12D5E408700A1E6B3 /* PrivacyInfo.xcprivacy */, ); path = RxCocoa; sourceTree = ""; }; C8093E811B8A732E0088E94D /* Common */ = { isa = PBXGroup; children = ( C80D338E1B91EF9E0014629D /* Observable+Bind.swift */, 786DED7124F849F3008C4FAC /* Infallible+Bind.swift */, C8093E8B1B8A732E0088E94D /* DelegateProxy.swift */, C8093E8C1B8A732E0088E94D /* DelegateProxyType.swift */, C8093E9C1B8A732E0088E94D /* RxTarget.swift */, C89AB1711DAAC1680065FBE6 /* ControlTarget.swift */, C8D132431C42D15E00B59FFF /* SectionedViewDataSourceType.swift */, C88F76801CE5341700D5A014 /* TextInput.swift */, C89AB1A51DAAC25A0065FBE6 /* RxCocoaObjCRuntimeError+Extensions.swift */, C8E65EFA1F6E91D1004478C3 /* Binder.swift */, ); path = Common; sourceTree = ""; }; C8093F571B8A73A20088E94D /* RxBlocking */ = { isa = PBXGroup; children = ( C8093F591B8A73A20088E94D /* README.md */, C85B01661DB2ACAF006043C3 /* Platform */, C8093F581B8A73A20088E94D /* ObservableConvertibleType+Blocking.swift */, C8941BDE1BD5695C00A0E874 /* BlockingObservable.swift */, C8941BE31BD56B0700A0E874 /* BlockingObservable+Operators.swift */, C88E296A1BEB712E001CCB92 /* RunLoopLock.swift */, C85218041E33FCA50015DD38 /* Resources.swift */, A111CE961B91C97C00D0DCEE /* Info.plist */, ); path = RxBlocking; sourceTree = ""; }; C81A09851E6C701700900B3B /* Traits */ = { isa = PBXGroup; children = ( 786DED6524F83F49008C4FAC /* Infallible */, 786DED6424F83F37008C4FAC /* PrimitiveSequence */, ); path = Traits; sourceTree = ""; }; C81B6AA71DB2C15C0047CF86 /* Platform */ = { isa = PBXGroup; children = ( C8165AD421891DBE00494BEF /* AtomicInt.swift */, C8F03F4E1DBBAE9400AECC4C /* DispatchQueue+Extensions.swift */, C81B6AA81DB2C15C0047CF86 /* Platform.Darwin.swift */, C81B6AA91DB2C15C0047CF86 /* Platform.Linux.swift */, C85218001E33FC160015DD38 /* RecursiveLock.swift */, ); path = Platform; sourceTree = ""; }; C834F6C01DB394E100C29244 /* RxBlockingTests */ = { isa = PBXGroup; children = ( C834F6C11DB394E100C29244 /* Observable+BlockingTest.swift */, ); path = RxBlockingTests; sourceTree = ""; }; C83508D31C38706D0027C24C /* Tests */ = { isa = PBXGroup; children = ( C8E8BA6D1E2C18AE00A4AC2C /* Microoptimizations */, C8E8BA611E2C186200A4AC2C /* Benchmarks */, C81B6AA71DB2C15C0047CF86 /* Platform */, C834F6C01DB394E100C29244 /* RxBlockingTests */, C83508D81C38706D0027C24C /* RxCocoaTests */, C83508F21C38706D0027C24C /* RxSwiftTests */, A2FD4E9A225D04D600288525 /* RxRelayTests */, C89CFA0B1DAAB4670079D23B /* RxTest.swift */, C8353CE01DA19BC500BE3F5C /* Recorded+Timeless.swift */, C8353CE11DA19BC500BE3F5C /* TestErrors.swift */, C8353CE21DA19BC500BE3F5C /* XCTest+AllTests.swift */, C8353CDB1DA19BA000BE3F5C /* MessageProcessingStage.swift */, C8323A8D1E33FD5200CC0C7F /* Resources.swift */, ); path = Tests; sourceTree = ""; }; C83508D81C38706D0027C24C /* RxCocoaTests */ = { isa = PBXGroup; children = ( C8D970DF1F532FD20058F2FE /* TestImplementations */, C8561B651DFE1169005E97F1 /* ExampleTests.swift */, C8D970DC1F532FD10058F2FE /* Signal+Test.swift */, C8D970DD1F532FD10058F2FE /* SharedSequence+Test.swift */, C8D970E11F532FD20058F2FE /* SharedSequence+Extensions.swift */, C8D970DE1F532FD20058F2FE /* Driver+Test.swift */, C8D970E21F532FD30058F2FE /* SharedSequence+OperatorTest.swift */, DB08833826FB07CB005805BE /* SharedSequence+ConcurrencyTests.swift */, C8091C521FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift */, C83508DD1C38706D0027C24C /* ControlEventTests.swift */, C83508DE1C38706D0027C24C /* ControlPropertyTests.swift */, DB8157D2264941B200164D4B /* UIApplication+RxTests.swift */, C83508E11C38706D0027C24C /* DelegateProxyTest.swift */, 504540CA24196EB10098665F /* WKWebView+RxTests.swift */, C83508DF1C38706D0027C24C /* DelegateProxyTest+Cocoa.swift */, C83508E01C38706D0027C24C /* DelegateProxyTest+UIKit.swift */, 504540CF241971E70098665F /* DelegateProxyTest+WebKit.swift */, C83508E41C38706D0027C24C /* KVOObservableTests.swift */, C8C4F1761DE9D84900003FA7 /* NSButton+RxTests.swift */, C834F6C51DB3950600C29244 /* NSControl+RxTests.swift */, C83508E51C38706D0027C24C /* NSLayoutConstraint+RxTests.swift */, C83508E61C38706D0027C24C /* NotificationCenterTests.swift */, C83508E71C38706D0027C24C /* NSObject+RxTests.swift */, C8C4F1741DE9D80A00003FA7 /* NSSlider+RxTests.swift */, C8C4F1721DE9D7A300003FA7 /* NSTextField+RxTests.swift */, 927A78C82117BCB400A45638 /* NSTextView+RxTests.swift */, C83508E81C38706D0027C24C /* NSView+RxTests.swift */, C8A9B6F31DAD752200C9B027 /* Observable+BindTests.swift */, C83508E91C38706D0027C24C /* RuntimeStateSnapshot.swift */, C83508EA1C38706D0027C24C /* RXObjCRuntime+Testing.h */, C83508EB1C38706D0027C24C /* RXObjCRuntime+Testing.m */, C83508EC1C38706D0027C24C /* RxObjCRuntimeState.swift */, C83508ED1C38706D0027C24C /* RxTest-iOS-Bridging-Header.h */, C83508EE1C38706D0027C24C /* RxTest-macOS-Bridging-Header.h */, C83508EF1C38706D0027C24C /* RxTest-tvOS-Bridging-Header.h */, C8B290841C94D55600E923D0 /* RxTest+Controls.swift */, C83508F01C38706D0027C24C /* SentMessageTest.swift */, C8C4F1681DE9D48F00003FA7 /* UIActivityIndicatorView+RxTests.swift */, C8C4F16A1DE9D4C100003FA7 /* UIAlertAction+RxTests.swift */, C8C4F15C1DE9CAEE00003FA7 /* UIBarButtonItem+RxTests.swift */, C8379EF31D1DD326003EF8FC /* UIButton+RxTests.swift */, C8802DD31F8CD47F001D677E /* UIControl+RxTests.swift */, C8C217D61CB710200038A2E6 /* UICollectionView+RxTests.swift */, C8C4F16C1DE9D4F400003FA7 /* UIDatePicker+RxTests.swift */, C8C4F1641DE9D3FB00003FA7 /* UIGestureRecognizer+RxTests.swift */, C8C4F1601DE9CD1600003FA7 /* UILabel+RxTests.swift */, D9080AD71EA06189002B433B /* UINavigationController+RxTests.swift */, 54700C9E1CE37D1000EF3A8F /* UINavigationItem+RxTests.swift.swift */, 914FCD661CCDB82E0058B304 /* UIPageControl+RxTest.swift */, 844BC8B71CE5023200F5C7CB /* UIPickerView+RxTests.swift */, C8C4F1621DE9D0A800003FA7 /* UIProgressView+RxTests.swift */, 033C2EF41D081B2A0050C015 /* UIScrollView+RxTests.swift */, C8B2908C1C94D6C500E923D0 /* UISearchBar+RxTests.swift */, 84E4D3951C9B011000ADFDC9 /* UISearchController+RxTests.swift */, C8C4F1661DE9D44600003FA7 /* UISegmentedControl+RxTests.swift */, C8C4F16E1DE9D5E000003FA7 /* UISlider+RxTests.swift */, C8C4F1701DE9D68000003FA7 /* UIStepper+RxTests.swift */, C8C4F15E1DE9CC5B00003FA7 /* UISwitch+RxTests.swift */, 88718D001CE5DE2500D88D60 /* UITabBar+RxTests.swift */, ECBBA5A01DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift */, 7EDBAEAB1C89B1A5006CBE67 /* UITabBarItem+RxTests.swift */, C8C217D41CB7100E0038A2E6 /* UITableView+RxTests.swift */, C8F27DAC1CE6710900D5FB4F /* UITextField+RxTests.swift */, C8F27DB11CE6711600D5FB4F /* UITextView+RxTests.swift */, C83508F11C38706D0027C24C /* UIView+RxTests.swift */, 271A97421CFC99FE00D64125 /* UIViewController+RxTests.swift */, 78C385CD25685076005E39B3 /* Infallible+BindTests.swift */, ); path = RxCocoaTests; sourceTree = ""; }; C83508F21C38706D0027C24C /* RxSwiftTests */ = { isa = PBXGroup; children = ( C8F03F401DBB98DB00AECC4C /* Anomalies.swift */, C83509031C38706D0027C24C /* AssumptionsTest.swift */, 0BA9496B1E224B9C0036DD06 /* AsyncSubjectTests.swift */, C8ADC18D2200F9B000B611D4 /* Atomic+Overrides.swift */, 1E3079AB21FB52330072A7E6 /* AtomicTests.swift */, C83509041C38706D0027C24C /* BagTest.swift */, C83509051C38706D0027C24C /* BehaviorSubjectTest.swift */, 78B6157623B6A035009C2AD9 /* Binder+Tests.swift */, C8A53AE41F09292A00490535 /* Completable+AndThen.swift */, C801DE3D1F6EAD57008DB060 /* CompletableTest.swift */, C83509061C38706D0027C24C /* CurrentThreadSchedulerTest.swift */, C83509071C38706D0027C24C /* DisposableTest.swift */, 4C8DE0E120D54545003E2D8A /* DisposeBagTest.swift */, C822BAC51DB4048F00F98810 /* Event+Test.swift */, C83509081C38706D0027C24C /* HistoricalSchedulerTest.swift */, C83509091C38706D0027C24C /* MainSchedulerTests.swift */, C801DE391F6EAD48008DB060 /* MaybeTest.swift */, C820A9491EB4E75E00D431BC /* Observable+AmbTests.swift */, C820AA051EB5139C00D431BC /* Observable+BufferTests.swift */, C820A9891EB4FBD600D431BC /* Observable+CatchTests.swift */, C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */, C835090F1C38706D0027C24C /* Observable+CombineLatestTests+arity.swift */, C83509101C38706D0027C24C /* Observable+CombineLatestTests+arity.tt */, 4C5213AB225E20350079FC77 /* Observable+CompactMapTests.swift */, C820A9951EB4FF7000D431BC /* Observable+ConcatTests.swift */, C820A9851EB4FB5B00D431BC /* Observable+DebugTests.swift */, C820A9F11EB5109300D431BC /* Observable+DefaultIfEmpty.swift */, C820AA011EB5134000D431BC /* Observable+DelaySubscriptionTests.swift */, C820AA111EB5145200D431BC /* Observable+DelayTests.swift */, C820A9FD1EB5110E00D431BC /* Observable+DematerializeTests.swift */, C820A9D51EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift */, C820A9D91EB50CAA00D431BC /* Observable+DoOnTests.swift */, C820A9C91EB50A7100D431BC /* Observable+ElementAtTests.swift */, C8E390671F379386004FC993 /* Observable+EnumeratedTests.swift */, C820A9AD1EB5073E00D431BC /* Observable+FilterTests.swift */, 788DCE5E24CB8512005B8F8C /* Observable+DecodeTests.swift */, C820A9751EB4F92100D431BC /* Observable+GenerateTests.swift */, C820A9D11EB50B0900D431BC /* Observable+GroupByTests.swift */, C820A9691EB4F64800D431BC /* Observable+JustTests.swift */, C820A9B51EB5081400D431BC /* Observable+MapTests.swift */, C820A9F91EB510D500D431BC /* Observable+MaterializeTests.swift */, C820A9991EB5001C00D431BC /* Observable+MergeTests.swift */, C820A9551EB4ED7C00D431BC /* Observable+MulticastTests.swift */, C820A9611EB4EFD300D431BC /* Observable+ObserveOnTests.swift */, C820A9711EB4F84000D431BC /* Observable+OptionalTests.swift */, C801DE491F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift */, C820A9791EB4FA0800D431BC /* Observable+RangeTests.swift */, C820A94D1EB4EC3C00D431BC /* Observable+ReduceTests.swift */, C820A97D1EB4FA5A00D431BC /* Observable+RepeatTests.swift */, C820A9E91EB50E3400D431BC /* Observable+RetryWhenTests.swift */, C820A9E11EB50D6C00D431BC /* Observable+SampleTests.swift */, C820A9ED1EB50EA100D431BC /* Observable+ScanTests.swift */, C820A96D1EB4F7AC00D431BC /* Observable+SequenceTests.swift */, C8845AD91EDB607800B36836 /* Observable+ShareReplayScopeTests.swift */, C820A9CD1EB50AD400D431BC /* Observable+SingleTests.swift */, C820A9C11EB509FC00D431BC /* Observable+SkipTests.swift */, C820A9A51EB5056C00D431BC /* Observable+SkipUntilTests.swift */, C820A9C51EB50A4200D431BC /* Observable+SkipWhileTests.swift */, C820A9651EB4F39500D431BC /* Observable+SubscribeOnTests.swift */, C83509161C38706D0027C24C /* Observable+SubscriptionTest.swift */, C820A9911EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift */, C820A98D1EB4FCC400D431BC /* Observable+SwitchTests.swift */, C820A9BD1EB509B500D431BC /* Observable+TakeLastTests.swift */, C820A9B91EB5097700D431BC /* Observable+TakeTests.swift */, C820A9A11EB5011700D431BC /* Observable+TakeUntilTests.swift */, C820A9B11EB507D300D431BC /* Observable+TakeWhileTests.swift */, C83509021C38706D0027C24C /* Observable+Tests.swift */, C820A9DD1EB50CF800D431BC /* Observable+ThrottleTests.swift */, C820AA0D1EB5140100D431BC /* Observable+TimeoutTests.swift */, C820A9E51EB50DB900D431BC /* Observable+TimerTests.swift */, C820A9511EB4ECC000D431BC /* Observable+ToArrayTests.swift */, C820A9811EB4FB0400D431BC /* Observable+UsingTests.swift */, C820AA091EB513C800D431BC /* Observable+WindowTests.swift */, C820A9A91EB505A800D431BC /* Observable+WithLatestFromTests.swift */, C81A097C1E6C27A100900B3B /* Observable+ZipTests.swift */, C83509111C38706D0027C24C /* Observable+ZipTests+arity.swift */, C83509121C38706D0027C24C /* Observable+ZipTests+arity.tt */, C82FF0EE1F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift */, C83509181C38706D0027C24C /* ObserverTests.swift */, C898147D1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift */, C898147C1E75A98A0035949C /* PrimitiveSequenceTest+zip+arity.tt */, 1AF67DA11CED420A00C310FA /* PublishSubjectTest.swift */, C83509191C38706D0027C24C /* QueueTests.swift */, C822BACD1DB424EC00F98810 /* Reactive+Tests.swift */, C8BAA78C1E34F8D400EEC727 /* RecursiveLockTest.swift */, 1AF67DA51CED430100C310FA /* ReplaySubjectTest.swift */, C86B1E211D42BF5200130546 /* SchedulerTests.swift */, C8B0F70C1F530A1700548EBE /* SharingSchedulerTests.swift */, C801DE351F6EAD3C008DB060 /* SingleTest.swift */, C835091A1C38706D0027C24C /* SubjectConcurrencyTest.swift */, 1E9DA0C422006858000EB80A /* Synchronized.swift */, C83508F31C38706D0027C24C /* TestImplementations */, C835091C1C38706D0027C24C /* VirtualSchedulerTest.swift */, 78C385EA256859DC005E39B3 /* Infallible+Tests.swift */, A20CC6D4259F408100370AE3 /* Observable+WithUnretainedTests.swift */, DB0B921F26FB3139005CEED9 /* Observable+ConcurrencyTests.swift */, DB0B922726FB343B005CEED9 /* Infallible+ConcurrencyTests.swift */, DB0B922A26FB34D3005CEED9 /* PrimitiveSequence+ConcurrencyTests.swift */, ); path = RxSwiftTests; sourceTree = ""; }; C83508F31C38706D0027C24C /* TestImplementations */ = { isa = PBXGroup; children = ( C83508F41C38706D0027C24C /* ElementIndexPair.swift */, C83508F51C38706D0027C24C /* EquatableArray.swift */, C83508F61C38706D0027C24C /* Mocks */, C83508FF1C38706D0027C24C /* Observable+Extensions.swift */, C83509001C38706D0027C24C /* TestVirtualScheduler.swift */, ); path = TestImplementations; sourceTree = ""; }; C83508F61C38706D0027C24C /* Mocks */ = { isa = PBXGroup; children = ( C83508F71C38706D0027C24C /* BackgroundThreadPrimitiveHotObservable.swift */, C83508F81C38706D0027C24C /* MainThreadPrimitiveHotObservable.swift */, C83508F91C38706D0027C24C /* MockDisposable.swift */, C83508FA1C38706D0027C24C /* MySubject.swift */, C83508FB1C38706D0027C24C /* Observable.Extensions.swift */, C83508FC1C38706D0027C24C /* PrimitiveHotObservable.swift */, C83508FD1C38706D0027C24C /* PrimitiveMockObserver.swift */, C83508FE1C38706D0027C24C /* TestConnectableObservable.swift */, ); path = Mocks; sourceTree = ""; }; C83D73B21C1DBAEE003DC470 /* Internal */ = { isa = PBXGroup; children = ( C83D73B41C1DBAEE003DC470 /* InvocableScheduledItem.swift */, C83D73B51C1DBAEE003DC470 /* InvocableType.swift */, C83D73B61C1DBAEE003DC470 /* ScheduledItem.swift */, C83D73B71C1DBAEE003DC470 /* ScheduledItemType.swift */, C80EEC331D42D06E00131C39 /* DispatchQueueConfiguration.swift */, ); path = Internal; sourceTree = ""; }; C85106851C2D54B70075150C /* Extensions */ = { isa = PBXGroup; children = ( C86781871DB814AD00B2029A /* Bag+Rx.swift */, ); path = Extensions; sourceTree = ""; }; C85B01661DB2ACAF006043C3 /* Platform */ = { isa = PBXGroup; children = ( C8165ACC21891BE400494BEF /* AtomicInt.swift */, C85B01671DB2ACAF006043C3 /* Platform.Darwin.swift */, C85B01681DB2ACAF006043C3 /* Platform.Linux.swift */, C85217FB1E33FBFB0015DD38 /* RecursiveLock.swift */, ); path = Platform; sourceTree = ""; }; C85B01711DB2ACF2006043C3 /* Platform */ = { isa = PBXGroup; children = ( C8165AC921891B9500494BEF /* AtomicInt.swift */, C86781461DB8119900B2029A /* DataStructures */, C85217F41E33F9D70015DD38 /* RecursiveLock.swift */, C85B01721DB2ACF2006043C3 /* Platform.Darwin.swift */, C85B01731DB2ACF2006043C3 /* Platform.Linux.swift */, C8F03F441DBBA61B00AECC4C /* DispatchQueue+Extensions.swift */, ); path = Platform; sourceTree = ""; }; C85E6FBA1F52FF4F00C5681E /* Signal */ = { isa = PBXGroup; children = ( C85E6FBB1F52FF4F00C5681E /* Signal.swift */, C8091C561FAA39C1001DB32A /* ControlEvent+Signal.swift */, C8B0F7211F53135100548EBE /* ObservableConvertibleType+Signal.swift */, C8D970CD1F5324D90058F2FE /* Signal+Subscription.swift */, A2897D65225D0182004EA481 /* PublishRelay+Signal.swift */, ); path = Signal; sourceTree = ""; }; C86781461DB8119900B2029A /* DataStructures */ = { isa = PBXGroup; children = ( C86781471DB8119900B2029A /* Bag.swift */, C86781481DB8119900B2029A /* InfiniteSequence.swift */, C86781491DB8119900B2029A /* PriorityQueue.swift */, C867814A1DB8119900B2029A /* Queue.swift */, ); path = DataStructures; sourceTree = ""; }; C867816B1DB8129E00B2029A /* DataStructures */ = { isa = PBXGroup; children = ( C867816C1DB8129E00B2029A /* Bag.swift */, C867816D1DB8129E00B2029A /* InfiniteSequence.swift */, C867816E1DB8129E00B2029A /* PriorityQueue.swift */, C867816F1DB8129E00B2029A /* Queue.swift */, ); path = DataStructures; sourceTree = ""; }; C86781801DB8143A00B2029A /* Platform */ = { isa = PBXGroup; children = ( C86781811DB8143A00B2029A /* DataStructures */, ); path = Platform; sourceTree = ""; }; C86781811DB8143A00B2029A /* DataStructures */ = { isa = PBXGroup; children = ( C86781821DB8143A00B2029A /* Bag.swift */, ); path = DataStructures; sourceTree = ""; }; C86781901DB823B500B2029A /* macOS */ = { isa = PBXGroup; children = ( C86781911DB823B500B2029A /* NSButton+Rx.swift */, C86781921DB823B500B2029A /* NSControl+Rx.swift */, C86781941DB823B500B2029A /* NSSlider+Rx.swift */, C86781951DB823B500B2029A /* NSTextField+Rx.swift */, C86781961DB823B500B2029A /* NSView+Rx.swift */, 927A78B621179FFD00A45638 /* NSTextView+Rx.swift */, ); path = macOS; sourceTree = ""; }; C88253EE1B8A752B00B02D69 /* iOS */ = { isa = PBXGroup; children = ( C88253F01B8A752B00B02D69 /* DataSources */, C88253F31B8A752B00B02D69 /* Events */, C88253F61B8A752B00B02D69 /* Protocols */, C88253F91B8A752B00B02D69 /* Proxies */, C88254051B8A752B00B02D69 /* UIBarButtonItem+Rx.swift */, C88254061B8A752B00B02D69 /* UIButton+Rx.swift */, DB8157E8264941EB00164D4B /* UIApplication+Rx.swift */, C88254071B8A752B00B02D69 /* UICollectionView+Rx.swift */, C88254081B8A752B00B02D69 /* UIControl+Rx.swift */, C88254091B8A752B00B02D69 /* UIDatePicker+Rx.swift */, C882540A1B8A752B00B02D69 /* UIGestureRecognizer+Rx.swift */, 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */, C882540D1B8A752B00B02D69 /* UIScrollView+Rx.swift */, C882540E1B8A752B00B02D69 /* UISearchBar+Rx.swift */, D9080AD21EA05DDF002B433B /* UINavigationController+Rx.swift */, C882540F1B8A752B00B02D69 /* UISegmentedControl+Rx.swift */, C88254101B8A752B00B02D69 /* UISlider+Rx.swift */, F31F35AF1BB4FED800961002 /* UIStepper+Rx.swift */, C88254111B8A752B00B02D69 /* UISwitch+Rx.swift */, C88254121B8A752B00B02D69 /* UITableView+Rx.swift */, C88254131B8A752B00B02D69 /* UITextField+Rx.swift */, C88254141B8A752B00B02D69 /* UITextView+Rx.swift */, 842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */, 9BA1CBD11C0F7C0A0044B50A /* UIActivityIndicatorView+Rx.swift */, 88718CFD1CE5D80000D88D60 /* UITabBar+Rx.swift */, ECBBA59A1DF8C0BA00DDDC2E /* UITabBarController+Rx.swift */, 84E4D3901C9AFCD500ADFDC9 /* UISearchController+Rx.swift */, 844BC8B31CE4FD7500F5C7CB /* UIPickerView+Rx.swift */, 504540C824196D960098665F /* WKWebView+Rx.swift */, ); path = iOS; sourceTree = ""; }; C88253F01B8A752B00B02D69 /* DataSources */ = { isa = PBXGroup; children = ( C88253F11B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift */, C88253F21B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift */, A5CD03891F1660F40005A376 /* RxPickerViewAdapter.swift */, ); path = DataSources; sourceTree = ""; }; C88253F31B8A752B00B02D69 /* Events */ = { isa = PBXGroup; children = ( C88253F41B8A752B00B02D69 /* ItemEvents.swift */, ); path = Events; sourceTree = ""; }; C88253F61B8A752B00B02D69 /* Protocols */ = { isa = PBXGroup; children = ( C88253F71B8A752B00B02D69 /* RxCollectionViewDataSourceType.swift */, C88253F81B8A752B00B02D69 /* RxTableViewDataSourceType.swift */, A520FFF61F0D258E00573734 /* RxPickerViewDataSourceType.swift */, ); path = Protocols; sourceTree = ""; }; C88253F91B8A752B00B02D69 /* Proxies */ = { isa = PBXGroup; children = ( B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */, C88253FC1B8A752B00B02D69 /* RxCollectionViewDataSourceProxy.swift */, C88253FD1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift */, C88253FE1B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift */, C88253FF1B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift */, ECBBA59D1DF8C0D400DDDC2E /* RxTabBarControllerDelegateProxy.swift */, 88D98F2D1CE7549A00D50457 /* RxTabBarDelegateProxy.swift */, B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */, C88254001B8A752B00B02D69 /* RxTableViewDataSourceProxy.swift */, C88254011B8A752B00B02D69 /* RxTableViewDelegateProxy.swift */, C88254021B8A752B00B02D69 /* RxTextViewDelegateProxy.swift */, 84C225A21C33F00B008724EC /* RxTextStorageDelegateProxy.swift */, 846436E11C9AF64C0035B40D /* RxSearchControllerDelegateProxy.swift */, 844BC8AA1CE4FA5600F5C7CB /* RxPickerViewDelegateProxy.swift */, D9080ACD1EA05A16002B433B /* RxNavigationControllerDelegateProxy.swift */, 504540CD2419701D0098665F /* RxWKNavigationDelegateProxy.swift */, A520FFFB1F0D291500573734 /* RxPickerViewDataSourceProxy.swift */, ); path = Proxies; sourceTree = ""; }; C89AB1AA1DAAC3350065FBE6 /* Traits */ = { isa = PBXGroup; children = ( C89AB1AB1DAAC3350065FBE6 /* ControlEvent.swift */, C89AB1AC1DAAC3350065FBE6 /* ControlProperty.swift */, C85E6FBA1F52FF4F00C5681E /* Signal */, C89AB1AD1DAAC3350065FBE6 /* Driver */, C89AB1B41DAAC3350065FBE6 /* SharedSequence */, ); path = Traits; sourceTree = ""; }; C89AB1AD1DAAC3350065FBE6 /* Driver */ = { isa = PBXGroup; children = ( C8C8BCD31F89459300501D4D /* BehaviorRelay+Driver.swift */, C89AB1AE1DAAC3350065FBE6 /* ControlEvent+Driver.swift */, C89AB1AF1DAAC3350065FBE6 /* ControlProperty+Driver.swift */, C89AB1B01DAAC3350065FBE6 /* Driver+Subscription.swift */, C89AB1B11DAAC3350065FBE6 /* Driver.swift */, CD8F7AC427BA9187001574EB /* Infallible+Driver.swift */, C89AB1B21DAAC3350065FBE6 /* ObservableConvertibleType+Driver.swift */, ); path = Driver; sourceTree = ""; }; C89AB1B41DAAC3350065FBE6 /* SharedSequence */ = { isa = PBXGroup; children = ( C89AB1B61DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift */, C89AB1B71DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt */, C89AB1B81DAAC3350065FBE6 /* SharedSequence+Operators.swift */, DB08833626FB0637005805BE /* SharedSequence+Concurrency.swift */, C89AB1B91DAAC3350065FBE6 /* SharedSequence.swift */, C85E6FBD1F53025700C5681E /* SchedulerType+SharedSequence.swift */, C8091C4D1FAA345C001DB32A /* ObservableConvertibleType+SharedSequence.swift */, ); path = SharedSequence; sourceTree = ""; }; C89AB1BC1DAAC3350065FBE6 /* Foundation */ = { isa = PBXGroup; children = ( C89AB1BD1DAAC3350065FBE6 /* KVORepresentable+CoreGraphics.swift */, C89AB1BE1DAAC3350065FBE6 /* KVORepresentable+Swift.swift */, C89AB1BF1DAAC3350065FBE6 /* KVORepresentable.swift */, C89AB1C11DAAC3350065FBE6 /* NotificationCenter+Rx.swift */, C89AB1C21DAAC3350065FBE6 /* NSObject+Rx+KVORepresentable.swift */, C89AB1C31DAAC3350065FBE6 /* NSObject+Rx+RawRepresentable.swift */, C89AB1C41DAAC3350065FBE6 /* NSObject+Rx.swift */, C89AB1C51DAAC3350065FBE6 /* URLSession+Rx.swift */, ); path = Foundation; sourceTree = ""; }; C89AB22B1DAAC3A60065FBE6 /* Runtime */ = { isa = PBXGroup; children = ( C89AB2541DAACC580065FBE6 /* include */, C89AB22D1DAAC3A60065FBE6 /* _RX.m */, C89AB22F1DAAC3A60065FBE6 /* _RXDelegateProxy.m */, C89AB2311DAAC3A60065FBE6 /* _RXKVOObserver.m */, C89AB2331DAAC3A60065FBE6 /* _RXObjCRuntime.m */, ); path = Runtime; sourceTree = ""; }; C89AB2541DAACC580065FBE6 /* include */ = { isa = PBXGroup; children = ( C89AB2731DAACCE30065FBE6 /* RxCocoaRuntime.h */, C89AB2551DAACC580065FBE6 /* _RX.h */, C89AB2561DAACC580065FBE6 /* _RXDelegateProxy.h */, C89AB2571DAACC580065FBE6 /* _RXKVOObserver.h */, C89AB2581DAACC580065FBE6 /* _RXObjCRuntime.h */, ); path = include; sourceTree = ""; }; C89CFA0F1DAABBE20079D23B /* RxTest */ = { isa = PBXGroup; children = ( C86781801DB8143A00B2029A /* Platform */, C89CFA171DAABBE20079D23B /* Schedulers */, C89CFA101DAABBE20079D23B /* Any+Equatable.swift */, C89CFA111DAABBE20079D23B /* ColdObservable.swift */, C89CFA121DAABBE20079D23B /* Event+Equatable.swift */, C89CFA131DAABBE20079D23B /* HotObservable.swift */, C89CFA151DAABBE20079D23B /* Recorded.swift */, 4583D8211FE94BB100AA1BB1 /* Recorded+Event.swift */, C89CFA161DAABBE20079D23B /* RxTest.swift */, C89CFA1A1DAABBE20079D23B /* Subscription.swift */, C89CFA1B1DAABBE20079D23B /* TestableObservable.swift */, C89CFA1C1DAABBE20079D23B /* TestableObserver.swift */, C89CFA1D1DAABBE20079D23B /* XCTest+Rx.swift */, C89CFA141DAABBE20079D23B /* Info.plist */, ); path = RxTest; sourceTree = ""; }; C89CFA171DAABBE20079D23B /* Schedulers */ = { isa = PBXGroup; children = ( C89CFA181DAABBE20079D23B /* TestScheduler.swift */, C89CFA191DAABBE20079D23B /* TestSchedulerVirtualTimeConverter.swift */, ); path = Schedulers; sourceTree = ""; }; C8A56ACD1AD7424700B4673B = { isa = PBXGroup; children = ( C85B01711DB2ACF2006043C3 /* Platform */, C8093C471B8A72BE0088E94D /* RxSwift */, C8093F571B8A73A20088E94D /* RxBlocking */, C8093E801B8A732E0088E94D /* RxCocoa */, A2897CB2225CA1C6004EA481 /* RxRelay */, C89CFA0F1DAABBE20079D23B /* RxTest */, C83508D31C38706D0027C24C /* Tests */, C8A56AD81AD7424700B4673B /* Products */, D27B5DA41F78C4F100797776 /* Frameworks */, ); sourceTree = ""; }; C8A56AD81AD7424700B4673B /* Products */ = { isa = PBXGroup; children = ( C8A56AD71AD7424700B4673B /* RxSwift.framework */, C809396D1B8A71760088E94D /* RxCocoa.framework */, C8093BC71B8A71F00088E94D /* RxBlocking.framework */, C88FA50C1C25C44800CCFEA4 /* RxTest.framework */, C83508C31C386F6F0027C24C /* AllTests-iOS.xctest */, C83509841C38740E0027C24C /* AllTests-tvOS.xctest */, C83509941C38742C0027C24C /* AllTests-macOS.xctest */, C85BA04B1C3878740075D68E /* Microoptimizations.app */, C8E8BA551E2C181A00A4AC2C /* Benchmarks.xctest */, A2897D53225CA1E7004EA481 /* RxRelay.framework */, ); name = Products; sourceTree = ""; }; C8A81C9E1E05E82C0008DEF4 /* Platform */ = { isa = PBXGroup; children = ( C8A81C9F1E05E82C0008DEF4 /* DispatchQueue+Extensions.swift */, ); path = Platform; sourceTree = ""; }; C8BF34C81C2E426800416CAE /* Platform */ = { isa = PBXGroup; children = ( C8165ACA21891BBF00494BEF /* AtomicInt.swift */, C867816B1DB8129E00B2029A /* DataStructures */, C8BF34C91C2E426800416CAE /* Platform.Darwin.swift */, C8BF34CA1C2E426800416CAE /* Platform.Linux.swift */, C8F03F491DBBAC0A00AECC4C /* DispatchQueue+Extensions.swift */, C85217F61E33FBBE0015DD38 /* RecursiveLock.swift */, ); path = Platform; sourceTree = ""; }; C8D970DF1F532FD20058F2FE /* TestImplementations */ = { isa = PBXGroup; children = ( C8D970E01F532FD20058F2FE /* SectionedViewDataSourceMock.swift */, ); path = TestImplementations; sourceTree = ""; }; C8E8BA611E2C186200A4AC2C /* Benchmarks */ = { isa = PBXGroup; children = ( C8E8BA621E2C186200A4AC2C /* Benchmarks.swift */, C8E8BA631E2C186200A4AC2C /* Info.plist */, ); path = Benchmarks; sourceTree = ""; }; C8E8BA6D1E2C18AE00A4AC2C /* Microoptimizations */ = { isa = PBXGroup; children = ( C8E8BA6E1E2C18AE00A4AC2C /* Info.plist */, C8E8BA6F1E2C18AE00A4AC2C /* main.swift */, C8E8BA701E2C18AE00A4AC2C /* PerformanceTools.swift */, ); path = Microoptimizations; sourceTree = ""; }; D27B5DA41F78C4F100797776 /* Frameworks */ = { isa = PBXGroup; children = ( ); name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ A2897CB5225CA1E7004EA481 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C80939641B8A71760088E94D /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( C89AB25E1DAACC580065FBE6 /* _RXDelegateProxy.h in Headers */, C89AB2661DAACC580065FBE6 /* _RXObjCRuntime.h in Headers */, C89AB25A1DAACC580065FBE6 /* _RX.h in Headers */, C89AB2791DAACE490065FBE6 /* RxCocoa.h in Headers */, C89AB2621DAACC580065FBE6 /* _RXKVOObserver.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; C8093BBA1B8A71F00088E94D /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C88FA5061C25C44800CCFEA4 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C8A56AD41AD7424700B4673B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ A2897CB3225CA1E7004EA481 /* RxRelay */ = { isa = PBXNativeTarget; buildConfigurationList = A2897D4F225CA1E7004EA481 /* Build configuration list for PBXNativeTarget "RxRelay" */; buildPhases = ( A2897CB5225CA1E7004EA481 /* Headers */, A2897CB4225CA1E7004EA481 /* SwiftLint */, A2897CB6225CA1E7004EA481 /* Sources */, A2897D4D225CA1E7004EA481 /* Resources */, A2897D4E225CA1E7004EA481 /* Frameworks */, ); buildRules = ( ); dependencies = ( A2897D5A225CA28F004EA481 /* PBXTargetDependency */, ); name = RxRelay; productName = RxSwift; productReference = A2897D53225CA1E7004EA481 /* RxRelay.framework */; productType = "com.apple.product-type.framework"; }; C80938F51B8A71760088E94D /* RxCocoa */ = { isa = PBXNativeTarget; buildConfigurationList = C80939691B8A71760088E94D /* Build configuration list for PBXNativeTarget "RxCocoa" */; buildPhases = ( C80939641B8A71760088E94D /* Headers */, A21D625B21E1D80F00E3E359 /* SwiftLint */, C80938F61B8A71760088E94D /* Sources */, C80939681B8A71760088E94D /* Resources */, C80939631B8A71760088E94D /* Frameworks */, ); buildRules = ( ); dependencies = ( A2897D64225CBD37004EA481 /* PBXTargetDependency */, C872BD1C1BC0529600D7175E /* PBXTargetDependency */, ); name = RxCocoa; productName = RxSwift; productReference = C809396D1B8A71760088E94D /* RxCocoa.framework */; productType = "com.apple.product-type.framework"; }; C8093B4B1B8A71F00088E94D /* RxBlocking */ = { isa = PBXNativeTarget; buildConfigurationList = C8093BC31B8A71F00088E94D /* Build configuration list for PBXNativeTarget "RxBlocking" */; buildPhases = ( C8093BBA1B8A71F00088E94D /* Headers */, A21D625C21E1D82B00E3E359 /* SwiftLint */, C8093B4C1B8A71F00088E94D /* Sources */, C8093BBE1B8A71F00088E94D /* Resources */, C8093BB91B8A71F00088E94D /* Frameworks */, ); buildRules = ( ); dependencies = ( C872BD241BC052B800D7175E /* PBXTargetDependency */, ); name = RxBlocking; productName = RxSwift; productReference = C8093BC71B8A71F00088E94D /* RxBlocking.framework */; productType = "com.apple.product-type.framework"; }; C83508C21C386F6F0027C24C /* AllTests-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = C83508CE1C386F6F0027C24C /* Build configuration list for PBXNativeTarget "AllTests-iOS" */; buildPhases = ( C83508BF1C386F6F0027C24C /* Sources */, C83508C11C386F6F0027C24C /* Resources */, C83508C01C386F6F0027C24C /* Frameworks */, ); buildRules = ( ); dependencies = ( C8B52BC6215434D600EAA87C /* PBXTargetDependency */, C835097D1C3871380027C24C /* PBXTargetDependency */, C835097B1C3871340027C24C /* PBXTargetDependency */, C83508CA1C386F6F0027C24C /* PBXTargetDependency */, ); name = "AllTests-iOS"; productName = "AllTests-iOS"; productReference = C83508C31C386F6F0027C24C /* AllTests-iOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; C83509831C38740E0027C24C /* AllTests-tvOS */ = { isa = PBXNativeTarget; buildConfigurationList = C835098C1C38740E0027C24C /* Build configuration list for PBXNativeTarget "AllTests-tvOS" */; buildPhases = ( C83509801C38740E0027C24C /* Sources */, C83509821C38740E0027C24C /* Resources */, C83509811C38740E0027C24C /* Frameworks */, ); buildRules = ( ); dependencies = ( C83E398721890703001F4F0E /* PBXTargetDependency */, C83E398921890703001F4F0E /* PBXTargetDependency */, C83E398B21890703001F4F0E /* PBXTargetDependency */, C83E398D21890703001F4F0E /* PBXTargetDependency */, ); name = "AllTests-tvOS"; productName = "AllTests-tvOS"; productReference = C83509841C38740E0027C24C /* AllTests-tvOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; C83509931C38742C0027C24C /* AllTests-macOS */ = { isa = PBXNativeTarget; buildConfigurationList = C835099C1C38742C0027C24C /* Build configuration list for PBXNativeTarget "AllTests-macOS" */; buildPhases = ( C83509901C38742C0027C24C /* Sources */, C83509921C38742C0027C24C /* Resources */, C83509911C38742C0027C24C /* Frameworks */, ); buildRules = ( ); dependencies = ( C83E398F2189070A001F4F0E /* PBXTargetDependency */, C83E39912189070A001F4F0E /* PBXTargetDependency */, C83E39932189070A001F4F0E /* PBXTargetDependency */, C83E39952189070A001F4F0E /* PBXTargetDependency */, ); name = "AllTests-macOS"; productName = "AllTests-OSX"; productReference = C83509941C38742C0027C24C /* AllTests-macOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; C85BA04A1C3878740075D68E /* Microoptimizations */ = { isa = PBXNativeTarget; buildConfigurationList = C85BA0581C3878750075D68E /* Build configuration list for PBXNativeTarget "Microoptimizations" */; buildPhases = ( C85BA0471C3878740075D68E /* Sources */, C85BA0481C3878740075D68E /* Frameworks */, C85BA0491C3878740075D68E /* Resources */, ); buildRules = ( ); dependencies = ( ); name = Microoptimizations; productName = PerformanceTests; productReference = C85BA04B1C3878740075D68E /* Microoptimizations.app */; productType = "com.apple.product-type.application"; }; C88FA4FD1C25C44800CCFEA4 /* RxTest */ = { isa = PBXNativeTarget; buildConfigurationList = C88FA5081C25C44800CCFEA4 /* Build configuration list for PBXNativeTarget "RxTest" */; buildPhases = ( C88FA5061C25C44800CCFEA4 /* Headers */, A21D625D21E1D83800E3E359 /* SwiftLint */, C88FA5001C25C44800CCFEA4 /* Sources */, C88FA5071C25C44800CCFEA4 /* Resources */, C88FA5051C25C44800CCFEA4 /* Frameworks */, ); buildRules = ( ); dependencies = ( C88FA4FE1C25C44800CCFEA4 /* PBXTargetDependency */, ); name = RxTest; productName = RxSwift; productReference = C88FA50C1C25C44800CCFEA4 /* RxTest.framework */; productType = "com.apple.product-type.framework"; }; C8A56AD61AD7424700B4673B /* RxSwift */ = { isa = PBXNativeTarget; buildConfigurationList = C8A56AED1AD7424700B4673B /* Build configuration list for PBXNativeTarget "RxSwift" */; buildPhases = ( C8A56AD41AD7424700B4673B /* Headers */, A21F589121E109AD0051AEA2 /* SwiftLint */, C8A56AD21AD7424700B4673B /* Sources */, C8A56AD51AD7424700B4673B /* Resources */, C8A56AD31AD7424700B4673B /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = RxSwift; productName = RxSwift; productReference = C8A56AD71AD7424700B4673B /* RxSwift.framework */; productType = "com.apple.product-type.framework"; }; C8E8BA541E2C181A00A4AC2C /* Benchmarks */ = { isa = PBXNativeTarget; buildConfigurationList = C8E8BA5D1E2C181A00A4AC2C /* Build configuration list for PBXNativeTarget "Benchmarks" */; buildPhases = ( C8E8BA511E2C181A00A4AC2C /* Sources */, C8E8BA521E2C181A00A4AC2C /* Frameworks */, C8E8BA531E2C181A00A4AC2C /* Resources */, ); buildRules = ( ); dependencies = ( C8E8BA761E2C1BB200A4AC2C /* PBXTargetDependency */, C8E8BA5C1E2C181A00A4AC2C /* PBXTargetDependency */, ); name = Benchmarks; productName = Benchmarks; productReference = C8E8BA551E2C181A00A4AC2C /* Benchmarks.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ C8A56ACE1AD7424700B4673B /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; LastUpgradeCheck = 1250; ORGANIZATIONNAME = RxSwift; TargetAttributes = { C80938F51B8A71760088E94D = { LastSwiftMigration = 0800; }; C8093B4B1B8A71F00088E94D = { LastSwiftMigration = 0800; }; C83508C21C386F6F0027C24C = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; C83509831C38740E0027C24C = { CreatedOnToolsVersion = 7.2; ProvisioningStyle = Manual; }; C83509931C38742C0027C24C = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; C85BA04A1C3878740075D68E = { CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; C88FA4FD1C25C44800CCFEA4 = { LastSwiftMigration = 0800; }; C8A56AD61AD7424700B4673B = { CreatedOnToolsVersion = 6.3; LastSwiftMigration = 0800; }; C8E8BA541E2C181A00A4AC2C = { CreatedOnToolsVersion = 8.2.1; ProvisioningStyle = Manual; }; }; }; buildConfigurationList = C8A56AD11AD7424700B4673B /* Build configuration list for PBXProject "Rx" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = C8A56ACD1AD7424700B4673B; productRefGroup = C8A56AD81AD7424700B4673B /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( C8A56AD61AD7424700B4673B /* RxSwift */, C80938F51B8A71760088E94D /* RxCocoa */, A2897CB3225CA1E7004EA481 /* RxRelay */, C8093B4B1B8A71F00088E94D /* RxBlocking */, C88FA4FD1C25C44800CCFEA4 /* RxTest */, C83508C21C386F6F0027C24C /* AllTests-iOS */, C83509831C38740E0027C24C /* AllTests-tvOS */, C83509931C38742C0027C24C /* AllTests-macOS */, C85BA04A1C3878740075D68E /* Microoptimizations */, C8E8BA541E2C181A00A4AC2C /* Benchmarks */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ A2897D4D225CA1E7004EA481 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( D040ADC42D5E409700A1E6B3 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; C80939681B8A71760088E94D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( D040ADC22D5E408700A1E6B3 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; C8093BBE1B8A71F00088E94D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C83508C11C386F6F0027C24C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C83509821C38740E0027C24C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C83509921C38742C0027C24C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C85BA0491C3878740075D68E /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C88FA5071C25C44800CCFEA4 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C8A56AD51AD7424700B4673B /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( D040ADC62D5E442300A1E6B3 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; C8E8BA531E2C181A00A4AC2C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ A21D625B21E1D80F00E3E359 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( ); inputPaths = ( ); name = SwiftLint; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"$SRCROOT\"/scripts/swiftlint.sh\n"; }; A21D625C21E1D82B00E3E359 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( ); inputPaths = ( ); name = SwiftLint; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"$SRCROOT\"/scripts/swiftlint.sh\n"; }; A21D625D21E1D83800E3E359 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( ); inputPaths = ( ); name = SwiftLint; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"$SRCROOT\"/scripts/swiftlint.sh\n"; }; A21F589121E109AD0051AEA2 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( ); inputPaths = ( ); name = SwiftLint; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"$SRCROOT\"/scripts/swiftlint.sh\n"; }; A2897CB4225CA1E7004EA481 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( ); inputPaths = ( ); name = SwiftLint; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"$SRCROOT\"/scripts/swiftlint.sh\n"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ A2897CB6225CA1E7004EA481 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( A2897D57225CA236004EA481 /* PublishRelay.swift in Sources */, 6A94254A23AFC2F300B7A24C /* ReplayRelay.swift in Sources */, A2897D58225CA236004EA481 /* BehaviorRelay.swift in Sources */, A2897D62225CA3F3004EA481 /* Observable+Bind.swift in Sources */, A2897D69225D023A004EA481 /* Utils.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C80938F61B8A71760088E94D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C88254321B8A752B00B02D69 /* UISlider+Rx.swift in Sources */, C882542F1B8A752B00B02D69 /* UIScrollView+Rx.swift in Sources */, C83E39822189066F001F4F0E /* NSSlider+Rx.swift in Sources */, 844BC8B41CE4FD7500F5C7CB /* UIPickerView+Rx.swift in Sources */, C83E39802189066F001F4F0E /* NSControl+Rx.swift in Sources */, C8093EE31B8A732E0088E94D /* DelegateProxyType.swift in Sources */, C8093EFD1B8A732E0088E94D /* RxTarget.swift in Sources */, C88254361B8A752B00B02D69 /* UITextView+Rx.swift in Sources */, C88254171B8A752B00B02D69 /* RxTableViewReactiveArrayDataSource.swift in Sources */, C8C8BCD41F89459300501D4D /* BehaviorRelay+Driver.swift in Sources */, C882541E1B8A752B00B02D69 /* RxCollectionViewDataSourceProxy.swift in Sources */, C85E6FBE1F53025700C5681E /* SchedulerType+SharedSequence.swift in Sources */, 84C225A31C33F00B008724EC /* RxTextStorageDelegateProxy.swift in Sources */, C89AB1DA1DAAC3350065FBE6 /* Driver.swift in Sources */, C88254231B8A752B00B02D69 /* RxTableViewDelegateProxy.swift in Sources */, C89AB2381DAAC3A60065FBE6 /* _RX.m in Sources */, C83E39852189066F001F4F0E /* NSTextView+Rx.swift in Sources */, 7F600F411C5D0C6E00535B1D /* UIRefreshControl+Rx.swift in Sources */, F31F35B01BB4FED800961002 /* UIStepper+Rx.swift in Sources */, C8B0F7221F53135100548EBE /* ObservableConvertibleType+Signal.swift in Sources */, C89AB1C61DAAC3350065FBE6 /* ControlEvent.swift in Sources */, C8091C571FAA39C1001DB32A /* ControlEvent+Signal.swift in Sources */, A520FFFC1F0D291500573734 /* RxPickerViewDataSourceProxy.swift in Sources */, C882542A1B8A752B00B02D69 /* UIControl+Rx.swift in Sources */, C8D132441C42D15E00B59FFF /* SectionedViewDataSourceType.swift in Sources */, 786DED7224F849F3008C4FAC /* Infallible+Bind.swift in Sources */, B562478F203515DD00D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */, 84E4D3921C9AFD3400ADFDC9 /* UISearchController+Rx.swift in Sources */, C88254341B8A752B00B02D69 /* UITableView+Rx.swift in Sources */, CD8F7AC527BA9187001574EB /* Infallible+Driver.swift in Sources */, C89AB1A61DAAC25A0065FBE6 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */, C88254161B8A752B00B02D69 /* RxCollectionViewReactiveArrayDataSource.swift in Sources */, C89AB2221DAAC3350065FBE6 /* URLSession+Rx.swift in Sources */, 846436E31C9AF65B0035B40D /* RxSearchControllerDelegateProxy.swift in Sources */, C882541F1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift in Sources */, C88254201B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift in Sources */, C89AB20A1DAAC3350065FBE6 /* KVORepresentable.swift in Sources */, C88F76811CE5341700D5A014 /* TextInput.swift in Sources */, C89AB1CE1DAAC3350065FBE6 /* ControlEvent+Driver.swift in Sources */, C89AB1D61DAAC3350065FBE6 /* Driver+Subscription.swift in Sources */, C88254211B8A752B00B02D69 /* RxSearchBarDelegateProxy.swift in Sources */, A520FFF71F0D258E00573734 /* RxPickerViewDataSourceType.swift in Sources */, C8D970CE1F5324D90058F2FE /* Signal+Subscription.swift in Sources */, 844BC8AC1CE4FA6300F5C7CB /* RxPickerViewDelegateProxy.swift in Sources */, C89AB2271DAAC33F0065FBE6 /* RxCocoa.swift in Sources */, C89AB1F61DAAC3350065FBE6 /* SharedSequence.swift in Sources */, C89AB1EA1DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift in Sources */, ECBBA59B1DF8C0BA00DDDC2E /* UITabBarController+Rx.swift in Sources */, C89AB21A1DAAC3350065FBE6 /* NSObject+Rx+RawRepresentable.swift in Sources */, A5CD038A1F1660F40005A376 /* RxPickerViewAdapter.swift in Sources */, C89AB2021DAAC3350065FBE6 /* KVORepresentable+CoreGraphics.swift in Sources */, C80D338F1B91EF9E0014629D /* Observable+Bind.swift in Sources */, C88254311B8A752B00B02D69 /* UISegmentedControl+Rx.swift in Sources */, C83E397F2189066F001F4F0E /* NSButton+Rx.swift in Sources */, C83E39832189066F001F4F0E /* NSTextField+Rx.swift in Sources */, A2897D66225D0182004EA481 /* PublishRelay+Signal.swift in Sources */, C85E6FC21F5305E300C5681E /* Signal.swift in Sources */, C83E39842189066F001F4F0E /* NSView+Rx.swift in Sources */, C89AB2481DAAC3A60065FBE6 /* _RXKVOObserver.m in Sources */, C88254281B8A752B00B02D69 /* UIButton+Rx.swift in Sources */, C8091C4E1FAA345C001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */, C89AB1CA1DAAC3350065FBE6 /* ControlProperty.swift in Sources */, ECBBA59E1DF8C0D400DDDC2E /* RxTabBarControllerDelegateProxy.swift in Sources */, 78F2D93E24C8D35700D13F0C /* RxWKNavigationDelegateProxy.swift in Sources */, C89AB1F21DAAC3350065FBE6 /* SharedSequence+Operators.swift in Sources */, 9BA1CBD31C0F7D550044B50A /* UIActivityIndicatorView+Rx.swift in Sources */, 842A5A2C1C357F92003568D5 /* NSTextStorage+Rx.swift in Sources */, C88254241B8A752B00B02D69 /* RxTextViewDelegateProxy.swift in Sources */, C89AB2401DAAC3A60065FBE6 /* _RXDelegateProxy.m in Sources */, C89AB2061DAAC3350065FBE6 /* KVORepresentable+Swift.swift in Sources */, C89AB1DE1DAAC3350065FBE6 /* ObservableConvertibleType+Driver.swift in Sources */, D9080ACF1EA05AE0002B433B /* RxNavigationControllerDelegateProxy.swift in Sources */, C88254271B8A752B00B02D69 /* UIBarButtonItem+Rx.swift in Sources */, C89AB2161DAAC3350065FBE6 /* NSObject+Rx+KVORepresentable.swift in Sources */, C882542B1B8A752B00B02D69 /* UIDatePicker+Rx.swift in Sources */, C88254221B8A752B00B02D69 /* RxTableViewDataSourceProxy.swift in Sources */, C882542C1B8A752B00B02D69 /* UIGestureRecognizer+Rx.swift in Sources */, C89AB1D21DAAC3350065FBE6 /* ControlProperty+Driver.swift in Sources */, C8093EE11B8A732E0088E94D /* DelegateProxy.swift in Sources */, C89AB2501DAAC3A60065FBE6 /* _RXObjCRuntime.m in Sources */, C89AB21E1DAAC3350065FBE6 /* NSObject+Rx.swift in Sources */, D9080AD41EA05DE9002B433B /* UINavigationController+Rx.swift in Sources */, 88718CFE1CE5D80000D88D60 /* UITabBar+Rx.swift in Sources */, 88D98F2E1CE7549A00D50457 /* RxTabBarDelegateProxy.swift in Sources */, C88254331B8A752B00B02D69 /* UISwitch+Rx.swift in Sources */, C88254291B8A752B00B02D69 /* UICollectionView+Rx.swift in Sources */, C882541A1B8A752B00B02D69 /* RxCollectionViewDataSourceType.swift in Sources */, C8A81CA01E05E82C0008DEF4 /* DispatchQueue+Extensions.swift in Sources */, C88254351B8A752B00B02D69 /* UITextField+Rx.swift in Sources */, DB8157E9264941EB00164D4B /* UIApplication+Rx.swift in Sources */, C88254301B8A752B00B02D69 /* UISearchBar+Rx.swift in Sources */, C89AB2121DAAC3350065FBE6 /* NotificationCenter+Rx.swift in Sources */, C88254181B8A752B00B02D69 /* ItemEvents.swift in Sources */, 504540C924196D960098665F /* WKWebView+Rx.swift in Sources */, DB08833726FB0637005805BE /* SharedSequence+Concurrency.swift in Sources */, C89AB1731DAAC1680065FBE6 /* ControlTarget.swift in Sources */, C882541B1B8A752B00B02D69 /* RxTableViewDataSourceType.swift in Sources */, B5624794203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C8093B4C1B8A71F00088E94D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C8165ACD21891BE400494BEF /* AtomicInt.swift in Sources */, C85B016D1DB2ACAF006043C3 /* Platform.Linux.swift in Sources */, C88E296B1BEB712E001CCB92 /* RunLoopLock.swift in Sources */, C8941BDF1BD5695C00A0E874 /* BlockingObservable.swift in Sources */, C8941BE41BD56B0700A0E874 /* BlockingObservable+Operators.swift in Sources */, C8093F5E1B8A73A20088E94D /* ObservableConvertibleType+Blocking.swift in Sources */, C85218051E33FCA50015DD38 /* Resources.swift in Sources */, C85B01691DB2ACAF006043C3 /* Platform.Darwin.swift in Sources */, C85217FC1E33FBFB0015DD38 /* RecursiveLock.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C83508BF1C386F6F0027C24C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( DB8157D3264941B300164D4B /* UIApplication+RxTests.swift in Sources */, C820A9961EB4FF7000D431BC /* Observable+ConcatTests.swift in Sources */, 033C2EF61D081C460050C015 /* UIScrollView+RxTests.swift in Sources */, C820AA121EB5145200D431BC /* Observable+DelayTests.swift in Sources */, C820A9A21EB5011700D431BC /* Observable+TakeUntilTests.swift in Sources */, C8845ADA1EDB607800B36836 /* Observable+ShareReplayScopeTests.swift in Sources */, C83509611C38706E0027C24C /* ObserverTests.swift in Sources */, C83509471C38706E0027C24C /* PrimitiveMockObserver.swift in Sources */, C8D970EF1F532FD30058F2FE /* SharedSequence+Extensions.swift in Sources */, C8F03F4F1DBBAE9400AECC4C /* DispatchQueue+Extensions.swift in Sources */, C835094B1C38706E0027C24C /* Observable+Tests.swift in Sources */, C8C217D51CB7100E0038A2E6 /* UITableView+RxTests.swift in Sources */, C8802DD41F8CD47F001D677E /* UIControl+RxTests.swift in Sources */, C835092E1C38706E0027C24C /* ControlEventTests.swift in Sources */, 844BC8BB1CE5024500F5C7CB /* UIPickerView+RxTests.swift in Sources */, C801DE361F6EAD3C008DB060 /* SingleTest.swift in Sources */, 504540D0241971E80098665F /* DelegateProxyTest+WebKit.swift in Sources */, C896A68B1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */, 4C8DE0E220D54545003E2D8A /* DisposeBagTest.swift in Sources */, C820A9AA1EB505A800D431BC /* Observable+WithLatestFromTests.swift in Sources */, C8D970E61F532FD30058F2FE /* SharedSequence+Test.swift in Sources */, C820A94E1EB4EC3C00D431BC /* Observable+ReduceTests.swift in Sources */, C820A97A1EB4FA0800D431BC /* Observable+RangeTests.swift in Sources */, C8B290891C94D64600E923D0 /* RxTest+Controls.swift in Sources */, 4C5213AE225E224F0079FC77 /* Observable+CompactMapTests.swift in Sources */, C8C4F1611DE9CD1600003FA7 /* UILabel+RxTests.swift in Sources */, C820A9761EB4F92100D431BC /* Observable+GenerateTests.swift in Sources */, C8353CDC1DA19BA000BE3F5C /* MessageProcessingStage.swift in Sources */, C820AA0A1EB513C800D431BC /* Observable+WindowTests.swift in Sources */, C801DE3A1F6EAD48008DB060 /* MaybeTest.swift in Sources */, C8C4F16B1DE9D4C100003FA7 /* UIAlertAction+RxTests.swift in Sources */, 1AF67DA61CED430100C310FA /* ReplaySubjectTest.swift in Sources */, C835095A1C38706E0027C24C /* Observable+ZipTests+arity.swift in Sources */, C83509621C38706E0027C24C /* QueueTests.swift in Sources */, C82A336D1E2C3344003A6044 /* PerformanceTools.swift in Sources */, 914FCD671CCDB82E0058B304 /* UIPageControl+RxTest.swift in Sources */, C8C4F1651DE9D3FB00003FA7 /* UIGestureRecognizer+RxTests.swift in Sources */, C83509351C38706E0027C24C /* KVOObservableTests.swift in Sources */, C89046581DC5F6F70041C7D8 /* UISearchBar+RxTests.swift in Sources */, C85218011E33FC160015DD38 /* RecursiveLock.swift in Sources */, 6A7D2CD423BBDBDC0038576E /* ReplayRelayTests.swift in Sources */, C822BACA1DB4058000F98810 /* Event+Test.swift in Sources */, C83509421C38706E0027C24C /* MainThreadPrimitiveHotObservable.swift in Sources */, C801DE4A1F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift in Sources */, C820A98A1EB4FBD600D431BC /* Observable+CatchTests.swift in Sources */, C835093A1C38706E0027C24C /* RuntimeStateSnapshot.swift in Sources */, C8561B661DFE1169005E97F1 /* ExampleTests.swift in Sources */, C86B1E221D42BF5200130546 /* SchedulerTests.swift in Sources */, C820A9D61EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift in Sources */, C820A9FE1EB5110E00D431BC /* Observable+DematerializeTests.swift in Sources */, C8C4F1711DE9D68000003FA7 /* UIStepper+RxTests.swift in Sources */, C820A9D21EB50B0900D431BC /* Observable+GroupByTests.swift in Sources */, C83509441C38706E0027C24C /* MySubject.swift in Sources */, DB0B922926FB3462005CEED9 /* Infallible+ConcurrencyTests.swift in Sources */, C835095F1C38706E0027C24C /* Observable+SubscriptionTest.swift in Sources */, 78C385EB256859DC005E39B3 /* Infallible+Tests.swift in Sources */, C8C217D71CB710200038A2E6 /* UICollectionView+RxTests.swift in Sources */, C83509451C38706E0027C24C /* Observable.Extensions.swift in Sources */, C835093B1C38706E0027C24C /* RXObjCRuntime+Testing.m in Sources */, C83509461C38706E0027C24C /* PrimitiveHotObservable.swift in Sources */, C820A9861EB4FB5B00D431BC /* Observable+DebugTests.swift in Sources */, C820AA021EB5134000D431BC /* Observable+DelaySubscriptionTests.swift in Sources */, C835097E1C38726E0027C24C /* RxMutableBox.swift in Sources */, C820A9CE1EB50AD400D431BC /* Observable+SingleTests.swift in Sources */, C8F27DC21CE68DAB00D5FB4F /* UITextField+RxTests.swift in Sources */, C83509311C38706E0027C24C /* DelegateProxyTest+UIKit.swift in Sources */, C83509481C38706E0027C24C /* TestConnectableObservable.swift in Sources */, C8353CEC1DA19BC500BE3F5C /* XCTest+AllTests.swift in Sources */, C8B0F70D1F530A1700548EBE /* SharingSchedulerTests.swift in Sources */, D9080AD81EA06189002B433B /* UINavigationController+RxTests.swift in Sources */, DB08833A26FB0806005805BE /* SharedSequence+ConcurrencyTests.swift in Sources */, C8353CE61DA19BC500BE3F5C /* Recorded+Timeless.swift in Sources */, C83509371C38706E0027C24C /* NotificationCenterTests.swift in Sources */, C81B6AAD1DB2C15C0047CF86 /* Platform.Linux.swift in Sources */, C820A9E21EB50D6C00D431BC /* Observable+SampleTests.swift in Sources */, C8C4F1691DE9D48F00003FA7 /* UIActivityIndicatorView+RxTests.swift in Sources */, C89CFA0C1DAAB4670079D23B /* RxTest.swift in Sources */, C835094F1C38706E0027C24C /* CurrentThreadSchedulerTest.swift in Sources */, C820A97E1EB4FA5A00D431BC /* Observable+RepeatTests.swift in Sources */, C820A94A1EB4E75E00D431BC /* Observable+AmbTests.swift in Sources */, 1AF67DA21CED420A00C310FA /* PublishSubjectTest.swift in Sources */, C820A9C61EB50A4200D431BC /* Observable+SkipWhileTests.swift in Sources */, C835093E1C38706E0027C24C /* UIView+RxTests.swift in Sources */, 7EDBAEB41C89B1A6006CBE67 /* UITabBarItem+RxTests.swift in Sources */, C83509411C38706E0027C24C /* BackgroundThreadPrimitiveHotObservable.swift in Sources */, C8379EF41D1DD326003EF8FC /* UIButton+RxTests.swift in Sources */, C820A9B61EB5081400D431BC /* Observable+MapTests.swift in Sources */, C8C4F16F1DE9D5E000003FA7 /* UISlider+RxTests.swift in Sources */, C820A9821EB4FB0400D431BC /* Observable+UsingTests.swift in Sources */, C820A9F21EB5109300D431BC /* Observable+DefaultIfEmpty.swift in Sources */, C820AA0E1EB5140100D431BC /* Observable+TimeoutTests.swift in Sources */, C8F03F411DBB98DB00AECC4C /* Anomalies.swift in Sources */, C820A9561EB4ED7C00D431BC /* Observable+MulticastTests.swift in Sources */, C820A9E61EB50DB900D431BC /* Observable+TimerTests.swift in Sources */, C8353CE91DA19BC500BE3F5C /* TestErrors.swift in Sources */, C820A9521EB4ECC000D431BC /* Observable+ToArrayTests.swift in Sources */, C801DE3E1F6EAD57008DB060 /* CompletableTest.swift in Sources */, C83509581C38706E0027C24C /* Observable+CombineLatestTests+arity.swift in Sources */, C8A53AE51F09292A00490535 /* Completable+AndThen.swift in Sources */, C820A99A1EB5001C00D431BC /* Observable+MergeTests.swift in Sources */, C83509651C38706E0027C24C /* VirtualSchedulerTest.swift in Sources */, C8C4F15D1DE9CAEE00003FA7 /* UIBarButtonItem+RxTests.swift in Sources */, C83509361C38706E0027C24C /* NSLayoutConstraint+RxTests.swift in Sources */, C898147E1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift in Sources */, C8C4F1631DE9D0A800003FA7 /* UIProgressView+RxTests.swift in Sources */, C820A9BA1EB5097700D431BC /* Observable+TakeTests.swift in Sources */, C835094C1C38706E0027C24C /* AssumptionsTest.swift in Sources */, 788DCE5F24CB8512005B8F8C /* Observable+DecodeTests.swift in Sources */, C8D970F21F532FD30058F2FE /* SharedSequence+OperatorTest.swift in Sources */, C834F6C21DB394E100C29244 /* Observable+BlockingTest.swift in Sources */, C8BAA78D1E34F8D400EEC727 /* RecursiveLockTest.swift in Sources */, C8E390681F379386004FC993 /* Observable+EnumeratedTests.swift in Sources */, C835093F1C38706E0027C24C /* ElementIndexPair.swift in Sources */, C820A9CA1EB50A7100D431BC /* Observable+ElementAtTests.swift in Sources */, A2FD4E9D225D050A00288525 /* Observable+RelayBindTests.swift in Sources */, C83509381C38706E0027C24C /* NSObject+RxTests.swift in Sources */, C820AA061EB5139C00D431BC /* Observable+BufferTests.swift in Sources */, C820A96E1EB4F7AC00D431BC /* Observable+SequenceTests.swift in Sources */, C8A9B6F41DAD752200C9B027 /* Observable+BindTests.swift in Sources */, 271A97441CFC9F7B00D64125 /* UIViewController+RxTests.swift in Sources */, A20CC6EA259F40A100370AE3 /* Observable+WithUnretainedTests.swift in Sources */, C83509631C38706E0027C24C /* SubjectConcurrencyTest.swift in Sources */, C82FF0EF1F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift in Sources */, C820A9721EB4F84000D431BC /* Observable+OptionalTests.swift in Sources */, DB0B922C26FB3569005CEED9 /* PrimitiveSequence+ConcurrencyTests.swift in Sources */, 84E4D3961C9B011000ADFDC9 /* UISearchController+RxTests.swift in Sources */, C8C4F15F1DE9CC5B00003FA7 /* UISwitch+RxTests.swift in Sources */, ECBBA5A11DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift in Sources */, 78B6157723B6A035009C2AD9 /* Binder+Tests.swift in Sources */, C820A9A61EB5056C00D431BC /* Observable+SkipUntilTests.swift in Sources */, 88718D011CE5DE2600D88D60 /* UITabBar+RxTests.swift in Sources */, C8D970EC1F532FD30058F2FE /* SectionedViewDataSourceMock.swift in Sources */, 504540CB24196EB10098665F /* WKWebView+RxTests.swift in Sources */, C822BACE1DB424EC00F98810 /* Reactive+Tests.swift in Sources */, C820A9BE1EB509B500D431BC /* Observable+TakeLastTests.swift in Sources */, C8165AD521891DBF00494BEF /* AtomicInt.swift in Sources */, C820A9AE1EB5073E00D431BC /* Observable+FilterTests.swift in Sources */, C83509511C38706E0027C24C /* HistoricalSchedulerTest.swift in Sources */, C83509521C38706E0027C24C /* MainSchedulerTests.swift in Sources */, C835094D1C38706E0027C24C /* BagTest.swift in Sources */, 54700CA01CE37E1800EF3A8F /* UINavigationItem+RxTests.swift.swift in Sources */, 1E9DA0C522006858000EB80A /* Synchronized.swift in Sources */, C820A9C21EB509FC00D431BC /* Observable+SkipTests.swift in Sources */, C820A9DE1EB50CF800D431BC /* Observable+ThrottleTests.swift in Sources */, C820A9921EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift in Sources */, C835093D1C38706E0027C24C /* SentMessageTest.swift in Sources */, C83509401C38706E0027C24C /* EquatableArray.swift in Sources */, C820A9621EB4EFD300D431BC /* Observable+ObserveOnTests.swift in Sources */, C820A9DA1EB50CAA00D431BC /* Observable+DoOnTests.swift in Sources */, C835092F1C38706E0027C24C /* ControlPropertyTests.swift in Sources */, C835093C1C38706E0027C24C /* RxObjCRuntimeState.swift in Sources */, C83509491C38706E0027C24C /* Observable+Extensions.swift in Sources */, C835094A1C38706E0027C24C /* TestVirtualScheduler.swift in Sources */, DB0B922026FB3139005CEED9 /* Observable+ConcurrencyTests.swift in Sources */, C83509501C38706E0027C24C /* DisposableTest.swift in Sources */, C835094E1C38706E0027C24C /* BehaviorSubjectTest.swift in Sources */, C8C4F1671DE9D44600003FA7 /* UISegmentedControl+RxTests.swift in Sources */, C820A9661EB4F39500D431BC /* Observable+SubscribeOnTests.swift in Sources */, C820A9EE1EB50EA100D431BC /* Observable+ScanTests.swift in Sources */, C8D970E91F532FD30058F2FE /* Driver+Test.swift in Sources */, C820A96A1EB4F64800D431BC /* Observable+JustTests.swift in Sources */, C8ADC18E2200F9B000B611D4 /* Atomic+Overrides.swift in Sources */, C820A98E1EB4FCC400D431BC /* Observable+SwitchTests.swift in Sources */, C81B6AAA1DB2C15C0047CF86 /* Platform.Darwin.swift in Sources */, C81A097D1E6C27A100900B3B /* Observable+ZipTests.swift in Sources */, C83509321C38706E0027C24C /* DelegateProxyTest.swift in Sources */, C8091C531FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */, 1E3079AC21FB52330072A7E6 /* AtomicTests.swift in Sources */, 78C385CE25685076005E39B3 /* Infallible+BindTests.swift in Sources */, 0BA9496C1E224B9C0036DD06 /* AsyncSubjectTests.swift in Sources */, C8F27DC01CE68DA600D5FB4F /* UITextView+RxTests.swift in Sources */, C820A9B21EB507D300D431BC /* Observable+TakeWhileTests.swift in Sources */, C820A9FA1EB510D500D431BC /* Observable+MaterializeTests.swift in Sources */, C820A9EA1EB50E3400D431BC /* Observable+RetryWhenTests.swift in Sources */, C83509431C38706E0027C24C /* MockDisposable.swift in Sources */, C8323A8E1E33FD5200CC0C7F /* Resources.swift in Sources */, C8C4F16D1DE9D4F400003FA7 /* UIDatePicker+RxTests.swift in Sources */, C8D970E31F532FD30058F2FE /* Signal+Test.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C83509801C38740E0027C24C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C896A68C1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */, C83509F31C38755D0027C24C /* AssumptionsTest.swift in Sources */, C83509ED1C3875580027C24C /* MySubject.swift in Sources */, C83509C61C3875220027C24C /* NSObject+RxTests.swift in Sources */, C820A9871EB4FB5B00D431BC /* Observable+DebugTests.swift in Sources */, C8C4F1881DE9DF0200003FA7 /* UITableView+RxTests.swift in Sources */, C820A9FF1EB5110E00D431BC /* Observable+DematerializeTests.swift in Sources */, 1E9DA0C622006858000EB80A /* Synchronized.swift in Sources */, C83509EE1C3875580027C24C /* Observable.Extensions.swift in Sources */, C83509BD1C38750D0027C24C /* ControlPropertyTests.swift in Sources */, 4C5213AF225E22500079FC77 /* Observable+CompactMapTests.swift in Sources */, C83509E11C3875500027C24C /* TestVirtualScheduler.swift in Sources */, C820A94F1EB4EC3C00D431BC /* Observable+ReduceTests.swift in Sources */, C8B2908A1C94D64700E923D0 /* RxTest+Controls.swift in Sources */, 78C385CF25685076005E39B3 /* Infallible+BindTests.swift in Sources */, B44D73EC1EE6D4A300EBFBE8 /* UIViewController+RxTests.swift in Sources */, C820A9671EB4F39500D431BC /* Observable+SubscribeOnTests.swift in Sources */, C820A9C71EB50A4200D431BC /* Observable+SkipWhileTests.swift in Sources */, DB08833B26FB080B005805BE /* SharedSequence+ConcurrencyTests.swift in Sources */, C8BAA78E1E34F8D400EEC727 /* RecursiveLockTest.swift in Sources */, C83509EF1C3875580027C24C /* PrimitiveHotObservable.swift in Sources */, C8C4F17D1DE9DF0200003FA7 /* UIGestureRecognizer+RxTests.swift in Sources */, C8C4F1811DE9DF0200003FA7 /* UIScrollView+RxTests.swift in Sources */, 1E3079AD21FB52330072A7E6 /* AtomicTests.swift in Sources */, 54700CA11CE37E1900EF3A8F /* UINavigationItem+RxTests.swift.swift in Sources */, C8D970E71F532FD30058F2FE /* SharedSequence+Test.swift in Sources */, C8350A191C38756A0027C24C /* VirtualSchedulerTest.swift in Sources */, C820A9E71EB50DB900D431BC /* Observable+TimerTests.swift in Sources */, C820A97F1EB4FA5A00D431BC /* Observable+RepeatTests.swift in Sources */, C8C4F1781DE9DF0200003FA7 /* UIActivityIndicatorView+RxTests.swift in Sources */, C8ADC18F2200F9B000B611D4 /* Atomic+Overrides.swift in Sources */, C83509BF1C3875220027C24C /* DelegateProxyTest+UIKit.swift in Sources */, C8D970F31F532FD30058F2FE /* SharedSequence+OperatorTest.swift in Sources */, C820A94B1EB4E75E00D431BC /* Observable+AmbTests.swift in Sources */, C834F6C31DB394E100C29244 /* Observable+BlockingTest.swift in Sources */, C83509D41C38753C0027C24C /* RxObjCRuntimeState.swift in Sources */, C822BACF1DB424EC00F98810 /* Reactive+Tests.swift in Sources */, C8C4F17E1DE9DF0200003FA7 /* UILabel+RxTests.swift in Sources */, C83509C01C3875220027C24C /* DelegateProxyTest.swift in Sources */, C820A9F31EB5109300D431BC /* Observable+DefaultIfEmpty.swift in Sources */, C801DE371F6EAD3C008DB060 /* SingleTest.swift in Sources */, C8350A131C38756A0027C24C /* Observable+SubscriptionTest.swift in Sources */, C83509E01C3875500027C24C /* Observable+Extensions.swift in Sources */, C8C4F1801DE9DF0200003FA7 /* UIProgressView+RxTests.swift in Sources */, C85217EE1E33C8E60015DD38 /* PerformanceTools.swift in Sources */, C8C4F17C1DE9DF0200003FA7 /* UIDatePicker+RxTests.swift in Sources */, A20CC6F5259F40A100370AE3 /* Observable+WithUnretainedTests.swift in Sources */, C83509C41C3875220027C24C /* NSLayoutConstraint+RxTests.swift in Sources */, C820A9731EB4F84000D431BC /* Observable+OptionalTests.swift in Sources */, C820A9931EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift in Sources */, 88718D021CE5DE2600D88D60 /* UITabBar+RxTests.swift in Sources */, C83509BC1C38750D0027C24C /* ControlEventTests.swift in Sources */, C83509EC1C3875580027C24C /* MockDisposable.swift in Sources */, C820A9D31EB50B0900D431BC /* Observable+GroupByTests.swift in Sources */, C820AA131EB5145200D431BC /* Observable+DelayTests.swift in Sources */, C820AA0B1EB513C800D431BC /* Observable+WindowTests.swift in Sources */, 1AF67DA31CED427D00C310FA /* PublishSubjectTest.swift in Sources */, C820A9EF1EB50EA100D431BC /* Observable+ScanTests.swift in Sources */, C8353CDD1DA19BA000BE3F5C /* MessageProcessingStage.swift in Sources */, C820A9831EB4FB0400D431BC /* Observable+UsingTests.swift in Sources */, C8350A2A1C3875B50027C24C /* RxMutableBox.swift in Sources */, C820A9B71EB5081400D431BC /* Observable+MapTests.swift in Sources */, D9080AD91EA06189002B433B /* UINavigationController+RxTests.swift in Sources */, C8C4F17A1DE9DF0200003FA7 /* UIBarButtonItem+RxTests.swift in Sources */, C8350A151C38756A0027C24C /* ObserverTests.swift in Sources */, 1AF67DA71CED430100C310FA /* ReplaySubjectTest.swift in Sources */, C82FF0F01F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift in Sources */, C820A9531EB4ECC000D431BC /* Observable+ToArrayTests.swift in Sources */, C81B6AAB1DB2C15C0047CF86 /* Platform.Darwin.swift in Sources */, C801DE3B1F6EAD48008DB060 /* MaybeTest.swift in Sources */, C820A98B1EB4FBD600D431BC /* Observable+CatchTests.swift in Sources */, C83509F11C3875580027C24C /* TestConnectableObservable.swift in Sources */, C83509F51C38755D0027C24C /* BehaviorSubjectTest.swift in Sources */, C820A97B1EB4FA0800D431BC /* Observable+RangeTests.swift in Sources */, ECBBA5A21DF8C0FF00DDDC2E /* UITabBarController+RxTests.swift in Sources */, C8353CED1DA19BC500BE3F5C /* XCTest+AllTests.swift in Sources */, DB0B922126FB3139005CEED9 /* Observable+ConcurrencyTests.swift in Sources */, C85218021E33FC160015DD38 /* RecursiveLock.swift in Sources */, C8D970E41F532FD30058F2FE /* Signal+Test.swift in Sources */, C820A9771EB4F92100D431BC /* Observable+GenerateTests.swift in Sources */, C83509EB1C3875580027C24C /* MainThreadPrimitiveHotObservable.swift in Sources */, C8F03F501DBBAE9400AECC4C /* DispatchQueue+Extensions.swift in Sources */, C820A9BF1EB509B500D431BC /* Observable+TakeLastTests.swift in Sources */, C820A9CB1EB50A7100D431BC /* Observable+ElementAtTests.swift in Sources */, C822BACB1DB4058000F98810 /* Event+Test.swift in Sources */, C8A53AE61F09292A00490535 /* Completable+AndThen.swift in Sources */, C820A99B1EB5001C00D431BC /* Observable+MergeTests.swift in Sources */, C8D970F01F532FD30058F2FE /* SharedSequence+Extensions.swift in Sources */, C8353CE71DA19BC500BE3F5C /* Recorded+Timeless.swift in Sources */, C8350A161C38756A0027C24C /* QueueTests.swift in Sources */, C820A9DB1EB50CAA00D431BC /* Observable+DoOnTests.swift in Sources */, C820A9971EB4FF7000D431BC /* Observable+ConcatTests.swift in Sources */, C801DE3F1F6EAD57008DB060 /* CompletableTest.swift in Sources */, C898147F1E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift in Sources */, C89CFA0D1DAAB4670079D23B /* RxTest.swift in Sources */, C83509C51C3875220027C24C /* NotificationCenterTests.swift in Sources */, C820A9CF1EB50AD400D431BC /* Observable+SingleTests.swift in Sources */, C820A9D71EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift in Sources */, C820A9631EB4EFD300D431BC /* Observable+ObserveOnTests.swift in Sources */, C820A98F1EB4FCC400D431BC /* Observable+SwitchTests.swift in Sources */, C8F27DC31CE68DAC00D5FB4F /* UITextField+RxTests.swift in Sources */, C83509FF1C38755D0027C24C /* Observable+CombineLatestTests+arity.swift in Sources */, C8C4F1831DE9DF0200003FA7 /* UISearchController+RxTests.swift in Sources */, C83509D81C3875420027C24C /* SentMessageTest.swift in Sources */, C8C4F1851DE9DF0200003FA7 /* UISlider+RxTests.swift in Sources */, 0BA9496D1E224B9C0036DD06 /* AsyncSubjectTests.swift in Sources */, C83509F61C38755D0027C24C /* CurrentThreadSchedulerTest.swift in Sources */, C820A9AF1EB5073E00D431BC /* Observable+FilterTests.swift in Sources */, C820A9DF1EB50CF800D431BC /* Observable+ThrottleTests.swift in Sources */, C83509F01C3875580027C24C /* PrimitiveMockObserver.swift in Sources */, 6A7D2CD523BBDBDC0038576E /* ReplayRelayTests.swift in Sources */, C820A9C31EB509FC00D431BC /* Observable+SkipTests.swift in Sources */, C83509C31C3875220027C24C /* KVOObservableTests.swift in Sources */, C8A9B6F51DAD752200C9B027 /* Observable+BindTests.swift in Sources */, C83509F91C38755D0027C24C /* MainSchedulerTests.swift in Sources */, C8C4F1871DE9DF0200003FA7 /* UISwitch+RxTests.swift in Sources */, C820AA031EB5134000D431BC /* Observable+DelaySubscriptionTests.swift in Sources */, 7EDBAEC31C89BCB9006CBE67 /* UITabBarItem+RxTests.swift in Sources */, C8091C541FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */, 4C8DE0E320D54545003E2D8A /* DisposeBagTest.swift in Sources */, 914FCD681CCDB82E0058B304 /* UIPageControl+RxTest.swift in Sources */, C83509DD1C38754C0027C24C /* EquatableArray.swift in Sources */, C83509F71C38755D0027C24C /* DisposableTest.swift in Sources */, C8C4F18A1DE9DFA400003FA7 /* UISearchBar+RxTests.swift in Sources */, C8323A8F1E33FD5200CC0C7F /* Resources.swift in Sources */, C8F03F421DBB98DB00AECC4C /* Anomalies.swift in Sources */, C8E390691F379386004FC993 /* Observable+EnumeratedTests.swift in Sources */, C820A9A71EB5056C00D431BC /* Observable+SkipUntilTests.swift in Sources */, C83509DC1C38754C0027C24C /* ElementIndexPair.swift in Sources */, C8B0F70E1F530A1700548EBE /* SharingSchedulerTests.swift in Sources */, C8845ADB1EDB607800B36836 /* Observable+ShareReplayScopeTests.swift in Sources */, 78C385EC256859DC005E39B3 /* Infallible+Tests.swift in Sources */, C8350A171C38756A0027C24C /* SubjectConcurrencyTest.swift in Sources */, C83509EA1C3875580027C24C /* BackgroundThreadPrimitiveHotObservable.swift in Sources */, C84CB1721C3876B800EB63CC /* UIView+RxTests.swift in Sources */, C8353CEA1DA19BC500BE3F5C /* TestErrors.swift in Sources */, C820A9B31EB507D300D431BC /* Observable+TakeWhileTests.swift in Sources */, C820A9AB1EB505A800D431BC /* Observable+WithLatestFromTests.swift in Sources */, C820A9571EB4ED7C00D431BC /* Observable+MulticastTests.swift in Sources */, C83509F81C38755D0027C24C /* HistoricalSchedulerTest.swift in Sources */, C8379EF51D1DD326003EF8FC /* UIButton+RxTests.swift in Sources */, C81B6AAE1DB2C15C0047CF86 /* Platform.Linux.swift in Sources */, C83509F21C38755D0027C24C /* Observable+Tests.swift in Sources */, C820A9E31EB50D6C00D431BC /* Observable+SampleTests.swift in Sources */, 788DCE6024CB8512005B8F8C /* Observable+DecodeTests.swift in Sources */, C8D970EA1F532FD30058F2FE /* Driver+Test.swift in Sources */, C820A9FB1EB510D500D431BC /* Observable+MaterializeTests.swift in Sources */, C801DE4B1F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift in Sources */, C820AA0F1EB5140100D431BC /* Observable+TimeoutTests.swift in Sources */, C820A9BB1EB5097700D431BC /* Observable+TakeTests.swift in Sources */, C820A96B1EB4F64800D431BC /* Observable+JustTests.swift in Sources */, C8C4F1791DE9DF0200003FA7 /* UIAlertAction+RxTests.swift in Sources */, C83509D31C3875390027C24C /* RXObjCRuntime+Testing.m in Sources */, C81A097E1E6C27A100900B3B /* Observable+ZipTests.swift in Sources */, C8C4F17B1DE9DF0200003FA7 /* UICollectionView+RxTests.swift in Sources */, C820A96F1EB4F7AC00D431BC /* Observable+SequenceTests.swift in Sources */, C8165AD621891DBF00494BEF /* AtomicInt.swift in Sources */, C820A9A31EB5011700D431BC /* Observable+TakeUntilTests.swift in Sources */, C8C4F1841DE9DF0200003FA7 /* UISegmentedControl+RxTests.swift in Sources */, C820A9EB1EB50E3400D431BC /* Observable+RetryWhenTests.swift in Sources */, C83509D01C38752E0027C24C /* RuntimeStateSnapshot.swift in Sources */, C8C4F1861DE9DF0200003FA7 /* UIStepper+RxTests.swift in Sources */, A2FD4E9E225D050B00288525 /* Observable+RelayBindTests.swift in Sources */, C83509F41C38755D0027C24C /* BagTest.swift in Sources */, C8F27DC11CE68DA700D5FB4F /* UITextView+RxTests.swift in Sources */, C86B1E231D42BF5200130546 /* SchedulerTests.swift in Sources */, C820AA071EB5139C00D431BC /* Observable+BufferTests.swift in Sources */, C8D970ED1F532FD30058F2FE /* SectionedViewDataSourceMock.swift in Sources */, C8350A0F1C3875630027C24C /* Observable+ZipTests+arity.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C83509901C38742C0027C24C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C8350A201C38756B0027C24C /* QueueTests.swift in Sources */, A20CC6F6259F40A200370AE3 /* Observable+WithUnretainedTests.swift in Sources */, C820A9541EB4ECC000D431BC /* Observable+ToArrayTests.swift in Sources */, 1AF67DA41CED427D00C310FA /* PublishSubjectTest.swift in Sources */, C820A9781EB4F92100D431BC /* Observable+GenerateTests.swift in Sources */, 0BA9496E1E224B9C0036DD06 /* AsyncSubjectTests.swift in Sources */, C83509E71C3875580027C24C /* PrimitiveHotObservable.swift in Sources */, C83509CE1C3875230027C24C /* NSObject+RxTests.swift in Sources */, C820A9D81EB50C5C00D431BC /* Observable+DistinctUntilChangedTests.swift in Sources */, C820A9B81EB5081400D431BC /* Observable+MapTests.swift in Sources */, C8350A011C38755E0027C24C /* AssumptionsTest.swift in Sources */, C820A9D41EB50B0900D431BC /* Observable+GroupByTests.swift in Sources */, C820AA101EB5140100D431BC /* Observable+TimeoutTests.swift in Sources */, C81B6AAC1DB2C15C0047CF86 /* Platform.Darwin.swift in Sources */, C8350A2B1C3875B60027C24C /* RxMutableBox.swift in Sources */, C8350A071C38755E0027C24C /* MainSchedulerTests.swift in Sources */, C8D970F41F532FD30058F2FE /* SharedSequence+OperatorTest.swift in Sources */, 4C5213B0225E22510079FC77 /* Observable+CompactMapTests.swift in Sources */, C820A9F01EB50EA100D431BC /* Observable+ScanTests.swift in Sources */, C8ADC1902200F9B000B611D4 /* Atomic+Overrides.swift in Sources */, C83509B81C38750D0027C24C /* ControlEventTests.swift in Sources */, A2FD4E9F225D050B00288525 /* Observable+RelayBindTests.swift in Sources */, C83509CB1C3875230027C24C /* KVOObservableTests.swift in Sources */, C83509C81C3875230027C24C /* DelegateProxyTest.swift in Sources */, C8350A0D1C38755E0027C24C /* Observable+CombineLatestTests+arity.swift in Sources */, C822BACC1DB4058100F98810 /* Event+Test.swift in Sources */, C8BAA78F1E34F8D400EEC727 /* RecursiveLockTest.swift in Sources */, C820A9581EB4ED7C00D431BC /* Observable+MulticastTests.swift in Sources */, C822BAD01DB424EC00F98810 /* Reactive+Tests.swift in Sources */, 78067D1125164938007CB7EE /* NSTextView+RxTests.swift in Sources */, C83509E21C3875580027C24C /* BackgroundThreadPrimitiveHotObservable.swift in Sources */, C8091C551FAA3588001DB32A /* ObservableConvertibleType+SharedSequence.swift in Sources */, C8350A0E1C3875630027C24C /* Observable+ZipTests+arity.swift in Sources */, C820AA001EB5110E00D431BC /* Observable+DematerializeTests.swift in Sources */, C8D970F11F532FD30058F2FE /* SharedSequence+Extensions.swift in Sources */, C820A9941EB4FD1400D431BC /* Observable+SwitchIfEmptyTests.swift in Sources */, C83509CF1C3875260027C24C /* NSView+RxTests.swift in Sources */, 6A7D2CD623BBDBDC0038576E /* ReplayRelayTests.swift in Sources */, C820A9501EB4EC3C00D431BC /* Observable+ReduceTests.swift in Sources */, C820A9841EB4FB0400D431BC /* Observable+UsingTests.swift in Sources */, C820A9881EB4FB5B00D431BC /* Observable+DebugTests.swift in Sources */, C820A9E01EB50CF800D431BC /* Observable+ThrottleTests.swift in Sources */, C8350A1F1C38756B0027C24C /* ObserverTests.swift in Sources */, C820A9681EB4F39500D431BC /* Observable+SubscribeOnTests.swift in Sources */, C820A9981EB4FF7000D431BC /* Observable+ConcatTests.swift in Sources */, C820A9901EB4FCC400D431BC /* Observable+SwitchTests.swift in Sources */, C8845ADC1EDB607800B36836 /* Observable+ShareReplayScopeTests.swift in Sources */, C834F6C61DB3950600C29244 /* NSControl+RxTests.swift in Sources */, C83509D61C3875420027C24C /* SentMessageTest.swift in Sources */, C81A097F1E6C27A100900B3B /* Observable+ZipTests.swift in Sources */, C820AA0C1EB513C800D431BC /* Observable+WindowTests.swift in Sources */, C8350A021C38755E0027C24C /* BagTest.swift in Sources */, C86B1E241D42BF5200130546 /* SchedulerTests.swift in Sources */, C89814801E75AD380035949C /* PrimitiveSequenceTest+zip+arity.swift in Sources */, C820A9FC1EB510D500D431BC /* Observable+MaterializeTests.swift in Sources */, C83509E81C3875580027C24C /* PrimitiveMockObserver.swift in Sources */, C83509BE1C3875100027C24C /* DelegateProxyTest+Cocoa.swift in Sources */, C820A9F41EB5109300D431BC /* Observable+DefaultIfEmpty.swift in Sources */, C820AA041EB5134000D431BC /* Observable+DelaySubscriptionTests.swift in Sources */, C8E3906A1F379386004FC993 /* Observable+EnumeratedTests.swift in Sources */, C8353CEB1DA19BC500BE3F5C /* TestErrors.swift in Sources */, C8B2908B1C94D64700E923D0 /* RxTest+Controls.swift in Sources */, 4C8DE0E420D54545003E2D8A /* DisposeBagTest.swift in Sources */, C8C4F1751DE9D80A00003FA7 /* NSSlider+RxTests.swift in Sources */, C820A9E41EB50D6C00D431BC /* Observable+SampleTests.swift in Sources */, C8F03F511DBBAE9400AECC4C /* DispatchQueue+Extensions.swift in Sources */, C82A336B1E2C3343003A6044 /* PerformanceTools.swift in Sources */, C8350A231C38756B0027C24C /* VirtualSchedulerTest.swift in Sources */, C83509E51C3875580027C24C /* MySubject.swift in Sources */, C820A94C1EB4E75E00D431BC /* Observable+AmbTests.swift in Sources */, C801DE4C1F6EBB84008DB060 /* Observable+PrimitiveSequenceTest.swift in Sources */, C83509B91C38750D0027C24C /* ControlPropertyTests.swift in Sources */, C820AA081EB5139C00D431BC /* Observable+BufferTests.swift in Sources */, C820A9D01EB50AD400D431BC /* Observable+SingleTests.swift in Sources */, C820A9C81EB50A4200D431BC /* Observable+SkipWhileTests.swift in Sources */, DB08833C26FB080B005805BE /* SharedSequence+ConcurrencyTests.swift in Sources */, C820A9EC1EB50E3400D431BC /* Observable+RetryWhenTests.swift in Sources */, C8323A901E33FD5200CC0C7F /* Resources.swift in Sources */, C820A98C1EB4FBD600D431BC /* Observable+CatchTests.swift in Sources */, C820A9AC1EB505A800D431BC /* Observable+WithLatestFromTests.swift in Sources */, C8350A061C38755E0027C24C /* HistoricalSchedulerTest.swift in Sources */, C820A9E81EB50DB900D431BC /* Observable+TimerTests.swift in Sources */, C820A9CC1EB50A7100D431BC /* Observable+ElementAtTests.swift in Sources */, C83509D11C38752E0027C24C /* RuntimeStateSnapshot.swift in Sources */, C8A53AE71F09292A00490535 /* Completable+AndThen.swift in Sources */, 1E9DA0C722006858000EB80A /* Synchronized.swift in Sources */, C83509D21C3875380027C24C /* RXObjCRuntime+Testing.m in Sources */, C8353CDE1DA19BA000BE3F5C /* MessageProcessingStage.swift in Sources */, 1E3079AE21FB52330072A7E6 /* AtomicTests.swift in Sources */, C8F03F431DBB98DB00AECC4C /* Anomalies.swift in Sources */, C8D970E81F532FD30058F2FE /* SharedSequence+Test.swift in Sources */, C83509CC1C3875230027C24C /* NSLayoutConstraint+RxTests.swift in Sources */, C896A68D1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */, C820A9A41EB5011700D431BC /* Observable+TakeUntilTests.swift in Sources */, C8C4F1731DE9D7A300003FA7 /* NSTextField+RxTests.swift in Sources */, C820A9641EB4EFD300D431BC /* Observable+ObserveOnTests.swift in Sources */, 788DCE6124CB8512005B8F8C /* Observable+DecodeTests.swift in Sources */, C83509E41C3875580027C24C /* MockDisposable.swift in Sources */, C83509D51C38753E0027C24C /* RxObjCRuntimeState.swift in Sources */, 1AF67DA81CED430100C310FA /* ReplaySubjectTest.swift in Sources */, C820A9801EB4FA5A00D431BC /* Observable+RepeatTests.swift in Sources */, C8350A001C38755E0027C24C /* Observable+Tests.swift in Sources */, C83509E91C3875580027C24C /* TestConnectableObservable.swift in Sources */, C820A97C1EB4FA0800D431BC /* Observable+RangeTests.swift in Sources */, C82FF0F11F93DD2E00BDB34D /* ObservableType+SubscriptionTests.swift in Sources */, C83509DF1C38754F0027C24C /* TestVirtualScheduler.swift in Sources */, C820A9DC1EB50CAA00D431BC /* Observable+DoOnTests.swift in Sources */, C83509CD1C3875230027C24C /* NotificationCenterTests.swift in Sources */, C83509DB1C38754C0027C24C /* EquatableArray.swift in Sources */, C820A9BC1EB5097700D431BC /* Observable+TakeTests.swift in Sources */, C8350A031C38755E0027C24C /* BehaviorSubjectTest.swift in Sources */, C83509E31C3875580027C24C /* MainThreadPrimitiveHotObservable.swift in Sources */, C834F6C41DB394E100C29244 /* Observable+BlockingTest.swift in Sources */, C820AA141EB5145200D431BC /* Observable+DelayTests.swift in Sources */, C8350A1D1C38756B0027C24C /* Observable+SubscriptionTest.swift in Sources */, C820A9C01EB509B500D431BC /* Observable+TakeLastTests.swift in Sources */, C820A9B41EB507D300D431BC /* Observable+TakeWhileTests.swift in Sources */, C820A9B01EB5073E00D431BC /* Observable+FilterTests.swift in Sources */, C8350A041C38755E0027C24C /* CurrentThreadSchedulerTest.swift in Sources */, C8353CE81DA19BC500BE3F5C /* Recorded+Timeless.swift in Sources */, C8A9B6F61DAD752200C9B027 /* Observable+BindTests.swift in Sources */, 504540D1241971E80098665F /* DelegateProxyTest+WebKit.swift in Sources */, DB0B922226FB3139005CEED9 /* Observable+ConcurrencyTests.swift in Sources */, C820A99C1EB5001C00D431BC /* Observable+MergeTests.swift in Sources */, C8350A051C38755E0027C24C /* DisposableTest.swift in Sources */, C820A96C1EB4F64800D431BC /* Observable+JustTests.swift in Sources */, C801DE401F6EAD57008DB060 /* CompletableTest.swift in Sources */, C820A9741EB4F84000D431BC /* Observable+OptionalTests.swift in Sources */, 504540CC24196EB10098665F /* WKWebView+RxTests.swift in Sources */, C820A9C41EB509FC00D431BC /* Observable+SkipTests.swift in Sources */, C820A9701EB4F7AC00D431BC /* Observable+SequenceTests.swift in Sources */, C8B0F70F1F530A1700548EBE /* SharingSchedulerTests.swift in Sources */, C8350A211C38756B0027C24C /* SubjectConcurrencyTest.swift in Sources */, C8353CEE1DA19BC500BE3F5C /* XCTest+AllTests.swift in Sources */, C8D970E51F532FD30058F2FE /* Signal+Test.swift in Sources */, C8165AD721891DBF00494BEF /* AtomicInt.swift in Sources */, C801DE381F6EAD3C008DB060 /* SingleTest.swift in Sources */, C81B6AAF1DB2C15C0047CF86 /* Platform.Linux.swift in Sources */, C801DE3C1F6EAD48008DB060 /* MaybeTest.swift in Sources */, C8C4F1771DE9D84900003FA7 /* NSButton+RxTests.swift in Sources */, C820A9A81EB5056C00D431BC /* Observable+SkipUntilTests.swift in Sources */, C83509E61C3875580027C24C /* Observable.Extensions.swift in Sources */, C8D970EB1F532FD30058F2FE /* Driver+Test.swift in Sources */, C83509DE1C38754F0027C24C /* Observable+Extensions.swift in Sources */, C83509DA1C38754C0027C24C /* ElementIndexPair.swift in Sources */, C89CFA0E1DAAB4670079D23B /* RxTest.swift in Sources */, C85218031E33FC160015DD38 /* RecursiveLock.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C85BA0471C3878740075D68E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C85217F31E33ECA00015DD38 /* PerformanceTools.swift in Sources */, C8E8BA721E2C18AE00A4AC2C /* main.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C88FA5001C25C44800CCFEA4 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C89CFA321DAABBE20079D23B /* Recorded.swift in Sources */, C89CFA4A1DAABBE20079D23B /* TestableObserver.swift in Sources */, C89CFA4E1DAABBE20079D23B /* XCTest+Rx.swift in Sources */, C89CFA361DAABBE20079D23B /* RxTest.swift in Sources */, C89CFA261DAABBE20079D23B /* Event+Equatable.swift in Sources */, C89CFA221DAABBE20079D23B /* ColdObservable.swift in Sources */, C89CFA461DAABBE20079D23B /* TestableObservable.swift in Sources */, C89CFA3A1DAABBE20079D23B /* TestScheduler.swift in Sources */, C86781831DB8143A00B2029A /* Bag.swift in Sources */, C89CFA2A1DAABBE20079D23B /* HotObservable.swift in Sources */, 4583D8231FE94BBA00AA1BB1 /* Recorded+Event.swift in Sources */, C89CFA421DAABBE20079D23B /* Subscription.swift in Sources */, C89CFA1E1DAABBE20079D23B /* Any+Equatable.swift in Sources */, C89CFA3E1DAABBE20079D23B /* TestSchedulerVirtualTimeConverter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C8A56AD21AD7424700B4673B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( DB0B922426FB31C1005CEED9 /* PrimitiveSequence+Concurrency.swift in Sources */, C820A8BC1EB4DA5A00D431BC /* SwitchIfEmpty.swift in Sources */, C8093CCB1B8A72BE0088E94D /* ConnectableObservableType.swift in Sources */, C820A8801EB4DA5A00D431BC /* Filter.swift in Sources */, C820A86C1EB4DA5A00D431BC /* ElementAt.swift in Sources */, 25F6ECBC1F48C366008552FA /* Maybe.swift in Sources */, C83D73BC1C1DBAEE003DC470 /* InvocableScheduledItem.swift in Sources */, C8093CE51B8A72BE0088E94D /* NopDisposable.swift in Sources */, C86781741DB8129E00B2029A /* InfiniteSequence.swift in Sources */, C8093CD31B8A72BE0088E94D /* Disposable.swift in Sources */, C801DE451F6EBB32008DB060 /* ObservableType+PrimitiveSequence.swift in Sources */, C820A8A41EB4DA5A00D431BC /* DistinctUntilChanged.swift in Sources */, C8093CED1B8A72BE0088E94D /* SingleAssignmentDisposable.swift in Sources */, C820A8341EB4DA5900D431BC /* Delay.swift in Sources */, C89814781E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift in Sources */, C849BE2B1BAB5D070019AD27 /* ObservableConvertibleType.swift in Sources */, C8093D9B1B8A72BE0088E94D /* SchedulerServices+Emulation.swift in Sources */, C820A8B81EB4DA5A00D431BC /* Concat.swift in Sources */, C820A8301EB4DA5900D431BC /* Switch.swift in Sources */, 601AE3DA1EE24E4F00617386 /* SwiftSupport.swift in Sources */, 819C2F091F2FBC7F009104B6 /* First.swift in Sources */, C820A8B41EB4DA5A00D431BC /* TakeWithPredicate.swift in Sources */, C80EEC341D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */, C820A8841EB4DA5A00D431BC /* Dematerialize.swift in Sources */, C820A8941EB4DA5A00D431BC /* RetryWhen.swift in Sources */, C820A8441EB4DA5900D431BC /* DelaySubscription.swift in Sources */, C820A8E81EB4DA5A00D431BC /* Just.swift in Sources */, C8093D691B8A72BE0088E94D /* AnyObserver.swift in Sources */, C8B144FB1BD2D44500267DCE /* ConcurrentMainScheduler.swift in Sources */, C820A9181EB4DA5A00D431BC /* AsMaybe.swift in Sources */, 0BA949671E224B7E0036DD06 /* AsyncSubject.swift in Sources */, C8E390631F379041004FC993 /* Enumerated.swift in Sources */, C820A8CC1EB4DA5A00D431BC /* Optional.swift in Sources */, C8093D871B8A72BE0088E94D /* RxMutableBox.swift in Sources */, C8093D931B8A72BE0088E94D /* MainScheduler.swift in Sources */, C820A8481EB4DA5900D431BC /* Skip.swift in Sources */, C820A8D81EB4DA5A00D431BC /* Using.swift in Sources */, C8165ACB21891BBF00494BEF /* AtomicInt.swift in Sources */, 786DED6E24F84623008C4FAC /* Infallible+Operators.swift in Sources */, C8550B4B1D95A41400A6FCFE /* Reactive.swift in Sources */, CB883B451BE256D4000AC2EE /* BooleanDisposable.swift in Sources */, C820A9241EB4DA5A00D431BC /* CombineLatest.swift in Sources */, C86781881DB814AD00B2029A /* Bag+Rx.swift in Sources */, 1D858B6629E57EE900CD6814 /* Infallible+CombineLatest+Collection.swift in Sources */, C820A8881EB4DA5A00D431BC /* Materialize.swift in Sources */, C820A9201EB4DA5A00D431BC /* AddRef.swift in Sources */, C820A9081EB4DA5A00D431BC /* Multicast.swift in Sources */, C8093DA31B8A72BE0088E94D /* ReplaySubject.swift in Sources */, DB08833526FA9834005805BE /* Observable+Concurrency.swift in Sources */, 786DED6924F8415B008C4FAC /* Infallible+Zip+arity.swift in Sources */, C8093CFB1B8A72BE0088E94D /* ObservableType+Extensions.swift in Sources */, 4C5213AA225D41E60079FC77 /* CompactMap.swift in Sources */, C820A8781EB4DA5A00D431BC /* TakeLast.swift in Sources */, C83D73C01C1DBAEE003DC470 /* InvocableType.swift in Sources */, C8093D731B8A72BE0088E94D /* ObserverBase.swift in Sources */, C820A8EC1EB4DA5A00D431BC /* Never.swift in Sources */, C820A8981EB4DA5A00D431BC /* Catch.swift in Sources */, C820A9141EB4DA5A00D431BC /* ToArray.swift in Sources */, C820A8741EB4DA5A00D431BC /* SkipWhile.swift in Sources */, 25F6ECBE1F48C373008552FA /* Completable.swift in Sources */, C820A91C1EB4DA5A00D431BC /* AsSingle.swift in Sources */, C8BF34CF1C2E426800416CAE /* Platform.Linux.swift in Sources */, C8093D791B8A72BE0088E94D /* TailRecursiveSink.swift in Sources */, C8093CC71B8A72BE0088E94D /* AsyncLock.swift in Sources */, DB0B922626FB31EF005CEED9 /* Infallible+Concurrency.swift in Sources */, C820A8501EB4DA5900D431BC /* Timer.swift in Sources */, C8A53AE01F09178700490535 /* Completable+AndThen.swift in Sources */, C8F03F4A1DBBAC0A00AECC4C /* DispatchQueue+Extensions.swift in Sources */, C820A8E41EB4DA5A00D431BC /* Error.swift in Sources */, C8093CD71B8A72BE0088E94D /* BinaryDisposable.swift in Sources */, C8FA89141C30405400CD3A17 /* VirtualTimeConverterType.swift in Sources */, C820A8B01EB4DA5A00D431BC /* SkipUntil.swift in Sources */, C820A8F41EB4DA5A00D431BC /* Create.swift in Sources */, C820A8901EB4DA5A00D431BC /* Scan.swift in Sources */, CB883B401BE24C15000AC2EE /* RefCountDisposable.swift in Sources */, 7846F56624F83AF400A39919 /* Infallible.swift in Sources */, C84CC54E1BDCF48200E06A64 /* LockOwnerType.swift in Sources */, C8FA89151C30405400CD3A17 /* VirtualTimeScheduler.swift in Sources */, C84CC5531BDCF49300E06A64 /* SynchronizedOnType.swift in Sources */, C820A8601EB4DA5A00D431BC /* Generate.swift in Sources */, 786DED7024F847BF008C4FAC /* Infallible+Create.swift in Sources */, 78B6157523B69F49009C2AD9 /* Binder.swift in Sources */, C8C3DA0F1B939767004D233E /* CurrentThreadScheduler.swift in Sources */, C8093D851B8A72BE0088E94D /* Rx.swift in Sources */, C820A84C1EB4DA5900D431BC /* Take.swift in Sources */, C820A9381EB4DA5A00D431BC /* Zip.swift in Sources */, C8093DA51B8A72BE0088E94D /* SubjectType.swift in Sources */, C820A9341EB4DA5A00D431BC /* Sink.swift in Sources */, C8FA89171C30409900CD3A17 /* HistoricalScheduler.swift in Sources */, C8093D6B1B8A72BE0088E94D /* AnonymousObserver.swift in Sources */, C8093DA11B8A72BE0088E94D /* PublishSubject.swift in Sources */, 1E3EDF65226356A000B631B9 /* Date+Dispatch.swift in Sources */, C83D73C81C1DBAEE003DC470 /* ScheduledItemType.swift in Sources */, C820A8C41EB4DA5A00D431BC /* CombineLatest+Collection.swift in Sources */, C820A9301EB4DA5A00D431BC /* Producer.swift in Sources */, C8093D8D1B8A72BE0088E94D /* SchedulerType.swift in Sources */, C820A8D41EB4DA5A00D431BC /* Range.swift in Sources */, C820A8C01EB4DA5A00D431BC /* Zip+Collection.swift in Sources */, C84CC5621BDD037900E06A64 /* SynchronizedDisposeType.swift in Sources */, C820A8381EB4DA5900D431BC /* Timeout.swift in Sources */, C820A8701EB4DA5A00D431BC /* Merge.swift in Sources */, C8093D951B8A72BE0088E94D /* OperationQueueScheduler.swift in Sources */, C8093CDD1B8A72BE0088E94D /* DisposeBag.swift in Sources */, C85217E91E3374970015DD38 /* GroupedObservable.swift in Sources */, C820A93C1EB4DA5A00D431BC /* Zip+arity.swift in Sources */, C8093D971B8A72BE0088E94D /* RecursiveScheduler.swift in Sources */, C8093CDF1B8A72BE0088E94D /* DisposeBase.swift in Sources */, 786DED6C24F844BC008C4FAC /* Infallible+CombineLatest+arity.swift in Sources */, C820A8C81EB4DA5A00D431BC /* Debug.swift in Sources */, C820A8F81EB4DA5A00D431BC /* SubscribeOn.swift in Sources */, C8093CD51B8A72BE0088E94D /* AnonymousDisposable.swift in Sources */, C820A8DC1EB4DA5A00D431BC /* Repeat.swift in Sources */, C820A8681EB4DA5A00D431BC /* SingleAsync.swift in Sources */, C81A09871E6C702700900B3B /* PrimitiveSequence.swift in Sources */, C8093D8F1B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift in Sources */, 25F6ECC01F48C37C008552FA /* Single.swift in Sources */, C820A8A01EB4DA5A00D431BC /* Do.swift in Sources */, C8093D9F1B8A72BE0088E94D /* BehaviorSubject.swift in Sources */, C820A83C1EB4DA5900D431BC /* Window.swift in Sources */, C8093D651B8A72BE0088E94D /* ObservableType.swift in Sources */, C820A9281EB4DA5A00D431BC /* CombineLatest+arity.swift in Sources */, C820A8581EB4DA5900D431BC /* Debounce.swift in Sources */, C8093D9D1B8A72BE0088E94D /* SerialDispatchQueueScheduler.swift in Sources */, CDDEF16A1D4FB40000CA8546 /* Disposables.swift in Sources */, C8093CC91B8A72BE0088E94D /* Lock.swift in Sources */, C85217F71E33FBBE0015DD38 /* RecursiveLock.swift in Sources */, C820A88C1EB4DA5A00D431BC /* DefaultIfEmpty.swift in Sources */, C820A8401EB4DA5900D431BC /* Buffer.swift in Sources */, C820A82C1EB4DA5900D431BC /* Map.swift in Sources */, C8093CF31B8A72BE0088E94D /* Errors.swift in Sources */, A20CC6C9259F3FE700370AE3 /* WithUnretained.swift in Sources */, C86781781DB8129E00B2029A /* PriorityQueue.swift in Sources */, C820A8D01EB4DA5A00D431BC /* Sequence.swift in Sources */, C820A8E01EB4DA5A00D431BC /* Deferred.swift in Sources */, C820A8AC1EB4DA5A00D431BC /* Amb.swift in Sources */, C820A8541EB4DA5900D431BC /* Sample.swift in Sources */, C8845AD41EDB4C9900B36836 /* ShareReplayScope.swift in Sources */, 786DED6324F83DE5008C4FAC /* ObservableConvertibleType+Infallible.swift in Sources */, C86781701DB8129E00B2029A /* Bag.swift in Sources */, C8093CF71B8A72BE0088E94D /* ImmediateSchedulerType.swift in Sources */, C8BF34CB1C2E426800416CAE /* Platform.Darwin.swift in Sources */, C820A85C1EB4DA5A00D431BC /* Throttle.swift in Sources */, C8093CC51B8A72BE0088E94D /* Cancelable.swift in Sources */, 788DCE5D24CB8249005B8F8C /* Decode.swift in Sources */, C8093CE71B8A72BE0088E94D /* ScheduledDisposable.swift in Sources */, C8FA891C1C30412A00CD3A17 /* HistoricalSchedulerTimeConverter.swift in Sources */, C8093CDB1B8A72BE0088E94D /* CompositeDisposable.swift in Sources */, C8093D7D1B8A72BE0088E94D /* ObserverType.swift in Sources */, C820A8F01EB4DA5A00D431BC /* Empty.swift in Sources */, C8093CFD1B8A72BE0088E94D /* Observable.swift in Sources */, C84CC55D1BDD010800E06A64 /* SynchronizedUnsubscribeType.swift in Sources */, C8093CEB1B8A72BE0088E94D /* SerialDisposable.swift in Sources */, C820A9101EB4DA5A00D431BC /* Reduce.swift in Sources */, C820A8641EB4DA5A00D431BC /* GroupBy.swift in Sources */, C84CC5671BDD08A500E06A64 /* SubscriptionDisposable.swift in Sources */, C820A89C1EB4DA5A00D431BC /* StartWith.swift in Sources */, C820A8FC1EB4DA5A00D431BC /* ObserveOn.swift in Sources */, C8093CF51B8A72BE0088E94D /* Event.swift in Sources */, C83D73C41C1DBAEE003DC470 /* ScheduledItem.swift in Sources */, C820A8A81EB4DA5A00D431BC /* WithLatestFrom.swift in Sources */, C867817C1DB8129E00B2029A /* Queue.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C8E8BA511E2C181A00A4AC2C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C8E8BA641E2C186200A4AC2C /* Benchmarks.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ A2897D5A225CA28F004EA481 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = A2897D59225CA28F004EA481 /* PBXContainerItemProxy */; }; A2897D64225CBD37004EA481 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = A2897CB3225CA1E7004EA481 /* RxRelay */; targetProxy = A2897D63225CBD37004EA481 /* PBXContainerItemProxy */; }; C83508CA1C386F6F0027C24C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = C83508C91C386F6F0027C24C /* PBXContainerItemProxy */; }; C835097B1C3871340027C24C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C88FA4FD1C25C44800CCFEA4 /* RxTest */; targetProxy = C835097A1C3871340027C24C /* PBXContainerItemProxy */; }; C835097D1C3871380027C24C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8093B4B1B8A71F00088E94D /* RxBlocking */; targetProxy = C835097C1C3871380027C24C /* PBXContainerItemProxy */; }; C83E398721890703001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = C83E398621890703001F4F0E /* PBXContainerItemProxy */; }; C83E398921890703001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C80938F51B8A71760088E94D /* RxCocoa */; targetProxy = C83E398821890703001F4F0E /* PBXContainerItemProxy */; }; C83E398B21890703001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8093B4B1B8A71F00088E94D /* RxBlocking */; targetProxy = C83E398A21890703001F4F0E /* PBXContainerItemProxy */; }; C83E398D21890703001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C88FA4FD1C25C44800CCFEA4 /* RxTest */; targetProxy = C83E398C21890703001F4F0E /* PBXContainerItemProxy */; }; C83E398F2189070A001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = C83E398E2189070A001F4F0E /* PBXContainerItemProxy */; }; C83E39912189070A001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C80938F51B8A71760088E94D /* RxCocoa */; targetProxy = C83E39902189070A001F4F0E /* PBXContainerItemProxy */; }; C83E39932189070A001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8093B4B1B8A71F00088E94D /* RxBlocking */; targetProxy = C83E39922189070A001F4F0E /* PBXContainerItemProxy */; }; C83E39952189070A001F4F0E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C88FA4FD1C25C44800CCFEA4 /* RxTest */; targetProxy = C83E39942189070A001F4F0E /* PBXContainerItemProxy */; }; C872BD1C1BC0529600D7175E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = C872BD1B1BC0529600D7175E /* PBXContainerItemProxy */; }; C872BD241BC052B800D7175E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = C872BD231BC052B800D7175E /* PBXContainerItemProxy */; }; C88FA4FE1C25C44800CCFEA4 /* PBXTargetDependency */ = { isa = PBXTargetDependency; platformFilters = ( ios, maccatalyst, macos, tvos, xros, ); target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = C88FA4FF1C25C44800CCFEA4 /* PBXContainerItemProxy */; }; C8B52BC6215434D600EAA87C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C80938F51B8A71760088E94D /* RxCocoa */; targetProxy = C8B52BC5215434D600EAA87C /* PBXContainerItemProxy */; }; C8E8BA5C1E2C181A00A4AC2C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C8A56AD61AD7424700B4673B /* RxSwift */; targetProxy = C8E8BA5B1E2C181A00A4AC2C /* PBXContainerItemProxy */; }; C8E8BA761E2C1BB200A4AC2C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C80938F51B8A71760088E94D /* RxCocoa */; targetProxy = C8E8BA751E2C1BB200A4AC2C /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ A2897D50225CA1E7004EA481 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxRelay/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Debug; }; A2897D51225CA1E7004EA481 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxRelay/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Release; }; A2897D52225CA1E7004EA481 /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxRelay/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = "Release-Tests"; }; C809396A1B8A71760088E94D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Debug; }; C809396B1B8A71760088E94D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Release; }; C809396C1B8A71760088E94D /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxCocoa/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxCocoa; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = "Release-Tests"; }; C8093BC41B8A71F00088E94D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Debug; }; C8093BC51B8A71F00088E94D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Release; }; C8093BC61B8A71F00088E94D /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxBlocking/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxBlocking; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = "Release-Tests"; }; C83508CB1C386F6F0027C24C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; APPLICATION_EXTENSION_API_ONLY = NO; DEBUG_INFORMATION_FORMAT = dwarf; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-iOS-Bridging-Header.h"; }; name = Debug; }; C83508CC1C386F6F0027C24C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; APPLICATION_EXTENSION_API_ONLY = NO; BUILD_LIBRARY_FOR_DISTRIBUTION = NO; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-iOS-Bridging-Header.h"; SWIFT_REFLECTION_METADATA_LEVEL = none; }; name = Release; }; C83508CD1C386F6F0027C24C /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; APPLICATION_EXTENSION_API_ONLY = NO; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-iOS-Bridging-Header.h"; SWIFT_REFLECTION_METADATA_LEVEL = none; }; name = "Release-Tests"; }; C835098D1C38740E0027C24C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Manual; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-tvOS"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-tvOS-Bridging-Header.h"; }; name = Debug; }; C835098E1C38740E0027C24C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = NO; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-tvOS"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-tvOS-Bridging-Header.h"; SWIFT_REFLECTION_METADATA_LEVEL = none; }; name = Release; }; C835098F1C38740E0027C24C /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-tvOS"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-tvOS-Bridging-Header.h"; SWIFT_REFLECTION_METADATA_LEVEL = none; }; name = "Release-Tests"; }; C835099D1C38742C0027C24C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_BITCODE = NO; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SUPPORTED_PLATFORMS = macosx; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-macOS-Bridging-Header.h"; }; name = Debug; }; C835099E1C38742C0027C24C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = NO; COMBINE_HIDPI_IMAGES = YES; ENABLE_BITCODE = NO; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SUPPORTED_PLATFORMS = macosx; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-macOS-Bridging-Header.h"; SWIFT_REFLECTION_METADATA_LEVEL = none; }; name = Release; }; C835099F1C38742C0027C24C /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; ENABLE_BITCODE = NO; INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.AllTests-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SUPPORTED_PLATFORMS = macosx; SWIFT_OBJC_BRIDGING_HEADER = "Tests/RxCocoaTests/RxTest-macOS-Bridging-Header.h"; SWIFT_REFLECTION_METADATA_LEVEL = none; }; name = "Release-Tests"; }; C85BA0551C3878750075D68E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_BITCODE = NO; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/Microoptimizations/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = io.rx.PerformanceTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; name = Debug; }; C85BA0561C3878750075D68E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; ENABLE_BITCODE = NO; INFOPLIST_FILE = Tests/Microoptimizations/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = io.rx.PerformanceTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; name = Release; }; C85BA0571C3878750075D68E /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; ENABLE_BITCODE = NO; INFOPLIST_FILE = Tests/Microoptimizations/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = io.rx.PerformanceTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; name = "Release-Tests"; }; C8633A941B08FA5500375D60 /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_CODE_COVERAGE = NO; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = "TRACE_RESOURCES=1"; GCC_TREAT_WARNINGS_AS_ERRORS = 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 = 12.0; MACH_O_TYPE = mh_dylib; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; ONLY_ACTIVE_ARCH = NO; OTHER_SWIFT_FLAGS = "-D TRACE_RESOURCES -Xfrontend -debug-time-function-bodies -Xfrontend -warn-long-expression-type-checking=100 -Xfrontend -warn-long-function-bodies=100"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchos watchsimulator"; SUPPORTS_MACCATALYST = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; TVOS_DEPLOYMENT_TARGET = 11.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 3.0; }; name = "Release-Tests"; }; C8633A951B08FA5500375D60 /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxSwift/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = "Release-Tests"; }; C88FA5091C25C44800CCFEA4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = NO; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks"; INFOPLIST_FILE = RxTest/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.RxTest; PRODUCT_NAME = RxTest; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,7"; }; name = Debug; }; C88FA50A1C25C44800CCFEA4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = NO; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks"; INFOPLIST_FILE = RxTest/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.RxTest; PRODUCT_NAME = RxTest; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,7"; }; name = Release; }; C88FA50B1C25C44800CCFEA4 /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = NO; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks"; INFOPLIST_FILE = RxTest/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.RxTest; PRODUCT_NAME = RxTest; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,7"; }; name = "Release-Tests"; }; C8A56AEB1AD7424700B4673B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "TRACE_RESOURCES=1", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = 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 = 12.0; MACH_O_TYPE = mh_dylib; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; OTHER_SWIFT_FLAGS = "-D TRACE_RESOURCES -D DEBUG"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchos watchsimulator"; SUPPORTS_MACCATALYST = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; TVOS_DEPLOYMENT_TARGET = 11.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 3.0; }; name = Debug; }; C8A56AEC1AD7424700B4673B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_CODE_COVERAGE = NO; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = 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 = 12.0; MACH_O_TYPE = mh_dylib; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; ONLY_ACTIVE_ARCH = NO; OTHER_SWIFT_FLAGS = "-D RELEASE"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchos watchsimulator"; SUPPORTS_MACCATALYST = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; TVOS_DEPLOYMENT_TARGET = 11.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 3.0; }; name = Release; }; C8A56AEE1AD7424700B4673B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxSwift/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Debug; }; C8A56AEF1AD7424700B4673B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/RxSwift/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = RxSwift; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator"; SUPPORTS_MACCATALYST = YES; TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; }; name = Release; }; C8E8BA5E1E2C181A00A4AC2C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/Benchmarks/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = io.rx.Benchmarks; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; }; name = Debug; }; C8E8BA5F1E2C181A00A4AC2C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Tests/Benchmarks/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = io.rx.Benchmarks; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; }; name = Release; }; C8E8BA601E2C181A00A4AC2C /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Tests/Benchmarks/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = io.rx.Benchmarks; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; }; name = "Release-Tests"; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ A2897D4F225CA1E7004EA481 /* Build configuration list for PBXNativeTarget "RxRelay" */ = { isa = XCConfigurationList; buildConfigurations = ( A2897D50225CA1E7004EA481 /* Debug */, A2897D51225CA1E7004EA481 /* Release */, A2897D52225CA1E7004EA481 /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C80939691B8A71760088E94D /* Build configuration list for PBXNativeTarget "RxCocoa" */ = { isa = XCConfigurationList; buildConfigurations = ( C809396A1B8A71760088E94D /* Debug */, C809396B1B8A71760088E94D /* Release */, C809396C1B8A71760088E94D /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C8093BC31B8A71F00088E94D /* Build configuration list for PBXNativeTarget "RxBlocking" */ = { isa = XCConfigurationList; buildConfigurations = ( C8093BC41B8A71F00088E94D /* Debug */, C8093BC51B8A71F00088E94D /* Release */, C8093BC61B8A71F00088E94D /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C83508CE1C386F6F0027C24C /* Build configuration list for PBXNativeTarget "AllTests-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( C83508CB1C386F6F0027C24C /* Debug */, C83508CC1C386F6F0027C24C /* Release */, C83508CD1C386F6F0027C24C /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C835098C1C38740E0027C24C /* Build configuration list for PBXNativeTarget "AllTests-tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( C835098D1C38740E0027C24C /* Debug */, C835098E1C38740E0027C24C /* Release */, C835098F1C38740E0027C24C /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C835099C1C38742C0027C24C /* Build configuration list for PBXNativeTarget "AllTests-macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( C835099D1C38742C0027C24C /* Debug */, C835099E1C38742C0027C24C /* Release */, C835099F1C38742C0027C24C /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C85BA0581C3878750075D68E /* Build configuration list for PBXNativeTarget "Microoptimizations" */ = { isa = XCConfigurationList; buildConfigurations = ( C85BA0551C3878750075D68E /* Debug */, C85BA0561C3878750075D68E /* Release */, C85BA0571C3878750075D68E /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C88FA5081C25C44800CCFEA4 /* Build configuration list for PBXNativeTarget "RxTest" */ = { isa = XCConfigurationList; buildConfigurations = ( C88FA5091C25C44800CCFEA4 /* Debug */, C88FA50A1C25C44800CCFEA4 /* Release */, C88FA50B1C25C44800CCFEA4 /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C8A56AD11AD7424700B4673B /* Build configuration list for PBXProject "Rx" */ = { isa = XCConfigurationList; buildConfigurations = ( C8A56AEB1AD7424700B4673B /* Debug */, C8A56AEC1AD7424700B4673B /* Release */, C8633A941B08FA5500375D60 /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C8A56AED1AD7424700B4673B /* Build configuration list for PBXNativeTarget "RxSwift" */ = { isa = XCConfigurationList; buildConfigurations = ( C8A56AEE1AD7424700B4673B /* Debug */, C8A56AEF1AD7424700B4673B /* Release */, C8633A951B08FA5500375D60 /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C8E8BA5D1E2C181A00A4AC2C /* Build configuration list for PBXNativeTarget "Benchmarks" */ = { isa = XCConfigurationList; buildConfigurations = ( C8E8BA5E1E2C181A00A4AC2C /* Debug */, C8E8BA5F1E2C181A00A4AC2C /* Release */, C8E8BA601E2C181A00A4AC2C /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = C8A56ACE1AD7424700B4673B /* Project object */; } ================================================ FILE: Rx.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Rx.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/91761072-433E-43DC-A058-545FB88C59EC.plist ================================================ classNames Benchmarks testCombineLatestCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.78754 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testCombineLatestPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.40023 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testFlatMapLatestCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.31364 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testFlatMapLatestPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 1.0434 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testFlatMapsCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.28765 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testFlatMapsPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.73057 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testMapFilterCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.21918 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testMapFilterDriverCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.6856 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testMapFilterDriverPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.57503 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testMapFilterPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.18783 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testPublishSubjectCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.34253 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 testPublishSubjectPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.36147 baselineIntegrationDisplayName Jan 21, 2017, 22:52:02 ================================================ FILE: Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/996C445D-86F0-429E-92A9-44EBD3769290.plist ================================================ classNames Benchmarks testCombineLatestCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 1.0266 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testCombineLatestPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.57447 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testFlatMapLatestCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.37629 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testFlatMapLatestPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 1.451 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testFlatMapsCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.33589 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testFlatMapsPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.93107 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testMapFilterCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.25352 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testMapFilterDriverCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 1.0115 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testMapFilterDriverPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.78744 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testMapFilterPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.24782 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testPublishSubjectCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.49188 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 testPublishSubjectPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.50931 baselineIntegrationDisplayName Mar 4, 2017, 21:45:48 ================================================ FILE: Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/B553A9F9-C6F1-4009-9BDC-AC42F9D31E38.plist ================================================ classNames Benchmarks testCombineLatestCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 1.0261 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testCombineLatestPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.58378 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testFlatMapLatestCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.38735 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testFlatMapLatestPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 1.4896 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testFlatMapsCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.33991 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testFlatMapsPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.9919 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testMapFilterCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.25215 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testMapFilterDriverCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.9969 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testMapFilterDriverPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.78215 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testMapFilterPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.24464 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testPublishSubjectCreating() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.49331 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 testPublishSubjectPumping() com.apple.XCTPerformanceMetric_WallClockTime baselineAverage 0.49641 baselineIntegrationDisplayName Mar 4, 2017, 21:38:44 ================================================ FILE: Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/Info.plist ================================================ runDestinationsByUUID 91761072-433E-43DC-A058-545FB88C59EC localComputer busSpeedInMHz 100 cpuCount 1 cpuKind Intel Core i7 cpuSpeedInMHz 2500 logicalCPUCoresPerPackage 8 modelCode MacBookPro11,3 physicalCPUCoresPerPackage 4 platformIdentifier com.apple.platform.macosx targetArchitecture x86_64 targetDevice modelCode iPhone9,2 platformIdentifier com.apple.platform.iphonesimulator 996C445D-86F0-429E-92A9-44EBD3769290 localComputer busSpeedInMHz 100 cpuCount 1 cpuKind Intel Core i7 cpuSpeedInMHz 2500 logicalCPUCoresPerPackage 8 modelCode MacBookPro11,3 physicalCPUCoresPerPackage 4 platformIdentifier com.apple.platform.macosx targetArchitecture i386 targetDevice modelCode iPad3,1 platformIdentifier com.apple.platform.iphonesimulator ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/AllTests-iOS.xcscheme ================================================ ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/AllTests-macOS.xcscheme ================================================ ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/AllTests-tvOS.xcscheme ================================================ ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/RxBlocking.xcscheme ================================================ ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/RxCocoa.xcscheme ================================================ ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/RxRelay.xcscheme ================================================ ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/RxSwift.xcscheme ================================================ ================================================ FILE: Rx.xcodeproj/xcshareddata/xcschemes/RxTest.xcscheme ================================================ ================================================ FILE: Rx.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Rx.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: RxBlocking/BlockingObservable+Operators.swift ================================================ // // BlockingObservable+Operators.swift // RxBlocking // // Created by Krunoslav Zaher on 10/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift /// The `MaterializedSequenceResult` enum represents the materialized /// output of a BlockingObservable. /// /// If the sequence terminates successfully, the result is represented /// by `.completed` with the array of elements. /// /// If the sequence terminates with error, the result is represented /// by `.failed` with both the array of elements and the terminating error. @frozen public enum MaterializedSequenceResult { case completed(elements: [T]) case failed(elements: [T], error: Error) } public extension BlockingObservable { /// Blocks current thread until sequence terminates. /// /// If sequence terminates with error, terminating error will be thrown. /// /// - returns: All elements of sequence. func toArray() throws -> [Element] { let results = materializeResult() return try elementsOrThrow(results) } } public extension BlockingObservable { /// Blocks current thread until sequence produces first element. /// /// If sequence terminates with error before producing first element, terminating error will be thrown. /// /// - returns: First element of sequence. If sequence is empty `nil` is returned. func first() throws -> Element? { let results = materializeResult(max: 1) return try elementsOrThrow(results).first } } public extension BlockingObservable { /// Blocks current thread until sequence terminates. /// /// If sequence terminates with error, terminating error will be thrown. /// /// - returns: Last element in the sequence. If sequence is empty `nil` is returned. func last() throws -> Element? { let results = materializeResult() return try elementsOrThrow(results).last } } public extension BlockingObservable { /// Blocks current thread until sequence terminates. /// /// If sequence terminates with error before producing first element, terminating error will be thrown. /// /// - returns: Returns the only element of an sequence, and reports an error if there is not exactly one element in the observable sequence. func single() throws -> Element { try single { _ in true } } /// Blocks current thread until sequence terminates. /// /// If sequence terminates with error before producing first element, terminating error will be thrown. /// /// - parameter predicate: A function to test each source element for a condition. /// - returns: Returns the only element of an sequence that satisfies the condition in the predicate, and reports an error if there is not exactly one element in the sequence. func single(_ predicate: @escaping (Element) throws -> Bool) throws -> Element { let results = materializeResult(max: 2, predicate: predicate) let elements = try elementsOrThrow(results) if elements.count > 1 { throw RxError.moreThanOneElement } guard let first = elements.first else { throw RxError.noElements } return first } } public extension BlockingObservable { /// Blocks current thread until sequence terminates. /// /// The sequence is materialized as a result type capturing how the sequence terminated (completed or error), along with any elements up to that point. /// /// - returns: On completion, returns the list of elements in the sequence. On error, returns the list of elements up to that point, along with the error itself. func materialize() -> MaterializedSequenceResult { materializeResult() } } extension BlockingObservable { private func materializeResult(max: Int? = nil, predicate: @escaping (Element) throws -> Bool = { _ in true }) -> MaterializedSequenceResult { var elements = [Element]() var error: Swift.Error? let lock = RunLoopLock(timeout: timeout) let d = SingleAssignmentDisposable() defer { d.dispose() } lock.dispatch { let subscription = self.source.subscribe { event in if d.isDisposed { return } switch event { case let .next(element): do { if try predicate(element) { elements.append(element) } if let max, elements.count >= max { d.dispose() lock.stop() } } catch let err { error = err d.dispose() lock.stop() } case let .error(err): error = err d.dispose() lock.stop() case .completed: d.dispose() lock.stop() } } d.setDisposable(subscription) } do { try lock.run() } catch let err { error = err } if let error { return MaterializedSequenceResult.failed(elements: elements, error: error) } return MaterializedSequenceResult.completed(elements: elements) } private func elementsOrThrow(_ results: MaterializedSequenceResult) throws -> [Element] { switch results { case let .failed(_, error): throw error case let .completed(elements): return elements } } } ================================================ FILE: RxBlocking/BlockingObservable.swift ================================================ // // BlockingObservable.swift // RxBlocking // // Created by Krunoslav Zaher on 10/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift /** `BlockingObservable` is a variety of `Observable` that provides blocking operators. It can be useful for testing and demo purposes, but is generally inappropriate for production applications. If you think you need to use a `BlockingObservable` this is usually a sign that you should rethink your design. */ public struct BlockingObservable { let timeout: TimeInterval? let source: Observable } ================================================ FILE: RxBlocking/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString $(RX_VERSION) CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: RxBlocking/ObservableConvertibleType+Blocking.swift ================================================ // // ObservableConvertibleType+Blocking.swift // RxBlocking // // Created by Krunoslav Zaher on 7/12/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift public extension ObservableConvertibleType { /// Converts an Observable into a `BlockingObservable` (an Observable with blocking operators). /// /// - parameter timeout: Maximal time interval BlockingObservable can block without throwing `RxError.timeout`. /// - returns: `BlockingObservable` version of `self` func toBlocking(timeout: TimeInterval? = nil) -> BlockingObservable { BlockingObservable(timeout: timeout, source: asObservable()) } } ================================================ FILE: RxBlocking/README.md ================================================ RxBlocking ============================================================ Set of blocking operators for easy unit testing. ***Don't use these operators in production apps. These operators are only meant for testing purposes.*** ```swift extension BlockingObservable { public func toArray() throws -> [E] {} } extension BlockingObservable { public func first() throws -> Element? {} } extension BlockingObservable { public func last() throws -> Element? {} } extension BlockingObservable { public func single() throws -> Element? {} public func single(_ predicate: @escaping (E) throws -> Bool) throws -> Element? {} } extension BlockingObservable { public func materialize() -> MaterializedSequenceResult } ``` ================================================ FILE: RxBlocking/Resources.swift ================================================ // // Resources.swift // RxBlocking // // Created by Krunoslav Zaher on 1/21/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxSwift #if TRACE_RESOURCES enum Resources { static func incrementTotal() -> Int32 { RxSwift.Resources.incrementTotal() } static func decrementTotal() -> Int32 { RxSwift.Resources.decrementTotal() } static var numberOfSerialDispatchQueueObservables: Int32 { RxSwift.Resources.numberOfSerialDispatchQueueObservables } static var total: Int32 { RxSwift.Resources.total } } #endif ================================================ FILE: RxBlocking/RunLoopLock.swift ================================================ // // RunLoopLock.swift // RxBlocking // // Created by Krunoslav Zaher on 11/5/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import CoreFoundation import Foundation import RxSwift #if !canImport(Darwin) import Foundation let runLoopMode: RunLoop.Mode = .default let runLoopModeRaw: CFString = unsafeBitCast(runLoopMode.rawValue._bridgeToObjectiveC(), to: CFString.self) #else let runLoopMode: CFRunLoopMode = .defaultMode let runLoopModeRaw = runLoopMode.rawValue #endif final class RunLoopLock { let currentRunLoop: CFRunLoop let calledRun = AtomicInt(0) let calledStop = AtomicInt(0) var timeout: TimeInterval? init(timeout: TimeInterval?) { self.timeout = timeout currentRunLoop = CFRunLoopGetCurrent() } func dispatch(_ action: @escaping () -> Void) { CFRunLoopPerformBlock(currentRunLoop, runLoopModeRaw) { if CurrentThreadScheduler.isScheduleRequired { _ = CurrentThreadScheduler.instance.schedule(()) { _ in action() return Disposables.create() } } else { action() } } CFRunLoopWakeUp(currentRunLoop) } func stop() { if decrement(calledStop) > 1 { return } CFRunLoopPerformBlock(currentRunLoop, runLoopModeRaw) { CFRunLoopStop(self.currentRunLoop) } CFRunLoopWakeUp(currentRunLoop) } func run() throws { if increment(calledRun) != 0 { fatalError("Run can be only called once") } if let timeout { #if !canImport(Darwin) let runLoopResult = CFRunLoopRunInMode(runLoopModeRaw, timeout, false) #else let runLoopResult = CFRunLoopRunInMode(runLoopMode, timeout, false) #endif switch runLoopResult { case .finished: return case .handledSource: return case .stopped: return case .timedOut: throw RxError.timeout default: return } } else { CFRunLoopRun() } } } ================================================ FILE: RxCocoa/Common/ControlTarget.swift ================================================ // // ControlTarget.swift // RxCocoa // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) || os(macOS) import RxSwift #if os(iOS) || os(tvOS) || os(visionOS) import UIKit typealias Control = UIKit.UIControl #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) || os(visionOS) let controlEvents: UIControl.Event #endif var callback: Callback? #if os(iOS) || os(tvOS) || os(visionOS) init(control: Control, controlEvents: UIControl.Event, callback: @escaping Callback) { MainScheduler.ensureRunningOnMainThread() self.control = control self.controlEvents = controlEvents self.callback = callback super.init() control.addTarget(self, action: selector, for: controlEvents) let method = method(for: selector) if method == nil { rxFatalError("Can't find method") } } #elseif os(macOS) init(control: Control, callback: @escaping Callback) { MainScheduler.ensureRunningOnMainThread() self.control = control self.callback = callback super.init() control.target = self control.action = selector let method = method(for: selector) if method == nil { rxFatalError("Can't find method") } } #endif @objc func eventHandler(_: Control!) { if let callback, let control { callback(control) } } override func dispose() { super.dispose() #if os(iOS) || os(tvOS) || os(visionOS) control?.removeTarget(self, action: selector, for: controlEvents) #elseif os(macOS) control?.target = nil control?.action = nil #endif callback = nil } } #endif ================================================ FILE: RxCocoa/Common/DelegateProxy.swift ================================================ // // 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 var _parentObject: ParentObject? private let _currentDelegateFor: (ParentObject) -> AnyObject? private let _setCurrentDelegateTo: (AnyObject?, ParentObject) -> Void /// 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 { _parentObject = parentObject _currentDelegateFor = delegateProxy._currentDelegate _setCurrentDelegateTo = delegateProxy._setCurrentDelegate MainScheduler.ensureRunningOnMainThread() #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.ensureRunningOnMainThread() let subject = _sentMessageForSelector[selector] if let 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.ensureRunningOnMainThread() let subject = _methodInvokedForSelector[selector] if let subject { return subject.asObservable() } else { let subject = MessageDispatcher(selector: selector, delegateProxy: self) _methodInvokedForSelector[selector] = subject return subject.asObservable() } } fileprivate func checkSelectorIsObservable(_ selector: Selector) { MainScheduler.ensureRunningOnMainThread() 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 !(_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 override open func _sentMessage(_ selector: Selector, withArguments arguments: [Any]) { _sentMessageForSelector[selector]?.on(.next(arguments)) } override open 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? { castOptionalOrFatalError(_forwardToDelegate) } /// Sets reference of normal delegate that receives all forwarded messages /// through `self`. /// /// - parameter delegate: 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.ensureRunningOnMainThread() #endif _setForwardToDelegate(delegate, retainDelegate: retainDelegate) let sentSelectors: [Selector] = _sentMessageForSelector.values.filter(\.hasObservers).map(\.selector) let invokedSelectors: [Selector] = _methodInvokedForSelector.values.filter(\.hasObservers).map(\.selector) let allUsedSelectors = sentSelectors + invokedSelectors for selector in Set(allUsedSelectors) { checkSelectorIsObservable(selector) } reset() } private func hasObservers(selector: Selector) -> Bool { (_sentMessageForSelector[selector]?.hasObservers ?? false) || (_methodInvokedForSelector[selector]?.hasObservers ?? false) } override open func responds(to aSelector: Selector!) -> Bool { guard let aSelector else { return false } return super.responds(to: aSelector) || (_forwardToDelegate?.responds(to: aSelector) ?? false) || (voidDelegateMethodsContain(aSelector) && hasObservers(selector: aSelector)) } fileprivate func reset() { guard let parentObject = _parentObject else { return } let maybeCurrentDelegate = _currentDelegateFor(parentObject) if maybeCurrentDelegate === self { _setCurrentDelegateTo(nil, parentObject) _setCurrentDelegateTo(castOrFatalError(self), parentObject) } } deinit { for v in self._sentMessageForSelector.values { v.on(.completed) } for v in self._methodInvokedForSelector.values { v.on(.completed) } #if TRACE_RESOURCES _ = Resources.decrementTotal() #endif } } private let mainScheduler = MainScheduler() private final class MessageDispatcher { private let dispatcher: PublishSubject<[Any]> private let result: Observable<[Any]> fileprivate let selector: Selector init(selector: Selector, delegateProxy _delegateProxy: DelegateProxy) { #if swift(>=6.2) weak let weakDelegateProxy = _delegateProxy #else weak var weakDelegateProxy = _delegateProxy #endif let dispatcher = PublishSubject<[Any]>() self.dispatcher = dispatcher self.selector = selector result = dispatcher .do(onSubscribed: { weakDelegateProxy?.checkSelectorIsObservable(selector); weakDelegateProxy?.reset() }, onDispose: { weakDelegateProxy?.reset() }) .share() .subscribe(on: mainScheduler) } var on: (Event<[Any]>) -> Void { dispatcher.on } var hasObservers: Bool { dispatcher.hasObservers } func asObservable() -> Observable<[Any]> { result } } #endif ================================================ FILE: RxCocoa/Common/DelegateProxyType.swift ================================================ // // DelegateProxyType.swift // RxCocoa // // Created by Krunoslav Zaher on 6/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if !os(Linux) import Foundation 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 Proxies 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: AnyObject { 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 delegate: Delegate value. /// - parameter object: Object that has delegate property. 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 public extension DelegateProxyType { /// Unique identifier for delegate 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? { currentDelegate(for: object).map { $0 as AnyObject } } static func _setCurrentDelegate(_ delegate: AnyObject?, to object: ParentObject) { setCurrentDelegate(castOptionalOrFatalError(delegate), to: object) } func _forwardToDelegate() -> AnyObject? { forwardToDelegate().map { $0 as AnyObject } } func _setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) { setForwardToDelegate(castOptionalOrFatalError(forwardToDelegate), retainDelegate: retainDelegate) } } public 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. static func register(make: @escaping (Parent) -> Self) { factory.extend(make: make) } /// Creates new proxy for target object. /// Should not call this function directory, use 'DelegateProxy.proxy(for:)' static func createProxy(for object: AnyObject) -> Self { 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:))) /// ... /// } /// } static func proxy(for object: ParentObject) -> Self { MainScheduler.ensureRunningOnMainThread() let maybeProxy = assignedProxy(for: object) let proxy: AnyObject if let existingProxy = maybeProxy { proxy = existingProxy } else { proxy = castOrFatalError(createProxy(for: object)) assignProxy(proxy, toObject: object) assert(assignedProxy(for: object) === proxy) } let currentDelegate = _currentDelegate(for: object) let delegateProxy: Self = castOrFatalError(proxy) if currentDelegate !== delegateProxy { delegateProxy._setForwardToDelegate(currentDelegate, retainDelegate: false) assert(delegateProxy._forwardToDelegate() === currentDelegate) _setCurrentDelegate(proxy, to: object) assert(_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. static func installForwardDelegate(_ forwardDelegate: Delegate, retainDelegate: Bool, onProxyForObject object: ParentObject) -> Disposable { #if swift(>=6.2) weak let weakForwardDelegate: AnyObject? = forwardDelegate as AnyObject #else weak var weakForwardDelegate: AnyObject? = forwardDelegate as AnyObject #endif let proxy = 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 is 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.ensureRunningOnMainThread() 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) } } } // private extensions extension DelegateProxyType { private static var factory: DelegateProxyFactory { DelegateProxyFactory.sharedFactory(for: self) } private static func assignedProxy(for object: ParentObject) -> AnyObject? { let maybeDelegate = objc_getAssociatedObject(object, identifier) return castOptionalOrFatalError(maybeDelegate) } private static func assignProxy(_ proxy: AnyObject, toObject object: ParentObject) { objc_setAssociatedObject(object, 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 } } public extension DelegateProxyType where ParentObject: HasDelegate, Self.Delegate == ParentObject.Delegate { static func currentDelegate(for object: ParentObject) -> Delegate? { object.delegate } 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 } } public extension DelegateProxyType where ParentObject: HasDataSource, Self.Delegate == ParentObject.DataSource { static func currentDelegate(for object: ParentObject) -> Delegate? { object.dataSource } static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) { object.dataSource = delegate } } /// Describes an object that has a prefetch data source. @available(iOS 10.0, tvOS 10.0, *) public protocol HasPrefetchDataSource: AnyObject { /// Prefetch data source type associatedtype PrefetchDataSource /// Prefetch data source var prefetchDataSource: PrefetchDataSource? { get set } } @available(iOS 10.0, tvOS 10.0, *) public extension DelegateProxyType where ParentObject: HasPrefetchDataSource, Self.Delegate == ParentObject.PrefetchDataSource { static func currentDelegate(for object: ParentObject) -> Delegate? { object.prefetchDataSource } static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) { object.prefetchDataSource = delegate } } #if os(iOS) || os(tvOS) || os(visionOS) 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) // Do not perform layoutIfNeeded if the object is still not in the view hierarchy if object.window != nil { // this is needed to flush any delayed old state (https://github.com/RxSwiftCommunity/RxDataSources/pull/75) object.layoutIfNeeded() } let subscription = asObservable() .observe(on: MainScheduler()) .catch { 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()) .take(until: object.rx.deallocated) .subscribe { [weak object] (event: Event) in if let 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 let .error(error): bindingError(error) unregisterDelegate.dispose() case .completed: unregisterDelegate.dispose() default: break } } return Disposables.create { [weak object] in subscription.dispose() if object?.window != nil { 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.ensureRunningOnMainThread() 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: (some DelegateProxyType).Type) { _factories = [:] _delegateProxyType = proxyType _identifier = proxyType.identifier } fileprivate func extend(make: @escaping (ParentObject) -> DelegateProxy) { MainScheduler.ensureRunningOnMainThread() 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.ensureRunningOnMainThread() 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 ================================================ FILE: RxCocoa/Common/Infallible+Bind.swift ================================================ // // Infallible+Bind.swift // RxCocoa // // Created by Shai Mishali on 27/08/2020. // Copyright © 2020 Krunoslav Zaher. All rights reserved. // import RxSwift public extension InfallibleType { /** Creates new subscription and sends elements to observer(s). In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables writing more consistent binding code. - parameter observers: Observers to receives events. - returns: Disposable object that can be used to unsubscribe the observers. */ func bind(to observers: Observer...) -> Disposable where Observer.Element == Element { subscribe { infallibleEvent in observers.forEach { $0.on(infallibleEvent.event) } } } /** Creates new subscription and sends elements to observer(s). In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables writing more consistent binding code. - parameter observers: Observers to receives events. - returns: Disposable object that can be used to unsubscribe the observers. */ func bind(to observers: Observer...) -> Disposable where Observer.Element == Element? { map { $0 as Element? } .subscribe { infallibleEvent in observers.forEach { $0.on(infallibleEvent.event) } } } /** Subscribes to observable sequence using custom binder function. - parameter binder: Function used to bind elements from `self`. - returns: Object representing subscription. */ func bind(to binder: (Self) -> Result) -> Result { 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 binder: Function used to bind elements from `self`. - parameter curriedArgument: Final argument passed to `binder` to finish binding process. - returns: Object representing subscription. */ func bind(to binder: (Self) -> (R1) -> R2, curriedArgument: R1) -> R2 { 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. */ func bind(onNext: @escaping (Element) -> Void) -> Disposable { subscribe(onNext: onNext) } /** Creates new subscription and sends elements to `BehaviorRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func bind(to relays: BehaviorRelay...) -> Disposable { subscribe(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `BehaviorRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func bind(to relays: BehaviorRelay...) -> Disposable { subscribe(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `PublishRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func bind(to relays: PublishRelay...) -> Disposable { subscribe(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `PublishRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func bind(to relays: PublishRelay...) -> Disposable { subscribe(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `ReplayRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func bind(to relays: ReplayRelay...) -> Disposable { subscribe(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `ReplayRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func bind(to relays: ReplayRelay...) -> Disposable { subscribe(onNext: { e in relays.forEach { $0.accept(e) } }) } } ================================================ FILE: RxCocoa/Common/Observable+Bind.swift ================================================ // // Observable+Bind.swift // RxCocoa // // Created by Krunoslav Zaher on 8/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift public extension ObservableType { /** Creates new subscription and sends elements to observer(s). In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables writing more consistent binding code. - parameter observers: Observers to receives events. - returns: Disposable object that can be used to unsubscribe the observers. */ func bind(to observers: Observer...) -> Disposable where Observer.Element == Element { subscribe { event in observers.forEach { $0.on(event) } } } /** Creates new subscription and sends elements to observer(s). In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables writing more consistent binding code. - parameter observers: Observers to receives events. - returns: Disposable object that can be used to unsubscribe the observers. */ func bind(to observers: Observer...) -> Disposable where Observer.Element == Element? { map { $0 as Element? } .subscribe { event in observers.forEach { $0.on(event) } } } /** Subscribes to observable sequence using custom binder function. - parameter binder: Function used to bind elements from `self`. - returns: Object representing subscription. */ func bind(to binder: (Self) -> Result) -> Result { 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 binder: Function used to bind elements from `self`. - parameter curriedArgument: Final argument passed to `binder` to finish binding process. - returns: Object representing subscription. */ func bind(to binder: (Self) -> (R1) -> R2, curriedArgument: R1) -> R2 { 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. - Note: If `object` can't be retained, none of the other closures will be invoked. - parameter object: The object to provide an unretained reference on. - parameter onNext: Action to invoke for each element in the observable sequence. - returns: Subscription object used to unsubscribe from the observable sequence. */ func bind( with object: Object, onNext: @escaping (Object, Element) -> Void ) -> Disposable { subscribe( onNext: { [weak object] in guard let object else { return } onNext(object, $0) }, onError: { error in rxFatalErrorInDebug("Binding error: \(error)") } ) } /** 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. */ func bind(onNext: @escaping (Element) -> Void) -> Disposable { subscribe( onNext: onNext, onError: { error in rxFatalErrorInDebug("Binding error: \(error)") } ) } } ================================================ FILE: RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift ================================================ // // 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) } public extension RxCocoaObjCRuntimeError { /// A textual representation of `self`, suitable for debugging. 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) @unknown default: fatalError("Unhandled Objective C Runtime Error") } } return RxCocoaObjCRuntimeError.unknown(target: target) } } #endif ================================================ FILE: RxCocoa/Common/RxTarget.swift ================================================ // // RxTarget.swift // RxCocoa // // Created by Krunoslav Zaher on 7/12/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift class RxTarget: NSObject, Disposable { private var retainSelf: RxTarget? override init() { super.init() retainSelf = self #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif #if DEBUG MainScheduler.ensureRunningOnMainThread() #endif } func dispose() { #if DEBUG MainScheduler.ensureRunningOnMainThread() #endif retainSelf = nil } #if TRACE_RESOURCES deinit { _ = Resources.decrementTotal() } #endif } ================================================ FILE: RxCocoa/Common/SectionedViewDataSourceType.swift ================================================ // // SectionedViewDataSourceType.swift // RxCocoa // // Created by Krunoslav Zaher on 1/10/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation /// 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 } ================================================ FILE: RxCocoa/Common/TextInput.swift ================================================ // // 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) || os(visionOS) 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 } } public extension Reactive where Base: UITextField { /// Reactive text input. var textInput: TextInput { TextInput(base: base, text: text) } } public extension Reactive where Base: UITextView { /// Reactive text input. var textInput: TextInput { TextInput(base: base, text: 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 } } public extension Reactive where Base: NSTextField, Base: NSTextInputClient { /// Reactive text input. var textInput: TextInput { TextInput(base: base, text: text) } } #endif ================================================ FILE: RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift ================================================ // // KVORepresentable+CoreGraphics.swift // RxCocoa // // Created by Krunoslav Zaher on 11/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if !os(Linux) import CoreGraphics import RxSwift import Foundation #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) || os(watchOS) 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 ================================================ FILE: RxCocoa/Foundation/KVORepresentable+Swift.swift ================================================ // // KVORepresentable+Swift.swift // RxCocoa // // Created by Krunoslav Zaher on 11/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation 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 else { return nil } guard let rawValue = RawValue(KVOValue: KVOValue) else { return nil } self.init(rawValue: rawValue) } } ================================================ FILE: RxCocoa/Foundation/KVORepresentable.swift ================================================ // // 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 else { return nil } self.init(KVOValue: KVOValue) } } ================================================ FILE: RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift ================================================ // // 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 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) } public 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. */ func observe(_: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable { observe(Element.KVOType.self, keyPath, options: options, retainSelf: retainSelf) .map(Element.init) } } #if !DISABLE_SWIZZLING && !os(Linux) // KVO public extension Reactive where Base: NSObject { /** Specialization of generic `observeWeakly` method. For more information take a look at `observeWeakly` method. */ func observeWeakly(_: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable { observeWeakly(Element.KVOType.self, keyPath, options: options) .map(Element.init) } } #endif #endif ================================================ FILE: RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift ================================================ // // 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 public 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. */ func observe(_: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable where Element.RawValue: KVORepresentable { observe(Element.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf) .map(Element.init) } } #if !DISABLE_SWIZZLING // observeWeakly + RawRepresentable public 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. */ func observeWeakly(_: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable where Element.RawValue: KVORepresentable { observeWeakly(Element.RawValue.KVOType.self, keyPath, options: options) .map(Element.init) } } #endif #endif ================================================ FILE: RxCocoa/Foundation/NSObject+Rx.swift ================================================ // // NSObject+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if !os(Linux) import Foundation import RxSwift #if SWIFT_PACKAGE && !DISABLE_SWIZZLING && !os(Linux) import RxCocoaRuntime #endif #if !DISABLE_SWIZZLING && !os(Linux) private var deallocatingSubjectTriggerContext: UInt8 = 0 private var deallocatingSubjectContext: UInt8 = 0 #endif private var deallocatedSubjectTriggerContext: UInt8 = 0 private 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. */ public 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 type: Optional type hint of the observed sequence elements. - 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`. */ func observe( _: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true ) -> Observable { KVOObservable(object: base, keyPath: keyPath, options: options, retainTarget: retainSelf).asObservable() } /** Observes values at the provided key path using the provided options. - parameter keyPath: A key path between the object and one of its properties. - parameter options: Key-value observation options, defaults to `.new` and `.initial`. - note: When the object is deallocated, a completion event is emitted. - returns: An observable emitting value changes at the provided key path. */ func observe( _ keyPath: KeyPath, options: NSKeyValueObservingOptions = [.new, .initial] ) -> Observable { Observable.create { [weak base] observer in let observation = base?.observe(keyPath, options: options) { obj, _ in observer.on(.next(obj[keyPath: keyPath])) } return Disposables.create { observation?.invalidate() } } .take(until: base.rx.deallocated) } } #endif #if !DISABLE_SWIZZLING && !os(Linux) // KVO public 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 type: Optional type hint of the observed sequence elements. - parameter keyPath: Key path of property names to observe. - parameter options: KVO mechanism notification options. - returns: Observable sequence of objects on `keyPath`. */ func observeWeakly(_: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable { observeWeaklyKeyPathFor(base, keyPath: keyPath, options: options) .map { n in n as? Element } } } #endif // Dealloc public 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. */ var deallocated: Observable { synchronized { if let deallocObservable = objc_getAssociatedObject(self.base, &deallocatedSubjectContext) as? DeallocObservable { return deallocObservable.subject } let deallocObservable = DeallocObservable() objc_setAssociatedObject(self.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. */ func sentMessage(_ selector: Selector) -> Observable<[Any]> { synchronized { // in case of dealloc selector replay subject behavior needs to be used if selector == deallocSelector { return self.deallocating.map { _ in [] } } do { let proxy: MessageSentProxy = try self.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. */ func methodInvoked(_ selector: Selector) -> Observable<[Any]> { synchronized { // in case of dealloc selector replay subject behavior needs to be used if selector == deallocSelector { return self.deallocated.map { _ in [] } } do { let proxy: MessageSentProxy = try self.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. */ var deallocating: Observable { synchronized { do { let proxy: DeallocatingProxy = try self.registerMessageInterceptor(deallocSelector) return proxy.messageSent.asObservable() } catch let e { return Observable.error(e) } } } private 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) private protocol MessageInterceptorSubject: AnyObject { init() var isActive: Bool { get } var targetImplementation: IMP { get set } } private final class DeallocatingProxy: MessageInterceptorSubject, RXDeallocatingObserver { typealias Element = Void let messageSent = ReplaySubject.create(bufferSize: 1) @objc var targetImplementation: IMP = RX_default_target_implementation() var isActive: Bool { targetImplementation != RX_default_target_implementation() } init() {} @objc func deallocating() { messageSent.on(.next(())) } deinit { self.messageSent.on(.completed) } } private final class MessageSentProxy: MessageInterceptorSubject, RXMessageSentObserver { typealias Element = [AnyObject] let messageSent = PublishSubject<[Any]>() let methodInvoked = PublishSubject<[Any]>() @objc var targetImplementation: IMP = RX_default_target_implementation() var isActive: Bool { targetImplementation != RX_default_target_implementation() } init() {} @objc func messageSent(withArguments arguments: [Any]) { messageSent.on(.next(arguments)) } @objc func methodInvoked(withArguments arguments: [Any]) { methodInvoked.on(.next(arguments)) } deinit { self.messageSent.on(.completed) self.methodInvoked.on(.completed) } } #endif private final class DeallocObservable { let subject = ReplaySubject.create(bufferSize: 1) init() {} deinit { self.subject.on(.next(())) self.subject.on(.completed) } } // MARK: KVO #if !os(Linux) private protocol KVOObservableProtocol { var target: AnyObject { get } var keyPath: String { get } var retainTarget: Bool { get } var options: KeyValueObservingOptions { get } } private final class KVOObserver: _RXKVOObserver, Disposable { typealias Callback = (Any?) -> Void var retainSelf: KVOObserver? 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) retainSelf = self } override func dispose() { super.dispose() retainSelf = nil } deinit { #if TRACE_RESOURCES _ = Resources.decrementTotal() #endif } } private final class KVOObservable: ObservableType, KVOObservableProtocol { typealias Element = 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) { target = object self.keyPath = keyPath self.options = options self.retainTarget = retainTarget if retainTarget { strongTarget = object } } func subscribe(_ observer: Observer) -> Disposable where Observer.Element == 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) } } private extension KeyValueObservingOptions { var nsOptions: NSKeyValueObservingOptions { var result: UInt = 0 if contains(.new) { result |= NSKeyValueObservingOptions.new.rawValue } if contains(.initial) { result |= NSKeyValueObservingOptions.initial.rawValue } return NSKeyValueObservingOptions(rawValue: result) } } #endif #if !DISABLE_SWIZZLING && !os(Linux) private 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.isDisjoint(with: .initial) { 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. private func isWeakProperty(_ properyRuntimeInfo: String) -> Bool { properyRuntimeInfo.range(of: ",W,") != nil } private extension ObservableType where Element == AnyObject? { func finishWithNilWhenDealloc(_ target: NSObject) -> Observable { let deallocating = target.rx.deallocating return deallocating .map { _ in Observable.just(nil) } .startWith(asObservable()) .switchLatest() } } private func observeWeaklyKeyPathFor( _ target: NSObject, keyPathSections: [String], options: KeyValueObservingOptions ) -> Observable { #if swift(>=6.2) weak let weakTarget: AnyObject? = target #else weak var weakTarget: AnyObject? = target #endif let propertyName = keyPathSections[0] let remainingPaths = Array(keyPathSections[1 ..< keyPathSections.count]) let property = class_getProperty(object_getClass(target), propertyName) if property == nil { return Observable.error(RxCocoaError.invalidPropertyName(object: target, propertyName: propertyName)) } let propertyAttributes = property_getAttributes(property!) // should dealloc hook be in place if week property, or just create strong reference because it doesn't matter let isWeak = isWeakProperty(propertyAttributes.map(String.init) ?? "") let propertyObservable = KVOObservable(object: target, keyPath: propertyName, options: options.union(.initial), retainTarget: false) as KVOObservable // 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 private let deallocSelector = NSSelectorFromString("dealloc") // MARK: AnyObject + Reactive extension Reactive where Base: AnyObject { func synchronized(_ action: () -> T) -> T { objc_sync_enter(base) let result = action() objc_sync_exit(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 ================================================ FILE: RxCocoa/Foundation/NotificationCenter+Rx.swift ================================================ // // NotificationCenter+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 5/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift public 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. */ func notification(_ name: Notification.Name?, object: AnyObject? = nil) -> Observable { 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) } } } } ================================================ FILE: RxCocoa/Foundation/URLSession+Rx.swift ================================================ // // URLSession+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 3/23/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift #if canImport(FoundationNetworking) import FoundationNetworking #endif /// 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: "Unknown error has occurred." case let .nonHTTPResponse(response): "Response is not NSHTTPURLResponse `\(response)`." case let .httpRequestFailed(response, _): "HTTP request failed with `\(response.statusCode)`." case let .deserializationError(error): "Error during deserialization of the response: \(error)" } } } private func escapeTerminalString(_ value: String) -> String { value.replacingOccurrences(of: "\"", with: "\\\"", options: [], range: nil) } private func convertURLRequestToCurlCommand(_ request: URLRequest) -> String { let method = request.httpMethod ?? "GET" var returnValue = "curl -X \(method) " if let httpBody = request.httpBody { 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 } private 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 { if error.domain == NSURLErrorDomain, error.code == NSURLErrorCancelled { return "Canceled (\(ms)ms)" } return "Failure (\(ms)ms): NSError > \(error)" } return "" } public 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. */ func response(request: URLRequest) -> Observable<(response: HTTPURLResponse, data: Data)> { Observable.create { observer in // smart compiler should be able to optimize this out let d: Date? = if URLSession.rx.shouldLogRequest(request) { Date() } else { nil } let task = self.base.dataTask(with: request) { data, response, error in if URLSession.rx.shouldLogRequest(request) { let interval = Date().timeIntervalSince(d ?? Date()) print(convertURLRequestToCurlCommand(request)) #if !canImport(Darwin) print(convertResponseToString(response, error.flatMap { $0 as NSError }, interval)) #else print(convertResponseToString(response, error.map { $0 as NSError }, interval)) #endif } guard let response, let 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. */ func data(request: URLRequest) -> Observable { 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. */ func json(request: URLRequest, options: JSONSerialization.ReadingOptions = []) -> Observable { data(request: request).map { data -> Any in do { return try JSONSerialization.jsonObject(with: data, options: options) } catch { 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. */ func json(url: Foundation.URL) -> Observable { json(request: URLRequest(url: url)) } } public extension Reactive where Base == URLSession { /// Log URL requests to standard output in curl format. static var shouldLogRequest: (URLRequest) -> Bool = { _ in #if DEBUG return true #else return false #endif } } ================================================ FILE: RxCocoa/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString $(RX_VERSION) CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: RxCocoa/Runtime/_RX.m ================================================ // // _RX.m // RxCocoa // // Created by Krunoslav Zaher on 7/12/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #import "include/_RX.h" ================================================ FILE: RxCocoa/Runtime/_RXDelegateProxy.m ================================================ // // _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)]; } } -(NSMethodSignature *)methodSignatureForSelector:(SEL)selector { NSMethodSignature *signature = [super methodSignatureForSelector:selector]; if (!signature) { signature = [self._forwardToDelegate methodSignatureForSelector:selector]; } return signature; } -(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 ================================================ FILE: RxCocoa/Runtime/_RXKVOObserver.m ================================================ // // _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 ================================================ FILE: RxCocoa/Runtime/_RXObjCRuntime.m ================================================ // // _RXObjCRuntime.m // RxCocoa // // Created by Krunoslav Zaher on 7/11/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #import #import #import #import #import #import #import "include/_RX.h" #import "include/_RXObjCRuntime.h" // self + cmd #define HIDDEN_ARGUMENT_COUNT 2 #if !DISABLE_SWIZZLING #define NSErrorParam NSError *__autoreleasing __nullable * __nullable @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 _Atomic static int32_t numberOInterceptedMethods = 0; _Atomic 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]); } #endif 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; } IMP __nonnull RX_default_target_implementation(void) { return _objc_msgForward; } #if !DISABLE_SWIZZLING 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; } // 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_SELECTOR_IDENTIFIER(...) RX_CAT2(exampleSelector, RX_FOREACH(_, CAT, UNDERSCORE_TYPE_CAT, ## __VA_ARGS__)) #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_DEFINITIONS(return_value, ...) \ 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__) \ #define SWIZZLE_OBSERVE_METHOD_BODY(return_value, ...) \ __unused SEL GENERATE_SELECTOR_IDENTIFIER(return_value, ## __VA_ARGS__) = @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:GENERATE_SELECTOR_IDENTIFIER(return_value, ## __VA_ARGS__)]; \ // 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 @interface RXObjCRuntime (swizzle) @end @implementation RXObjCRuntime(swizzle) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, char) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, short) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, int) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, long) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_uchar) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_ushort) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_uint) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_ulong) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_block) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, float) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, double) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, SEL) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, id) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, char) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, short) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, int) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, long) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_uchar) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_ushort) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_uint) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_ulong) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_block) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, float) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, double) SWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, SEL) +(void)load { SWIZZLE_OBSERVE_METHOD_BODY(void) SWIZZLE_OBSERVE_METHOD_BODY(void, id) SWIZZLE_OBSERVE_METHOD_BODY(void, char) SWIZZLE_OBSERVE_METHOD_BODY(void, short) SWIZZLE_OBSERVE_METHOD_BODY(void, int) SWIZZLE_OBSERVE_METHOD_BODY(void, long) SWIZZLE_OBSERVE_METHOD_BODY(void, rx_uchar) SWIZZLE_OBSERVE_METHOD_BODY(void, rx_ushort) SWIZZLE_OBSERVE_METHOD_BODY(void, rx_uint) SWIZZLE_OBSERVE_METHOD_BODY(void, rx_ulong) SWIZZLE_OBSERVE_METHOD_BODY(void, rx_block) SWIZZLE_OBSERVE_METHOD_BODY(void, float) SWIZZLE_OBSERVE_METHOD_BODY(void, double) SWIZZLE_OBSERVE_METHOD_BODY(void, SEL) SWIZZLE_OBSERVE_METHOD_BODY(void, id, id) SWIZZLE_OBSERVE_METHOD_BODY(void, id, char) SWIZZLE_OBSERVE_METHOD_BODY(void, id, short) SWIZZLE_OBSERVE_METHOD_BODY(void, id, int) SWIZZLE_OBSERVE_METHOD_BODY(void, id, long) SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_uchar) SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_ushort) SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_uint) SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_ulong) SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_block) SWIZZLE_OBSERVE_METHOD_BODY(void, id, float) SWIZZLE_OBSERVE_METHOD_BODY(void, id, double) SWIZZLE_OBSERVE_METHOD_BODY(void, id, SEL) } @end // 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 atomic_fetch_add(&numberOfForwardedMethods, 1); #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 atomic_fetch_add(&numberOInterceptedMethods, 1); #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(void) { __block NSInteger count = 0; [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { count = self.dynamicSubclassByRealClass.count; }]; return count; } NSInteger RX_number_of_forwarding_enabled_classes(void) { __block NSInteger count = 0; [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { count = self.classesThatSupportObservingByForwarding.count; }]; return count; } NSInteger RX_number_of_intercepting_classes(void) { __block NSInteger count = 0; [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) { count = self.interceptorIMPbySelectorsByClass.count; }]; return count; } NSInteger RX_number_of_forwarded_methods(void) { return numberOfForwardedMethods; } NSInteger RX_number_of_swizzled_methods(void) { return numberOInterceptedMethods; } #endif #endif ================================================ FILE: RxCocoa/Runtime/include/RxCocoaRuntime.h ================================================ // // 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[]; ================================================ FILE: RxCocoa/Runtime/include/_RX.h ================================================ // // _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__) ================================================ FILE: RxCocoa/Runtime/include/_RXDelegateProxy.h ================================================ // // _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 ================================================ FILE: RxCocoa/Runtime/include/_RXKVOObserver.h ================================================ // // _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 ================================================ FILE: RxCocoa/Runtime/include/_RXObjCRuntime.h ================================================ // // _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); #endif /// 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); ================================================ FILE: RxCocoa/RxCocoa.h ================================================ // // RxCocoa.h // RxCocoa // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #import #import #import #import #import //! Project version number for RxCocoa. FOUNDATION_EXPORT double RxCocoaVersionNumber; //! Project version string for RxCocoa. FOUNDATION_EXPORT const unsigned char RxCocoaVersionString[]; ================================================ FILE: RxCocoa/RxCocoa.swift ================================================ // // RxCocoa.swift // RxCocoa // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation // Importing RxCocoa also imports RxRelay @_exported import RxRelay 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 public extension RxCocoaError { /// A textual representation of `self`, suitable for debugging. var debugDescription: String { switch self { case .unknown: "Unknown error occurred." case let .invalidOperation(object): "Invalid operation was attempted on `\(object)`." case let .itemsNotYetBound(object): "Data source is set, but items are not yet bound to user interface for `\(object)`." case let .invalidPropertyName(object, propertyName): "Object `\(object)` doesn't have a property named `\(propertyName)`." case let .invalidObjectOnKeyPath(object, sourceObject, propertyName): "Unobservable object `\(object)` was observed as `\(propertyName)` of `\(sourceObject)`." case .errorDuringSwizzling: "Error during swizzling." case let .castingError(object, targetType): "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 \(String(describing: 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) } ================================================ FILE: RxCocoa/Traits/ControlEvent.swift ================================================ // // ControlEvent.swift // RxCocoa // // Created by Krunoslav Zaher on 8/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift /// A protocol that extends `ControlEvent`. public protocol ControlEventType: ObservableType { /// - returns: `ControlEvent` interface func asControlEvent() -> ControlEvent } /** A trait for `Observable`/`ObservableType` that represents an event on a UI element. Properties: - it doesn’t send any initial value on subscription, - it `Complete`s the sequence when the control deallocates, - 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 (`subscribe(on: ConcurrentMainScheduler.instance)` behavior).** **It is the implementor’s responsibility to make sure that all other properties enumerated above are satisfied.** **If they aren’t, using this trait will communicate wrong properties, and could potentially break someone’s code.** **If the `events` observable sequence passed into the initializer doesn’t satisfy all enumerated properties, don’t use this trait.** */ public struct ControlEvent: ControlEventType { public typealias Element = 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.Element == Element { self.events = events.subscribe(on: 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: Observer) -> Disposable where Observer.Element == Element { events.subscribe(observer) } /// - returns: `Observable` interface. public func asObservable() -> Observable { events } /// - returns: `ControlEvent` interface. public func asControlEvent() -> ControlEvent { self } /// - returns: `Infallible` interface. public func asInfallible() -> Infallible { asInfallible(onErrorFallbackTo: .empty()) } } ================================================ FILE: RxCocoa/Traits/ControlProperty.swift ================================================ // // 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. Programmatic value changes won't be reported. It's properties are: - `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 (`subscribe(on: 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 Element = 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: Values, valueSink: Sink) where Element == Values.Element, Element == Sink.Element { self.values = values.subscribe(on: ConcurrentMainScheduler.instance) self.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: Observer) -> Disposable where Observer.Element == Element { values.subscribe(observer) } /// `ControlEvent` of user initiated value changes. Every time user updates control value change event /// will be emitted from `changed` event. /// /// Programmatic 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 programmatic and user updates, /// or for any other reason). public var changed: ControlEvent { ControlEvent(events: values.skip(1)) } /// - returns: `Observable` interface. public func asObservable() -> Observable { values } /// - returns: `ControlProperty` interface. public func asControlProperty() -> ControlProperty { 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 builds raise fatal error, RELEASE builds log event to standard output. /// - In case sequence completes, nothing happens. public func on(_ event: Event) { switch event { case let .error(error): bindingError(error) case .next: valueSink.on(event) case .completed: valueSink.on(event) } } } public extension ControlPropertyType where Element == String? { /// Transforms control property of type `String?` into control property of type `String`. var orEmpty: ControlProperty { let original: ControlProperty = asControlProperty() let values: Observable = original.values.map { $0 ?? "" } let valueSink: AnyObserver = original.valueSink.mapObserver { $0 } return ControlProperty(values: values, valueSink: valueSink) } } ================================================ FILE: RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift ================================================ // // BehaviorRelay+Driver.swift // RxCocoa // // Created by Krunoslav Zaher on 10/7/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxRelay import RxSwift public extension BehaviorRelay { /// Converts `BehaviorRelay` to `Driver`. /// /// - returns: Observable sequence. func asDriver() -> Driver { let source = asObservable() .observe(on: DriverSharingStrategy.scheduler) return SharedSequence(source) } } ================================================ FILE: RxCocoa/Traits/Driver/ControlEvent+Driver.swift ================================================ // // ControlEvent+Driver.swift // RxCocoa // // Created by Krunoslav Zaher on 9/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift public extension ControlEvent { /// Converts `ControlEvent` to `Driver` trait. /// /// `ControlEvent` already can't fail, so no special case needs to be handled. func asDriver() -> Driver { asDriver { _ -> Driver in #if DEBUG rxFatalError("Somehow driver received error from a source that shouldn't fail.") #else return Driver.empty() #endif } } } ================================================ FILE: RxCocoa/Traits/Driver/ControlProperty+Driver.swift ================================================ // // ControlProperty+Driver.swift // RxCocoa // // Created by Krunoslav Zaher on 9/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift public extension ControlProperty { /// Converts `ControlProperty` to `Driver` trait. /// /// `ControlProperty` already can't fail, so no special case needs to be handled. func asDriver() -> Driver { asDriver { _ -> Driver in #if DEBUG rxFatalError("Somehow driver received error from a source that shouldn't fail.") #else return Driver.empty() #endif } } } ================================================ FILE: RxCocoa/Traits/Driver/Driver+Subscription.swift ================================================ // // Driver+Subscription.swift // RxCocoa // // Created by Krunoslav Zaher on 9/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxRelay 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" public 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 observers: Observers that receives events. - returns: Disposable object that can be used to unsubscribe the observer from the subject. */ func drive(_ observers: Observer...) -> Disposable where Observer.Element == Element { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return asSharedSequence() .asObservable() .subscribe { e in observers.forEach { $0.on(e) } } } /** 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 observers: Observers that receives events. - returns: Disposable object that can be used to unsubscribe the observer from the subject. */ func drive(_ observers: Observer...) -> Disposable where Observer.Element == Element? { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return asSharedSequence() .asObservable() .map { $0 as Element? } .subscribe { e in observers.forEach { $0.on(e) } } } /** Creates new subscription and sends elements to `BehaviorRelay`. This method can be only called from `MainThread`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func drive(_ relays: BehaviorRelay...) -> Disposable { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return drive(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `BehaviorRelay`. This method can be only called from `MainThread`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func drive(_ relays: BehaviorRelay...) -> Disposable { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return drive(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `ReplayRelay`. This method can be only called from `MainThread`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func drive(_ relays: ReplayRelay...) -> Disposable { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return drive(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `ReplayRelay`. This method can be only called from `MainThread`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func drive(_ relays: ReplayRelay...) -> Disposable { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return drive(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Subscribes to observable sequence using custom binder function. This method can be only called from `MainThread`. - parameter transformation: Function used to bind elements from `self`. - returns: Object representing subscription. */ func drive(_ transformation: (Observable) -> Result) -> Result { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return transformation(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. */ func drive(_ with: (Observable) -> (R1) -> R2, curriedArgument: R1) -> R2 { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return with(asObservable())(curriedArgument) } /** Subscribes an element handler, a completion handler and disposed handler to an observable sequence. This method can be only called from `MainThread`. Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence. Error callback is not exposed because `Driver` can't error out. - Note: If `object` can't be retained, none of the other closures will be invoked. - parameter object: The object to provide an unretained reference on. - 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. */ func drive( with object: Object, onNext: ((Object, Element) -> Void)? = nil, onCompleted: ((Object) -> Void)? = nil, onDisposed: ((Object) -> Void)? = nil ) -> Disposable { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return asObservable().subscribe(with: object, onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed) } /** 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. */ func drive( onNext: ((Element) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil ) -> Disposable { MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage) return asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed) } /** Subscribes to this `Driver` with a no-op. This method can be only called from `MainThread`. - note: This is an alias of `drive(onNext: nil, onCompleted: nil, onDisposed: nil)` used to fix an ambiguity bug in Swift: https://bugs.swift.org/browse/SR-13657 - returns: Subscription object used to unsubscribe from the observable sequence. */ func drive() -> Disposable { drive(onNext: nil, onCompleted: nil, onDisposed: nil) } } ================================================ FILE: RxCocoa/Traits/Driver/Driver.swift ================================================ // // 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 { SharingScheduler.make() } public static func share(_ source: Observable) -> Observable { source.share(replay: 1, scope: .whileConnected) } } public extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy { /// Adds `asDriver` to `SharingSequence` with `DriverSharingStrategy`. func asDriver() -> Driver { asSharedSequence() } } ================================================ FILE: RxCocoa/Traits/Driver/Infallible+Driver.swift ================================================ // // Infallible+Driver.swift // RxCocoa // // Created by Anton Siliuk on 14/02/2022. // Copyright © 2022 Krunoslav Zaher. All rights reserved. // import RxSwift public extension InfallibleType { /// Converts `InfallibleType` to `Driver`. /// /// - returns: Observable sequence. func asDriver() -> Driver { SharedSequence(asObservable().observe(on: DriverSharingStrategy.scheduler)) } } ================================================ FILE: RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift ================================================ // // ObservableConvertibleType+Driver.swift // RxCocoa // // Created by Krunoslav Zaher on 9/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift public 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. */ func asDriver(onErrorJustReturn: Element) -> Driver { let source = asObservable() .observe(on: DriverSharingStrategy.scheduler) .catchAndReturn(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. */ func asDriver(onErrorDriveWith: Driver) -> Driver { let source = asObservable() .observe(on: DriverSharingStrategy.scheduler) .catch { _ 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. */ func asDriver(onErrorRecover: @escaping (_ error: Swift.Error) -> Driver) -> Driver { let source = asObservable() .observe(on: DriverSharingStrategy.scheduler) .catch { error in onErrorRecover(error).asObservable() } return Driver(source) } } ================================================ FILE: RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift ================================================ // // ObservableConvertibleType+SharedSequence.swift // RxCocoa // // Created by Krunoslav Zaher on 11/1/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxSwift public 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. */ func asSharedSequence(sharingStrategy _: S.Type = S.self, onErrorJustReturn: Element) -> SharedSequence { let source = asObservable() .observe(on: S.scheduler) .catchAndReturn(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. */ func asSharedSequence(sharingStrategy _: S.Type = S.self, onErrorDriveWith: SharedSequence) -> SharedSequence { let source = asObservable() .observe(on: S.scheduler) .catch { _ 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. */ func asSharedSequence(sharingStrategy _: S.Type = S.self, onErrorRecover: @escaping (_ error: Swift.Error) -> SharedSequence) -> SharedSequence { let source = asObservable() .observe(on: S.scheduler) .catch { error in onErrorRecover(error).asObservable() } return SharedSequence(source) } } ================================================ FILE: RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift ================================================ // // 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.** */ public static func mock(scheduler: SchedulerType, action: () throws -> Void) rethrows { try 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.** */ public static func mock(makeScheduler: @escaping () -> SchedulerType, action: () throws -> Void) rethrows { let originalMake = make make = makeScheduler defer { make = originalMake } try action() // If you remove this line , compiler buggy optimizations will change behavior of this code _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(makeScheduler) // Scary, I know } } #if !canImport(Darwin) import Glibc #else import Foundation #endif func _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(_ scheduler: () -> SchedulerType) { let a: Int32 = 1 #if !canImport(Darwin) let b = 314 + Int32(Glibc.random() & 1) #else let b = 314 + Int32(arc4random() & 1) #endif if a == b { print(scheduler()) } } ================================================ FILE: RxCocoa/Traits/SharedSequence/SharedSequence+Concurrency.swift ================================================ // // SharedSequence+Concurrency.swift // RxCocoa // // Created by Shai Mishali on 22/09/2021. // Copyright © 2021 Krunoslav Zaher. All rights reserved. // #if swift(>=5.7) import Foundation // MARK: - Shared Sequence @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) public extension SharedSequence { /// Allows iterating over the values of this Shared Sequence /// asynchronously via Swift's concurrency features (`async/await`) /// /// A sample usage would look like so: /// /// ```swift /// for await value in driver.values { /// // Handle emitted values /// } /// ``` @MainActor var values: AsyncStream { AsyncStream { continuation in // It is safe to ignore the `onError` closure here since // Shared Sequences (`Driver` and `Signal`) cannot fail let disposable = self.asObservable() .subscribe( onNext: { value in continuation.yield(value) }, onCompleted: { continuation.finish() } ) continuation.onTermination = { @Sendable termination in if termination == .cancelled { disposable.dispose() } } } } } #endif ================================================ FILE: RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift ================================================ // 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element) -> SharedSequence where SharingStrategy == O1.SharingStrategy, SharingStrategy == O2.SharingStrategy { let source = Observable.zip( source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), resultSelector: resultSelector ) return SharedSequence(source) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element) -> SharedSequence where SharingStrategy == O1.SharingStrategy, SharingStrategy == O2.SharingStrategy { let source = Observable.combineLatest( source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), resultSelector: resultSelector ) return SharedSequence(source) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element) -> 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) } } public extension SharedSequenceConvertibleType where Element == 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. */ 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) } } ================================================ FILE: RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.tt ================================================ // // SharedSequence+Operators+arity.swift // RxCocoa // // Created by Krunoslav Zaher on 10/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift <% for i in 2 ... 8 { %> // <%= i %> 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<<%= (Array(1...i).map { "O\($0): SharedSequenceConvertibleType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).Element" }).joined(separator: ", ") %>) throws -> Element) -> SharedSequence where <%= (Array(1...i).map { "SharingStrategy == O\($0).SharingStrategy" }).joined(separator: ",\n ") %> { let source = Observable.zip( <%= (Array(1...i).map { "source\($0).asSharedSequence().asObservable()" }).joined(separator: ", ") %>, resultSelector: resultSelector ) return SharedSequence(source) } } extension SharedSequenceConvertibleType where Element == 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<<%= (Array(1...i).map { "O\($0): SharedSequenceConvertibleType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>) -> SharedSequence)> where <%= (Array(1...i).map { "SharingStrategy == O\($0).SharingStrategy" }).joined(separator: ",\n ") %> { let source = Observable.zip( <%= (Array(1...i).map { "source\($0).asSharedSequence().asObservable()" }).joined(separator: ", ") %> ) 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<<%= (Array(1...i).map { "O\($0): SharedSequenceConvertibleType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).Element" }).joined(separator: ", ") %>) throws -> Element) -> SharedSequence where <%= (Array(1...i).map { "SharingStrategy == O\($0).SharingStrategy" }).joined(separator: ",\n ") %> { let source = Observable.combineLatest( <%= (Array(1...i).map { "source\($0).asSharedSequence().asObservable()" }).joined(separator: ", ") %>, resultSelector: resultSelector ) return SharedSequence(source) } } extension SharedSequenceConvertibleType where Element == 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<<%= (Array(1...i).map { "O\($0): SharedSequenceConvertibleType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>) -> SharedSequence)> where <%= (Array(1...i).map { "SharingStrategy == O\($0).SharingStrategy" }).joined(separator: ",\n ") %> { let source = Observable.combineLatest( <%= (Array(1...i).map { "source\($0).asSharedSequence().asObservable()" }).joined(separator: ", ") %> ) return SharedSequence)>(source) } } <% } %> ================================================ FILE: RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift ================================================ // // SharedSequence+Operators.swift // RxCocoa // // Created by Krunoslav Zaher on 9/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift // MARK: map public 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. */ func map(_ selector: @escaping (Element) -> Result) -> SharedSequence { let source = asObservable() .map(selector) return SharedSequence(source) } } // MARK: compactMap public extension SharedSequenceConvertibleType { /** Projects each element of an observable sequence into an optional form and filters all optional results. - parameter selector: A transform function to apply to each source element and which returns an element or nil. - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source. */ func compactMap(_ selector: @escaping (Element) -> Result?) -> SharedSequence { let source = asObservable() .compactMap(selector) return SharedSequence(source) } } // MARK: filter public 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. */ func filter(_ predicate: @escaping (Element) -> Bool) -> SharedSequence { let source = asObservable() .filter(predicate) return SharedSequence(source) } } // MARK: switchLatest public extension SharedSequenceConvertibleType where Element: 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. */ func switchLatest() -> SharedSequence { let source: Observable = asObservable() .map { $0.asSharedSequence() } .switchLatest() return SharedSequence(source) } } // MARK: flatMapLatest public 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. */ func flatMapLatest(_ selector: @escaping (Element) -> SharedSequence) -> SharedSequence { let source: Observable = asObservable() .flatMapLatest(selector) return SharedSequence(source) } } // MARK: flatMapFirst public 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. */ func flatMapFirst(_ selector: @escaping (Element) -> SharedSequence) -> SharedSequence { let source: Observable = asObservable() .flatMapFirst(selector) return SharedSequence(source) } } // MARK: do public 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 afterNext: Action to invoke for each element after the observable has passed an onNext event along to its downstream. - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. - parameter afterCompleted: Action to invoke after 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. */ func `do`(onNext: ((Element) -> Void)? = nil, afterNext: ((Element) -> Void)? = nil, onCompleted: (() -> Void)? = nil, afterCompleted: (() -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil) -> SharedSequence { let source = asObservable() .do(onNext: onNext, afterNext: afterNext, onCompleted: onCompleted, afterCompleted: afterCompleted, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose) return SharedSequence(source) } } // MARK: debug public 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. */ func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function) -> SharedSequence { let source = asObservable() .debug(identifier, trimOutput: trimOutput, file: file, line: line, function: function) return SharedSequence(source) } } // MARK: distinctUntilChanged public extension SharedSequenceConvertibleType where Element: 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. */ func distinctUntilChanged() -> SharedSequence { let source = asObservable() .distinctUntilChanged { $0 } comparer: { $0 == $1 } return SharedSequence(source) } } public 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. */ func distinctUntilChanged(_ keySelector: @escaping (Element) -> some Equatable) -> SharedSequence { let source = 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. */ func distinctUntilChanged(_ comparer: @escaping (Element, Element) -> Bool) -> SharedSequence { let source = 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. */ func distinctUntilChanged(_ keySelector: @escaping (Element) -> K, comparer: @escaping (K, K) -> Bool) -> SharedSequence { let source = asObservable() .distinctUntilChanged(keySelector, comparer: comparer) return SharedSequence(source) } } // MARK: flatMap public 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. */ func flatMap(_ selector: @escaping (Element) -> SharedSequence) -> SharedSequence { let source = asObservable() .flatMap(selector) return SharedSequence(source) } } // MARK: merge public 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. */ static func merge(_ sources: Collection) -> SharedSequence where Collection.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. */ 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. */ static func merge(_ sources: SharedSequence...) -> SharedSequence { let source = Observable.merge(sources.map { $0.asObservable() }) return SharedSequence(source) } } // MARK: merge public extension SharedSequenceConvertibleType where Element: 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. */ func merge() -> SharedSequence { let source = 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. */ func merge(maxConcurrent: Int) -> SharedSequence { let source = asObservable() .map { $0.asSharedSequence() } .merge(maxConcurrent: maxConcurrent) return SharedSequence(source) } } // MARK: throttle public 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. */ func throttle(_ dueTime: RxTimeInterval, latest: Bool = true) -> SharedSequence { let source = 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. */ func debounce(_ dueTime: RxTimeInterval) -> SharedSequence { let source = asObservable() .debounce(dueTime, scheduler: SharingStrategy.scheduler) return SharedSequence(source) } } // MARK: scan public 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. */ func scan(_ seed: A, accumulator: @escaping (A, Element) -> A) -> SharedSequence { let source = asObservable() .scan(seed, accumulator: accumulator) return SharedSequence(source) } } // MARK: concat public 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. */ static func concat(_ sequence: Sequence) -> SharedSequence where Sequence.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. */ static func concat(_ collection: Collection) -> SharedSequence where Collection.Element == SharedSequence { let source = Observable.concat(collection.map { $0.asObservable() }) return SharedSequence(source) } } // MARK: zip public 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. */ static func zip(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> SharedSequence where Collection.Element == SharedSequence { let source = Observable.zip(collection.map { $0.asSharedSequence().asObservable() }, resultSelector: 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. */ static func zip(_ collection: Collection) -> SharedSequence where Collection.Element == SharedSequence { let source = Observable.zip(collection.map { $0.asSharedSequence().asObservable() }) return SharedSequence(source) } } // MARK: combineLatest public 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. */ static func combineLatest(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> SharedSequence where Collection.Element == SharedSequence { let source = Observable.combineLatest(collection.map { $0.asObservable() }, resultSelector: 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. */ static func combineLatest(_ collection: Collection) -> SharedSequence where Collection.Element == SharedSequence { let source = Observable.combineLatest(collection.map { $0.asObservable() }) return SharedSequence(source) } } // MARK: - withUnretained public extension SharedSequenceConvertibleType where SharingStrategy == SignalSharingStrategy { /** Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence. In the case the provided object cannot be retained successfully, the sequence will complete. - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle. - parameter obj: The object to provide an unretained reference on. - parameter resultSelector: A function to combine the unretained referenced on `obj` and the value of the observable sequence. - returns: An observable sequence that contains the result of `resultSelector` being called with an unretained reference on `obj` and the values of the original sequence. */ func withUnretained( _ obj: Object, resultSelector: @escaping (Object, Element) -> Out ) -> SharedSequence { SharedSequence(asObservable().withUnretained(obj, resultSelector: resultSelector)) } /** Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence. In the case the provided object cannot be retained successfully, the sequence will complete. - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle. - parameter obj: The object to provide an unretained reference on. - returns: An observable sequence of tuples that contains both an unretained reference on `obj` and the values of the original sequence. */ func withUnretained(_ obj: Object) -> SharedSequence { withUnretained(obj) { ($0, $1) } } } public extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy { @available(*, message: "withUnretained has been deprecated for Driver. Consider using `drive(with:onNext:onCompleted:onDisposed:)`, instead", unavailable) func withUnretained( _ obj: Object, resultSelector: @escaping (Object, Element) -> Out ) -> SharedSequence { SharedSequence(asObservable().withUnretained(obj, resultSelector: resultSelector)) } @available(*, message: "withUnretained has been deprecated for Driver. Consider using `drive(with:onNext:onCompleted:onDisposed:)`, instead", unavailable) func withUnretained(_ obj: Object) -> SharedSequence { SharedSequence(asObservable().withUnretained(obj) { ($0, $1) }) } } // MARK: withLatestFrom public 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. */ func withLatestFrom(_ second: SecondO, resultSelector: @escaping (Element, SecondO.Element) -> ResultType) -> SharedSequence where SecondO.SharingStrategy == SharingStrategy { let source = 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. */ func withLatestFrom(_ second: SecondO) -> SharedSequence { let source = asObservable() .withLatestFrom(second.asSharedSequence()) return SharedSequence(source) } } // MARK: skip public 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. */ func skip(_ count: Int) -> SharedSequence { let source = asObservable() .skip(count) return SharedSequence(source) } } // MARK: startWith public 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. */ func startWith(_ element: Element) -> SharedSequence { let source = asObservable() .startWith(element) return SharedSequence(source) } } // MARK: delay public 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. - returns: the source Observable shifted in time by the specified delay. */ func delay(_ dueTime: RxTimeInterval) -> SharedSequence { let source = asObservable() .delay(dueTime, scheduler: SharingStrategy.scheduler) return SharedSequence(source) } } ================================================ FILE: RxCocoa/Traits/SharedSequence/SharedSequence.swift ================================================ // // 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, ObservableConvertibleType { let source: Observable init(_ source: Observable) { self.source = SharingStrategy.share(source) } init(raw: Observable) { 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 them to ensure shared sequence properties are preserved after extension. */ public static func createUnsafe(source: Source) -> SharedSequence { SharedSequence(raw: source.asObservable()) } #endif /** - returns: Built observable sequence. */ public func asObservable() -> Observable { source } /** - returns: `self` */ public func asSharedSequence() -> SharedSequence { self } /// - returns: `Infallible` interface. public func asInfallible() -> Infallible { asInfallible(onErrorFallbackTo: .empty()) } } /** 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 } public extension SharedSequenceConvertibleType { func asObservable() -> Observable { asSharedSequence().asObservable() } } public 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. */ static func empty() -> SharedSequence { SharedSequence(raw: Observable.empty().subscribe(on: SharingStrategy.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. */ static func never() -> SharedSequence { 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. */ static func just(_ element: Element) -> SharedSequence { SharedSequence(raw: Observable.just(element).subscribe(on: SharingStrategy.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. */ static func deferred(_ observableFactory: @escaping () -> SharedSequence) -> SharedSequence { 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. */ static func of(_ elements: Element ...) -> SharedSequence { let source = Observable.from(elements, scheduler: SharingStrategy.scheduler) return SharedSequence(raw: source) } } public 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. */ static func from(_ array: [Element]) -> SharedSequence { let source = Observable.from(array, scheduler: SharingStrategy.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. */ static func from(_ sequence: Sequence) -> SharedSequence where Sequence.Element == Element { 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. */ static func from(optional: Element?) -> SharedSequence { let source = Observable.from(optional: optional, scheduler: SharingStrategy.scheduler) return SharedSequence(raw: source) } } public 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. */ static func interval(_ period: RxTimeInterval) -> SharedSequence { SharedSequence(Observable.interval(period, scheduler: SharingStrategy.scheduler)) } } // MARK: timer public 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. */ static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval) -> SharedSequence { SharedSequence(Observable.timer(dueTime, period: period, scheduler: SharingStrategy.scheduler)) } } ================================================ FILE: RxCocoa/Traits/Signal/ControlEvent+Signal.swift ================================================ // // ControlEvent+Signal.swift // RxCocoa // // Created by Krunoslav Zaher on 11/1/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxSwift public extension ControlEvent { /// Converts `ControlEvent` to `Signal` trait. /// /// `ControlEvent` already can't fail, so no special case needs to be handled. func asSignal() -> Signal { asSignal { _ -> Signal in #if DEBUG rxFatalError("Somehow signal received error from a source that shouldn't fail.") #else return Signal.empty() #endif } } } ================================================ FILE: RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift ================================================ // // ObservableConvertibleType+Signal.swift // RxCocoa // // Created by Krunoslav Zaher on 9/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift public 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. */ func asSignal(onErrorJustReturn: Element) -> Signal { let source = asObservable() .observe(on: SignalSharingStrategy.scheduler) .catchAndReturn(onErrorJustReturn) return Signal(source) } /** Converts observable sequence to `Signal` trait. - parameter onErrorSignalWith: Signal that continues to emit the sequence in case of error. - returns: Signal trait. */ func asSignal(onErrorSignalWith: Signal) -> Signal { let source = asObservable() .observe(on: SignalSharingStrategy.scheduler) .catch { _ in onErrorSignalWith.asObservable() } return Signal(source) } /** Converts observable sequence to `Signal` trait. - parameter onErrorRecover: Calculates signal that continues to emit the sequence in case of error. - returns: Signal trait. */ func asSignal(onErrorRecover: @escaping (_ error: Swift.Error) -> Signal) -> Signal { let source = asObservable() .observe(on: SignalSharingStrategy.scheduler) .catch { error in onErrorRecover(error).asObservable() } return Signal(source) } } ================================================ FILE: RxCocoa/Traits/Signal/PublishRelay+Signal.swift ================================================ // // PublishRelay+Signal.swift // RxCocoa // // Created by Krunoslav Zaher on 12/28/15. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxRelay import RxSwift public extension PublishRelay { /// Converts `PublishRelay` to `Signal`. /// /// - returns: Observable sequence. func asSignal() -> Signal { let source = asObservable() .observe(on: SignalSharingStrategy.scheduler) return SharedSequence(source) } } ================================================ FILE: RxCocoa/Traits/Signal/Signal+Subscription.swift ================================================ // // Signal+Subscription.swift // RxCocoa // // Created by Krunoslav Zaher on 9/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxRelay import RxSwift public 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 observers: Observers that receives events. - returns: Disposable object that can be used to unsubscribe the observer from the subject. */ func emit(to observers: Observer...) -> Disposable where Observer.Element == Element { asSharedSequence() .asObservable() .subscribe { event in observers.forEach { $0.on(event) } } } /** Creates new subscription and sends elements to observer. In this form it's equivalent to `subscribe` method, but it communicates intent better. - parameter observers: Observers that receives events. - returns: Disposable object that can be used to unsubscribe the observer from the subject. */ func emit(to observers: Observer...) -> Disposable where Observer.Element == Element? { asSharedSequence() .asObservable() .map { $0 as Element? } .subscribe { event in observers.forEach { $0.on(event) } } } /** Creates new subscription and sends elements to `BehaviorRelay`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func emit(to relays: BehaviorRelay...) -> Disposable { emit(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `BehaviorRelay`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func emit(to relays: BehaviorRelay...) -> Disposable { emit(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `PublishRelay`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func emit(to relays: PublishRelay...) -> Disposable { emit(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `PublishRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func emit(to relays: PublishRelay...) -> Disposable { emit(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `ReplayRelay`. - parameter relays: Target relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func emit(to relays: ReplayRelay...) -> Disposable { emit(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Creates new subscription and sends elements to `ReplayRelay`. - parameter relays: Target relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer from the relay. */ func emit(to relays: ReplayRelay...) -> Disposable { emit(onNext: { e in relays.forEach { $0.accept(e) } }) } /** Subscribes an element handler, a completion handler and disposed handler to an observable sequence. Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence. Error callback is not exposed because `Signal` can't error out. - Note: If `object` can't be retained, none of the other closures will be invoked. - parameter object: The object to provide an unretained reference on. - 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. */ func emit( with object: Object, onNext: ((Object, Element) -> Void)? = nil, onCompleted: ((Object) -> Void)? = nil, onDisposed: ((Object) -> Void)? = nil ) -> Disposable { asObservable().subscribe( with: object, onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed ) } /** 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. */ func emit( onNext: ((Element) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil ) -> Disposable { asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed) } /** Subscribes to this `Signal` with a no-op. This method can be only called from `MainThread`. - note: This is an alias of `emit(onNext: nil, onCompleted: nil, onDisposed: nil)` used to fix an ambiguity bug in Swift: https://bugs.swift.org/browse/SR-13657 - returns: Subscription object used to unsubscribe from the observable sequence. */ func emit() -> Disposable { emit(onNext: nil, onCompleted: nil, onDisposed: nil) } } ================================================ FILE: RxCocoa/Traits/Signal/Signal.swift ================================================ // // 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 { SharingScheduler.make() } public static func share(_ source: Observable) -> Observable { source.share(scope: .whileConnected) } } public extension SharedSequenceConvertibleType where SharingStrategy == SignalSharingStrategy { /// Adds `asPublisher` to `SharingSequence` with `PublishSharingStrategy`. func asSignal() -> Signal { asSharedSequence() } } ================================================ FILE: RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift ================================================ // // RxCollectionViewReactiveArrayDataSource.swift // RxCocoa // // Created by Krunoslav Zaher on 6/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit // objc monkey business class _RxCollectionViewReactiveArrayDataSource: NSObject, UICollectionViewDataSource { @objc(numberOfSectionsInCollectionView:) func numberOfSections(in _: UICollectionView) -> Int { 1 } func _collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int { 0 } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { _collectionView(collectionView, numberOfItemsInSection: section) } fileprivate func _collectionView(_: UICollectionView, cellForItemAt _: IndexPath) -> UICollectionViewCell { rxAbstractMethod() } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { _collectionView(collectionView, cellForItemAt: indexPath) } } class RxCollectionViewReactiveArrayDataSourceSequenceWrapper: RxCollectionViewReactiveArrayDataSource, RxCollectionViewDataSourceType { typealias Element = Sequence 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]? func modelAtIndex(_ index: Int) -> Element? { 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(_: UICollectionView, numberOfItemsInSection _: Int) -> Int { itemModels?.count ?? 0 } override func _collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { cellFactory(collectionView, indexPath.item, itemModels![indexPath.item]) } // reactive func collectionView(_ collectionView: UICollectionView, observedElements: [Element]) { 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 ================================================ FILE: RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift ================================================ // // RxPickerViewAdapter.swift // RxCocoa // // Created by Sergey Shulga on 12/07/2017. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit 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 _: UIPickerView) -> Int { 1 } func pickerView(_: UIPickerView, numberOfRowsInComponent _: Int) -> Int { items.count } } class RxPickerViewSequenceDataSource: RxPickerViewArrayDataSource, RxPickerViewDataSourceType { typealias Element = Sequence 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, Sequence.Element) -> String? private let titleForRow: TitleForRow init(titleForRow: @escaping TitleForRow) { self.titleForRow = titleForRow super.init() } func pickerView(_: UIPickerView, titleForRow row: Int, forComponent _: Int) -> String? { titleForRow(row, items[row]) } } final class RxAttributedStringPickerViewAdapter: RxPickerViewSequenceDataSource, UIPickerViewDelegate { typealias AttributedTitleForRow = (Int, Sequence.Element) -> NSAttributedString? private let attributedTitleForRow: AttributedTitleForRow init(attributedTitleForRow: @escaping AttributedTitleForRow) { self.attributedTitleForRow = attributedTitleForRow super.init() } func pickerView(_: UIPickerView, attributedTitleForRow row: Int, forComponent _: Int) -> NSAttributedString? { attributedTitleForRow(row, items[row]) } } final class RxPickerViewAdapter: RxPickerViewSequenceDataSource, UIPickerViewDelegate { typealias ViewForRow = (Int, Sequence.Element, UIView?) -> UIView private let viewForRow: ViewForRow init(viewForRow: @escaping ViewForRow) { self.viewForRow = viewForRow super.init() } func pickerView(_: UIPickerView, viewForRow row: Int, forComponent _: Int, reusing view: UIView?) -> UIView { viewForRow(row, items[row], view) } } #endif ================================================ FILE: RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift ================================================ // // RxTableViewReactiveArrayDataSource.swift // RxCocoa // // Created by Krunoslav Zaher on 6/26/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit // objc monkey business class _RxTableViewReactiveArrayDataSource: NSObject, UITableViewDataSource { func numberOfSections(in _: UITableView) -> Int { 1 } func _tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int { 0 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { _tableView(tableView, numberOfRowsInSection: section) } fileprivate func _tableView(_: UITableView, cellForRowAt _: IndexPath) -> UITableViewCell { rxAbstractMethod() } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { _tableView(tableView, cellForRowAt: indexPath) } } class RxTableViewReactiveArrayDataSourceSequenceWrapper: RxTableViewReactiveArrayDataSource, RxTableViewDataSourceType { typealias Element = Sequence 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]? func modelAtIndex(_ index: Int) -> Element? { 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(_: UITableView, numberOfRowsInSection _: Int) -> Int { itemModels?.count ?? 0 } override func _tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { cellFactory(tableView, indexPath.item, itemModels![indexPath.row]) } // reactive func tableView(_ tableView: UITableView, observedElements: [Element]) { itemModels = observedElements tableView.reloadData() } } #endif ================================================ FILE: RxCocoa/iOS/Events/ItemEvents.swift ================================================ // // ItemEvents.swift // RxCocoa // // Created by Krunoslav Zaher on 6/20/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import UIKit public typealias ItemMovedEvent = (sourceIndex: IndexPath, destinationIndex: IndexPath) public typealias WillDisplayCellEvent = (cell: UITableViewCell, indexPath: IndexPath) public typealias DidEndDisplayingCellEvent = (cell: UITableViewCell, indexPath: IndexPath) #endif ================================================ FILE: RxCocoa/iOS/NSTextStorage+Rx.swift ================================================ // // NSTextStorage+Rx.swift // RxCocoa // // Created by Segii Shulga on 12/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: NSTextStorage { /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxTextStorageDelegateProxy.proxy(for: base) } /// Reactive wrapper for `delegate` message. var didProcessEditingRangeChangeInLength: Observable<(editedMask: NSTextStorage.EditActions, editedRange: NSRange, delta: Int)> { delegate .methodInvoked(#selector(NSTextStorageDelegate.textStorage(_:didProcessEditing:range:changeInLength:))) .map { a in let editedMask = try NSTextStorage.EditActions(rawValue: 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 ================================================ FILE: RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift ================================================ // // RxCollectionViewDataSourceType.swift // RxCocoa // // Created by Krunoslav Zaher on 6/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit /// 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) } #endif ================================================ FILE: RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift ================================================ // // RxPickerViewDataSourceType.swift // RxCocoa // // Created by Sergey Shulga on 05/07/2017. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit /// 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 ================================================ FILE: RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift ================================================ // // RxTableViewDataSourceType.swift // RxCocoa // // Created by Krunoslav Zaher on 6/26/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit /// 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) } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxCollectionViewDataSourcePrefetchingProxy.swift ================================================ // // RxCollectionViewDataSourcePrefetchingProxy.swift // RxCocoa // // Created by Rowan Livingstone on 2/15/18. // Copyright © 2018 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit @available(iOS 10.0, tvOS 10.0, *) extension UICollectionView: HasPrefetchDataSource { public typealias PrefetchDataSource = UICollectionViewDataSourcePrefetching } @available(iOS 10.0, tvOS 10.0, *) private let collectionViewPrefetchDataSourceNotSet = CollectionViewPrefetchDataSourceNotSet() @available(iOS 10.0, tvOS 10.0, *) private final class CollectionViewPrefetchDataSourceNotSet: NSObject, UICollectionViewDataSourcePrefetching { func collectionView(_: UICollectionView, prefetchItemsAt _: [IndexPath]) {} } @available(iOS 10.0, tvOS 10.0, *) open class RxCollectionViewDataSourcePrefetchingProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak var collectionView: UICollectionView? /// - parameter collectionView: Parent object for delegate proxy. public init(collectionView: ParentObject) { self.collectionView = collectionView super.init(parentObject: collectionView, delegateProxy: RxCollectionViewDataSourcePrefetchingProxy.self) } // Register known implementations public static func registerKnownImplementations() { register { RxCollectionViewDataSourcePrefetchingProxy(collectionView: $0) } } private var _prefetchItemsPublishSubject: PublishSubject<[IndexPath]>? /// Optimized version used for observing prefetch items callbacks. var prefetchItemsPublishSubject: PublishSubject<[IndexPath]> { if let subject = _prefetchItemsPublishSubject { return subject } let subject = PublishSubject<[IndexPath]>() _prefetchItemsPublishSubject = subject return subject } private weak var _requiredMethodsPrefetchDataSource: UICollectionViewDataSourcePrefetching? = collectionViewPrefetchDataSourceNotSet /// For more information take a look at `DelegateProxyType`. override open func setForwardToDelegate(_ forwardToDelegate: UICollectionViewDataSourcePrefetching?, retainDelegate: Bool) { _requiredMethodsPrefetchDataSource = forwardToDelegate ?? collectionViewPrefetchDataSourceNotSet super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) } deinit { if let subject = _prefetchItemsPublishSubject { subject.on(.completed) } } } @available(iOS 10.0, tvOS 10.0, *) extension RxCollectionViewDataSourcePrefetchingProxy: UICollectionViewDataSourcePrefetching { /// Required delegate method implementation. public func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) { if let subject = _prefetchItemsPublishSubject { subject.on(.next(indexPaths)) } (_requiredMethodsPrefetchDataSource ?? collectionViewPrefetchDataSourceNotSet).collectionView(collectionView, prefetchItemsAt: indexPaths) } } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift ================================================ // // RxCollectionViewDataSourceProxy.swift // RxCocoa // // Created by Krunoslav Zaher on 6/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit extension UICollectionView: HasDataSource { public typealias DataSource = UICollectionViewDataSource } private let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet() private final class CollectionViewDataSourceNotSet: NSObject, UICollectionViewDataSource { func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int { 0 } // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: func collectionView(_: UICollectionView, cellForItemAt _: IndexPath) -> UICollectionViewCell { rxAbstractMethod(message: dataSourceNotSet) } } /// For more information take a look at `DelegateProxyType`. open class RxCollectionViewDataSourceProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxCollectionViewDataSourceProxy(collectionView: $0) } } private weak var _requiredMethodsDataSource: UICollectionViewDataSource? = collectionViewDataSourceNotSet /// For more information take a look at `DelegateProxyType`. override open func setForwardToDelegate(_ forwardToDelegate: UICollectionViewDataSource?, retainDelegate: Bool) { _requiredMethodsDataSource = forwardToDelegate ?? collectionViewDataSourceNotSet super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) } } extension RxCollectionViewDataSourceProxy: UICollectionViewDataSource { /// Required delegate method implementation. public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, numberOfItemsInSection: section) } /// Required delegate method implementation. public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, cellForItemAt: indexPath) } } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift ================================================ // // RxCollectionViewDelegateProxy.swift // RxCocoa // // Created by Krunoslav Zaher on 6/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit /// For more information take a look at `DelegateProxyType`. open class RxCollectionViewDelegateProxy: RxScrollViewDelegateProxy { /// Typed parent object. public private(set) weak var collectionView: UICollectionView? /// Initializes `RxCollectionViewDelegateProxy` /// /// - parameter collectionView: Parent object for delegate proxy. public init(collectionView: UICollectionView) { self.collectionView = collectionView super.init(scrollView: collectionView) } } extension RxCollectionViewDelegateProxy: UICollectionViewDelegateFlowLayout {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift ================================================ // // RxNavigationControllerDelegateProxy.swift // RxCocoa // // Created by Diogo on 13/04/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit extension UINavigationController: HasDelegate { public typealias Delegate = UINavigationControllerDelegate } /// For more information take a look at `DelegateProxyType`. open class RxNavigationControllerDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxNavigationControllerDelegateProxy(navigationController: $0) } } } extension RxNavigationControllerDelegateProxy: UINavigationControllerDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift ================================================ // // RxPickerViewDataSourceProxy.swift // RxCocoa // // Created by Sergey Shulga on 05/07/2017. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit extension UIPickerView: HasDataSource { public typealias DataSource = UIPickerViewDataSource } private let pickerViewDataSourceNotSet = PickerViewDataSourceNotSet() private final class PickerViewDataSourceNotSet: NSObject, UIPickerViewDataSource { func numberOfComponents(in _: UIPickerView) -> Int { 0 } func pickerView(_: UIPickerView, numberOfRowsInComponent _: Int) -> Int { 0 } } /// For more information take a look at `DelegateProxyType`. public class RxPickerViewDataSourceProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxPickerViewDataSourceProxy(pickerView: $0) } } private weak var _requiredMethodsDataSource: UIPickerViewDataSource? = pickerViewDataSourceNotSet /// For more information take a look at `DelegateProxyType`. override public func setForwardToDelegate(_ forwardToDelegate: UIPickerViewDataSource?, retainDelegate: Bool) { _requiredMethodsDataSource = forwardToDelegate ?? pickerViewDataSourceNotSet super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) } } // MARK: UIPickerViewDataSource extension RxPickerViewDataSourceProxy: UIPickerViewDataSource { /// Required delegate method implementation. public func numberOfComponents(in pickerView: UIPickerView) -> Int { (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).numberOfComponents(in: pickerView) } /// Required delegate method implementation. public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).pickerView(pickerView, numberOfRowsInComponent: component) } } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift ================================================ // // RxPickerViewDelegateProxy.swift // RxCocoa // // Created by Segii Shulga on 5/12/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit extension UIPickerView: HasDelegate { public typealias Delegate = UIPickerViewDelegate } open class RxPickerViewDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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 implementations public static func registerKnownImplementations() { register { RxPickerViewDelegateProxy(pickerView: $0) } } } extension RxPickerViewDelegateProxy: UIPickerViewDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift ================================================ // // RxScrollViewDelegateProxy.swift // RxCocoa // // Created by Krunoslav Zaher on 6/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit extension UIScrollView: HasDelegate { public typealias Delegate = UIScrollViewDelegate } /// For more information take a look at `DelegateProxyType`. open class RxScrollViewDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxScrollViewDelegateProxy(scrollView: $0) } register { RxTableViewDelegateProxy(tableView: $0) } register { RxCollectionViewDelegateProxy(collectionView: $0) } register { RxTextViewDelegateProxy(textView: $0) } } private var _contentOffsetBehaviorSubject: BehaviorSubject? private var _contentOffsetPublishSubject: PublishSubject? /// Optimized version used for observing content offset changes. var contentOffsetBehaviorSubject: BehaviorSubject { if let subject = _contentOffsetBehaviorSubject { return subject } let subject = BehaviorSubject(value: scrollView?.contentOffset ?? CGPoint.zero) _contentOffsetBehaviorSubject = subject return subject } /// Optimized version used for observing content offset changes. var contentOffsetPublishSubject: PublishSubject { if let subject = _contentOffsetPublishSubject { return subject } let subject = PublishSubject() _contentOffsetPublishSubject = subject return subject } deinit { if let subject = _contentOffsetBehaviorSubject { subject.on(.completed) } if let subject = _contentOffsetPublishSubject { subject.on(.completed) } } } extension RxScrollViewDelegateProxy: UIScrollViewDelegate { /// 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(())) } _forwardToDelegate?.scrollViewDidScroll?(scrollView) } } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift ================================================ // // RxSearchBarDelegateProxy.swift // RxCocoa // // Created by Krunoslav Zaher on 7/4/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit extension UISearchBar: HasDelegate { public typealias Delegate = UISearchBarDelegate } /// For more information take a look at `DelegateProxyType`. open class RxSearchBarDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxSearchBarDelegateProxy(searchBar: $0) } } } extension RxSearchBarDelegateProxy: UISearchBarDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift ================================================ // // RxSearchControllerDelegateProxy.swift // RxCocoa // // Created by Segii Shulga on 3/17/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit extension UISearchController: HasDelegate { public typealias Delegate = UISearchControllerDelegate } /// For more information take a look at `DelegateProxyType`. open class RxSearchControllerDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxSearchControllerDelegateProxy(searchController: $0) } } } extension RxSearchControllerDelegateProxy: UISearchControllerDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift ================================================ // // RxTabBarControllerDelegateProxy.swift // RxCocoa // // Created by Yusuke Kita on 2016/12/07. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import RxSwift import UIKit extension UITabBarController: HasDelegate { public typealias Delegate = UITabBarControllerDelegate } /// For more information take a look at `DelegateProxyType`. open class RxTabBarControllerDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxTabBarControllerDelegateProxy(tabBar: $0) } } } extension RxTabBarControllerDelegateProxy: UITabBarControllerDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift ================================================ // // RxTabBarDelegateProxy.swift // RxCocoa // // Created by Jesse Farless on 5/14/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import RxSwift import UIKit extension UITabBar: HasDelegate { public typealias Delegate = UITabBarDelegate } /// For more information take a look at `DelegateProxyType`. open class RxTabBarDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxTabBarDelegateProxy(tabBar: $0) } } /// For more information take a look at `DelegateProxyType`. open class func currentDelegate(for object: ParentObject) -> UITabBarDelegate? { object.delegate } /// For more information take a look at `DelegateProxyType`. open class func setCurrentDelegate(_ delegate: UITabBarDelegate?, to object: ParentObject) { object.delegate = delegate } } extension RxTabBarDelegateProxy: UITabBarDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxTableViewDataSourcePrefetchingProxy.swift ================================================ // // RxTableViewDataSourcePrefetchingProxy.swift // RxCocoa // // Created by Rowan Livingstone on 2/15/18. // Copyright © 2018 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit @available(iOS 10.0, tvOS 10.0, *) extension UITableView: HasPrefetchDataSource { public typealias PrefetchDataSource = UITableViewDataSourcePrefetching } @available(iOS 10.0, tvOS 10.0, *) private let tableViewPrefetchDataSourceNotSet = TableViewPrefetchDataSourceNotSet() @available(iOS 10.0, tvOS 10.0, *) private final class TableViewPrefetchDataSourceNotSet: NSObject, UITableViewDataSourcePrefetching { func tableView(_: UITableView, prefetchRowsAt _: [IndexPath]) {} } @available(iOS 10.0, tvOS 10.0, *) open class RxTableViewDataSourcePrefetchingProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak var tableView: UITableView? /// - parameter tableView: Parent object for delegate proxy. public init(tableView: ParentObject) { self.tableView = tableView super.init(parentObject: tableView, delegateProxy: RxTableViewDataSourcePrefetchingProxy.self) } // Register known implementations public static func registerKnownImplementations() { register { RxTableViewDataSourcePrefetchingProxy(tableView: $0) } } private var _prefetchRowsPublishSubject: PublishSubject<[IndexPath]>? /// Optimized version used for observing prefetch rows callbacks. var prefetchRowsPublishSubject: PublishSubject<[IndexPath]> { if let subject = _prefetchRowsPublishSubject { return subject } let subject = PublishSubject<[IndexPath]>() _prefetchRowsPublishSubject = subject return subject } private weak var _requiredMethodsPrefetchDataSource: UITableViewDataSourcePrefetching? = tableViewPrefetchDataSourceNotSet /// For more information take a look at `DelegateProxyType`. override open func setForwardToDelegate(_ forwardToDelegate: UITableViewDataSourcePrefetching?, retainDelegate: Bool) { _requiredMethodsPrefetchDataSource = forwardToDelegate ?? tableViewPrefetchDataSourceNotSet super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) } deinit { if let subject = _prefetchRowsPublishSubject { subject.on(.completed) } } } @available(iOS 10.0, tvOS 10.0, *) extension RxTableViewDataSourcePrefetchingProxy: UITableViewDataSourcePrefetching { /// Required delegate method implementation. public func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) { if let subject = _prefetchRowsPublishSubject { subject.on(.next(indexPaths)) } (_requiredMethodsPrefetchDataSource ?? tableViewPrefetchDataSourceNotSet).tableView(tableView, prefetchRowsAt: indexPaths) } } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift ================================================ // // RxTableViewDataSourceProxy.swift // RxCocoa // // Created by Krunoslav Zaher on 6/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit extension UITableView: HasDataSource { public typealias DataSource = UITableViewDataSource } private let tableViewDataSourceNotSet = TableViewDataSourceNotSet() private final class TableViewDataSourceNotSet: NSObject, UITableViewDataSource { func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int { 0 } func tableView(_: UITableView, cellForRowAt _: IndexPath) -> UITableViewCell { rxAbstractMethod(message: dataSourceNotSet) } } /// For more information take a look at `DelegateProxyType`. open class RxTableViewDataSourceProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxTableViewDataSourceProxy(tableView: $0) } } private weak var _requiredMethodsDataSource: UITableViewDataSource? = tableViewDataSourceNotSet /// For more information take a look at `DelegateProxyType`. override open func setForwardToDelegate(_ forwardToDelegate: UITableViewDataSource?, retainDelegate: Bool) { _requiredMethodsDataSource = forwardToDelegate ?? tableViewDataSourceNotSet super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) } } extension RxTableViewDataSourceProxy: UITableViewDataSource { /// Required delegate method implementation. public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, numberOfRowsInSection: section) } /// Required delegate method implementation. public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, cellForRowAt: indexPath) } } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift ================================================ // // RxTableViewDelegateProxy.swift // RxCocoa // // Created by Krunoslav Zaher on 6/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit /// For more information take a look at `DelegateProxyType`. open class RxTableViewDelegateProxy: RxScrollViewDelegateProxy { /// Typed parent object. public private(set) weak var tableView: UITableView? /// - parameter tableView: Parent object for delegate proxy. public init(tableView: UITableView) { self.tableView = tableView super.init(scrollView: tableView) } } extension RxTableViewDelegateProxy: UITableViewDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift ================================================ // // RxTextStorageDelegateProxy.swift // RxCocoa // // Created by Segii Shulga on 12/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit extension NSTextStorage: HasDelegate { public typealias Delegate = NSTextStorageDelegate } open class RxTextStorageDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak 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() { register { RxTextStorageDelegateProxy(textStorage: $0) } } } extension RxTextStorageDelegateProxy: NSTextStorageDelegate {} #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift ================================================ // // RxTextViewDelegateProxy.swift // RxCocoa // // Created by Yuta ToKoRo on 7/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit /// For more information take a look at `DelegateProxyType`. open class RxTextViewDelegateProxy: RxScrollViewDelegateProxy { /// Typed parent object. public private(set) weak var textView: UITextView? /// - parameter textview: Parent object for delegate proxy. public init(textView: UITextView) { self.textView = textView super.init(scrollView: textView) } } extension RxTextViewDelegateProxy: UITextViewDelegate { /// 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 = forwardToDelegate() as? UITextViewDelegate return forwardToDelegate?.textView?( textView, shouldChangeTextIn: range, replacementText: text ) ?? true } } #endif ================================================ FILE: RxCocoa/iOS/Proxies/RxWKNavigationDelegateProxy.swift ================================================ // // RxWKNavigationDelegateProxy.swift // RxCocoa // // Created by Giuseppe Lanza on 14/02/2020. // Copyright © 2020 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(macOS) import RxSwift import WebKit @available(iOS 8.0, macOS 10.10, macOSApplicationExtension 10.10, *) open class RxWKNavigationDelegateProxy: DelegateProxy, DelegateProxyType { /// Typed parent object. public private(set) weak var webView: WKWebView? /// - parameter webView: Parent object for delegate proxy. public init(webView: ParentObject) { self.webView = webView super.init(parentObject: webView, delegateProxy: RxWKNavigationDelegateProxy.self) } // Register known implementations public static func registerKnownImplementations() { register { RxWKNavigationDelegateProxy(webView: $0) } } public static func currentDelegate(for object: WKWebView) -> WKNavigationDelegate? { object.navigationDelegate } public static func setCurrentDelegate(_ delegate: WKNavigationDelegate?, to object: WKWebView) { object.navigationDelegate = delegate } } @available(iOS 8.0, macOS 10.10, macOSApplicationExtension 10.10, *) extension RxWKNavigationDelegateProxy: WKNavigationDelegate {} #endif ================================================ FILE: RxCocoa/iOS/UIActivityIndicatorView+Rx.swift ================================================ // // UIActivityIndicatorView+Rx.swift // RxCocoa // // Created by Ivan Persidskiy on 02/12/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIActivityIndicatorView { /// Bindable sink for `startAnimating()`, `stopAnimating()` methods. var isAnimating: Binder { Binder(base) { activityIndicator, active in if active { activityIndicator.startAnimating() } else { activityIndicator.stopAnimating() } } } } #endif ================================================ FILE: RxCocoa/iOS/UIApplication+Rx.swift ================================================ // // UIApplication+Rx.swift // RxCocoa // // Created by Mads Bøgeskov on 18/01/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit #endif #if os(iOS) public extension Reactive where Base: UIApplication { /// Bindable sink for `isNetworkActivityIndicatorVisible`. var isNetworkActivityIndicatorVisible: Binder { Binder(base) { application, active in application.isNetworkActivityIndicatorVisible = active } } } #endif #if os(iOS) || os(visionOS) public extension Reactive where Base: UIApplication { /// Reactive wrapper for `UIApplication.didEnterBackgroundNotification` static var didEnterBackground: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.didEnterBackgroundNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.willEnterForegroundNotification` static var willEnterForeground: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.willEnterForegroundNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.didFinishLaunchingNotification` static var didFinishLaunching: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.didFinishLaunchingNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.didBecomeActiveNotification` static var didBecomeActive: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.didBecomeActiveNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.willResignActiveNotification` static var willResignActive: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.willResignActiveNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.didReceiveMemoryWarningNotification` static var didReceiveMemoryWarning: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.didReceiveMemoryWarningNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.willTerminateNotification` static var willTerminate: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.willTerminateNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.significantTimeChangeNotification` static var significantTimeChange: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.significantTimeChangeNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.backgroundRefreshStatusDidChangeNotification` static var backgroundRefreshStatusDidChange: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.backgroundRefreshStatusDidChangeNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.protectedDataWillBecomeUnavailableNotification` static var protectedDataWillBecomeUnavailable: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.protectedDataWillBecomeUnavailableNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.protectedDataDidBecomeAvailableNotification` static var protectedDataDidBecomeAvailable: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.protectedDataDidBecomeAvailableNotification).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for `UIApplication.userDidTakeScreenshotNotification` static var userDidTakeScreenshot: ControlEvent { let source = NotificationCenter.default.rx.notification(UIApplication.userDidTakeScreenshotNotification).map { _ in } return ControlEvent(events: source) } } #endif ================================================ FILE: RxCocoa/iOS/UIBarButtonItem+Rx.swift ================================================ // // UIBarButtonItem+Rx.swift // RxCocoa // // Created by Daniel Tartaglia on 5/31/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit private var rx_tap_key: UInt8 = 0 public extension Reactive where Base: UIBarButtonItem { /// Reactive wrapper for target action pattern on `self`. var tap: ControlEvent { let source = lazyInstanceObservable(&rx_tap_key) { () -> Observable in Observable.create { [weak control = self.base] observer in guard let control else { observer.on(.completed) return Disposables.create() } let target = BarButtonItemTarget(barButtonItem: control) { observer.on(.next(())) } return target } .take(until: 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.ensureRunningOnMainThread() #endif barButtonItem?.target = nil barButtonItem?.action = nil callback = nil } @objc func action(_: AnyObject) { callback() } } #endif ================================================ FILE: RxCocoa/iOS/UIButton+Rx.swift ================================================ // // UIButton+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIButton { /// Reactive wrapper for `TouchUpInside` control event. var tap: ControlEvent { controlEvent(.touchUpInside) } } #endif #if os(tvOS) import RxSwift import UIKit public extension Reactive where Base: UIButton { /// Reactive wrapper for `PrimaryActionTriggered` control event. var primaryAction: ControlEvent { controlEvent(.primaryActionTriggered) } } #endif #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIButton { /// Reactive wrapper for `setTitle(_:for:)` func title(for controlState: UIControl.State = []) -> Binder { Binder(base) { button, title in button.setTitle(title, for: controlState) } } /// Reactive wrapper for `setImage(_:for:)` func image(for controlState: UIControl.State = []) -> Binder { Binder(base) { button, image in button.setImage(image, for: controlState) } } /// Reactive wrapper for `setBackgroundImage(_:for:)` func backgroundImage(for controlState: UIControl.State = []) -> Binder { Binder(base) { button, image in button.setBackgroundImage(image, for: controlState) } } } #endif #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIButton { /// Reactive wrapper for `setAttributedTitle(_:controlState:)` func attributedTitle(for controlState: UIControl.State = []) -> Binder { Binder(base) { button, attributedTitle in button.setAttributedTitle(attributedTitle, for: controlState) } } } #endif ================================================ FILE: RxCocoa/iOS/UICollectionView+Rx.swift ================================================ // // UICollectionView+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 4/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit // Items public 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) */ func items (_ source: Source) -> (_ cellFactory: @escaping (UICollectionView, Int, Sequence.Element) -> UICollectionViewCell) -> Disposable where Source.Element == Sequence { { 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 collection 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) */ func items (cellIdentifier: String, cellType _: Cell.Type = Cell.self) -> (_ source: Source) -> (_ configureCell: @escaping (Int, Sequence.Element, Cell) -> Void) -> Disposable where Source.Element == Sequence { { source in { 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) */ func items< DataSource: RxCollectionViewDataSourceType & UICollectionViewDataSource, Source: ObservableType > (dataSource: DataSource) -> (_ source: Source) -> Disposable where DataSource.Element == Source.Element { { source in // This is called for side effects 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) in guard let collectionView else { return } dataSource.collectionView(collectionView, observedEvent: event) } } } } public extension Reactive where Base: UICollectionView { typealias DisplayCollectionViewCellEvent = (cell: UICollectionViewCell, at: IndexPath) typealias DisplayCollectionViewSupplementaryViewEvent = (supplementaryView: UICollectionReusableView, elementKind: String, at: IndexPath) /// Reactive wrapper for `dataSource`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var dataSource: DelegateProxy { 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. func setDataSource(_ dataSource: UICollectionViewDataSource) -> Disposable { RxCollectionViewDataSourceProxy.installForwardDelegate(dataSource, retainDelegate: false, onProxyForObject: base) } /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`. var itemSelected: ControlEvent { let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didSelectItemAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `collectionView(_:didDeselectItemAtIndexPath:)`. var itemDeselected: ControlEvent { let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didDeselectItemAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `collectionView(_:didHighlightItemAt:)`. var itemHighlighted: ControlEvent { let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didHighlightItemAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `collectionView(_:didUnhighlightItemAt:)`. var itemUnhighlighted: ControlEvent { let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didUnhighlightItemAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `collectionView:willDisplay:forItemAt:`. var willDisplayCell: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:willDisplay:forItemAt:))) .map { a in try (castOrThrow(UICollectionViewCell.self, a[1]), castOrThrow(IndexPath.self, a[2])) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `collectionView(_:willDisplaySupplementaryView:forElementKind:at:)`. var willDisplaySupplementaryView: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:willDisplaySupplementaryView:forElementKind:at:))) .map { a in try ( castOrThrow(UICollectionReusableView.self, a[1]), castOrThrow(String.self, a[2]), castOrThrow(IndexPath.self, a[3]) ) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `collectionView:didEndDisplaying:forItemAt:`. var didEndDisplayingCell: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didEndDisplaying:forItemAt:))) .map { a in try (castOrThrow(UICollectionViewCell.self, a[1]), castOrThrow(IndexPath.self, a[2])) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:)`. var didEndDisplayingSupplementaryView: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:))) .map { a in try ( castOrThrow(UICollectionReusableView.self, a[1]), castOrThrow(String.self, a[2]), 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 { ... /// ``` func modelSelected(_: T.Type) -> ControlEvent { let source: Observable = itemSelected.flatMap { [weak view = self.base as UICollectionView] indexPath -> Observable in guard let view else { return Observable.empty() } return try Observable.just(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 { ... /// ``` func modelDeselected(_: T.Type) -> ControlEvent { let source: Observable = itemDeselected.flatMap { [weak view = self.base as UICollectionView] indexPath -> Observable in guard let view else { return Observable.empty() } return try Observable.just(view.rx.model(at: indexPath)) } return ControlEvent(events: source) } /// Synchronous helper method for retrieving a model at indexPath through a reactive data source func model(at indexPath: IndexPath) throws -> T { let dataSource: SectionedViewDataSourceType = castOrFatalError(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) } } @available(iOS 10.0, tvOS 10.0, *) public extension Reactive where Base: UICollectionView { /// Reactive wrapper for `prefetchDataSource`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var prefetchDataSource: DelegateProxy { RxCollectionViewDataSourcePrefetchingProxy.proxy(for: base) } /** Installs prefetch data source as forwarding delegate on `rx.prefetchDataSource`. Prefetch data source won't be retained. It enables using normal delegate mechanism with reactive delegate mechanism. - parameter prefetchDataSource: Prefetch data source object. - returns: Disposable object that can be used to unbind the data source. */ func setPrefetchDataSource(_ prefetchDataSource: UICollectionViewDataSourcePrefetching) -> Disposable { RxCollectionViewDataSourcePrefetchingProxy.installForwardDelegate(prefetchDataSource, retainDelegate: false, onProxyForObject: base) } /// Reactive wrapper for `prefetchDataSource` message `collectionView(_:prefetchItemsAt:)`. var prefetchItems: ControlEvent<[IndexPath]> { let source = RxCollectionViewDataSourcePrefetchingProxy.proxy(for: base).prefetchItemsPublishSubject return ControlEvent(events: source) } /// Reactive wrapper for `prefetchDataSource` message `collectionView(_:cancelPrefetchingForItemsAt:)`. var cancelPrefetchingForItems: ControlEvent<[IndexPath]> { let source = prefetchDataSource.methodInvoked(#selector(UICollectionViewDataSourcePrefetching.collectionView(_:cancelPrefetchingForItemsAt:))) .map { a in try castOrThrow([IndexPath].self, a[1]) } return ControlEvent(events: source) } } #endif #if os(tvOS) public extension Reactive where Base: UICollectionView { /// Reactive wrapper for `delegate` message `collectionView(_:didUpdateFocusInContext:withAnimationCoordinator:)`. 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 ================================================ FILE: RxCocoa/iOS/UIControl+Rx.swift ================================================ // // UIControl+Rx.swift // RxCocoa // // Created by Daniel Tartaglia on 5/23/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIControl { /// Reactive wrapper for target action pattern. /// /// - parameter controlEvents: Filter for observed event types. func controlEvent(_ controlEvents: UIControl.Event) -> ControlEvent { let source: Observable = Observable.create { [weak control = self.base] observer in MainScheduler.ensureRunningOnMainThread() guard let control else { observer.on(.completed) return Disposables.create() } let controlTarget = ControlTarget(control: control, controlEvents: controlEvents) { _ in observer.on(.next(())) } return Disposables.create(with: controlTarget.dispose) } .take(until: 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. func controlProperty( editingEvents: UIControl.Event, getter: @escaping (Base) -> T, setter: @escaping (Base, T) -> Void ) -> 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) } .take(until: deallocated) let bindingObserver = Binder(base, binding: setter) return ControlProperty(values: source, valueSink: bindingObserver) } /// This is a separate method to better communicate to public consumers that /// an `editingEvent` needs to fire for control property to be updated. internal func controlPropertyWithDefaultEvents( editingEvents: UIControl.Event = [.allEditingEvents, .valueChanged], getter: @escaping (Base) -> T, setter: @escaping (Base, T) -> Void ) -> ControlProperty { controlProperty( editingEvents: editingEvents, getter: getter, setter: setter ) } } #endif ================================================ FILE: RxCocoa/iOS/UIDatePicker+Rx.swift ================================================ // // UIDatePicker+Rx.swift // RxCocoa // // Created by Daniel Tartaglia on 5/31/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIDatePicker { /// Reactive wrapper for `date` property. var date: ControlProperty { value } /// Reactive wrapper for `date` property. var value: ControlProperty { base.rx.controlPropertyWithDefaultEvents( getter: { datePicker in datePicker.date }, setter: { datePicker, value in datePicker.date = value } ) } /// Reactive wrapper for `countDownDuration` property. var countDownDuration: ControlProperty { base.rx.controlPropertyWithDefaultEvents( getter: { datePicker in datePicker.countDownDuration }, setter: { datePicker, value in datePicker.countDownDuration = value } ) } } #endif ================================================ FILE: RxCocoa/iOS/UIGestureRecognizer+Rx.swift ================================================ // // 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) || os(visionOS) import RxSwift import UIKit // This should be only used from `MainScheduler` final class GestureTarget: RxTarget { typealias Callback = (Recognizer) -> Void let selector = #selector(GestureTarget.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 = method(for: selector) if method == nil { fatalError("Can't find method") } } @objc func eventHandler(_: UIGestureRecognizer) { if let callback, let gestureRecognizer { callback(gestureRecognizer) } } override func dispose() { super.dispose() gestureRecognizer?.removeTarget(self, action: selector) callback = nil } } public extension Reactive where Base: UIGestureRecognizer { /// Reactive wrapper for gesture recognizer events. var event: ControlEvent { let source: Observable = Observable.create { [weak control = self.base] observer in MainScheduler.ensureRunningOnMainThread() guard let control else { observer.on(.completed) return Disposables.create() } let observer = GestureTarget(control) { control in observer.on(.next(control)) } return observer }.take(until: deallocated) return ControlEvent(events: source) } } #endif ================================================ FILE: RxCocoa/iOS/UINavigationController+Rx.swift ================================================ // // UINavigationController+Rx.swift // RxCocoa // // Created by Diogo on 13/04/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UINavigationController { typealias ShowEvent = (viewController: UIViewController, animated: Bool) /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxNavigationControllerDelegateProxy.proxy(for: base) } /// Reactive wrapper for delegate method `navigationController(:willShow:animated:)`. 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:)`. 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 ================================================ FILE: RxCocoa/iOS/UIPickerView+Rx.swift ================================================ // // UIPickerView+Rx.swift // RxCocoa // // Created by Segii Shulga on 5/12/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIPickerView { /// Reactive wrapper for `delegate`. /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { 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. func setDelegate(_ delegate: UIPickerViewDelegate) -> Disposable { RxPickerViewDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: base) } /** Reactive wrapper for `dataSource`. For more information take a look at `DelegateProxyType` protocol documentation. */ var dataSource: DelegateProxy { RxPickerViewDataSourceProxy.proxy(for: base) } /** Reactive wrapper for `delegate` message `pickerView:didSelectRow:inComponent:`. */ var itemSelected: ControlEvent<(row: Int, component: Int)> { let source = delegate .methodInvoked(#selector(UIPickerViewDelegate.pickerView(_:didSelectRow:inComponent:))) .map { try (row: castOrThrow(Int.self, $0[1]), component: 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 */ func modelSelected(_: T.Type) -> ControlEvent<[T]> { let source = itemSelected.flatMap { [weak view = self.base as UIPickerView] _, component -> Observable<[T]> in guard let 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 } .disposed(by: disposeBag) */ func itemTitles (_ source: Source) -> (_ titleForRow: @escaping (Int, Sequence.Element) -> String?) -> Disposable where Source.Element == Sequence { { 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) } .disposed(by: disposeBag) */ func itemAttributedTitles (_ source: Source) -> (_ attributedTitleForRow: @escaping (Int, Sequence.Element) -> NSAttributedString?) -> Disposable where Source.Element == Sequence { { 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) */ func items (_ source: Source) -> (_ viewForRow: @escaping (Int, Sequence.Element, UIView?) -> UIView) -> Disposable where Source.Element == Sequence { { 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. */ func items< Source: ObservableType, Adapter: RxPickerViewDataSourceType & UIPickerViewDataSource & UIPickerViewDelegate >(adapter: Adapter) -> (_ source: Source) -> Disposable where Source.Element == Adapter.Element { { 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 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. */ func model(at indexPath: IndexPath) throws -> T { let dataSource: SectionedViewDataSourceType = castOrFatalError(dataSource.forwardToDelegate(), message: "This method only works in case one of the `rx.itemTitles, rx.itemAttributedTitles, items(_ source: O)` methods was used.") return try castOrFatalError(dataSource.model(at: indexPath)) } } #endif ================================================ FILE: RxCocoa/iOS/UIRefreshControl+Rx.swift ================================================ // // UIRefreshControl+Rx.swift // RxCocoa // // Created by Yosuke Ishikawa on 1/31/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIRefreshControl { /// Bindable sink for `beginRefreshing()`, `endRefreshing()` methods. var isRefreshing: Binder { Binder(base) { refreshControl, refresh in if refresh { refreshControl.beginRefreshing() } else { refreshControl.endRefreshing() } } } } #endif ================================================ FILE: RxCocoa/iOS/UIScrollView+Rx.swift ================================================ // // UIScrollView+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 4/3/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIScrollView { typealias EndZoomEvent = (view: UIView?, scale: CGFloat) typealias WillEndDraggingEvent = (velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxScrollViewDelegateProxy.proxy(for: base) } /// Reactive wrapper for `contentOffset`. var contentOffset: ControlProperty { let proxy = RxScrollViewDelegateProxy.proxy(for: base) let bindingObserver = Binder(base) { scrollView, contentOffset in scrollView.contentOffset = contentOffset } return ControlProperty(values: proxy.contentOffsetBehaviorSubject, valueSink: bindingObserver) } /// Reactive wrapper for delegate method `scrollViewDidScroll` var didScroll: ControlEvent { let source = RxScrollViewDelegateProxy.proxy(for: base).contentOffsetPublishSubject return ControlEvent(events: source) } /// Reactive wrapper for delegate method `scrollViewWillBeginDecelerating` var willBeginDecelerating: ControlEvent { let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginDecelerating(_:))).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `scrollViewDidEndDecelerating` var didEndDecelerating: ControlEvent { let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndDecelerating(_:))).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `scrollViewWillBeginDragging` var willBeginDragging: ControlEvent { let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginDragging(_:))).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)` 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:)` 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` var didZoom: ControlEvent { let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidZoom)).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `scrollViewDidScrollToTop` var didScrollToTop: ControlEvent { let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidScrollToTop(_:))).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `scrollViewDidEndScrollingAnimation` var didEndScrollingAnimation: ControlEvent { let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndScrollingAnimation(_:))).map { _ in } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `scrollViewWillBeginZooming(_:with:)` 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:)` 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), 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. func setDelegate(_ delegate: UIScrollViewDelegate) -> Disposable { RxScrollViewDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: base) } } #endif ================================================ FILE: RxCocoa/iOS/UISearchBar+Rx.swift ================================================ // // UISearchBar+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UISearchBar { /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxSearchBarDelegateProxy.proxy(for: base) } /// Reactive wrapper for `text` property. var text: ControlProperty { value } /// Reactive wrapper for `text` property. var value: ControlProperty { let source: Observable = Observable.deferred { [weak searchBar = self.base as UISearchBar] () -> Observable in let text = searchBar?.text let textDidChange = (searchBar?.rx.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBar(_:textDidChange:))) ?? Observable.empty()) let didEndEditing = (searchBar?.rx.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidEndEditing(_:))) ?? Observable.empty()) return Observable.merge(textDidChange, didEndEditing) .map { _ in searchBar?.text ?? "" } .startWith(text) } let bindingObserver = Binder(base) { (searchBar, text: String?) in searchBar.text = text } return ControlProperty(values: source, valueSink: bindingObserver) } /// Reactive wrapper for `selectedScopeButtonIndex` property. 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 try castOrThrow(Int.self, a[1]) } .startWith(index) } let bindingObserver = Binder(base) { (searchBar, index: Int) in searchBar.selectedScopeButtonIndex = index } return ControlProperty(values: source, valueSink: bindingObserver) } #if os(iOS) || os(visionOS) /// Reactive wrapper for delegate method `searchBarCancelButtonClicked`. var cancelButtonClicked: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarCancelButtonClicked(_:))) .map { _ in () } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `searchBarBookmarkButtonClicked`. var bookmarkButtonClicked: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarBookmarkButtonClicked(_:))) .map { _ in () } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `searchBarResultsListButtonClicked`. var resultsListButtonClicked: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarResultsListButtonClicked(_:))) .map { _ in () } return ControlEvent(events: source) } #endif /// Reactive wrapper for delegate method `searchBarSearchButtonClicked`. var searchButtonClicked: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarSearchButtonClicked(_:))) .map { _ in () } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `searchBarTextDidBeginEditing`. var textDidBeginEditing: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidBeginEditing(_:))) .map { _ in () } return ControlEvent(events: source) } /// Reactive wrapper for delegate method `searchBarTextDidEndEditing`. var textDidEndEditing: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidEndEditing(_:))) .map { _ in () } 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. func setDelegate(_ delegate: UISearchBarDelegate) -> Disposable { RxSearchBarDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: base) } } #endif ================================================ FILE: RxCocoa/iOS/UISearchController+Rx.swift ================================================ // // UISearchController+Rx.swift // RxCocoa // // Created by Segii Shulga on 3/17/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UISearchController { /// Reactive wrapper for `delegate`. /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxSearchControllerDelegateProxy.proxy(for: base) } /// Reactive wrapper for `delegate` message. var didDismiss: Observable { delegate .methodInvoked(#selector(UISearchControllerDelegate.didDismissSearchController(_:))) .map { _ in } } /// Reactive wrapper for `delegate` message. var didPresent: Observable { delegate .methodInvoked(#selector(UISearchControllerDelegate.didPresentSearchController(_:))) .map { _ in } } /// Reactive wrapper for `delegate` message. var present: Observable { delegate .methodInvoked(#selector(UISearchControllerDelegate.presentSearchController(_:))) .map { _ in } } /// Reactive wrapper for `delegate` message. var willDismiss: Observable { delegate .methodInvoked(#selector(UISearchControllerDelegate.willDismissSearchController(_:))) .map { _ in } } /// Reactive wrapper for `delegate` message. var willPresent: Observable { delegate .methodInvoked(#selector(UISearchControllerDelegate.willPresentSearchController(_:))) .map { _ in } } } #endif ================================================ FILE: RxCocoa/iOS/UISegmentedControl+Rx.swift ================================================ // // 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) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UISegmentedControl { /// Reactive wrapper for `selectedSegmentIndex` property. var selectedSegmentIndex: ControlProperty { value } /// Reactive wrapper for `selectedSegmentIndex` property. var value: ControlProperty { base.rx.controlPropertyWithDefaultEvents( getter: { segmentedControl in segmentedControl.selectedSegmentIndex }, setter: { segmentedControl, value in segmentedControl.selectedSegmentIndex = value } ) } /// Reactive wrapper for `setEnabled(_:forSegmentAt:)` func enabledForSegment(at index: Int) -> Binder { Binder(base) { segmentedControl, segmentEnabled in segmentedControl.setEnabled(segmentEnabled, forSegmentAt: index) } } /// Reactive wrapper for `setTitle(_:forSegmentAt:)` func titleForSegment(at index: Int) -> Binder { Binder(base) { segmentedControl, title in segmentedControl.setTitle(title, forSegmentAt: index) } } /// Reactive wrapper for `setImage(_:forSegmentAt:)` func imageForSegment(at index: Int) -> Binder { Binder(base) { segmentedControl, image in segmentedControl.setImage(image, forSegmentAt: index) } } } #endif ================================================ FILE: RxCocoa/iOS/UISlider+Rx.swift ================================================ // // UISlider+Rx.swift // RxCocoa // // Created by Alexander van der Werff on 28/05/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UISlider { /// Reactive wrapper for `value` property. var value: ControlProperty { base.rx.controlPropertyWithDefaultEvents( getter: { slider in slider.value }, setter: { slider, value in slider.value = value } ) } } #endif ================================================ FILE: RxCocoa/iOS/UIStepper+Rx.swift ================================================ // // UIStepper+Rx.swift // RxCocoa // // Created by Yuta ToKoRo on 9/1/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UIStepper { /// Reactive wrapper for `value` property. var value: ControlProperty { base.rx.controlPropertyWithDefaultEvents( getter: { stepper in stepper.value }, setter: { stepper, value in stepper.value = value } ) } } #endif ================================================ FILE: RxCocoa/iOS/UISwitch+Rx.swift ================================================ // // UISwitch+Rx.swift // RxCocoa // // Created by Carlos García on 8/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UISwitch { /// Reactive wrapper for `isOn` property. var isOn: ControlProperty { 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`. var value: ControlProperty { base.rx.controlPropertyWithDefaultEvents( getter: { uiSwitch in uiSwitch.isOn }, setter: { uiSwitch, value in uiSwitch.isOn = value } ) } } #endif ================================================ FILE: RxCocoa/iOS/UITabBar+Rx.swift ================================================ // // 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 RxSwift import UIKit /** iOS only */ #if os(iOS) public extension Reactive where Base: UITabBar { /// Reactive wrapper for `delegate` message `tabBar(_:willBeginCustomizing:)`. var willBeginCustomizing: ControlEvent<[UITabBarItem]> { let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:willBeginCustomizing:))) .map { a in try castOrThrow([UITabBarItem].self, a[1]) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `tabBar(_:didBeginCustomizing:)`. var didBeginCustomizing: ControlEvent<[UITabBarItem]> { let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didBeginCustomizing:))) .map { a in try castOrThrow([UITabBarItem].self, a[1]) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `tabBar(_:willEndCustomizing:changed:)`. 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:)`. 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 */ public extension Reactive where Base: UITabBar { /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxTabBarDelegateProxy.proxy(for: base) } /// Reactive wrapper for `delegate` message `tabBar(_:didSelect:)`. var didSelectItem: ControlEvent { let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didSelect:))) .map { a in try castOrThrow(UITabBarItem.self, a[1]) } return ControlEvent(events: source) } } #endif ================================================ FILE: RxCocoa/iOS/UITabBarController+Rx.swift ================================================ // // 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 RxSwift import UIKit /** iOS only */ #if os(iOS) public extension Reactive where Base: UITabBarController { /// Reactive wrapper for `delegate` message `tabBarController:willBeginCustomizing:`. var willBeginCustomizing: ControlEvent<[UIViewController]> { let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:willBeginCustomizing:))) .map { a in try castOrThrow([UIViewController].self, a[1]) } return ControlEvent(events: source) } /// Reactive wrapper for `delegate` message `tabBarController:willEndCustomizing:changed:`. 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:`. 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 */ public extension Reactive where Base: UITabBarController { /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxTabBarControllerDelegateProxy.proxy(for: base) } /// Reactive wrapper for `delegate` message `tabBarController:didSelect:`. var didSelect: ControlEvent { let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:didSelect:))) .map { a in try castOrThrow(UIViewController.self, a[1]) } return ControlEvent(events: source) } } #endif ================================================ FILE: RxCocoa/iOS/UITableView+Rx.swift ================================================ // // UITableView+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 4/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit // Items public 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) */ func items (_ source: Source) -> (_ cellFactory: @escaping (UITableView, Int, Sequence.Element) -> UITableViewCell) -> Disposable where Source.Element == Sequence { { 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) */ func items (cellIdentifier: String, cellType _: Cell.Type = Cell.self) -> (_ source: Source) -> (_ configureCell: @escaping (Int, Sequence.Element, Cell) -> Void) -> Disposable where Source.Element == Sequence { { source in { 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. */ func items< DataSource: RxTableViewDataSourceType & UITableViewDataSource, Source: ObservableType > (dataSource: DataSource) -> (_ source: Source) -> Disposable where DataSource.Element == Source.Element { { source in // This is called for side effects 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) in guard let tableView else { return } dataSource.tableView(tableView, observedEvent: event) } } } } public extension Reactive where Base: UITableView { /** Reactive wrapper for `dataSource`. For more information take a look at `DelegateProxyType` protocol documentation. */ var dataSource: DelegateProxy { 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. */ func setDataSource(_ dataSource: UITableViewDataSource) -> Disposable { RxTableViewDataSourceProxy.installForwardDelegate(dataSource, retainDelegate: false, onProxyForObject: base) } // events /** Reactive wrapper for `delegate` message `tableView:didSelectRowAtIndexPath:`. */ var itemSelected: ControlEvent { let source = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didSelectRowAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:didDeselectRowAtIndexPath:`. */ var itemDeselected: ControlEvent { let source = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didDeselectRowAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:didHighlightRowAt:`. */ var itemHighlighted: ControlEvent { let source = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didHighlightRowAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:didUnhighlightRowAt:`. */ var itemUnhighlighted: ControlEvent { let source = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didUnhighlightRowAt:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:accessoryButtonTappedForRowWithIndexPath:`. */ var itemAccessoryButtonTapped: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:accessoryButtonTappedForRowWith:))) .map { a in try castOrThrow(IndexPath.self, a[1]) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`. */ var itemInserted: ControlEvent { let source = dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:commit:forRowAt:))) .filter { a in try UITableViewCell.EditingStyle(rawValue: castOrThrow(NSNumber.self, a[1]).intValue) == .insert } .map { a in try (castOrThrow(IndexPath.self, a[2])) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`. */ var itemDeleted: ControlEvent { let source = dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:commit:forRowAt:))) .filter { a in try UITableViewCell.EditingStyle(rawValue: castOrThrow(NSNumber.self, a[1]).intValue) == .delete } .map { a in try castOrThrow(IndexPath.self, a[2]) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:moveRowAtIndexPath:toIndexPath:`. */ var itemMoved: ControlEvent { let source: Observable = dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:moveRowAt:to:))) .map { a in try (castOrThrow(IndexPath.self, a[1]), castOrThrow(IndexPath.self, a[2])) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:willDisplayCell:forRowAtIndexPath:`. */ var willDisplayCell: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:willDisplay:forRowAt:))) .map { a in try (castOrThrow(UITableViewCell.self, a[1]), castOrThrow(IndexPath.self, a[2])) } return ControlEvent(events: source) } /** Reactive wrapper for `delegate` message `tableView:didEndDisplayingCell:forRowAtIndexPath:`. */ var didEndDisplayingCell: ControlEvent { let source: Observable = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didEndDisplaying:forRowAt:))) .map { a in try (castOrThrow(UITableViewCell.self, a[1]), 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 { ... ``` */ func modelSelected(_: T.Type) -> ControlEvent { let source: Observable = itemSelected.flatMap { [weak view = self.base as UITableView] indexPath -> Observable in guard let view else { return Observable.empty() } return try Observable.just(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 { ... ``` */ func modelDeselected(_: T.Type) -> ControlEvent { let source: Observable = itemDeselected.flatMap { [weak view = self.base as UITableView] indexPath -> Observable in guard let view else { return Observable.empty() } return try Observable.just(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 { ... ``` */ func modelDeleted(_: T.Type) -> ControlEvent { let source: Observable = itemDeleted.flatMap { [weak view = self.base as UITableView] indexPath -> Observable in guard let view else { return Observable.empty() } return try Observable.just(view.rx.model(at: indexPath)) } return ControlEvent(events: source) } /** Synchronous helper method for retrieving a model at indexPath through a reactive data source. */ func model(at indexPath: IndexPath) throws -> T { let dataSource: SectionedViewDataSourceType = castOrFatalError(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) } } @available(iOS 10.0, tvOS 10.0, *) public extension Reactive where Base: UITableView { /// Reactive wrapper for `prefetchDataSource`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var prefetchDataSource: DelegateProxy { RxTableViewDataSourcePrefetchingProxy.proxy(for: base) } /** Installs prefetch data source as forwarding delegate on `rx.prefetchDataSource`. Prefetch data source won't be retained. It enables using normal delegate mechanism with reactive delegate mechanism. - parameter prefetchDataSource: Prefetch data source object. - returns: Disposable object that can be used to unbind the data source. */ func setPrefetchDataSource(_ prefetchDataSource: UITableViewDataSourcePrefetching) -> Disposable { RxTableViewDataSourcePrefetchingProxy.installForwardDelegate(prefetchDataSource, retainDelegate: false, onProxyForObject: base) } /// Reactive wrapper for `prefetchDataSource` message `tableView(_:prefetchRowsAt:)`. var prefetchRows: ControlEvent<[IndexPath]> { let source = RxTableViewDataSourcePrefetchingProxy.proxy(for: base).prefetchRowsPublishSubject return ControlEvent(events: source) } /// Reactive wrapper for `prefetchDataSource` message `tableView(_:cancelPrefetchingForRowsAt:)`. var cancelPrefetchingForRows: ControlEvent<[IndexPath]> { let source = prefetchDataSource.methodInvoked(#selector(UITableViewDataSourcePrefetching.tableView(_:cancelPrefetchingForRowsAt:))) .map { a in try castOrThrow([IndexPath].self, a[1]) } return ControlEvent(events: source) } } #endif #if os(tvOS) public extension Reactive where Base: UITableView { /** Reactive wrapper for `delegate` message `tableView:didUpdateFocusInContext:withAnimationCoordinator:`. */ 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 ================================================ FILE: RxCocoa/iOS/UITextField+Rx.swift ================================================ // // UITextField+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UITextField { /// Reactive wrapper for `text` property. var text: ControlProperty { value } /// Reactive wrapper for `text` property. var value: ControlProperty { 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 important for proper input // when IME input method is used. if textField.text != value { textField.text = value } } ) } /// Bindable sink for `attributedText` property. var attributedText: ControlProperty { 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 important for proper input // when IME input method is used. if textField.attributedText != value { textField.attributedText = value } } ) } } #endif ================================================ FILE: RxCocoa/iOS/UITextView+Rx.swift ================================================ // // UITextView+Rx.swift // RxCocoa // // Created by Yuta ToKoRo on 7/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) || os(visionOS) import RxSwift import UIKit public extension Reactive where Base: UITextView { /// Reactive wrapper for `text` property var text: ControlProperty { value } /// Reactive wrapper for `text` property. 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. .observe(on: MainScheduler.asyncInstance) .map { _ in textView?.textStorage.string } ?? Observable.empty() return textChanged .startWith(text) } let bindingObserver = Binder(base) { (textView, text: String?) in // This check is important because setting text value always clears control state // including marked text selection which is important 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. 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. .observe(on: MainScheduler.asyncInstance) .map { _ in textView?.attributedText } ?? Observable.empty() return textChanged .startWith(attributedText) } let bindingObserver = Binder(base) { (textView, attributedText: NSAttributedString?) in // This check is important because setting text value always clears control state // including marked text selection which is important 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. var didBeginEditing: ControlEvent { ControlEvent(events: delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidBeginEditing(_:))) .map { _ in () }) } /// Reactive wrapper for `delegate` message. var didEndEditing: ControlEvent { ControlEvent(events: delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidEndEditing(_:))) .map { _ in () }) } /// Reactive wrapper for `delegate` message. var didChange: ControlEvent { ControlEvent(events: delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidChange(_:))) .map { _ in () }) } /// Reactive wrapper for `delegate` message. var didChangeSelection: ControlEvent { ControlEvent(events: delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidChangeSelection(_:))) .map { _ in () }) } } #endif ================================================ FILE: RxCocoa/iOS/WKWebView+Rx.swift ================================================ // // WKWebView+Rx.swift // RxCocoa // // Created by Giuseppe Lanza on 14/02/2020. // Copyright © 2020 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(macOS) import RxSwift import WebKit @available(iOS 8.0, macOS 10.10, macOSApplicationExtension 10.10, *) public extension Reactive where Base: WKWebView { /// Reactive wrapper for `navigationDelegate`. /// For more information take a look at `DelegateProxyType` protocol documentation. var navigationDelegate: DelegateProxy { RxWKNavigationDelegateProxy.proxy(for: base) } /// Reactive wrapper for `navigationDelegate` message. var didCommit: Observable { navigationDelegate .methodInvoked(#selector(WKNavigationDelegate.webView(_:didCommit:))) .map { a in try castOrThrow(WKNavigation.self, a[1]) } } /// Reactive wrapper for `navigationDelegate` message. var didStartLoad: Observable { navigationDelegate .methodInvoked(#selector(WKNavigationDelegate.webView(_:didStartProvisionalNavigation:))) .map { a in try castOrThrow(WKNavigation.self, a[1]) } } /// Reactive wrapper for `navigationDelegate` message. var didFinishLoad: Observable { navigationDelegate .methodInvoked(#selector(WKNavigationDelegate.webView(_:didFinish:))) .map { a in try castOrThrow(WKNavigation.self, a[1]) } } /// Reactive wrapper for `navigationDelegate` message. var didFailLoad: Observable<(WKNavigation, Error)> { navigationDelegate .methodInvoked(#selector(WKNavigationDelegate.webView(_:didFail:withError:))) .map { a in try ( castOrThrow(WKNavigation.self, a[1]), castOrThrow(Error.self, a[2]) ) } } } #endif ================================================ FILE: RxCocoa/macOS/NSButton+Rx.swift ================================================ // // NSButton+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 5/17/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(macOS) import Cocoa import RxSwift public extension Reactive where Base: NSButton { /// Reactive wrapper for control event. var tap: ControlEvent { controlEvent } /// Reactive wrapper for `state` property`. var state: ControlProperty { base.rx.controlProperty( getter: { control in control.state }, setter: { (control: NSButton, state: NSControl.StateValue) in control.state = state } ) } } #endif ================================================ FILE: RxCocoa/macOS/NSControl+Rx.swift ================================================ // // NSControl+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 5/31/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(macOS) import Cocoa import RxSwift private var rx_value_key: UInt8 = 0 private var rx_control_events_key: UInt8 = 0 public extension Reactive where Base: NSControl { /// Reactive wrapper for control event. var controlEvent: ControlEvent { MainScheduler.ensureRunningOnMainThread() let source = lazyInstanceObservable(&rx_control_events_key) { () -> Observable in Observable.create { [weak control = self.base] observer in MainScheduler.ensureRunningOnMainThread() guard let control else { observer.on(.completed) return Disposables.create() } let observer = ControlTarget(control: control) { _ in observer.on(.next(())) } return observer } .take(until: self.deallocated) .share() } return ControlEvent(events: source) } /// Creates a `ControlProperty` that is triggered by target/action pattern value updates. /// /// - parameter getter: Property value getter. /// - parameter setter: Property value setter. func controlProperty( getter: @escaping (Base) -> T, setter: @escaping (Base, T) -> Void ) -> ControlProperty { MainScheduler.ensureRunningOnMainThread() let source = base.rx.lazyInstanceObservable(&rx_value_key) { () -> Observable in return Observable.create { [weak weakControl = self.base] (observer: AnyObserver) in guard let control = weakControl else { observer.on(.completed) return Disposables.create() } observer.on(.next(())) let observer = ControlTarget(control: control) { _ in if weakControl != nil { observer.on(.next(())) } } return observer } .take(until: self.deallocated) .share(replay: 1, scope: .whileConnected) } .flatMap { [weak base] _ -> Observable in guard let control = base else { return Observable.empty() } return Observable.just(getter(control)) } let bindingObserver = Binder(base, binding: setter) return ControlProperty(values: source, valueSink: bindingObserver) } } #endif ================================================ FILE: RxCocoa/macOS/NSSlider+Rx.swift ================================================ // // NSSlider+Rx.swift // RxCocoa // // Created by Junior B. on 24/05/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(macOS) import Cocoa import RxSwift public extension Reactive where Base: NSSlider { /// Reactive wrapper for `value` property. var value: ControlProperty { base.rx.controlProperty( getter: { control -> Double in return control.doubleValue }, setter: { control, value in control.doubleValue = value } ) } } #endif ================================================ FILE: RxCocoa/macOS/NSTextField+Rx.swift ================================================ // // NSTextField+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 5/17/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(macOS) import Cocoa import RxSwift /// Delegate proxy for `NSTextField`. /// /// For more information take a look at `DelegateProxyType`. open class RxTextFieldDelegateProxy: DelegateProxy, DelegateProxyType, NSTextFieldDelegate { /// Typed parent object. public private(set) weak var textField: NSTextField? /// Initializes `RxTextFieldDelegateProxy` /// /// - parameter textField: Parent object for delegate proxy. init(textField: NSTextField) { self.textField = textField super.init(parentObject: textField, delegateProxy: RxTextFieldDelegateProxy.self) } public static func registerKnownImplementations() { register { RxTextFieldDelegateProxy(textField: $0) } } fileprivate let textSubject = PublishSubject() // MARK: Delegate methods open func controlTextDidChange(_ notification: Notification) { let textField: NSTextField = castOrFatalError(notification.object) let nextValue = textField.stringValue textSubject.on(.next(nextValue)) _forwardToDelegate?.controlTextDidChange?(notification) } // MARK: Delegate proxy methods /// For more information take a look at `DelegateProxyType`. open class func currentDelegate(for object: ParentObject) -> NSTextFieldDelegate? { object.delegate } /// For more information take a look at `DelegateProxyType`. open class func setCurrentDelegate(_ delegate: NSTextFieldDelegate?, to object: ParentObject) { object.delegate = delegate } } public extension Reactive where Base: NSTextField { /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxTextFieldDelegateProxy.proxy(for: base) } /// Reactive wrapper for `text` property. var text: ControlProperty { let delegate = RxTextFieldDelegateProxy.proxy(for: base) let source = Observable.deferred { [weak textField = self.base] in delegate.textSubject.startWith(textField?.stringValue) }.take(until: deallocated) let observer = Binder(base) { (control, value: String?) in control.stringValue = value ?? "" } return ControlProperty(values: source, valueSink: observer.asObserver()) } } #endif ================================================ FILE: RxCocoa/macOS/NSTextView+Rx.swift ================================================ // // NSTextView+Rx.swift // RxCocoa // // Created by Cee on 8/5/18. // Copyright © 2018 Krunoslav Zaher. All rights reserved. // #if os(macOS) import Cocoa import RxSwift /// Delegate proxy for `NSTextView`. /// /// For more information take a look at `DelegateProxyType`. open class RxTextViewDelegateProxy: DelegateProxy, DelegateProxyType, NSTextViewDelegate { #if compiler(>=5.2) /// Typed parent object. /// /// - note: Since Swift 5.2 and Xcode 11.4, Apple have suddenly /// disallowed using `weak` for NSTextView. For more details /// see this GitHub Issue: https://git.io/JvSRn public private(set) var textView: NSTextView? #else /// Typed parent object. public private(set) weak var textView: NSTextView? #endif /// Initializes `RxTextViewDelegateProxy` /// /// - parameter textView: Parent object for delegate proxy. init(textView: NSTextView) { self.textView = textView super.init(parentObject: textView, delegateProxy: RxTextViewDelegateProxy.self) } public static func registerKnownImplementations() { register { RxTextViewDelegateProxy(textView: $0) } } fileprivate let textSubject = PublishSubject() // MARK: Delegate methods open func textDidChange(_ notification: Notification) { let textView: NSTextView = castOrFatalError(notification.object) let nextValue = textView.string textSubject.on(.next(nextValue)) _forwardToDelegate?.textDidChange?(notification) } // MARK: Delegate proxy methods /// For more information take a look at `DelegateProxyType`. open class func currentDelegate(for object: ParentObject) -> NSTextViewDelegate? { object.delegate } /// For more information take a look at `DelegateProxyType`. open class func setCurrentDelegate(_ delegate: NSTextViewDelegate?, to object: ParentObject) { object.delegate = delegate } } public extension Reactive where Base: NSTextView { /// Reactive wrapper for `delegate`. /// /// For more information take a look at `DelegateProxyType` protocol documentation. var delegate: DelegateProxy { RxTextViewDelegateProxy.proxy(for: base) } /// Reactive wrapper for `string` property. var string: ControlProperty { let delegate = RxTextViewDelegateProxy.proxy(for: base) let source = Observable.deferred { [weak textView = self.base] in delegate.textSubject.startWith(textView?.string ?? "") }.take(until: deallocated) let observer = Binder(base) { control, value in control.string = value } return ControlProperty(values: source, valueSink: observer.asObserver()) } } #endif ================================================ FILE: RxCocoa/macOS/NSView+Rx.swift ================================================ // // NSView+Rx.swift // RxCocoa // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(macOS) import Cocoa import RxSwift public extension Reactive where Base: NSView { /// Bindable sink for `alphaValue` property. var alpha: Binder { Binder(base) { view, value in view.alphaValue = value } } } #endif ================================================ FILE: RxExample/Extensions/CLLocationManager+Rx.swift ================================================ // // CLLocationManager+Rx.swift // RxExample // // Created by Carlos García on 8/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import CoreLocation import RxCocoa import RxSwift public extension Reactive where Base: CLLocationManager { /** Reactive wrapper for `delegate`. For more information take a look at `DelegateProxyType` protocol documentation. */ var delegate: DelegateProxy { RxCLLocationManagerDelegateProxy.proxy(for: base) } // MARK: Responding to Location Events /** Reactive wrapper for `delegate` message. */ var didUpdateLocations: Observable<[CLLocation]> { RxCLLocationManagerDelegateProxy.proxy(for: base).didUpdateLocationsSubject.asObservable() } /** Reactive wrapper for `delegate` message. */ var didFailWithError: Observable { RxCLLocationManagerDelegateProxy.proxy(for: base).didFailWithErrorSubject.asObservable() } #if os(iOS) || os(macOS) /** Reactive wrapper for `delegate` message. */ var didFinishDeferredUpdatesWithError: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didFinishDeferredUpdatesWithError:))) .map { a in try castOptionalOrThrow(Error.self, a[1]) } } #endif #if os(iOS) // MARK: Pausing Location Updates /** Reactive wrapper for `delegate` message. */ var didPauseLocationUpdates: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManagerDidPauseLocationUpdates(_:))) .map { _ in () } } /** Reactive wrapper for `delegate` message. */ var didResumeLocationUpdates: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManagerDidResumeLocationUpdates(_:))) .map { _ in () } } // MARK: Responding to Heading Events /** Reactive wrapper for `delegate` message. */ var didUpdateHeading: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didUpdateHeading:))) .map { a in try castOrThrow(CLHeading.self, a[1]) } } // MARK: Responding to Region Events /** Reactive wrapper for `delegate` message. */ var didEnterRegion: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didEnterRegion:))) .map { a in try castOrThrow(CLRegion.self, a[1]) } } /** Reactive wrapper for `delegate` message. */ var didExitRegion: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didExitRegion:))) .map { a in try castOrThrow(CLRegion.self, a[1]) } } #endif #if os(iOS) || os(macOS) /** Reactive wrapper for `delegate` message. */ @available(macOS 10.10, *) var didDetermineStateForRegion: Observable<(state: CLRegionState, region: CLRegion)> { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didDetermineState:for:))) .map { a in let stateNumber = try castOrThrow(NSNumber.self, a[1]) let state = CLRegionState(rawValue: stateNumber.intValue) ?? CLRegionState.unknown let region = try castOrThrow(CLRegion.self, a[2]) return (state: state, region: region) } } /** Reactive wrapper for `delegate` message. */ var monitoringDidFailForRegionWithError: Observable<(region: CLRegion?, error: Error)> { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:monitoringDidFailFor:withError:))) .map { a in let region = try castOptionalOrThrow(CLRegion.self, a[1]) let error = try castOrThrow(Error.self, a[2]) return (region: region, error: error) } } /** Reactive wrapper for `delegate` message. */ var didStartMonitoringForRegion: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didStartMonitoringFor:))) .map { a in try castOrThrow(CLRegion.self, a[1]) } } #endif #if os(iOS) // MARK: Responding to Ranging Events /** Reactive wrapper for `delegate` message. */ var didRangeBeaconsInRegion: Observable<(beacons: [CLBeacon], region: CLBeaconRegion)> { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didRangeBeacons:in:))) .map { a in let beacons = try castOrThrow([CLBeacon].self, a[1]) let region = try castOrThrow(CLBeaconRegion.self, a[2]) return (beacons: beacons, region: region) } } /** Reactive wrapper for `delegate` message. */ var rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion, error: Error)> { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:rangingBeaconsDidFailFor:withError:))) .map { a in let region = try castOrThrow(CLBeaconRegion.self, a[1]) let error = try castOrThrow(Error.self, a[2]) return (region: region, error: error) } } // MARK: Responding to Visit Events /** Reactive wrapper for `delegate` message. */ @available(iOS 8.0, *) var didVisit: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didVisit:))) .map { a in try castOrThrow(CLVisit.self, a[1]) } } #endif // MARK: Responding to Authorization Changes /** Reactive wrapper for `delegate` message. */ var didChangeAuthorizationStatus: Observable { delegate.methodInvoked(#selector(CLLocationManagerDelegate.locationManager(_:didChangeAuthorization:))) .map { a in let number = try castOrThrow(NSNumber.self, a[1]) return CLAuthorizationStatus(rawValue: Int32(number.intValue)) ?? .notDetermined } } } private 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 } private func castOptionalOrThrow(_ resultType: T.Type, _ object: Any) throws -> T? { if NSNull().isEqual(object) { return nil } guard let returnValue = object as? T else { throw RxCocoaError.castingError(object: object, targetType: resultType) } return returnValue } ================================================ FILE: RxExample/Extensions/RxCLLocationManagerDelegateProxy.swift ================================================ // // RxCLLocationManagerDelegateProxy.swift // RxExample // // Created by Carlos García on 8/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import CoreLocation import RxCocoa import RxSwift extension CLLocationManager: @retroactive HasDelegate { public typealias Delegate = CLLocationManagerDelegate } public class RxCLLocationManagerDelegateProxy: DelegateProxy, DelegateProxyType, CLLocationManagerDelegate { public init(locationManager: CLLocationManager) { super.init(parentObject: locationManager, delegateProxy: RxCLLocationManagerDelegateProxy.self) } public static func registerKnownImplementations() { register { RxCLLocationManagerDelegateProxy(locationManager: $0) } } lazy var didUpdateLocationsSubject = PublishSubject<[CLLocation]>() lazy var didFailWithErrorSubject = PublishSubject() public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { _forwardToDelegate?.locationManager?(manager, didUpdateLocations: locations) didUpdateLocationsSubject.onNext(locations) } public func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { _forwardToDelegate?.locationManager?(manager, didFailWithError: error) didFailWithErrorSubject.onNext(error) } deinit { self.didUpdateLocationsSubject.on(.completed) self.didFailWithErrorSubject.on(.completed) } } ================================================ FILE: RxExample/Extensions/RxImagePickerDelegateProxy.swift ================================================ // // RxImagePickerDelegateProxy.swift // RxExample // // Created by Segii Shulga on 1/4/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) import RxCocoa import RxSwift import UIKit open class RxImagePickerDelegateProxy: RxNavigationControllerDelegateProxy, UIImagePickerControllerDelegate { public init(imagePicker: UIImagePickerController) { super.init(navigationController: imagePicker) } } #endif ================================================ FILE: RxExample/Extensions/UIImagePickerController+Rx.swift ================================================ // // UIImagePickerController+Rx.swift // RxExample // // Created by Segii Shulga on 1/4/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) import RxCocoa import RxSwift import UIKit public extension Reactive where Base: UIImagePickerController { /** Reactive wrapper for `delegate` message. */ var didFinishPickingMediaWithInfo: Observable<[UIImagePickerController.InfoKey: AnyObject]> { delegate .methodInvoked(#selector(UIImagePickerControllerDelegate.imagePickerController(_:didFinishPickingMediaWithInfo:))) .map { a in try castOrThrow([UIImagePickerController.InfoKey: AnyObject].self, a[1]) } } /** Reactive wrapper for `delegate` message. */ var didCancel: Observable { delegate .methodInvoked(#selector(UIImagePickerControllerDelegate.imagePickerControllerDidCancel(_:))) .map { _ in () } } } #endif private 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 } ================================================ FILE: RxExample/Playgrounds/Info.plist ================================================ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 1.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright Copyright © 2019 Krunoslav Zaher. All rights reserved. ================================================ FILE: RxExample/Playgrounds/RxPlaygrounds.swift ================================================ // // RxPlaygrounds.swift // RxExample // // Created by Shai Mishali on 20/04/2019. // Copyright © 2019 Krunoslav Zaher. All rights reserved. // @_exported import RxSwift // @_exported import RxCocoa // Also imports RxRelay // @_exported import RxTest // @_exported import RxBlocking ================================================ FILE: RxExample/RxDataSources/Differentiator/AnimatableSectionModel.swift ================================================ // // AnimatableSectionModel.swift // RxDataSources // // Created by Krunoslav Zaher on 1/10/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation public struct AnimatableSectionModel { public var model: Section public var items: [Item] public init(model: Section, items: [ItemType]) { self.model = model self.items = items } } extension AnimatableSectionModel: AnimatableSectionModelType { public typealias Item = ItemType public typealias Identity = Section.Identity public var identity: Section.Identity { model.identity } public init(original: AnimatableSectionModel, items: [Item]) { model = original.model self.items = items } public var hashValue: Int { model.identity.hashValue } } extension AnimatableSectionModel: CustomStringConvertible { public var description: String { "HashableSectionModel(model: \"\(model)\", items: \(items))" } } ================================================ FILE: RxExample/RxDataSources/Differentiator/AnimatableSectionModelType+ItemPath.swift ================================================ // // AnimatableSectionModelType+ItemPath.swift // RxDataSources // // Created by Krunoslav Zaher on 1/9/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation extension Array where Element: AnimatableSectionModelType { subscript(index: ItemPath) -> Element.Item { self[index.sectionIndex].items[index.itemIndex] } } ================================================ FILE: RxExample/RxDataSources/Differentiator/AnimatableSectionModelType.swift ================================================ // // AnimatableSectionModelType.swift // RxDataSources // // Created by Krunoslav Zaher on 1/6/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation public protocol AnimatableSectionModelType: SectionModelType, IdentifiableType where Item: IdentifiableType, Item: Equatable {} ================================================ FILE: RxExample/RxDataSources/Differentiator/Changeset.swift ================================================ // // Changeset.swift // RxDataSources // // Created by Krunoslav Zaher on 5/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public struct Changeset { public typealias Item = Section.Item public let reloadData: Bool public let originalSections: [Section] public let finalSections: [Section] public let insertedSections: [Int] public let deletedSections: [Int] public let movedSections: [(from: Int, to: Int)] public let updatedSections: [Int] public let insertedItems: [ItemPath] public let deletedItems: [ItemPath] public let movedItems: [(from: ItemPath, to: ItemPath)] public let updatedItems: [ItemPath] init( reloadData: Bool = false, originalSections: [Section] = [], finalSections: [Section] = [], insertedSections: [Int] = [], deletedSections: [Int] = [], movedSections: [(from: Int, to: Int)] = [], updatedSections: [Int] = [], insertedItems: [ItemPath] = [], deletedItems: [ItemPath] = [], movedItems: [(from: ItemPath, to: ItemPath)] = [], updatedItems: [ItemPath] = [] ) { self.reloadData = reloadData self.originalSections = originalSections self.finalSections = finalSections self.insertedSections = insertedSections self.deletedSections = deletedSections self.movedSections = movedSections self.updatedSections = updatedSections self.insertedItems = insertedItems self.deletedItems = deletedItems self.movedItems = movedItems self.updatedItems = updatedItems } public static func initialValue(_ sections: [Section]) -> Changeset
{ Changeset
( reloadData: true, finalSections: sections, insertedSections: Array(0 ..< sections.count) as [Int] ) } } extension ItemPath: CustomDebugStringConvertible { public var debugDescription: String { "(\(sectionIndex), \(itemIndex))" } } extension Changeset: CustomDebugStringConvertible { public var debugDescription: String { let serializedSections = "[\n" + finalSections.map { "\($0)" }.joined(separator: ",\n") + "\n]\n" return " >> Final sections" + " \n\(serializedSections)" + (insertedSections.count > 0 || deletedSections.count > 0 || movedSections.count > 0 || updatedSections.count > 0 ? "\nSections:" : "") + (insertedSections.count > 0 ? "\ninsertedSections:\n\t\(insertedSections)" : "") + (deletedSections.count > 0 ? "\ndeletedSections:\n\t\(deletedSections)" : "") + (movedSections.count > 0 ? "\nmovedSections:\n\t\(movedSections)" : "") + (updatedSections.count > 0 ? "\nupdatesSections:\n\t\(updatedSections)" : "") + (insertedItems.count > 0 || deletedItems.count > 0 || movedItems.count > 0 || updatedItems.count > 0 ? "\nItems:" : "") + (insertedItems.count > 0 ? "\ninsertedItems:\n\t\(insertedItems)" : "") + (deletedItems.count > 0 ? "\ndeletedItems:\n\t\(deletedItems)" : "") + (movedItems.count > 0 ? "\nmovedItems:\n\t\(movedItems)" : "") + (updatedItems.count > 0 ? "\nupdatedItems:\n\t\(updatedItems)" : "") } } ================================================ FILE: RxExample/RxDataSources/Differentiator/Diff.swift ================================================ // // Diff.swift // RxDataSources // // Created by Krunoslav Zaher on 6/27/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation private extension AnimatableSectionModelType { init(safeOriginal: Self, safeItems: [Item]) throws { self.init(original: safeOriginal, items: safeItems) if items != safeItems || identity != safeOriginal.identity { throw Diff.Error.invalidInitializerImplementation(section: self, expectedItems: safeItems, expectedIdentifier: safeOriginal.identity) } } } public enum Diff { public enum Error: Swift.Error, CustomDebugStringConvertible { case duplicateItem(item: Any) case duplicateSection(section: Any) case invalidInitializerImplementation(section: Any, expectedItems: Any, expectedIdentifier: Any) public var debugDescription: String { switch self { case let .duplicateItem(item): "Duplicate item \(item)" case let .duplicateSection(section): "Duplicate section \(section)" case let .invalidInitializerImplementation(section, expectedItems, expectedIdentifier): "Wrong initializer implementation for: \(section)\n" + "Expected it should return items: \(expectedItems)\n" + "Expected it should have id: \(expectedIdentifier)" } } } private enum EditEvent: CustomDebugStringConvertible { case inserted // can't be found in old sections case insertedAutomatically // Item inside section being inserted case deleted // Was in old, not in new, in it's place is something "not new" :(, otherwise it's Updated case deletedAutomatically // Item inside section that is being deleted case moved // same item, but was on different index, and needs explicit move case movedAutomatically // don't need to specify any changes for those rows case untouched var debugDescription: String { switch self { case .inserted: "Inserted" case .insertedAutomatically: "InsertedAutomatically" case .deleted: "Deleted" case .deletedAutomatically: "DeletedAutomatically" case .moved: "Moved" case .movedAutomatically: "MovedAutomatically" case .untouched: "Untouched" } } } private struct SectionAssociatedData: CustomDebugStringConvertible { var event: EditEvent var indexAfterDelete: Int? var moveIndex: Int? var itemCount: Int var debugDescription: String { "\(event), \(String(describing: indexAfterDelete))" } static var initial: SectionAssociatedData { SectionAssociatedData(event: .untouched, indexAfterDelete: nil, moveIndex: nil, itemCount: 0) } } private struct ItemAssociatedData: CustomDebugStringConvertible { var event: EditEvent var indexAfterDelete: Int? var moveIndex: ItemPath? var debugDescription: String { "\(event) \(String(describing: indexAfterDelete))" } static var initial: ItemAssociatedData { ItemAssociatedData(event: .untouched, indexAfterDelete: nil, moveIndex: nil) } } private static func indexSections(_ sections: [Section]) throws -> [Section.Identity: Int] { var indexedSections: [Section.Identity: Int] = [:] for (i, section) in sections.enumerated() { guard indexedSections[section.identity] == nil else { #if DEBUG if indexedSections[section.identity] != nil { print("Section \(section) has already been indexed at \(indexedSections[section.identity]!)") } #endif throw Error.duplicateSection(section: section) } indexedSections[section.identity] = i } return indexedSections } //================================================================================ // Optimizations because Swift dictionaries are extremely slow (ARC, bridging ...) //================================================================================ // swift dictionary optimizations { private struct OptimizedIdentity: Hashable { func hash(into hasher: inout Hasher) { hasher.combine(hash) } let hash: Int let identity: UnsafePointer init(_ identity: UnsafePointer) { self.identity = identity hash = identity.pointee.hashValue } static func == (lhs: OptimizedIdentity, rhs: OptimizedIdentity) -> Bool { if lhs.hashValue != rhs.hashValue { return false } if lhs.identity.distance(to: rhs.identity) == 0 { return true } return lhs.identity.pointee == rhs.identity.pointee } } private static func calculateAssociatedData( initialItemCache: ContiguousArray>, finalItemCache: ContiguousArray> ) throws -> (ContiguousArray>, ContiguousArray>) { typealias Identity = Item.Identity let totalInitialItems = initialItemCache.map(\.count).reduce(0, +) var initialIdentities: ContiguousArray = ContiguousArray() var initialItemPaths: ContiguousArray = ContiguousArray() initialIdentities.reserveCapacity(totalInitialItems) initialItemPaths.reserveCapacity(totalInitialItems) for (i, items) in initialItemCache.enumerated() { for j in 0 ..< items.count { let item = items[j] initialIdentities.append(item.identity) initialItemPaths.append(ItemPath(sectionIndex: i, itemIndex: j)) } } var initialItemData = ContiguousArray(initialItemCache.map { items in ContiguousArray(repeating: ItemAssociatedData.initial, count: items.count) }) var finalItemData = ContiguousArray(finalItemCache.map { items in ContiguousArray(repeating: ItemAssociatedData.initial, count: items.count) }) try initialIdentities.withUnsafeBufferPointer { (identitiesBuffer: UnsafeBufferPointer) in var dictionary: [OptimizedIdentity: Int] = Dictionary(minimumCapacity: totalInitialItems * 2) for i in 0 ..< initialIdentities.count { let identityPointer = identitiesBuffer.baseAddress!.advanced(by: i) let key = OptimizedIdentity(identityPointer) if let existingValueItemPathIndex = dictionary[key] { let itemPath = initialItemPaths[existingValueItemPathIndex] let item = initialItemCache[itemPath.sectionIndex][itemPath.itemIndex] #if DEBUG print("Item \(item) has already been indexed at \(itemPath)") #endif throw Error.duplicateItem(item: item) } dictionary[key] = i } for (i, items) in finalItemCache.enumerated() { for j in 0 ..< items.count { let item = items[j] var identity = item.identity let key = OptimizedIdentity(&identity) guard let initialItemPathIndex = dictionary[key] else { continue } let itemPath = initialItemPaths[initialItemPathIndex] if initialItemData[itemPath.sectionIndex][itemPath.itemIndex].moveIndex != nil { throw Error.duplicateItem(item: item) } initialItemData[itemPath.sectionIndex][itemPath.itemIndex].moveIndex = ItemPath(sectionIndex: i, itemIndex: j) finalItemData[i][j].moveIndex = itemPath } } return () } return (initialItemData, finalItemData) } // } swift dictionary optimizations /* I've uncovered this case during random stress testing of logic. This is the hardest generic update case that causes two passes, first delete, and then move/insert [ NumberSection(model: "1", items: [1111]), NumberSection(model: "2", items: [2222]), ] [ NumberSection(model: "2", items: [0]), NumberSection(model: "1", items: []), ] If update is in the form * Move section from 2 to 1 * Delete Items at paths 0 - 0, 1 - 0 * Insert Items at paths 0 - 0 or * Move section from 2 to 1 * Delete Items at paths 0 - 0 * Reload Items at paths 1 - 0 or * Move section from 2 to 1 * Delete Items at paths 0 - 0 * Reload Items at paths 0 - 0 it crashes table view. No matter what change is performed, it fails for me. If anyone knows how to make this work for one Changeset, PR is welcome. */ // If you are considering working out your own algorithm, these are tricky // transition cases that you can use. // case 1 /* from = [ NumberSection(model: "section 4", items: [10, 11, 12]), NumberSection(model: "section 9", items: [25, 26, 27]), ] to = [ HashableSectionModel(model: "section 9", items: [11, 26, 27]), HashableSectionModel(model: "section 4", items: [10, 12]) ] */ // case 2 /* from = [ HashableSectionModel(model: "section 10", items: [26]), HashableSectionModel(model: "section 7", items: [5, 29]), HashableSectionModel(model: "section 1", items: [14]), HashableSectionModel(model: "section 5", items: [16]), HashableSectionModel(model: "section 4", items: []), HashableSectionModel(model: "section 8", items: [3, 15, 19, 23]), HashableSectionModel(model: "section 3", items: [20]) ] to = [ HashableSectionModel(model: "section 10", items: [26]), HashableSectionModel(model: "section 1", items: [14]), HashableSectionModel(model: "section 9", items: [3]), HashableSectionModel(model: "section 5", items: [16, 8]), HashableSectionModel(model: "section 8", items: [15, 19, 23]), HashableSectionModel(model: "section 3", items: [20]), HashableSectionModel(model: "Section 2", items: [7]) ] */ // case 3 /* from = [ HashableSectionModel(model: "section 4", items: [5]), HashableSectionModel(model: "section 6", items: [20, 14]), HashableSectionModel(model: "section 9", items: []), HashableSectionModel(model: "section 2", items: [2, 26]), HashableSectionModel(model: "section 8", items: [23]), HashableSectionModel(model: "section 10", items: [8, 18, 13]), HashableSectionModel(model: "section 1", items: [28, 25, 6, 11, 10, 29, 24, 7, 19]) ] to = [ HashableSectionModel(model: "section 4", items: [5]), HashableSectionModel(model: "section 6", items: [20, 14]), HashableSectionModel(model: "section 9", items: [16]), HashableSectionModel(model: "section 7", items: [17, 15, 4]), HashableSectionModel(model: "section 2", items: [2, 26, 23]), HashableSectionModel(model: "section 8", items: []), HashableSectionModel(model: "section 10", items: [8, 18, 13]), HashableSectionModel(model: "section 1", items: [28, 25, 6, 11, 10, 29, 24, 7, 19]) ] */ // Generates differential changes suitable for sectioned view consumption. // It will not only detect changes between two states, but it will also try to compress those changes into // almost minimal set of changes. // // I know, I know, it's ugly :( Totally agree, but this is the only general way I could find that works 100%, and // avoids UITableView quirks. // // Please take into consideration that I was also convinced about 20 times that I've found a simple general // solution, but then UITableView falls apart under stress testing :( // // Sincerely, if somebody else would present me this 250 lines of code, I would call him a mad man. I would think // that there has to be a simpler solution. Well, after 3 days, I'm not convinced any more :) // // Maybe it can be made somewhat simpler, but don't think it can be made much simpler. // // The algorithm could take anywhere from 1 to 3 table view transactions to finish the updates. // // * stage 1 - remove deleted sections and items // * stage 2 - move sections into place // * stage 3 - fix moved and new items // // There maybe exists a better division, but time will tell. // public static func differencesForSectionedView( initialSections: [Section], finalSections: [Section] ) throws -> [Changeset
] { typealias Item = Section.Item var result: [Changeset
] = [] var sectionCommands = try CommandGenerator
.generatorForInitialSections(initialSections, finalSections: finalSections) try result.append(contentsOf: sectionCommands.generateDeleteSectionsDeletedItemsAndUpdatedItems()) try result.append(contentsOf: sectionCommands.generateInsertAndMoveSections()) try result.append(contentsOf: sectionCommands.generateInsertAndMovedItems()) return result } private struct CommandGenerator { typealias Item = Section.Item let initialSections: [Section] let finalSections: [Section] let initialSectionData: ContiguousArray let finalSectionData: ContiguousArray let initialItemData: ContiguousArray> let finalItemData: ContiguousArray> let initialItemCache: ContiguousArray> let finalItemCache: ContiguousArray> static func generatorForInitialSections( _ initialSections: [Section], finalSections: [Section] ) throws -> CommandGenerator
{ let (initialSectionData, finalSectionData) = try calculateSectionMovements(initialSections: initialSections, finalSections: finalSections) let initialItemCache = ContiguousArray(initialSections.map { ContiguousArray($0.items) }) let finalItemCache = ContiguousArray(finalSections.map { ContiguousArray($0.items) }) let (initialItemData, finalItemData) = try calculateItemMovements( initialItemCache: initialItemCache, finalItemCache: finalItemCache, initialSectionData: initialSectionData, finalSectionData: finalSectionData ) return CommandGenerator
( initialSections: initialSections, finalSections: finalSections, initialSectionData: initialSectionData, finalSectionData: finalSectionData, initialItemData: initialItemData, finalItemData: finalItemData, initialItemCache: initialItemCache, finalItemCache: finalItemCache ) } static func calculateItemMovements( initialItemCache: ContiguousArray>, finalItemCache: ContiguousArray>, initialSectionData: ContiguousArray, finalSectionData: ContiguousArray ) throws -> (ContiguousArray>, ContiguousArray>) { var (initialItemData, finalItemData) = try Diff.calculateAssociatedData( initialItemCache: initialItemCache, finalItemCache: finalItemCache ) let findNextUntouchedOldIndex = { (initialSectionIndex: Int, initialSearchIndex: Int?) -> Int? in guard var i2 = initialSearchIndex else { return nil } while i2 < initialSectionData[initialSectionIndex].itemCount { if initialItemData[initialSectionIndex][i2].event == .untouched { return i2 } i2 = i2 + 1 } return nil } // first mark deleted items for i in 0 ..< initialItemCache.count { guard let _ = initialSectionData[i].moveIndex else { continue } var indexAfterDelete = 0 for j in 0 ..< initialItemCache[i].count { guard let finalIndexPath = initialItemData[i][j].moveIndex else { initialItemData[i][j].event = .deleted continue } // from this point below, section has to be move type because it's initial and not deleted // because there is no move to inserted section if finalSectionData[finalIndexPath.sectionIndex].event == .inserted { initialItemData[i][j].event = .deleted continue } initialItemData[i][j].indexAfterDelete = indexAfterDelete indexAfterDelete += 1 } } // mark moved or moved automatically for i in 0 ..< finalItemCache.count { guard let originalSectionIndex = finalSectionData[i].moveIndex else { continue } var untouchedIndex: Int? = 0 for j in 0 ..< finalItemCache[i].count { untouchedIndex = findNextUntouchedOldIndex(originalSectionIndex, untouchedIndex) guard let originalIndex = finalItemData[i][j].moveIndex else { finalItemData[i][j].event = .inserted continue } // In case trying to move from deleted section, abort, otherwise it will crash table view if initialSectionData[originalIndex.sectionIndex].event == .deleted { finalItemData[i][j].event = .inserted continue } // original section can't be inserted else if initialSectionData[originalIndex.sectionIndex].event == .inserted { preconditionFailure("New section in initial sections, that is wrong") } let initialSectionEvent = initialSectionData[originalIndex.sectionIndex].event try precondition(initialSectionEvent == .moved || initialSectionEvent == .movedAutomatically, "Section not moved") let eventType = originalIndex == ItemPath(sectionIndex: originalSectionIndex, itemIndex: untouchedIndex ?? -1) ? EditEvent.movedAutomatically : EditEvent.moved initialItemData[originalIndex.sectionIndex][originalIndex.itemIndex].event = eventType finalItemData[i][j].event = eventType } } return (initialItemData, finalItemData) } static func calculateSectionMovements(initialSections: [Section], finalSections: [Section]) throws -> (ContiguousArray, ContiguousArray) { let initialSectionIndexes = try Diff.indexSections(initialSections) var initialSectionData = ContiguousArray(repeating: SectionAssociatedData.initial, count: initialSections.count) var finalSectionData = ContiguousArray(repeating: SectionAssociatedData.initial, count: finalSections.count) for (i, section) in finalSections.enumerated() { finalSectionData[i].itemCount = finalSections[i].items.count guard let initialSectionIndex = initialSectionIndexes[section.identity] else { continue } if initialSectionData[initialSectionIndex].moveIndex != nil { throw Error.duplicateSection(section: section) } initialSectionData[initialSectionIndex].moveIndex = i finalSectionData[i].moveIndex = initialSectionIndex } var sectionIndexAfterDelete = 0 // deleted sections for i in 0 ..< initialSectionData.count { initialSectionData[i].itemCount = initialSections[i].items.count if initialSectionData[i].moveIndex == nil { initialSectionData[i].event = .deleted continue } initialSectionData[i].indexAfterDelete = sectionIndexAfterDelete sectionIndexAfterDelete += 1 } // moved sections var untouchedOldIndex: Int? = 0 let findNextUntouchedOldIndex = { (initialSearchIndex: Int?) -> Int? in guard var i = initialSearchIndex else { return nil } while i < initialSections.count { if initialSectionData[i].event == .untouched { return i } i = i + 1 } return nil } // inserted and moved sections { // this should fix all sections and move them into correct places // 2nd stage for i in 0 ..< finalSections.count { untouchedOldIndex = findNextUntouchedOldIndex(untouchedOldIndex) // oh, it did exist if let oldSectionIndex = finalSectionData[i].moveIndex { let moveType = oldSectionIndex != untouchedOldIndex ? EditEvent.moved : EditEvent.movedAutomatically finalSectionData[i].event = moveType initialSectionData[oldSectionIndex].event = moveType } else { finalSectionData[i].event = .inserted } } // inserted sections for (i, section) in finalSectionData.enumerated() { if section.moveIndex == nil { _ = finalSectionData[i].event == .inserted } } return (initialSectionData, finalSectionData) } mutating func generateDeleteSectionsDeletedItemsAndUpdatedItems() throws -> [Changeset
] { var deletedSections = [Int]() var deletedItems = [ItemPath]() var updatedItems = [ItemPath]() var afterDeleteState = [Section]() // mark deleted items { // 1rst stage again (I know, I know ...) for (i, initialItems) in initialItemCache.enumerated() { let event = initialSectionData[i].event // Deleted section will take care of deleting child items. // In case of moving an item from deleted section, tableview will // crash anyway, so this is not limiting anything. if event == .deleted { deletedSections.append(i) continue } var afterDeleteItems: [Section.Item] = [] for j in 0 ..< initialItems.count { let event = initialItemData[i][j].event switch event { case .deleted: deletedItems.append(ItemPath(sectionIndex: i, itemIndex: j)) case .moved, .movedAutomatically: let finalItemIndex = try initialItemData[i][j].moveIndex.unwrap() let finalItem = finalItemCache[finalItemIndex.sectionIndex][finalItemIndex.itemIndex] if finalItem != initialSections[i].items[j] { updatedItems.append(ItemPath(sectionIndex: i, itemIndex: j)) } afterDeleteItems.append(finalItem) default: preconditionFailure("Unhandled case") } } try afterDeleteState.append(Section(safeOriginal: initialSections[i], safeItems: afterDeleteItems)) } // } if deletedItems.count == 0, deletedSections.count == 0, updatedItems.count == 0 { return [] } return [Changeset( finalSections: afterDeleteState, deletedSections: deletedSections, deletedItems: deletedItems, updatedItems: updatedItems )] } func generateInsertAndMoveSections() throws -> [Changeset
] { var movedSections = [(from: Int, to: Int)]() var insertedSections = [Int]() for i in 0 ..< initialSections.count { switch initialSectionData[i].event { case .deleted: break case .moved: try movedSections.append((from: initialSectionData[i].indexAfterDelete.unwrap(), to: initialSectionData[i].moveIndex.unwrap())) case .movedAutomatically: break default: preconditionFailure("Unhandled case in initial sections") } } for i in 0 ..< finalSections.count { switch finalSectionData[i].event { case .inserted: insertedSections.append(i) default: break } } if insertedSections.count == 0, movedSections.count == 0 { return [] } // sections should be in place, but items should be original without deleted ones let sectionsAfterChange: [Section] = try finalSections.enumerated().map { i, s -> Section in let event = finalSectionData[i].event if event == .inserted { // it's already set up return s } else if event == .moved || event == .movedAutomatically { let originalSectionIndex = try finalSectionData[i].moveIndex.unwrap() let originalSection = initialSections[originalSectionIndex] var items: [Section.Item] = [] items.reserveCapacity(originalSection.items.count) let itemAssociatedData = initialItemData[originalSectionIndex] for j in 0 ..< originalSection.items.count { let initialData = itemAssociatedData[j] guard initialData.event != .deleted else { continue } guard let finalIndex = initialData.moveIndex else { preconditionFailure("Item was moved, but no final location.") continue } items.append(finalItemCache[finalIndex.sectionIndex][finalIndex.itemIndex]) } let modifiedSection = try Section(safeOriginal: s, safeItems: items) return modifiedSection } else { preconditionFailure("This is weird, this shouldn't happen") } } return [Changeset( finalSections: sectionsAfterChange, insertedSections: insertedSections, movedSections: movedSections )] } mutating func generateInsertAndMovedItems() throws -> [Changeset
] { var insertedItems = [ItemPath]() var movedItems = [(from: ItemPath, to: ItemPath)]() // mark new and moved items { // 3rd stage for i in 0 ..< finalSections.count { let finalSection = finalSections[i] let sectionEvent = finalSectionData[i].event // new and deleted sections cause reload automatically if sectionEvent != .moved, sectionEvent != .movedAutomatically { continue } for j in 0 ..< finalSection.items.count { let currentItemEvent = finalItemData[i][j].event try precondition(currentItemEvent != .untouched, "Current event is not untouched") let event = finalItemData[i][j].event switch event { case .inserted: insertedItems.append(ItemPath(sectionIndex: i, itemIndex: j)) case .moved: let originalIndex = try finalItemData[i][j].moveIndex.unwrap() let finalSectionIndex = try initialSectionData[originalIndex.sectionIndex].moveIndex.unwrap() let moveFromItemWithIndex = try initialItemData[originalIndex.sectionIndex][originalIndex.itemIndex].indexAfterDelete.unwrap() let moveCommand = ( from: ItemPath(sectionIndex: finalSectionIndex, itemIndex: moveFromItemWithIndex), to: ItemPath(sectionIndex: i, itemIndex: j) ) movedItems.append(moveCommand) default: break } } } // } if insertedItems.count == 0, movedItems.count == 0 { return [] } return [Changeset( finalSections: finalSections, insertedItems: insertedItems, movedItems: movedItems )] } } } ================================================ FILE: RxExample/RxDataSources/Differentiator/Differentiator.h ================================================ // // Differentiator.h // Differentiator // // Created by muukii on 7/26/17. // Copyright © 2017 kzaher. All rights reserved. // #import //! Project version number for Differentiator. FOUNDATION_EXPORT double DifferentiatorVersionNumber; //! Project version string for Differentiator. FOUNDATION_EXPORT const unsigned char DifferentiatorVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import ================================================ FILE: RxExample/RxDataSources/Differentiator/IdentifiableType.swift ================================================ // // IdentifiableType.swift // RxDataSources // // Created by Krunoslav Zaher on 1/6/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation public protocol IdentifiableType { associatedtype Identity: Hashable var identity: Identity { get } } ================================================ FILE: RxExample/RxDataSources/Differentiator/IdentifiableValue.swift ================================================ // // IdentifiableValue.swift // RxDataSources // // Created by Krunoslav Zaher on 1/7/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation public struct IdentifiableValue { public let value: Value } extension IdentifiableValue: IdentifiableType { public typealias Identity = Value public var identity: Identity { value } } extension IdentifiableValue: Equatable, CustomStringConvertible, CustomDebugStringConvertible { public var description: String { "\(value)" } public var debugDescription: String { "\(value)" } } public func == (lhs: IdentifiableValue, rhs: IdentifiableValue) -> Bool { lhs.value == rhs.value } ================================================ FILE: RxExample/RxDataSources/Differentiator/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 3.0.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: RxExample/RxDataSources/Differentiator/ItemPath.swift ================================================ // // ItemPath.swift // RxDataSources // // Created by Krunoslav Zaher on 1/9/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation public struct ItemPath { public let sectionIndex: Int public let itemIndex: Int public init(sectionIndex: Int, itemIndex: Int) { self.sectionIndex = sectionIndex self.itemIndex = itemIndex } } extension ItemPath: Equatable {} public func == (lhs: ItemPath, rhs: ItemPath) -> Bool { lhs.sectionIndex == rhs.sectionIndex && lhs.itemIndex == rhs.itemIndex } extension ItemPath: Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(sectionIndex.byteSwapped) hasher.combine(itemIndex) } } ================================================ FILE: RxExample/RxDataSources/Differentiator/Optional+Extensions.swift ================================================ // // Optional+Extensions.swift // RxDataSources // // Created by Krunoslav Zaher on 1/8/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation extension Optional { func unwrap() throws -> Wrapped { if let unwrapped = self { return unwrapped } else { debugFatalError("Error during unwrapping optional") throw DifferentiatorError.unwrappingOptional } } } ================================================ FILE: RxExample/RxDataSources/Differentiator/SectionModel.swift ================================================ // // SectionModel.swift // RxDataSources // // Created by Krunoslav Zaher on 6/16/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public struct SectionModel { public var model: Section public var items: [Item] public init(model: Section, items: [Item]) { self.model = model self.items = items } } extension SectionModel: SectionModelType { public typealias Identity = Section public typealias Item = ItemType public var identity: Section { model } } extension SectionModel: CustomStringConvertible { public var description: String { "\(model) > \(items)" } } public extension SectionModel { init(original: SectionModel, items: [Item]) { model = original.model self.items = items } } ================================================ FILE: RxExample/RxDataSources/Differentiator/SectionModelType.swift ================================================ // // SectionModelType.swift // RxDataSources // // Created by Krunoslav Zaher on 6/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public protocol SectionModelType { associatedtype Item var items: [Item] { get } init(original: Self, items: [Item]) } ================================================ FILE: RxExample/RxDataSources/Differentiator/Utilities.swift ================================================ // // Utilities.swift // RxDataSources // // Created by muukii on 8/2/17. // Copyright © 2017 kzaher. All rights reserved. // import Foundation enum DifferentiatorError: Error { case unwrappingOptional case preconditionFailed(message: String) } func precondition(_ condition: Bool, _ message: @autoclosure () -> String) throws { if condition { return } debugFatalError("Precondition failed") throw DifferentiatorError.preconditionFailed(message: message()) } func debugFatalError(_ error: Error) { debugFatalError("\(error)") } func debugFatalError(_ message: String) { #if DEBUG fatalError(message) #else print(message) #endif } ================================================ FILE: RxExample/RxDataSources/README.md ================================================ RxSwift: DataSources ==================== This directory contains example implementations of reactive data sources. Reactive data sources are normal data sources + one additional method **This code has been packed in [RxDataSources](https://github.com/RxSwiftCommunity/RxDataSources) project.** ```swift func view(view: UIXXXView, observedEvent: Event) {} ``` That means that data sources now have additional responsibility of updating the corresponding view. For now this will be a directory in Rx project with a couple of files that you can just copy and customize. It's possible that in the future this will be extracted into separate repository and CocoaPod. It's really hard to satisfy all needs with one codebase regarding these orthogonal dimensions: * how do you determine identity of objects * how to determine the structure of data source * how to determine is object updated * are objects structures or references * are differences between transitions already precalculated in some form (I'm looking at you NSFetchedResultsController) * .... So instead of doing all things mediocre, you can use these couple of lines of code to code up your own optimized solution. The code in this directory includes these features: * using rows or sections as DataSources for UICollectionView or UITableView * unified sectioned view interface * automatic animated partial updates with O(n) complexity (it will generate all updates to sections and items) Example project uses these files to implement partial updates in `Reactive partial updates` example. The only problem regarding partial updates that is not solved perfectly is UICollectionView. Unfortunately UICollectionView has some weird problems with internal state. For same set of changes, depending on clicking speed it will sometimes get out of sync with data source. The changes in example problem are pseudorandom (they always use the same seed), so you will be able to sometimes crash UICollectionView by clicking fast, but it will be ok if you click slow :( The problem isn't in the differential algorithm, but in UICollectionView itself, so not sure how to solve it perfectly. Any suggestions are welcome. UITableView on the other hand passed all stress tests. (You can run stress tests with random changes in example project) ================================================ FILE: RxExample/RxDataSources/RxDataSources/AnimationConfiguration.swift ================================================ // // AnimationConfiguration.swift // RxDataSources // // Created by Esteban Torres on 5/2/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import UIKit /** Exposes custom animation styles for insertion, deletion and reloading behavior. */ public struct AnimationConfiguration { public let insertAnimation: UITableView.RowAnimation public let reloadAnimation: UITableView.RowAnimation public let deleteAnimation: UITableView.RowAnimation public init( insertAnimation: UITableView.RowAnimation = .automatic, reloadAnimation: UITableView.RowAnimation = .automatic, deleteAnimation: UITableView.RowAnimation = .automatic ) { self.insertAnimation = insertAnimation self.reloadAnimation = reloadAnimation self.deleteAnimation = deleteAnimation } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/Array+Extensions.swift ================================================ // // Array+Extensions.swift // RxDataSources // // Created by Krunoslav Zaher on 4/26/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation extension Array where Element: SectionModelType { mutating func moveFromSourceIndexPath(_ sourceIndexPath: IndexPath, destinationIndexPath: IndexPath) { let sourceSection = self[sourceIndexPath.section] var sourceItems = sourceSection.items let sourceItem = sourceItems.remove(at: sourceIndexPath.item) let sourceSectionNew = Element(original: sourceSection, items: sourceItems) self[sourceIndexPath.section] = sourceSectionNew let destinationSection = self[destinationIndexPath.section] var destinationItems = destinationSection.items destinationItems.insert(sourceItem, at: destinationIndexPath.item) self[destinationIndexPath.section] = Element(original: destinationSection, items: destinationItems) } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/CollectionViewSectionedDataSource.swift ================================================ // // CollectionViewSectionedDataSource.swift // RxDataSources // // Created by Krunoslav Zaher on 7/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import RxCocoa import UIKit open class CollectionViewSectionedDataSource: NSObject, UICollectionViewDataSource, SectionedViewDataSourceType { public typealias ConfigureCell = (CollectionViewSectionedDataSource
, UICollectionView, IndexPath, Section.Item) -> UICollectionViewCell public typealias ConfigureSupplementaryView = (CollectionViewSectionedDataSource
, UICollectionView, String, IndexPath) -> UICollectionReusableView public typealias MoveItem = (CollectionViewSectionedDataSource
, _ sourceIndexPath: IndexPath, _ destinationIndexPath: IndexPath) -> Void public typealias CanMoveItemAtIndexPath = (CollectionViewSectionedDataSource
, IndexPath) -> Bool public init( configureCell: @escaping ConfigureCell, configureSupplementaryView: @escaping ConfigureSupplementaryView, moveItem: @escaping MoveItem = { _, _, _ in () }, canMoveItemAtIndexPath: @escaping CanMoveItemAtIndexPath = { _, _ in false } ) { self.configureCell = configureCell self.configureSupplementaryView = configureSupplementaryView self.moveItem = moveItem self.canMoveItemAtIndexPath = canMoveItemAtIndexPath } #if DEBUG // If data source has already been bound, then mutating it // afterwards isn't something desired. // This simulates immutability after binding var _dataSourceBound: Bool = false private func ensureNotMutatedAfterBinding() { assert(!_dataSourceBound, "Data source is already bound. Please write this line before binding call (`bindTo`, `drive`). Data source must first be completely configured, and then bound after that, otherwise there could be runtime bugs, glitches, or partial malfunctions.") } #endif // This structure exists because model can be mutable // In that case current state value should be preserved. // The state that needs to be preserved is ordering of items in section // and their relationship with section. // If particular item is mutable, that is irrelevant for this logic to function // properly. public typealias SectionModelSnapshot = SectionModel private var _sectionModels: [SectionModelSnapshot] = [] open var sectionModels: [Section] { _sectionModels.map { Section(original: $0.model, items: $0.items) } } open subscript(section: Int) -> Section { let sectionModel = _sectionModels[section] return Section(original: sectionModel.model, items: sectionModel.items) } open subscript(indexPath: IndexPath) -> Section.Item { get { _sectionModels[indexPath.section].items[indexPath.item] } set(item) { var section = _sectionModels[indexPath.section] section.items[indexPath.item] = item _sectionModels[indexPath.section] = section } } open func model(at indexPath: IndexPath) throws -> Any { self[indexPath] } open func setSections(_ sections: [Section]) { _sectionModels = sections.map { SectionModelSnapshot(model: $0, items: $0.items) } } open var configureCell: ConfigureCell { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var configureSupplementaryView: ConfigureSupplementaryView { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var moveItem: MoveItem { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var canMoveItemAtIndexPath: ((CollectionViewSectionedDataSource
, IndexPath) -> Bool)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } // UICollectionViewDataSource open func numberOfSections(in _: UICollectionView) -> Int { _sectionModels.count } open func collectionView(_: UICollectionView, numberOfItemsInSection section: Int) -> Int { _sectionModels[section].items.count } open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { precondition(indexPath.item < _sectionModels[indexPath.section].items.count) return configureCell(self, collectionView, indexPath, self[indexPath]) } open func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { configureSupplementaryView(self, collectionView, kind, indexPath) } open func collectionView(_: UICollectionView, canMoveItemAt indexPath: IndexPath) -> Bool { guard let canMoveItem = canMoveItemAtIndexPath?(self, indexPath) else { return false } return canMoveItem } open func collectionView(_: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { _sectionModels.moveFromSourceIndexPath(sourceIndexPath, destinationIndexPath: destinationIndexPath) moveItem(self, sourceIndexPath, destinationIndexPath) } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/DataSources.swift ================================================ // // DataSources.swift // RxDataSources // // Created by Krunoslav Zaher on 1/8/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation enum RxDataSourceError: Error { case preconditionFailed(message: String) } func rxPrecondition(_ condition: Bool, _ message: @autoclosure () -> String) throws { if condition { return } rxDebugFatalError("Precondition failed") throw RxDataSourceError.preconditionFailed(message: message()) } func rxDebugFatalError(_ error: Error) { rxDebugFatalError("\(error)") } func rxDebugFatalError(_ message: String) { #if DEBUG fatalError(message) #else print(message) #endif } ================================================ FILE: RxExample/RxDataSources/RxDataSources/Deprecated.swift ================================================ // // Deprecated.swift // RxDataSources // // Created by Krunoslav Zaher on 10/8/17. // Copyright © 2017 kzaher. All rights reserved. // public extension CollectionViewSectionedDataSource { @available(*, deprecated, renamed: "configureSupplementaryView") var supplementaryViewFactory: ConfigureSupplementaryView { get { configureSupplementaryView } set { configureSupplementaryView = newValue } } } ================================================ FILE: RxExample/RxDataSources/RxDataSources/FloatingPointType+IdentifiableType.swift ================================================ // // FloatingPointType+IdentifiableType.swift // RxDataSources // // Created by Krunoslav Zaher on 7/4/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation extension FloatingPoint { typealias identity = Self public var identity: Self { self } } extension Float: IdentifiableType {} extension Double: IdentifiableType {} ================================================ FILE: RxExample/RxDataSources/RxDataSources/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 3.0.0 CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: RxExample/RxDataSources/RxDataSources/IntegerType+IdentifiableType.swift ================================================ // // IntegerType+IdentifiableType.swift // RxDataSources // // Created by Krunoslav Zaher on 7/4/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation extension BinaryInteger { typealias identity = Self public var identity: Self { self } } extension Int: IdentifiableType {} extension Int8: IdentifiableType {} extension Int16: IdentifiableType {} extension Int32: IdentifiableType {} extension Int64: IdentifiableType {} extension UInt: IdentifiableType {} extension UInt8: IdentifiableType {} extension UInt16: IdentifiableType {} extension UInt32: IdentifiableType {} extension UInt64: IdentifiableType {} ================================================ FILE: RxExample/RxDataSources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift ================================================ // // RxCollectionViewSectionedAnimatedDataSource.swift // RxExample // // Created by Krunoslav Zaher on 7/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import RxCocoa import RxSwift import UIKit /* This is commented because collection view has bugs when doing animated updates. Take a look at randomized sections. */ open class RxCollectionViewSectionedAnimatedDataSource: CollectionViewSectionedDataSource
, RxCollectionViewDataSourceType { public typealias Element = [Section] // animation configuration public var animationConfiguration: AnimationConfiguration public init( animationConfiguration: AnimationConfiguration = AnimationConfiguration(), configureCell: @escaping ConfigureCell, configureSupplementaryView: @escaping ConfigureSupplementaryView, moveItem: @escaping MoveItem = { _, _, _ in () }, canMoveItemAtIndexPath: @escaping CanMoveItemAtIndexPath = { _, _ in false } ) { self.animationConfiguration = animationConfiguration super.init( configureCell: configureCell, configureSupplementaryView: configureSupplementaryView, moveItem: moveItem, canMoveItemAtIndexPath: canMoveItemAtIndexPath ) partialUpdateEvent // so in case it does produce a crash, it will be after the data has changed .observe(on: MainScheduler.asyncInstance) // Collection view has issues digesting fast updates, this should // help to alleviate the issues with them. .throttle(.milliseconds(500), scheduler: MainScheduler.instance) .subscribe(onNext: { [weak self] event in self?.collectionView(event.0, throttledObservedEvent: event.1) }) .disposed(by: disposeBag) } // For some inexplicable reason, when doing animated updates first time // it crashes. Still need to figure out that one. var dataSet = false private let disposeBag = DisposeBag() // This subject and throttle are here // because collection view has problems processing animated updates fast. // This should somewhat help to alleviate the problem. private let partialUpdateEvent = PublishSubject<(UICollectionView, Event)>() /** This method exists because collection view updates are throttled because of internal collection view bugs. Collection view behaves poorly during fast updates, so this should remedy those issues. */ open func collectionView(_ collectionView: UICollectionView, throttledObservedEvent event: Event) { Binder(self) { dataSource, newSections in let oldSections = dataSource.sectionModels do { // if view is not in view hierarchy, performing batch updates will crash the app if collectionView.window == nil { dataSource.setSections(newSections) collectionView.reloadData() return } let differences = try Diff.differencesForSectionedView(initialSections: oldSections, finalSections: newSections) for difference in differences { dataSource.setSections(difference.finalSections) collectionView.performBatchUpdates(difference, animationConfiguration: self.animationConfiguration) } } catch let e { #if DEBUG print("Error while binding data animated: \(e)\nFallback to normal `reloadData` behavior.") rxDebugFatalError(e) #endif self.setSections(newSections) collectionView.reloadData() } }.on(event) } open func collectionView(_ collectionView: UICollectionView, observedEvent: Event) { Binder(self) { dataSource, newSections in #if DEBUG self._dataSourceBound = true #endif if !self.dataSet { self.dataSet = true dataSource.setSections(newSections) collectionView.reloadData() } else { let element = (collectionView, observedEvent) dataSource.partialUpdateEvent.on(.next(element)) } }.on(observedEvent) } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/RxCollectionViewSectionedReloadDataSource.swift ================================================ // // RxCollectionViewSectionedReloadDataSource.swift // RxExample // // Created by Krunoslav Zaher on 7/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import RxCocoa import RxSwift import UIKit open class RxCollectionViewSectionedReloadDataSource: CollectionViewSectionedDataSource
, RxCollectionViewDataSourceType { public typealias Element = [Section] open func collectionView(_ collectionView: UICollectionView, observedEvent: Event) { Binder(self) { dataSource, element in #if DEBUG self._dataSourceBound = true #endif dataSource.setSections(element) collectionView.reloadData() collectionView.collectionViewLayout.invalidateLayout() }.on(observedEvent) } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/RxDataSources.h ================================================ // // RxDataSources.h // RxDataSources // // Created by Krunoslav Zaher on 1/1/16. // Copyright © 2016 kzaher. All rights reserved. // #import //! Project version number for RxDataSources. FOUNDATION_EXPORT double RxDataSourcesVersionNumber; //! Project version string for RxDataSources. FOUNDATION_EXPORT const unsigned char RxDataSourcesVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import ================================================ FILE: RxExample/RxDataSources/RxDataSources/RxPickerViewAdapter.swift ================================================ // // RxPickerViewAdapter.swift // RxDataSources // // Created by Sergey Shulga on 04/07/2017. // Copyright © 2017 kzaher. All rights reserved. // #if os(iOS) import Foundation import RxCocoa import RxSwift import UIKit /// A reactive UIPickerView adapter which uses `func pickerView(UIPickerView, titleForRow: Int, forComponent: Int)` to display the content /** Example: let adapter = RxPickerViewStringAdapter<[T]>(...) items .bind(to: firstPickerView.rx.items(adapter: adapter)) .disposed(by: disposeBag) */ open class RxPickerViewStringAdapter: RxPickerViewDataSource, UIPickerViewDelegate { /** - parameter dataSource - parameter pickerView - parameter components - parameter row - parameter component */ public typealias TitleForRow = ( _ dataSource: RxPickerViewStringAdapter, _ pickerView: UIPickerView, _ components: T, _ row: Int, _ component: Int ) -> String? private let titleForRow: TitleForRow /** - parameter components: Initial content value. - parameter numberOfComponents: Implementation of corresponding delegate method. - parameter numberOfRowsInComponent: Implementation of corresponding delegate method. - parameter titleForRow: Implementation of corresponding adapter method that converts component to `String`. */ public init( components: T, numberOfComponents: @escaping NumberOfComponents, numberOfRowsInComponent: @escaping NumberOfRowsInComponent, titleForRow: @escaping TitleForRow ) { self.titleForRow = titleForRow super.init( components: components, numberOfComponents: numberOfComponents, numberOfRowsInComponent: numberOfRowsInComponent ) } open func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { titleForRow(self, pickerView, components, row, component) } } /// A reactive UIPickerView adapter which uses `func pickerView(UIPickerView, viewForRow: Int, forComponent: Int, reusing: UIView?)` to display the content /** Example: let adapter = RxPickerViewAttributedStringAdapter<[T]>(...) items .bind(to: firstPickerView.rx.items(adapter: adapter)) .disposed(by: disposeBag) */ open class RxPickerViewAttributedStringAdapter: RxPickerViewDataSource, UIPickerViewDelegate { /** - parameter dataSource - parameter pickerView - parameter components - parameter row - parameter component */ public typealias AttributedTitleForRow = ( _ dataSource: RxPickerViewAttributedStringAdapter, _ pickerView: UIPickerView, _ components: T, _ row: Int, _ component: Int ) -> NSAttributedString? private let attributedTitleForRow: AttributedTitleForRow /** - parameter components: Initial content value. - parameter numberOfComponents: Implementation of corresponding delegate method. - parameter numberOfRowsInComponent: Implementation of corresponding delegate method. - parameter attributedTitleForRow: Implementation of corresponding adapter method that converts component to `NSAttributedString`. */ public init( components: T, numberOfComponents: @escaping NumberOfComponents, numberOfRowsInComponent: @escaping NumberOfRowsInComponent, attributedTitleForRow: @escaping AttributedTitleForRow ) { self.attributedTitleForRow = attributedTitleForRow super.init( components: components, numberOfComponents: numberOfComponents, numberOfRowsInComponent: numberOfRowsInComponent ) } open func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { attributedTitleForRow(self, pickerView, components, row, component) } } /// A reactive UIPickerView adapter which uses `func pickerView(pickerView:, viewForRow row:, forComponent component:)` to display the content /** Example: let adapter = RxPickerViewViewAdapter<[T]>(...) items .bind(to: firstPickerView.rx.items(adapter: adapter)) .disposed(by: disposeBag) */ open class RxPickerViewViewAdapter: RxPickerViewDataSource, UIPickerViewDelegate { /** - parameter dataSource - parameter pickerView - parameter components - parameter row - parameter component - parameter view */ public typealias ViewForRow = ( _ dataSource: RxPickerViewViewAdapter, _ pickerView: UIPickerView, _ components: T, _ row: Int, _ component: Int, _ view: UIView? ) -> UIView private let viewForRow: ViewForRow /** - parameter components: Initial content value. - parameter numberOfComponents: Implementation of corresponding delegate method. - parameter numberOfRowsInComponent: Implementation of corresponding delegate method. - parameter attributedTitleForRow: Implementation of corresponding adapter method that converts component to `UIView`. */ public init( components: T, numberOfComponents: @escaping NumberOfComponents, numberOfRowsInComponent: @escaping NumberOfRowsInComponent, viewForRow: @escaping ViewForRow ) { self.viewForRow = viewForRow super.init( components: components, numberOfComponents: numberOfComponents, numberOfRowsInComponent: numberOfRowsInComponent ) } open func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { viewForRow(self, pickerView, components, row, component, view) } } /// A reactive UIPickerView data source open class RxPickerViewDataSource: NSObject, UIPickerViewDataSource { /** - parameter dataSource - parameter pickerView - parameter components */ public typealias NumberOfComponents = ( _ dataSource: RxPickerViewDataSource, _ pickerView: UIPickerView, _ components: T ) -> Int /** - parameter dataSource - parameter pickerView - parameter components - parameter component */ public typealias NumberOfRowsInComponent = ( _ dataSource: RxPickerViewDataSource, _ pickerView: UIPickerView, _ components: T, _ component: Int ) -> Int fileprivate var components: T /** - parameter components: Initial content value. - parameter numberOfComponents: Implementation of corresponding delegate method. - parameter numberOfRowsInComponent: Implementation of corresponding delegate method. */ init( components: T, numberOfComponents: @escaping NumberOfComponents, numberOfRowsInComponent: @escaping NumberOfRowsInComponent ) { self.components = components self.numberOfComponents = numberOfComponents self.numberOfRowsInComponent = numberOfRowsInComponent super.init() } private let numberOfComponents: NumberOfComponents private let numberOfRowsInComponent: NumberOfRowsInComponent // MARK: UIPickerViewDataSource public func numberOfComponents(in pickerView: UIPickerView) -> Int { numberOfComponents(self, pickerView, components) } public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { numberOfRowsInComponent(self, pickerView, components, component) } } extension RxPickerViewDataSource: RxPickerViewDataSourceType { public func pickerView(_ pickerView: UIPickerView, observedEvent: Event) { Binder(self) { dataSource, components in dataSource.components = components pickerView.reloadAllComponents() }.on(observedEvent) } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/RxTableViewSectionedAnimatedDataSource.swift ================================================ // // RxTableViewSectionedAnimatedDataSource.swift // RxExample // // Created by Krunoslav Zaher on 6/27/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import RxCocoa import RxSwift import UIKit open class RxTableViewSectionedAnimatedDataSource: TableViewSectionedDataSource
, RxTableViewDataSourceType { public typealias Element = [Section] /// Animation configuration for data source public var animationConfiguration: AnimationConfiguration #if os(iOS) public init( animationConfiguration: AnimationConfiguration = AnimationConfiguration(), configureCell: @escaping ConfigureCell, titleForHeaderInSection: @escaping TitleForHeaderInSection = { _, _ in nil }, titleForFooterInSection: @escaping TitleForFooterInSection = { _, _ in nil }, canEditRowAtIndexPath: @escaping CanEditRowAtIndexPath = { _, _ in false }, canMoveRowAtIndexPath: @escaping CanMoveRowAtIndexPath = { _, _ in false }, sectionIndexTitles: @escaping SectionIndexTitles = { _ in nil }, sectionForSectionIndexTitle: @escaping SectionForSectionIndexTitle = { _, _, index in index } ) { self.animationConfiguration = animationConfiguration super.init( configureCell: configureCell, titleForHeaderInSection: titleForHeaderInSection, titleForFooterInSection: titleForFooterInSection, canEditRowAtIndexPath: canEditRowAtIndexPath, canMoveRowAtIndexPath: canMoveRowAtIndexPath, sectionIndexTitles: sectionIndexTitles, sectionForSectionIndexTitle: sectionForSectionIndexTitle ) } #else public init( animationConfiguration: AnimationConfiguration = AnimationConfiguration(), configureCell: @escaping ConfigureCell, titleForHeaderInSection: @escaping TitleForHeaderInSection = { _, _ in nil }, titleForFooterInSection: @escaping TitleForFooterInSection = { _, _ in nil }, canEditRowAtIndexPath: @escaping CanEditRowAtIndexPath = { _, _ in false }, canMoveRowAtIndexPath: @escaping CanMoveRowAtIndexPath = { _, _ in false } ) { self.animationConfiguration = animationConfiguration super.init( configureCell: configureCell, titleForHeaderInSection: titleForHeaderInSection, titleForFooterInSection: titleForFooterInSection, canEditRowAtIndexPath: canEditRowAtIndexPath, canMoveRowAtIndexPath: canMoveRowAtIndexPath ) } #endif var dataSet = false open func tableView(_ tableView: UITableView, observedEvent: Event) { Binder(self) { dataSource, newSections in #if DEBUG self._dataSourceBound = true #endif if !self.dataSet { self.dataSet = true dataSource.setSections(newSections) tableView.reloadData() } else { DispatchQueue.main.async { // if view is not in view hierarchy, performing batch updates will crash the app if tableView.window == nil { dataSource.setSections(newSections) tableView.reloadData() return } let oldSections = dataSource.sectionModels do { let differences = try Diff.differencesForSectionedView(initialSections: oldSections, finalSections: newSections) for difference in differences { dataSource.setSections(difference.finalSections) tableView.performBatchUpdates(difference, animationConfiguration: self.animationConfiguration) } } catch let e { rxDebugFatalError(e) self.setSections(newSections) tableView.reloadData() } } } }.on(observedEvent) } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/RxTableViewSectionedReloadDataSource.swift ================================================ // // RxTableViewSectionedReloadDataSource.swift // RxExample // // Created by Krunoslav Zaher on 6/27/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import RxCocoa import RxSwift import UIKit open class RxTableViewSectionedReloadDataSource: TableViewSectionedDataSource
, RxTableViewDataSourceType { public typealias Element = [Section] open func tableView(_ tableView: UITableView, observedEvent: Event) { Binder(self) { dataSource, element in #if DEBUG self._dataSourceBound = true #endif dataSource.setSections(element) tableView.reloadData() }.on(observedEvent) } } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/String+IdentifiableType.swift ================================================ // // String+IdentifiableType.swift // RxDataSources // // Created by Krunoslav Zaher on 7/4/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation extension String: IdentifiableType { public typealias Identity = String public var identity: String { self } } ================================================ FILE: RxExample/RxDataSources/RxDataSources/TableViewSectionedDataSource.swift ================================================ // // TableViewSectionedDataSource.swift // RxDataSources // // Created by Krunoslav Zaher on 6/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import RxCocoa import UIKit open class TableViewSectionedDataSource: NSObject, UITableViewDataSource, SectionedViewDataSourceType { public typealias Item = Section.Item public typealias ConfigureCell = (TableViewSectionedDataSource
, UITableView, IndexPath, Item) -> UITableViewCell public typealias TitleForHeaderInSection = (TableViewSectionedDataSource
, Int) -> String? public typealias TitleForFooterInSection = (TableViewSectionedDataSource
, Int) -> String? public typealias CanEditRowAtIndexPath = (TableViewSectionedDataSource
, IndexPath) -> Bool public typealias CanMoveRowAtIndexPath = (TableViewSectionedDataSource
, IndexPath) -> Bool #if os(iOS) public typealias SectionIndexTitles = (TableViewSectionedDataSource
) -> [String]? public typealias SectionForSectionIndexTitle = (TableViewSectionedDataSource
, _ title: String, _ index: Int) -> Int #endif #if os(iOS) public init( configureCell: @escaping ConfigureCell, titleForHeaderInSection: @escaping TitleForHeaderInSection = { _, _ in nil }, titleForFooterInSection: @escaping TitleForFooterInSection = { _, _ in nil }, canEditRowAtIndexPath: @escaping CanEditRowAtIndexPath = { _, _ in false }, canMoveRowAtIndexPath: @escaping CanMoveRowAtIndexPath = { _, _ in false }, sectionIndexTitles: @escaping SectionIndexTitles = { _ in nil }, sectionForSectionIndexTitle: @escaping SectionForSectionIndexTitle = { _, _, index in index } ) { self.configureCell = configureCell self.titleForHeaderInSection = titleForHeaderInSection self.titleForFooterInSection = titleForFooterInSection self.canEditRowAtIndexPath = canEditRowAtIndexPath self.canMoveRowAtIndexPath = canMoveRowAtIndexPath self.sectionIndexTitles = sectionIndexTitles self.sectionForSectionIndexTitle = sectionForSectionIndexTitle } #else public init( configureCell: @escaping ConfigureCell, titleForHeaderInSection: @escaping TitleForHeaderInSection = { _, _ in nil }, titleForFooterInSection: @escaping TitleForFooterInSection = { _, _ in nil }, canEditRowAtIndexPath: @escaping CanEditRowAtIndexPath = { _, _ in false }, canMoveRowAtIndexPath: @escaping CanMoveRowAtIndexPath = { _, _ in false } ) { self.configureCell = configureCell self.titleForHeaderInSection = titleForHeaderInSection self.titleForFooterInSection = titleForFooterInSection self.canEditRowAtIndexPath = canEditRowAtIndexPath self.canMoveRowAtIndexPath = canMoveRowAtIndexPath } #endif #if DEBUG // If data source has already been bound, then mutating it // afterwards isn't something desired. // This simulates immutability after binding var _dataSourceBound: Bool = false private func ensureNotMutatedAfterBinding() { assert(!_dataSourceBound, "Data source is already bound. Please write this line before binding call (`bindTo`, `drive`). Data source must first be completely configured, and then bound after that, otherwise there could be runtime bugs, glitches, or partial malfunctions.") } #endif // This structure exists because model can be mutable // In that case current state value should be preserved. // The state that needs to be preserved is ordering of items in section // and their relationship with section. // If particular item is mutable, that is irrelevant for this logic to function // properly. public typealias SectionModelSnapshot = SectionModel private var _sectionModels: [SectionModelSnapshot] = [] open var sectionModels: [Section] { _sectionModels.map { Section(original: $0.model, items: $0.items) } } open subscript(section: Int) -> Section { let sectionModel = _sectionModels[section] return Section(original: sectionModel.model, items: sectionModel.items) } open subscript(indexPath: IndexPath) -> Item { get { _sectionModels[indexPath.section].items[indexPath.item] } set(item) { var section = _sectionModels[indexPath.section] section.items[indexPath.item] = item _sectionModels[indexPath.section] = section } } open func model(at indexPath: IndexPath) throws -> Any { self[indexPath] } open func setSections(_ sections: [Section]) { _sectionModels = sections.map { SectionModelSnapshot(model: $0, items: $0.items) } } open var configureCell: ConfigureCell { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var titleForHeaderInSection: TitleForHeaderInSection { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var titleForFooterInSection: TitleForFooterInSection { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var canEditRowAtIndexPath: CanEditRowAtIndexPath { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var canMoveRowAtIndexPath: CanMoveRowAtIndexPath { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var rowAnimation: UITableView.RowAnimation = .automatic #if os(iOS) open var sectionIndexTitles: SectionIndexTitles { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } open var sectionForSectionIndexTitle: SectionForSectionIndexTitle { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } #endif // UITableViewDataSource open func numberOfSections(in _: UITableView) -> Int { _sectionModels.count } open func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int { guard _sectionModels.count > section else { return 0 } return _sectionModels[section].items.count } open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { precondition(indexPath.item < _sectionModels[indexPath.section].items.count) return configureCell(self, tableView, indexPath, self[indexPath]) } open func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? { titleForHeaderInSection(self, section) } open func tableView(_: UITableView, titleForFooterInSection section: Int) -> String? { titleForFooterInSection(self, section) } open func tableView(_: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { canEditRowAtIndexPath(self, indexPath) } open func tableView(_: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { canMoveRowAtIndexPath(self, indexPath) } open func tableView(_: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { _sectionModels.moveFromSourceIndexPath(sourceIndexPath, destinationIndexPath: destinationIndexPath) } #if os(iOS) open func sectionIndexTitles(for _: UITableView) -> [String]? { sectionIndexTitles(self) } open func tableView(_: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int { sectionForSectionIndexTitle(self, title, index) } #endif } #endif ================================================ FILE: RxExample/RxDataSources/RxDataSources/UI+SectionedViewType.swift ================================================ // // UI+SectionedViewType.swift // RxDataSources // // Created by Krunoslav Zaher on 6/27/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import Foundation import UIKit func indexSet(_ values: [Int]) -> IndexSet { let indexSet = NSMutableIndexSet() for i in values { indexSet.add(i) } return indexSet as IndexSet } extension UITableView: SectionedViewType { public func insertItemsAtIndexPaths(_ paths: [IndexPath], animationStyle: UITableView.RowAnimation) { insertRows(at: paths, with: animationStyle) } public func deleteItemsAtIndexPaths(_ paths: [IndexPath], animationStyle: UITableView.RowAnimation) { deleteRows(at: paths, with: animationStyle) } public func moveItemAtIndexPath(_ from: IndexPath, to: IndexPath) { moveRow(at: from, to: to) } public func reloadItemsAtIndexPaths(_ paths: [IndexPath], animationStyle: UITableView.RowAnimation) { reloadRows(at: paths, with: animationStyle) } public func insertSections(_ sections: [Int], animationStyle: UITableView.RowAnimation) { insertSections(indexSet(sections), with: animationStyle) } public func deleteSections(_ sections: [Int], animationStyle: UITableView.RowAnimation) { deleteSections(indexSet(sections), with: animationStyle) } public func moveSection(_ from: Int, to: Int) { moveSection(from, toSection: to) } public func reloadSections(_ sections: [Int], animationStyle: UITableView.RowAnimation) { reloadSections(indexSet(sections), with: animationStyle) } public func performBatchUpdates(_ changes: Changeset, animationConfiguration: AnimationConfiguration) { beginUpdates() _performBatchUpdates(self, changes: changes, animationConfiguration: animationConfiguration) endUpdates() } } extension UICollectionView: SectionedViewType { public func insertItemsAtIndexPaths(_ paths: [IndexPath], animationStyle _: UITableView.RowAnimation) { insertItems(at: paths) } public func deleteItemsAtIndexPaths(_ paths: [IndexPath], animationStyle _: UITableView.RowAnimation) { deleteItems(at: paths) } public func moveItemAtIndexPath(_ from: IndexPath, to: IndexPath) { moveItem(at: from, to: to) } public func reloadItemsAtIndexPaths(_ paths: [IndexPath], animationStyle _: UITableView.RowAnimation) { reloadItems(at: paths) } public func insertSections(_ sections: [Int], animationStyle _: UITableView.RowAnimation) { insertSections(indexSet(sections)) } public func deleteSections(_ sections: [Int], animationStyle _: UITableView.RowAnimation) { deleteSections(indexSet(sections)) } public func moveSection(_ from: Int, to: Int) { moveSection(from, toSection: to) } public func reloadSections(_ sections: [Int], animationStyle _: UITableView.RowAnimation) { reloadSections(indexSet(sections)) } public func performBatchUpdates(_ changes: Changeset, animationConfiguration: AnimationConfiguration) { performBatchUpdates({ () in _performBatchUpdates(self, changes: changes, animationConfiguration: animationConfiguration) }, completion: { (_: Bool) in }) } } public protocol SectionedViewType { func insertItemsAtIndexPaths(_ paths: [IndexPath], animationStyle: UITableView.RowAnimation) func deleteItemsAtIndexPaths(_ paths: [IndexPath], animationStyle: UITableView.RowAnimation) func moveItemAtIndexPath(_ from: IndexPath, to: IndexPath) func reloadItemsAtIndexPaths(_ paths: [IndexPath], animationStyle: UITableView.RowAnimation) func insertSections(_ sections: [Int], animationStyle: UITableView.RowAnimation) func deleteSections(_ sections: [Int], animationStyle: UITableView.RowAnimation) func moveSection(_ from: Int, to: Int) func reloadSections(_ sections: [Int], animationStyle: UITableView.RowAnimation) func performBatchUpdates(_ changes: Changeset, animationConfiguration: AnimationConfiguration) } func _performBatchUpdates(_ view: some SectionedViewType, changes: Changeset, animationConfiguration: AnimationConfiguration) { typealias I = S.Item view.deleteSections(changes.deletedSections, animationStyle: animationConfiguration.deleteAnimation) // Updated sections doesn't mean reload entire section, somebody needs to update the section view manually // otherwise all cells will be reloaded for nothing. // view.reloadSections(changes.updatedSections, animationStyle: rowAnimation) view.insertSections(changes.insertedSections, animationStyle: animationConfiguration.insertAnimation) for (from, to) in changes.movedSections { view.moveSection(from, to: to) } view.deleteItemsAtIndexPaths( changes.deletedItems.map { IndexPath(item: $0.itemIndex, section: $0.sectionIndex) }, animationStyle: animationConfiguration.deleteAnimation ) view.insertItemsAtIndexPaths( changes.insertedItems.map { IndexPath(item: $0.itemIndex, section: $0.sectionIndex) }, animationStyle: animationConfiguration.insertAnimation ) view.reloadItemsAtIndexPaths( changes.updatedItems.map { IndexPath(item: $0.itemIndex, section: $0.sectionIndex) }, animationStyle: animationConfiguration.reloadAnimation ) for (from, to) in changes.movedItems { view.moveItemAtIndexPath( IndexPath(item: from.itemIndex, section: from.sectionIndex), to: IndexPath(item: to.itemIndex, section: to.sectionIndex) ) } } #endif ================================================ FILE: RxExample/RxExample/Application+Extensions.swift ================================================ // // Application+Extensions.swift // RxExample // // Created by Krunoslav Zaher on 8/20/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) import UIKit typealias OSApplication = UIApplication #elseif os(macOS) import Cocoa typealias OSApplication = NSApplication #endif extension OSApplication { static var isInUITest: Bool { ProcessInfo.processInfo.environment["isUITest"] != nil } } ================================================ FILE: RxExample/RxExample/Example.swift ================================================ // // Example.swift // RxExample // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) import UIKit typealias Image = UIImage #elseif os(macOS) import AppKit import Cocoa typealias Image = NSImage #endif let MB = 1024 * 1024 func exampleError(_ error: String, location: String = "\(#file):\(#line)") -> NSError { NSError(domain: "ExampleError", code: -1, userInfo: [NSLocalizedDescriptionKey: "\(location): \(error)"]) } extension String { func toFloat() -> Float? { let numberFormatter = NumberFormatter() return numberFormatter.number(from: self)?.floatValue } func toDouble() -> Double? { let numberFormatter = NumberFormatter() return numberFormatter.number(from: self)?.doubleValue } } ================================================ FILE: RxExample/RxExample/Examples/APIWrappers/APIWrappers.storyboard ================================================ Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. ================================================ FILE: RxExample/RxExample/Examples/APIWrappers/APIWrappersViewController.swift ================================================ // // APIWrappersViewController.swift // RxExample // // Created by Carlos García on 8/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import CoreLocation import RxCocoa import RxSwift import UIKit extension UILabel { override open var accessibilityValue: String! { get { text } set { text = newValue self.accessibilityValue = newValue } } } class APIWrappersViewController: ViewController { @IBOutlet var debugLabel: UILabel! @IBOutlet var openActionSheet: UIButton! @IBOutlet var openAlertView: UIButton! @IBOutlet var bbitem: UIBarButtonItem! @IBOutlet var segmentedControl: UISegmentedControl! @IBOutlet var switcher: UISwitch! @IBOutlet var activityIndicator: UIActivityIndicatorView! @IBOutlet var button: UIButton! @IBOutlet var slider: UISlider! @IBOutlet var textField: UITextField! @IBOutlet var textField2: UITextField! @IBOutlet var datePicker: UIDatePicker! @IBOutlet var mypan: UIPanGestureRecognizer! @IBOutlet var textView: UITextView! @IBOutlet var textView2: UITextView! let manager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() datePicker.date = Date(timeIntervalSince1970: 0) // MARK: UIBarButtonItem bbitem.rx.tap .subscribe(onNext: { [weak self] _ in self?.debug("UIBarButtonItem Tapped") }) .disposed(by: disposeBag) // MARK: UISegmentedControl // also test two way binding let segmentedValue = BehaviorRelay(value: 0) _ = segmentedControl.rx.value <-> segmentedValue segmentedValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UISegmentedControl value \(x)") }) .disposed(by: disposeBag) // MARK: UISwitch // also test two way binding let switchValue = BehaviorRelay(value: true) _ = switcher.rx.value <-> switchValue switchValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UISwitch value \(x)") }) .disposed(by: disposeBag) // MARK: UIActivityIndicatorView switcher.rx.value .bind(to: activityIndicator.rx.isAnimating) .disposed(by: disposeBag) // MARK: UIButton button.rx.tap .subscribe(onNext: { [weak self] _ in self?.debug("UIButton Tapped") }) .disposed(by: disposeBag) // MARK: UISlider // also test two way binding let sliderValue = BehaviorRelay(value: 1.0) _ = slider.rx.value <-> sliderValue sliderValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UISlider value \(x)") }) .disposed(by: disposeBag) // MARK: UIDatePicker // also test two way binding let dateValue = BehaviorRelay(value: Date(timeIntervalSince1970: 0)) _ = datePicker.rx.date <-> dateValue dateValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UIDatePicker date \(x)") }) .disposed(by: disposeBag) // MARK: UITextField // because of leak in ios 11.2 // // final class UITextFieldSubclass: UITextField { deinit { print("never called") } } // let textField = UITextFieldSubclass(frame: .zero) if #available(iOS 11.2, *) { // also test two way binding let textValue = BehaviorRelay(value: "") _ = textField.rx.textInput <-> textValue textValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UITextField text \(x)") }) .disposed(by: disposeBag) let attributedTextValue = BehaviorRelay(value: NSAttributedString(string: "")) _ = textField2.rx.attributedText <-> attributedTextValue attributedTextValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UITextField attributedText \(x?.description ?? "")") }) .disposed(by: disposeBag) } // MARK: UIGestureRecognizer mypan.rx.event .subscribe(onNext: { [weak self] x in self?.debug("UIGestureRecognizer event \(x.state.rawValue)") }) .disposed(by: disposeBag) // MARK: UITextView // also test two way binding let textViewValue = BehaviorRelay(value: "") _ = textView.rx.textInput <-> textViewValue textViewValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UITextView text \(x)") }) .disposed(by: disposeBag) let attributedTextViewValue = BehaviorRelay(value: NSAttributedString(string: "")) _ = textView2.rx.attributedText <-> attributedTextViewValue attributedTextViewValue.asObservable() .subscribe(onNext: { [weak self] x in self?.debug("UITextView attributedText \(x?.description ?? "")") }) .disposed(by: disposeBag) // MARK: CLLocationManager manager.requestWhenInUseAuthorization() manager.rx.didUpdateLocations .subscribe(onNext: { x in print("rx.didUpdateLocations \(x)") }) .disposed(by: disposeBag) _ = manager.rx.didFailWithError .subscribe(onNext: { x in print("rx.didFailWithError \(x)") }) manager.rx.didChangeAuthorizationStatus .subscribe(onNext: { status in print("Authorization status \(status)") }) .disposed(by: disposeBag) manager.startUpdatingLocation() } func debug(_ string: String) { print(string) debugLabel.text = string } } ================================================ FILE: RxExample/RxExample/Examples/Calculator/Calculator.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/Calculator/Calculator.swift ================================================ // // Calculator.swift // RxExample // // Created by Krunoslav Zaher on 12/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // enum Operator { case addition case subtraction case multiplication case division } enum CalculatorCommand { case clear case changeSign case percent case operation(Operator) case equal case addNumber(Character) case addDot } enum CalculatorState { case oneOperand(screen: String) case oneOperandAndOperator(operand: Double, operator: Operator) case twoOperandsAndOperator(operand: Double, operator: Operator, screen: String) } extension CalculatorState { static let initial = CalculatorState.oneOperand(screen: "0") func mapScreen(transform: (String) -> String) -> CalculatorState { switch self { case let .oneOperand(screen): .oneOperand(screen: transform(screen)) case let .oneOperandAndOperator(operand, operat): .twoOperandsAndOperator(operand: operand, operator: operat, screen: transform("0")) case let .twoOperandsAndOperator(operand, operat, screen): .twoOperandsAndOperator(operand: operand, operator: operat, screen: transform(screen)) } } var screen: String { switch self { case let .oneOperand(screen): screen case .oneOperandAndOperator: "0" case let .twoOperandsAndOperator(_, _, screen): screen } } var sign: String { switch self { case .oneOperand: "" case let .oneOperandAndOperator(_, o): o.sign case let .twoOperandsAndOperator(_, o, _): o.sign } } } extension CalculatorState { static func reduce(state: CalculatorState, _ x: CalculatorCommand) -> CalculatorState { switch x { case .clear: return CalculatorState.initial case let .addNumber(c): return state.mapScreen { $0 == "0" ? String(c) : $0 + String(c) } case .addDot: return state.mapScreen { $0.range(of: ".") == nil ? $0 + "." : $0 } case .changeSign: return state.mapScreen { "\(-(Double($0) ?? 0.0))" } case .percent: return state.mapScreen { "\((Double($0) ?? 0.0) / 100.0)" } case let .operation(o): switch state { case let .oneOperand(screen): return .oneOperandAndOperator(operand: screen.doubleValue, operator: o) case let .oneOperandAndOperator(operand, _): return .oneOperandAndOperator(operand: operand, operator: o) case let .twoOperandsAndOperator(operand, oldOperator, screen): return .twoOperandsAndOperator(operand: oldOperator.perform(operand, screen.doubleValue), operator: o, screen: "0") } case .equal: switch state { case let .twoOperandsAndOperator(operand, operat, screen): let result = operat.perform(operand, screen.doubleValue) return .oneOperand(screen: String(result)) default: return state } } } } extension Operator { var sign: String { switch self { case .addition: "+" case .subtraction: "-" case .multiplication: "×" case .division: "/" } } var perform: (Double, Double) -> Double { switch self { case .addition: (+) case .subtraction: (-) case .multiplication: (*) case .division: (/) } } } private extension String { var doubleValue: Double { guard let double = Double(self) else { return Double.infinity } return double } } ================================================ FILE: RxExample/RxExample/Examples/Calculator/CalculatorViewController.swift ================================================ // // CalculatorViewController.swift // RxExample // // Created by Carlos García on 4/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class CalculatorViewController: ViewController { @IBOutlet var lastSignLabel: UILabel! @IBOutlet var resultLabel: UILabel! @IBOutlet var allClearButton: UIButton! @IBOutlet var changeSignButton: UIButton! @IBOutlet var percentButton: UIButton! @IBOutlet var divideButton: UIButton! @IBOutlet var multiplyButton: UIButton! @IBOutlet var minusButton: UIButton! @IBOutlet var plusButton: UIButton! @IBOutlet var equalButton: UIButton! @IBOutlet var dotButton: UIButton! @IBOutlet var zeroButton: UIButton! @IBOutlet var oneButton: UIButton! @IBOutlet var twoButton: UIButton! @IBOutlet var threeButton: UIButton! @IBOutlet var fourButton: UIButton! @IBOutlet var fiveButton: UIButton! @IBOutlet var sixButton: UIButton! @IBOutlet var sevenButton: UIButton! @IBOutlet var eightButton: UIButton! @IBOutlet var nineButton: UIButton! override func viewDidLoad() { typealias FeedbackLoop = (ObservableSchedulerContext) -> Observable let uiFeedback: FeedbackLoop = bind(self) { this, state in let subscriptions = [ state.map(\.screen).bind(to: this.resultLabel.rx.text), state.map(\.sign).bind(to: this.lastSignLabel.rx.text) ] let events: [Observable] = [ this.allClearButton.rx.tap.map { _ in .clear }, this.changeSignButton.rx.tap.map { _ in .changeSign }, this.percentButton.rx.tap.map { _ in .percent }, this.divideButton.rx.tap.map { _ in .operation(.division) }, this.multiplyButton.rx.tap.map { _ in .operation(.multiplication) }, this.minusButton.rx.tap.map { _ in .operation(.subtraction) }, this.plusButton.rx.tap.map { _ in .operation(.addition) }, this.equalButton.rx.tap.map { _ in .equal }, this.dotButton.rx.tap.map { _ in .addDot }, this.zeroButton.rx.tap.map { _ in .addNumber("0") }, this.oneButton.rx.tap.map { _ in .addNumber("1") }, this.twoButton.rx.tap.map { _ in .addNumber("2") }, this.threeButton.rx.tap.map { _ in .addNumber("3") }, this.fourButton.rx.tap.map { _ in .addNumber("4") }, this.fiveButton.rx.tap.map { _ in .addNumber("5") }, this.sixButton.rx.tap.map { _ in .addNumber("6") }, this.sevenButton.rx.tap.map { _ in .addNumber("7") }, this.eightButton.rx.tap.map { _ in .addNumber("8") }, this.nineButton.rx.tap.map { _ in .addNumber("9") } ] return Bindings(subscriptions: subscriptions, events: events) } Observable.system( initialState: CalculatorState.initial, reduce: CalculatorState.reduce, scheduler: MainScheduler.instance, scheduledFeedback: uiFeedback ) .subscribe() .disposed(by: disposeBag) } func formatResult(_ result: String) -> String { if result.hasSuffix(".0") { String(result[result.startIndex ..< result.index(result.endIndex, offsetBy: -2)]) } else { result } } } ================================================ FILE: RxExample/RxExample/Examples/Dependencies.swift ================================================ // // Dependencies.swift // RxExample // // Created by carlos on 13/5/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift class Dependencies { // ***************************************************************************************** // !!! This is defined for simplicity sake, using singletons isn't advised !!! // !!! This is just a simple way to move services to one location so you can see Rx code !!! // ***************************************************************************************** static let sharedDependencies = Dependencies() // Singleton let URLSession = Foundation.URLSession.shared let backgroundWorkScheduler: ImmediateSchedulerType let mainScheduler: SerialDispatchQueueScheduler let wireframe: Wireframe let reachabilityService: ReachabilityService private init() { wireframe = DefaultWireframe() let operationQueue = OperationQueue() operationQueue.maxConcurrentOperationCount = 2 operationQueue.qualityOfService = QualityOfService.userInitiated backgroundWorkScheduler = OperationQueueScheduler(operationQueue: operationQueue) mainScheduler = MainScheduler.instance reachabilityService = try! DefaultReachabilityService() // try! is only for simplicity sake } } ================================================ FILE: RxExample/RxExample/Examples/GeolocationExample/Geolocation.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/GeolocationExample/GeolocationViewController.swift ================================================ // // GeolocationViewController.swift // RxExample // // Created by Carlos García on 19/01/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import CoreLocation import RxCocoa import RxSwift import UIKit private extension Reactive where Base: UILabel { var coordinates: Binder { Binder(base) { label, location in label.text = "Lat: \(location.latitude)\nLon: \(location.longitude)" } } } class GeolocationViewController: ViewController { @IBOutlet private var noGeolocationView: UIView! @IBOutlet private var button: UIButton! @IBOutlet private var button2: UIButton! @IBOutlet var label: UILabel! override func viewDidLoad() { super.viewDidLoad() view.addSubview(noGeolocationView) let geolocationService = GeolocationService.instance geolocationService.authorized .drive(noGeolocationView.rx.isHidden) .disposed(by: disposeBag) geolocationService.location .drive(label.rx.coordinates) .disposed(by: disposeBag) button.rx.tap .bind { [weak self] _ in self?.openAppPreferences() } .disposed(by: disposeBag) button2.rx.tap .bind { [weak self] _ in self?.openAppPreferences() } .disposed(by: disposeBag) } private func openAppPreferences() { UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositories.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositories.swift ================================================ // // GitHubSearchRepositories.swift // RxExample // // Created by Krunoslav Zaher on 3/18/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // enum GitHubCommand { case changeSearch(text: String) case loadMoreItems case gitHubResponseReceived(SearchRepositoriesResponse) } struct GitHubSearchRepositoriesState { // control var searchText: String var shouldLoadNextPage: Bool var repositories: Version<[Repository]> // Version is an optimization. When something unrelated changes, we don't want to reload table view. var nextURL: URL? var failure: GitHubServiceError? init(searchText: String) { self.searchText = searchText shouldLoadNextPage = true repositories = Version([]) nextURL = URL(string: "https://api.github.com/search/repositories?q=\(searchText.URLEscaped)") failure = nil } } extension GitHubSearchRepositoriesState { static let initial = GitHubSearchRepositoriesState(searchText: "") static func reduce(state: GitHubSearchRepositoriesState, command: GitHubCommand) -> GitHubSearchRepositoriesState { switch command { case let .changeSearch(text): GitHubSearchRepositoriesState(searchText: text).mutateOne { $0.failure = state.failure } case let .gitHubResponseReceived(result): switch result { case let .success((repositories, nextURL)): state.mutate { $0.repositories = Version($0.repositories.value + repositories) $0.shouldLoadNextPage = false $0.nextURL = nextURL $0.failure = nil } case let .failure(error): state.mutateOne { $0.failure = error } } case .loadMoreItems: state.mutate { if $0.failure == nil { $0.shouldLoadNextPage = true } } } } } import RxCocoa import RxSwift struct GithubQuery: Equatable { let searchText: String let shouldLoadNextPage: Bool let nextURL: URL? } /** This method contains the gist of paginated GitHub search. */ func githubSearchRepositories( searchText: Signal, loadNextPageTrigger: @escaping (Driver) -> Signal, performSearch: @escaping (URL) -> Observable ) -> Driver { let searchPerformerFeedback: (Driver) -> Signal = react( query: { state in GithubQuery(searchText: state.searchText, shouldLoadNextPage: state.shouldLoadNextPage, nextURL: state.nextURL) }, effects: { query -> Signal in if !query.shouldLoadNextPage { return Signal.empty() } if query.searchText.isEmpty { return Signal.just(GitHubCommand.gitHubResponseReceived(.success((repositories: [], nextURL: nil)))) } guard let nextURL = query.nextURL else { return Signal.empty() } return performSearch(nextURL) .asSignal(onErrorJustReturn: .failure(GitHubServiceError.networkError)) .map(GitHubCommand.gitHubResponseReceived) } ) // this is degenerated feedback loop that doesn't depend on output state let inputFeedbackLoop: (Driver) -> Signal = { state in let loadNextPage = loadNextPageTrigger(state).map { _ in GitHubCommand.loadMoreItems } let searchText = searchText.map(GitHubCommand.changeSearch) return Signal.merge(loadNextPage, searchText) } // Create a system with two feedback loops that drive the system // * one that tries to load new pages when necessary // * one that sends commands from user input return Driver.system( initialState: GitHubSearchRepositoriesState.initial, reduce: GitHubSearchRepositoriesState.reduce, feedback: searchPerformerFeedback, inputFeedbackLoop ) } extension GitHubSearchRepositoriesState { var isOffline: Bool { guard let failure else { return false } if case .offline = failure { return true } else { return false } } var isLimitExceeded: Bool { guard let failure else { return false } if case .githubLimitReached = failure { return true } else { return false } } } extension GitHubSearchRepositoriesState: Mutable {} ================================================ FILE: RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositoriesAPI.swift ================================================ // // GitHubSearchRepositoriesAPI.swift // RxExample // // Created by Krunoslav Zaher on 10/18/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift /** Parsed GitHub repository. */ struct Repository: CustomDebugStringConvertible { var name: String var url: URL init(name: String, url: URL) { self.name = name self.url = url } } extension Repository { var debugDescription: String { "\(name) | \(url)" } } enum GitHubServiceError: Error { case offline case githubLimitReached case networkError } typealias SearchRepositoriesResponse = Result<(repositories: [Repository], nextURL: URL?), GitHubServiceError> class GitHubSearchRepositoriesAPI { // ***************************************************************************************** // !!! This is defined for simplicity sake, using singletons isn't advised !!! // !!! This is just a simple way to move services to one location so you can see Rx code !!! // ***************************************************************************************** static let sharedAPI = GitHubSearchRepositoriesAPI(reachabilityService: try! DefaultReachabilityService()) private let _reachabilityService: ReachabilityService private init(reachabilityService: ReachabilityService) { _reachabilityService = reachabilityService } } extension GitHubSearchRepositoriesAPI { func loadSearchURL(_ searchURL: URL) -> Observable { URLSession.shared .rx.response(request: URLRequest(url: searchURL)) .retry(3) .observe(on: Dependencies.sharedDependencies.backgroundWorkScheduler) .map { pair -> SearchRepositoriesResponse in if pair.0.statusCode == 403 { return .failure(.githubLimitReached) } let jsonRoot = try GitHubSearchRepositoriesAPI.parseJSON(pair.0, data: pair.1) guard let json = jsonRoot as? [String: AnyObject] else { throw exampleError("Casting to dictionary failed") } let repositories = try Repository.parse(json) let nextURL = try GitHubSearchRepositoriesAPI.parseNextURL(pair.0) return .success((repositories: repositories, nextURL: nextURL)) } .retryOnBecomesReachable(.failure(.offline), reachabilityService: _reachabilityService) } } // MARK: Parsing the response extension GitHubSearchRepositoriesAPI { private static let parseLinksPattern = "\\s*,?\\s*<([^\\>]*)>\\s*;\\s*rel=\"([^\"]*)\"" private static let linksRegex = try! NSRegularExpression(pattern: parseLinksPattern, options: [.allowCommentsAndWhitespace]) private static func parseLinks(_ links: String) throws -> [String: String] { let length = (links as NSString).length let matches = GitHubSearchRepositoriesAPI.linksRegex.matches(in: links, options: NSRegularExpression.MatchingOptions(), range: NSRange(location: 0, length: length)) var result: [String: String] = [:] for m in matches { let matches = (1 ..< m.numberOfRanges).map { rangeIndex -> String in let range = m.range(at: rangeIndex) let startIndex = links.index(links.startIndex, offsetBy: range.location) let endIndex = links.index(links.startIndex, offsetBy: range.location + range.length) return String(links[startIndex ..< endIndex]) } if matches.count != 2 { throw exampleError("Error parsing links") } result[matches[1]] = matches[0] } return result } private static func parseNextURL(_ httpResponse: HTTPURLResponse) throws -> URL? { guard let serializedLinks = httpResponse.allHeaderFields["Link"] as? String else { return nil } let links = try GitHubSearchRepositoriesAPI.parseLinks(serializedLinks) guard let nextPageURL = links["next"] else { return nil } guard let nextUrl = URL(string: nextPageURL) else { throw exampleError("Error parsing next url `\(nextPageURL)`") } return nextUrl } private static func parseJSON(_ httpResponse: HTTPURLResponse, data: Data) throws -> AnyObject { if !(200 ..< 300 ~= httpResponse.statusCode) { throw exampleError("Call failed") } return try JSONSerialization.jsonObject(with: data, options: []) as AnyObject } } private extension Repository { static func parse(_ json: [String: AnyObject]) throws -> [Repository] { guard let items = json["items"] as? [[String: AnyObject]] else { throw exampleError("Can't find items") } return try items.map { item in guard let name = item["name"] as? String, let url = item["url"] as? String else { throw exampleError("Can't parse repository") } return try Repository(name: name, url: URL(string: url).unwrap()) } } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositoriesViewController.swift ================================================ // // GitHubSearchRepositoriesViewController.swift // RxExample // // Created by Yoshinori Sano on 9/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit extension UIScrollView { func isNearBottomEdge(edgeOffset: CGFloat = 20.0) -> Bool { contentOffset.y + frame.size.height + edgeOffset > contentSize.height } } class GitHubSearchRepositoriesViewController: ViewController, UITableViewDelegate { static let startLoadingOffset: CGFloat = 20.0 @IBOutlet var tableView: UITableView! @IBOutlet var searchBar: UISearchBar! let dataSource = RxTableViewSectionedReloadDataSource>( configureCell: { (_, tv, _, repository: Repository) in let cell = tv.dequeueReusableCell(withIdentifier: "Cell")! cell.textLabel?.text = repository.name cell.detailTextLabel?.text = repository.url.absoluteString return cell }, titleForHeaderInSection: { dataSource, sectionIndex in let section = dataSource[sectionIndex] return section.items.count > 0 ? "Repositories (\(section.items.count))" : "No repositories found" } ) override func viewDidLoad() { super.viewDidLoad() let tableView: UITableView = tableView let loadNextPageTrigger: (Driver) -> Signal = { state in tableView.rx.contentOffset.asDriver() .withLatestFrom(state) .flatMap { state in tableView.isNearBottomEdge(edgeOffset: 20.0) && !state.shouldLoadNextPage ? Signal.just(()) : Signal.empty() } } let activityIndicator = ActivityIndicator() let searchBar: UISearchBar = searchBar let state = githubSearchRepositories( searchText: searchBar.rx.text.orEmpty.changed.asSignal().throttle(.milliseconds(300)), loadNextPageTrigger: loadNextPageTrigger, performSearch: { URL in GitHubSearchRepositoriesAPI.sharedAPI.loadSearchURL(URL) .trackActivity(activityIndicator) } ) state .map(\.isOffline) .drive(navigationController!.rx.isOffline) .disposed(by: disposeBag) state .map(\.repositories) .distinctUntilChanged() .map { [SectionModel(model: "Repositories", items: $0.value)] } .drive(tableView.rx.items(dataSource: dataSource)) .disposed(by: disposeBag) tableView.rx.modelSelected(Repository.self) .subscribe(onNext: { repository in UIApplication.shared.open(repository.url) }) .disposed(by: disposeBag) state .map(\.isLimitExceeded) .distinctUntilChanged() .filter(\.self) .drive(onNext: { [weak self] _ in guard let self else { return } let message = "Exceeded limit of 10 non authenticated requests per minute for GitHub API. Please wait a minute. :(\nhttps://developer.github.com/v3/#rate-limiting" #if os(iOS) present(UIAlertController(title: "RxExample", message: message, preferredStyle: .alert), animated: true) #elseif os(macOS) let alert = NSAlert() alert.messageText = message alert.runModal() #endif }) .disposed(by: disposeBag) tableView.rx.contentOffset .subscribe { _ in if searchBar.isFirstResponder { _ = searchBar.resignFirstResponder() } } .disposed(by: disposeBag) // so normal delegate customization can also be used tableView.rx.setDelegate(self) .disposed(by: disposeBag) // activity indicator in status bar // { activityIndicator .drive(UIApplication.shared.rx.isNetworkActivityIndicatorVisible) .disposed(by: disposeBag) // } } // MARK: Table view delegate func tableView(_: UITableView, heightForHeaderInSection _: Int) -> CGFloat { 30 } deinit { // I know, I know, this isn't a good place of truth, but it's no self.navigationController?.navigationBar.backgroundColor = nil } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSearchRepositories/UINavigationController+Extensions.swift ================================================ // // UINavigationController+Extensions.swift // RxExample // // Created by Krunoslav Zaher on 12/13/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit enum Colors { static let offlineColor = UIColor(red: 1.0, green: 0.6, blue: 0.6, alpha: 1.0) static let onlineColor = nil as UIColor? } extension Reactive where Base: UINavigationController { var isOffline: Binder { Binder(base) { navigationController, isOffline in navigationController.navigationBar.barTintColor = isOffline ? Colors.offlineColor : Colors.onlineColor } } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/BindingExtensions.swift ================================================ // // BindingExtensions.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit extension ValidationResult: CustomStringConvertible { var description: String { switch self { case let .ok(message): message case .empty: "" case .validating: "validating ..." case let .failed(message): message } } } enum ValidationColors { static let okColor = UIColor(red: 138.0 / 255.0, green: 221.0 / 255.0, blue: 109.0 / 255.0, alpha: 1.0) static let errorColor = UIColor.red } extension ValidationResult { var textColor: UIColor { switch self { case .ok: ValidationColors.okColor case .empty: UIColor.black case .validating: UIColor.black case .failed: ValidationColors.errorColor } } } extension Reactive where Base: UILabel { var validationResult: Binder { Binder(base) { label, result in label.textColor = result.textColor label.text = result.description } } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/DefaultImplementations.swift ================================================ // // DefaultImplementations.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift class GitHubDefaultValidationService: GitHubValidationService { let API: GitHubAPI static let sharedValidationService = GitHubDefaultValidationService(API: GitHubDefaultAPI.sharedAPI) init(API: GitHubAPI) { self.API = API } // validation let minPasswordCount = 5 func validateUsername(_ username: String) -> Observable { if username.isEmpty { return .just(.empty) } // this obviously won't be if username.rangeOfCharacter(from: CharacterSet.alphanumerics.inverted) != nil { return .just(.failed(message: "Username can only contain numbers or digits")) } let loadingValue = ValidationResult.validating return API .usernameAvailable(username) .map { available in if available { .ok(message: "Username available") } else { .failed(message: "Username already taken") } } .startWith(loadingValue) } func validatePassword(_ password: String) -> ValidationResult { let numberOfCharacters = password.count if numberOfCharacters == 0 { return .empty } if numberOfCharacters < minPasswordCount { return .failed(message: "Password must be at least \(minPasswordCount) characters") } return .ok(message: "Password acceptable") } func validateRepeatedPassword(_ password: String, repeatedPassword: String) -> ValidationResult { if repeatedPassword.count == 0 { return .empty } if repeatedPassword == password { return .ok(message: "Password repeated") } else { return .failed(message: "Password different") } } } class GitHubDefaultAPI: GitHubAPI { let URLSession: Foundation.URLSession static let sharedAPI = GitHubDefaultAPI( URLSession: Foundation.URLSession.shared ) init(URLSession: Foundation.URLSession) { self.URLSession = URLSession } func usernameAvailable(_ username: String) -> Observable { // this is ofc just mock, but good enough let url = URL(string: "https://github.com/\(username.URLEscaped)")! let request = URLRequest(url: url) return URLSession.rx.response(request: request) .map { pair in pair.response.statusCode == 404 } .catchAndReturn(false) } func signup(_: String, password _: String) -> Observable { // this is also just a mock let signupResult = arc4random() % 5 == 0 ? false : true return Observable.just(signupResult) .delay(.seconds(1), scheduler: MainScheduler.instance) } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/GitHubSignup1.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/GitHubSignup2.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/Protocols.swift ================================================ // // Protocols.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift enum ValidationResult { case ok(message: String) case empty case validating case failed(message: String) } enum SignupState { case signedUp(signedUp: Bool) } protocol GitHubAPI { func usernameAvailable(_ username: String) -> Observable func signup(_ username: String, password: String) -> Observable } protocol GitHubValidationService { func validateUsername(_ username: String) -> Observable func validatePassword(_ password: String) -> ValidationResult func validateRepeatedPassword(_ password: String, repeatedPassword: String) -> ValidationResult } extension ValidationResult { var isValid: Bool { switch self { case .ok: true default: false } } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/UsingDriver/GitHubSignupViewController2.swift ================================================ // // GitHubSignupViewController2.swift // RxExample // // Created by Krunoslav Zaher on 4/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class GitHubSignupViewController2: ViewController { @IBOutlet var usernameOutlet: UITextField! @IBOutlet var usernameValidationOutlet: UILabel! @IBOutlet var passwordOutlet: UITextField! @IBOutlet var passwordValidationOutlet: UILabel! @IBOutlet var repeatedPasswordOutlet: UITextField! @IBOutlet var repeatedPasswordValidationOutlet: UILabel! @IBOutlet var signupOutlet: UIButton! @IBOutlet var signingUpOulet: UIActivityIndicatorView! override func viewDidLoad() { super.viewDidLoad() let viewModel = GithubSignupViewModel2( input: ( username: usernameOutlet.rx.text.orEmpty.asDriver(), password: passwordOutlet.rx.text.orEmpty.asDriver(), repeatedPassword: repeatedPasswordOutlet.rx.text.orEmpty.asDriver(), loginTaps: signupOutlet.rx.tap.asSignal() ), dependency: ( API: GitHubDefaultAPI.sharedAPI, validationService: GitHubDefaultValidationService.sharedValidationService, wireframe: DefaultWireframe.shared ) ) // bind results to { viewModel.signupEnabled .drive(onNext: { [weak self] valid in self?.signupOutlet.isEnabled = valid self?.signupOutlet.alpha = valid ? 1.0 : 0.5 }) .disposed(by: disposeBag) viewModel.validatedUsername .drive(usernameValidationOutlet.rx.validationResult) .disposed(by: disposeBag) viewModel.validatedPassword .drive(passwordValidationOutlet.rx.validationResult) .disposed(by: disposeBag) viewModel.validatedPasswordRepeated .drive(repeatedPasswordValidationOutlet.rx.validationResult) .disposed(by: disposeBag) viewModel.signingIn .drive(signingUpOulet.rx.isAnimating) .disposed(by: disposeBag) viewModel.signedIn .drive(onNext: { signedIn in print("User signed in \(signedIn)") }) .disposed(by: disposeBag) // } let tapBackground = UITapGestureRecognizer() tapBackground.rx.event .subscribe(onNext: { [weak self] _ in self?.view.endEditing(true) }) .disposed(by: disposeBag) view.addGestureRecognizer(tapBackground) } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/UsingDriver/GithubSignupViewModel2.swift ================================================ // // GithubSignupViewModel2.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift /** This is example where view model is mutable. Some consider this to be MVVM, some consider this to be Presenter, or some other name. In the end, it doesn't matter. If you want to take a look at example using "immutable VMs", take a look at `TableViewWithEditingCommands` example. This uses Driver builder for sequences. Please note that there is no explicit state, outputs are defined using inputs and dependencies. Please note that there is no dispose bag, because no subscription is being made. */ class GithubSignupViewModel2 { // outputs { // let validatedUsername: Driver let validatedPassword: Driver let validatedPasswordRepeated: Driver // Is signup button enabled let signupEnabled: Driver // Has user signed in let signedIn: Driver // Is signing process in progress let signingIn: Driver // } init( input: ( username: Driver, password: Driver, repeatedPassword: Driver, loginTaps: Signal ), dependency: ( API: GitHubAPI, validationService: GitHubValidationService, wireframe: Wireframe ) ) { let API = dependency.API let validationService = dependency.validationService let wireframe = dependency.wireframe /** Notice how no subscribe call is being made. Everything is just a definition. Pure transformation of input sequences to output sequences. When using `Driver`, underlying observable sequence elements are shared because driver automagically adds "shareReplay(1)" under the hood. .observe(on:MainScheduler.instance) .catchAndReturn(.Failed(message: "Error contacting server")) ... are squashed into single `.asDriver(onErrorJustReturn: .Failed(message: "Error contacting server"))` */ validatedUsername = input.username .flatMapLatest { username in validationService.validateUsername(username) .asDriver(onErrorJustReturn: .failed(message: "Error contacting server")) } validatedPassword = input.password .map { password in validationService.validatePassword(password) } validatedPasswordRepeated = Driver.combineLatest(input.password, input.repeatedPassword, resultSelector: validationService.validateRepeatedPassword) let signingIn = ActivityIndicator() self.signingIn = signingIn.asDriver() let usernameAndPassword = Driver.combineLatest(input.username, input.password) { (username: $0, password: $1) } signedIn = input.loginTaps.withLatestFrom(usernameAndPassword) .flatMapLatest { pair in API.signup(pair.username, password: pair.password) .trackActivity(signingIn) .asDriver(onErrorJustReturn: false) } .flatMapLatest { loggedIn -> Driver in let message = loggedIn ? "Mock: Signed in to GitHub." : "Mock: Sign in to GitHub failed" return wireframe.promptFor(message, cancelAction: "OK", actions: []) // propagate original value .map { _ in loggedIn } .asDriver(onErrorJustReturn: false) } signupEnabled = Driver.combineLatest( validatedUsername, validatedPassword, validatedPasswordRepeated, signingIn ) { username, password, repeatPassword, signingIn in username.isValid && password.isValid && repeatPassword.isValid && !signingIn } .distinctUntilChanged() } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/UsingVanillaObservables/GitHubSignupViewController1.swift ================================================ // // GitHubSignupViewController1.swift // RxExample // // Created by Krunoslav Zaher on 4/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class GitHubSignupViewController1: ViewController { @IBOutlet var usernameOutlet: UITextField! @IBOutlet var usernameValidationOutlet: UILabel! @IBOutlet var passwordOutlet: UITextField! @IBOutlet var passwordValidationOutlet: UILabel! @IBOutlet var repeatedPasswordOutlet: UITextField! @IBOutlet var repeatedPasswordValidationOutlet: UILabel! @IBOutlet var signupOutlet: UIButton! @IBOutlet var signingUpOulet: UIActivityIndicatorView! override func viewDidLoad() { super.viewDidLoad() let viewModel = GithubSignupViewModel1( input: ( username: usernameOutlet.rx.text.orEmpty.asObservable(), password: passwordOutlet.rx.text.orEmpty.asObservable(), repeatedPassword: repeatedPasswordOutlet.rx.text.orEmpty.asObservable(), loginTaps: signupOutlet.rx.tap.asObservable() ), dependency: ( API: GitHubDefaultAPI.sharedAPI, validationService: GitHubDefaultValidationService.sharedValidationService, wireframe: DefaultWireframe.shared ) ) // bind results to { viewModel.signupEnabled .subscribe(onNext: { [weak self] valid in self?.signupOutlet.isEnabled = valid self?.signupOutlet.alpha = valid ? 1.0 : 0.5 }) .disposed(by: disposeBag) viewModel.validatedUsername .bind(to: usernameValidationOutlet.rx.validationResult) .disposed(by: disposeBag) viewModel.validatedPassword .bind(to: passwordValidationOutlet.rx.validationResult) .disposed(by: disposeBag) viewModel.validatedPasswordRepeated .bind(to: repeatedPasswordValidationOutlet.rx.validationResult) .disposed(by: disposeBag) viewModel.signingIn .bind(to: signingUpOulet.rx.isAnimating) .disposed(by: disposeBag) viewModel.signedIn .subscribe(onNext: { signedIn in print("User signed in \(signedIn)") }) .disposed(by: disposeBag) // } let tapBackground = UITapGestureRecognizer() tapBackground.rx.event .subscribe(onNext: { [weak self] _ in self?.view.endEditing(true) }) .disposed(by: disposeBag) view.addGestureRecognizer(tapBackground) } } ================================================ FILE: RxExample/RxExample/Examples/GitHubSignup/UsingVanillaObservables/GithubSignupViewModel1.swift ================================================ // // GithubSignupViewModel1.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift /** This is example where view model is mutable. Some consider this to be MVVM, some consider this to be Presenter, or some other name. In the end, it doesn't matter. If you want to take a look at example using "immutable VMs", take a look at `TableViewWithEditingCommands` example. This uses vanilla rx observable sequences. Please note that there is no explicit state, outputs are defined using inputs and dependencies. Please note that there is no dispose bag, because no subscription is being made. */ class GithubSignupViewModel1 { // outputs { let validatedUsername: Observable let validatedPassword: Observable let validatedPasswordRepeated: Observable // Is signup button enabled let signupEnabled: Observable // Has user signed in let signedIn: Observable // Is signing process in progress let signingIn: Observable // } init( input: ( username: Observable, password: Observable, repeatedPassword: Observable, loginTaps: Observable ), dependency: ( API: GitHubAPI, validationService: GitHubValidationService, wireframe: Wireframe ) ) { let API = dependency.API let validationService = dependency.validationService let wireframe = dependency.wireframe /** Notice how no subscribe call is being made. Everything is just a definition. Pure transformation of input sequences to output sequences. */ validatedUsername = input.username .flatMapLatest { username in validationService.validateUsername(username) .observe(on: MainScheduler.instance) .catchAndReturn(.failed(message: "Error contacting server")) } .share(replay: 1) validatedPassword = input.password .map { password in validationService.validatePassword(password) } .share(replay: 1) validatedPasswordRepeated = Observable.combineLatest(input.password, input.repeatedPassword, resultSelector: validationService.validateRepeatedPassword) .share(replay: 1) let signingIn = ActivityIndicator() self.signingIn = signingIn.asObservable() let usernameAndPassword = Observable.combineLatest(input.username, input.password) { (username: $0, password: $1) } signedIn = input.loginTaps.withLatestFrom(usernameAndPassword) .flatMapLatest { pair in API.signup(pair.username, password: pair.password) .observe(on: MainScheduler.instance) .catchAndReturn(false) .trackActivity(signingIn) } .flatMapLatest { loggedIn -> Observable in let message = loggedIn ? "Mock: Signed in to GitHub." : "Mock: Sign in to GitHub failed" return wireframe.promptFor(message, cancelAction: "OK", actions: []) // propagate original value .map { _ in loggedIn } } .share(replay: 1) signupEnabled = Observable.combineLatest( validatedUsername, validatedPassword, validatedPasswordRepeated, signingIn.asObservable() ) { username, password, repeatPassword, signingIn in username.isValid && password.isValid && repeatPassword.isValid && !signingIn } .distinctUntilChanged() .share(replay: 1) } } ================================================ FILE: RxExample/RxExample/Examples/ImagePicker/ImagePicker.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/ImagePicker/ImagePickerController.swift ================================================ // // ImagePickerController.swift // RxExample // // Created by Segii Shulga on 1/5/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class ImagePickerController: ViewController { @IBOutlet var imageView: UIImageView! @IBOutlet var cameraButton: UIButton! @IBOutlet var galleryButton: UIButton! @IBOutlet var cropButton: UIButton! override func viewDidLoad() { super.viewDidLoad() cameraButton.isEnabled = UIImagePickerController.isSourceTypeAvailable(.camera) cameraButton.rx.tap .flatMapLatest { [weak self] _ in return UIImagePickerController.rx.createWithParent(self) { picker in picker.sourceType = .camera picker.allowsEditing = false } .flatMap(\.rx.didFinishPickingMediaWithInfo) .take(1) } .map { info in info[.originalImage] as? UIImage } .bind(to: imageView.rx.image) .disposed(by: disposeBag) galleryButton.rx.tap .flatMapLatest { [weak self] _ in return UIImagePickerController.rx.createWithParent(self) { picker in picker.sourceType = .photoLibrary picker.allowsEditing = false } .flatMap(\.rx.didFinishPickingMediaWithInfo) .take(1) } .map { info in info[.originalImage] as? UIImage } .bind(to: imageView.rx.image) .disposed(by: disposeBag) cropButton.rx.tap .flatMapLatest { [weak self] _ in return UIImagePickerController.rx.createWithParent(self) { picker in picker.sourceType = .photoLibrary picker.allowsEditing = true } .flatMap(\.rx.didFinishPickingMediaWithInfo) .take(1) } .map { info in info[.editedImage] as? UIImage } .bind(to: imageView.rx.image) .disposed(by: disposeBag) } } ================================================ FILE: RxExample/RxExample/Examples/ImagePicker/UIImagePickerController+RxCreate.swift ================================================ // // UIImagePickerController+RxCreate.swift // RxExample // // Created by Krunoslav Zaher on 1/10/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit func dismissViewController(_ viewController: UIViewController, animated: Bool) { if viewController.isBeingDismissed || viewController.isBeingPresented { DispatchQueue.main.async { dismissViewController(viewController, animated: animated) } return } if viewController.presentingViewController != nil { viewController.dismiss(animated: animated, completion: nil) } } extension Reactive where Base: UIImagePickerController { static func createWithParent(_ parent: UIViewController?, animated: Bool = true, configureImagePicker: @escaping (UIImagePickerController) throws -> Void = { _ in }) -> Observable { Observable.create { [weak parent] observer in let imagePicker = UIImagePickerController() let dismissDisposable = imagePicker.rx .didCancel .subscribe(onNext: { [weak imagePicker] _ in guard let imagePicker else { return } dismissViewController(imagePicker, animated: animated) }) do { try configureImagePicker(imagePicker) } catch { observer.on(.error(error)) return Disposables.create() } guard let parent else { observer.on(.completed) return Disposables.create() } parent.present(imagePicker, animated: animated, completion: nil) observer.on(.next(imagePicker)) return Disposables.create(dismissDisposable, Disposables.create { dismissViewController(imagePicker, animated: animated) }) } } } ================================================ FILE: RxExample/RxExample/Examples/Numbers/Numbers.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/Numbers/NumbersViewController.swift ================================================ // // NumbersViewController.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class NumbersViewController: ViewController { @IBOutlet var number1: UITextField! @IBOutlet var number2: UITextField! @IBOutlet var number3: UITextField! @IBOutlet var result: UILabel! override func viewDidLoad() { super.viewDidLoad() Observable.combineLatest(number1.rx.text.orEmpty, number2.rx.text.orEmpty, number3.rx.text.orEmpty) { textValue1, textValue2, textValue3 -> Int in return (Int(textValue1) ?? 0) + (Int(textValue2) ?? 0) + (Int(textValue3) ?? 0) } .map(\.description) .bind(to: result.rx.text) .disposed(by: disposeBag) } } ================================================ FILE: RxExample/RxExample/Examples/SimpleTableViewExample/SimpleTableViewExample.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/SimpleTableViewExample/SimpleTableViewExampleViewController.swift ================================================ // // SimpleTableViewExampleViewController.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class SimpleTableViewExampleViewController: ViewController, UITableViewDelegate { @IBOutlet var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() let items = Observable.just( (0 ..< 20).map { "\($0)" } ) items .bind(to: tableView.rx.items(cellIdentifier: "Cell", cellType: UITableViewCell.self)) { row, element, cell in cell.textLabel?.text = "\(element) @ row \(row)" } .disposed(by: disposeBag) tableView.rx .modelSelected(String.self) .subscribe(onNext: { value in DefaultWireframe.presentAlert("Tapped `\(value)`") }) .disposed(by: disposeBag) tableView.rx .itemAccessoryButtonTapped .subscribe(onNext: { indexPath in DefaultWireframe.presentAlert("Tapped Detail @ \(indexPath.section),\(indexPath.row)") }) .disposed(by: disposeBag) } } ================================================ FILE: RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectioned.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift ================================================ // // SimpleTableViewExampleSectionedViewController.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class SimpleTableViewExampleSectionedViewController: ViewController, UITableViewDelegate { @IBOutlet var tableView: UITableView! let dataSource = RxTableViewSectionedReloadDataSource>( configureCell: { _, tv, indexPath, element in let cell = tv.dequeueReusableCell(withIdentifier: "Cell")! cell.textLabel?.text = "\(element) @ row \(indexPath.row)" return cell }, titleForHeaderInSection: { dataSource, sectionIndex in dataSource[sectionIndex].model } ) override func viewDidLoad() { super.viewDidLoad() let dataSource = dataSource 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 ]) ]) items .bind(to: tableView.rx.items(dataSource: dataSource)) .disposed(by: disposeBag) tableView.rx .itemSelected .map { indexPath in (indexPath, dataSource[indexPath]) } .subscribe(onNext: { pair in DefaultWireframe.presentAlert("Tapped `\(pair.1)` @ \(pair.0)") }) .disposed(by: disposeBag) tableView.rx .setDelegate(self) .disposed(by: disposeBag) } // to prevent swipe to delete behavior func tableView(_: UITableView, editingStyleForRowAt _: IndexPath) -> UITableViewCell.EditingStyle { .none } func tableView(_: UITableView, heightForHeaderInSection _: Int) -> CGFloat { 40 } } ================================================ FILE: RxExample/RxExample/Examples/SimpleValidation/SimpleValidation.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/SimpleValidation/SimpleValidationViewController.swift ================================================ // // SimpleValidationViewController.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit private let minimalUsernameLength = 5 private let minimalPasswordLength = 5 class SimpleValidationViewController: ViewController { @IBOutlet var usernameOutlet: UITextField! @IBOutlet var usernameValidOutlet: UILabel! @IBOutlet var passwordOutlet: UITextField! @IBOutlet var passwordValidOutlet: UILabel! @IBOutlet var doSomethingOutlet: UIButton! override func viewDidLoad() { super.viewDidLoad() usernameValidOutlet.text = "Username has to be at least \(minimalUsernameLength) characters" passwordValidOutlet.text = "Password has to be at least \(minimalPasswordLength) characters" let usernameValid = usernameOutlet.rx.text.orEmpty .map { $0.count >= minimalUsernameLength } .share(replay: 1) // without this map would be executed once for each binding, rx is stateless by default let passwordValid = passwordOutlet.rx.text.orEmpty .map { $0.count >= minimalPasswordLength } .share(replay: 1) let everythingValid = Observable.combineLatest(usernameValid, passwordValid) { $0 && $1 } .share(replay: 1) usernameValid .bind(to: passwordOutlet.rx.isEnabled) .disposed(by: disposeBag) usernameValid .bind(to: usernameValidOutlet.rx.isHidden) .disposed(by: disposeBag) passwordValid .bind(to: passwordValidOutlet.rx.isHidden) .disposed(by: disposeBag) everythingValid .bind(to: doSomethingOutlet.rx.isEnabled) .disposed(by: disposeBag) doSomethingOutlet.rx.tap .subscribe(onNext: { [weak self] _ in self?.showAlert() }) .disposed(by: disposeBag) } func showAlert() { let alert = UIAlertController( title: "RxExample", message: "This is wonderful", preferredStyle: .alert ) let defaultAction = UIAlertAction( title: "Ok", style: .default, handler: nil ) alert.addAction(defaultAction) present(alert, animated: true, completion: nil) } } ================================================ FILE: RxExample/RxExample/Examples/TableViewPartialUpdates/NumberCell.swift ================================================ // // NumberCell.swift // RxExample // // Created by Krunoslav Zaher on 7/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import UIKit class NumberCell: UICollectionViewCell { @IBOutlet var value: UILabel? } ================================================ FILE: RxExample/RxExample/Examples/TableViewPartialUpdates/NumberSectionView.swift ================================================ // // NumberSectionView.swift // RxExample // // Created by Krunoslav Zaher on 7/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import UIKit class NumberSectionView: UICollectionReusableView { @IBOutlet var value: UILabel? } ================================================ FILE: RxExample/RxExample/Examples/TableViewPartialUpdates/PartialUpdates.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/TableViewPartialUpdates/PartialUpdatesViewController.swift ================================================ // // PartialUpdatesViewController.swift // RxExample // // Created by Krunoslav Zaher on 6/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit let generateCustomSize = true let runAutomatically = false let useAnimatedUpdateForCollectionView = false /** Code for reactive data sources is packed in [RxDataSources](https://github.com/RxSwiftCommunity/RxDataSources) project. */ class PartialUpdatesViewController: ViewController { @IBOutlet var reloadTableViewOutlet: UITableView! @IBOutlet var partialUpdatesTableViewOutlet: UITableView! @IBOutlet var partialUpdatesCollectionViewOutlet: UICollectionView! var timer: Foundation.Timer? static let initialValue: [AnimatableSectionModel] = [ NumberSection(model: "section 1", items: [1, 2, 3]), NumberSection(model: "section 2", items: [4, 5, 6]), NumberSection(model: "section 3", items: [7, 8, 9]), NumberSection(model: "section 4", items: [10, 11, 12]), NumberSection(model: "section 5", items: [13, 14, 15]), NumberSection(model: "section 6", items: [16, 17, 18]), NumberSection(model: "section 7", items: [19, 20, 21]), NumberSection(model: "section 8", items: [22, 23, 24]), NumberSection(model: "section 9", items: [25, 26, 27]), NumberSection(model: "section 10", items: [28, 29, 30]) ] static let firstChange: [AnimatableSectionModel]? = nil var generator = Randomizer(rng: PseudoRandomGenerator(4, 3), sections: initialValue) var sections = BehaviorRelay(value: [NumberSection]()) /** Code for reactive data sources is packed in [RxDataSources](https://github.com/RxSwiftCommunity/RxDataSources) project. */ override func viewDidLoad() { super.viewDidLoad() navigationItem.rightBarButtonItem?.accessibilityLabel = "Randomize" // For UICollectionView, if another animation starts before previous one is finished, it will sometimes crash :( // It's not deterministic (because Randomizer generates deterministic updates), and if you click fast // It sometimes will and sometimes wont crash, depending on tapping speed. // I guess you can maybe try some tricks with timeout, hard to tell :( That's on Apple side. if generateCustomSize { let nSections = UIApplication.isInUITest ? 5 : 10 let nItems = UIApplication.isInUITest ? 10 : 100 var sections = [AnimatableSectionModel]() for i in 0 ..< nSections { sections.append(AnimatableSectionModel(model: "Section \(i + 1)", items: Array(i * nItems ..< (i + 1) * nItems))) } generator = Randomizer(rng: PseudoRandomGenerator(4, 3), sections: sections) } #if runAutomatically timer = NSTimer.scheduledTimerWithTimeInterval(0.6, target: self, selector: "randomize", userInfo: nil, repeats: true) #endif sections.accept(generator.sections) let (configureCell, titleForSection) = PartialUpdatesViewController.tableViewDataSourceUI() let tvAnimatedDataSource = RxTableViewSectionedAnimatedDataSource( configureCell: configureCell, titleForHeaderInSection: titleForSection ) let reloadDataSource = RxTableViewSectionedReloadDataSource( configureCell: configureCell, titleForHeaderInSection: titleForSection ) sections.asObservable() .bind(to: partialUpdatesTableViewOutlet.rx.items(dataSource: tvAnimatedDataSource)) .disposed(by: disposeBag) sections.asObservable() .bind(to: reloadTableViewOutlet.rx.items(dataSource: reloadDataSource)) .disposed(by: disposeBag) // Collection view logic works, but when clicking fast because of internal bugs // collection view will sometimes get confused. I know what you are thinking, // but this is really not a bug in the algorithm. The generated changes are // pseudorandom, and crash happens depending on clicking speed. // // More info in `RxDataSourceStarterKit/README.md` // // If you want, turn this to true, just click slow :) // // While `useAnimatedUpdateForCollectionView` is false, you can click as fast as // you want, table view doesn't seem to have same issues like collection view. let (configureCollectionViewCell, configureSupplementaryView) = PartialUpdatesViewController.collectionViewDataSourceUI() #if useAnimatedUpdateForCollectionView let cvAnimatedDataSource = RxCollectionViewSectionedAnimatedDataSource( configureCell: configureCollectionViewCell, configureSupplementaryView: configureSupplementaryView ) sections.asObservable() .bind(to: partialUpdatesCollectionViewOutlet.rx.itemsWithDataSource(cvAnimatedDataSource)) .disposed(by: disposeBag) #else let cvReloadDataSource = RxCollectionViewSectionedReloadDataSource( configureCell: configureCollectionViewCell, configureSupplementaryView: configureSupplementaryView ) sections.asObservable() .bind(to: partialUpdatesCollectionViewOutlet.rx.items(dataSource: cvReloadDataSource)) .disposed(by: disposeBag) #endif // touches partialUpdatesCollectionViewOutlet.rx.itemSelected .subscribe(onNext: { [weak self] i in print("Let me guess, it's .... It's \(String(describing: self?.generator.sections[i.section].items[i.item])), isn't it? Yeah, I've got it.") }) .disposed(by: disposeBag) Observable.of(partialUpdatesTableViewOutlet.rx.itemSelected, reloadTableViewOutlet.rx.itemSelected) .merge() .subscribe(onNext: { [weak self] i in print("I have a feeling it's .... \(String(describing: self?.generator.sections[i.section].items[i.item]))?") }) .disposed(by: disposeBag) } override func viewWillDisappear(_: Bool) { timer?.invalidate() } @IBAction func randomize() { generator.randomize() var values = generator.sections // useful for debugging if PartialUpdatesViewController.firstChange != nil { values = PartialUpdatesViewController.firstChange! } // print(values) sections.accept(values) } } extension PartialUpdatesViewController { static func tableViewDataSourceUI() -> ( TableViewSectionedDataSource.ConfigureCell, TableViewSectionedDataSource.TitleForHeaderInSection ) { ( { _, tv, _, i in let cell = tv.dequeueReusableCell(withIdentifier: "Cell") ?? UITableViewCell(style: .default, reuseIdentifier: "Cell") cell.textLabel!.text = "\(i)" return cell }, { ds, section -> String? in return ds[section].model } ) } static func collectionViewDataSourceUI() -> ( CollectionViewSectionedDataSource.ConfigureCell, CollectionViewSectionedDataSource.ConfigureSupplementaryView ) { ( { _, cv, ip, i in let cell = cv.dequeueReusableCell(withReuseIdentifier: "Cell", for: ip) as! NumberCell cell.value!.text = "\(i)" return cell }, { ds, cv, kind, ip in let section = cv.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "Section", for: ip) as! NumberSectionView section.value!.text = "\(ds[ip.section].model)" return section } ) } } ================================================ FILE: RxExample/RxExample/Examples/TableViewWithEditingCommands/DetailViewController.swift ================================================ // // DetailViewController.swift // RxExample // // Created by carlos on 26/5/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift import UIKit class DetailViewController: ViewController { var user: User! let `$` = Dependencies.sharedDependencies @IBOutlet var imageView: UIImageView! @IBOutlet var label: UILabel! override func viewDidLoad() { super.viewDidLoad() imageView.makeRoundedCorners(40) let url = URL(string: user.imageURL)! let request = URLRequest(url: url) URLSession.shared.rx.data(request: request) .map { data in UIImage(data: data) } .observe(on: `$`.mainScheduler) .catchAndReturn(nil) .subscribe(imageView.rx.image) .disposed(by: disposeBag) label.text = user.firstName + " " + user.lastName } } ================================================ FILE: RxExample/RxExample/Examples/TableViewWithEditingCommands/RandomUserAPI.swift ================================================ // // RandomUserAPI.swift // RxExample // // Created by carlos on 28/5/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift class RandomUserAPI { static let sharedAPI = RandomUserAPI() private init() {} func getExampleUserResultSet() -> Observable<[User]> { let url = URL(string: "http://api.randomuser.me/?results=20")! return URLSession.shared.rx.json(url: url) .map { json in guard let json = json as? [String: AnyObject] else { throw exampleError("Casting to dictionary failed") } return try self.parseJSON(json) } } private func parseJSON(_ json: [String: AnyObject]) throws -> [User] { guard let results = json["results"] as? [[String: AnyObject]] else { throw exampleError("Can't find results") } let userParsingError = exampleError("Can't parse user") let searchResults: [User] = try results.map { user in let name = user["name"] as? [String: String] let pictures = user["picture"] as? [String: String] guard let firstName = name?["first"], let lastName = name?["last"], let imageURL = pictures?["medium"] else { throw userParsingError } let returnUser = User( firstName: firstName.capitalized, lastName: lastName.capitalized, imageURL: imageURL ) return returnUser } return searchResults } } ================================================ FILE: RxExample/RxExample/Examples/TableViewWithEditingCommands/TableViewWithEditingCommands.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/TableViewWithEditingCommands/TableViewWithEditingCommandsViewController.swift ================================================ // // TableViewWithEditingCommandsViewController.swift // RxExample // // Created by carlos on 26/5/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit /** Another way to do "MVVM". There are different ideas what does MVVM mean depending on your background. It's kind of similar like FRP. In the end, it doesn't really matter what jargon are you using. This would be the ideal case, but it's really hard to model complex views this way because it's not possible to observe partial model changes. */ struct TableViewEditingCommandsViewModel { let favoriteUsers: [User] let users: [User] static func executeCommand(state: TableViewEditingCommandsViewModel, _ command: TableViewEditingCommand) -> TableViewEditingCommandsViewModel { switch command { case let .setUsers(users): return TableViewEditingCommandsViewModel(favoriteUsers: state.favoriteUsers, users: users) case let .setFavoriteUsers(favoriteUsers): return TableViewEditingCommandsViewModel(favoriteUsers: favoriteUsers, users: state.users) case let .deleteUser(indexPath): var all = [state.favoriteUsers, state.users] all[indexPath.section].remove(at: indexPath.row) return TableViewEditingCommandsViewModel(favoriteUsers: all[0], users: all[1]) case let .moveUser(from, to): var all = [state.favoriteUsers, state.users] let user = all[from.section][from.row] all[from.section].remove(at: from.row) all[to.section].insert(user, at: to.row) return TableViewEditingCommandsViewModel(favoriteUsers: all[0], users: all[1]) } } } enum TableViewEditingCommand { case setUsers(users: [User]) case setFavoriteUsers(favoriteUsers: [User]) case deleteUser(indexPath: IndexPath) case moveUser(from: IndexPath, to: IndexPath) } class TableViewWithEditingCommandsViewController: ViewController, UITableViewDelegate { @IBOutlet var tableView: UITableView! let dataSource = TableViewWithEditingCommandsViewController.configureDataSource() override func viewDidLoad() { super.viewDidLoad() typealias Feedback = (ObservableSchedulerContext) -> Observable navigationItem.rightBarButtonItem = editButtonItem let superMan = User( firstName: "Super", lastName: "Man", imageURL: "http://nerdreactor.com/wp-content/uploads/2015/02/Superman1.jpg" ) let watMan = User( firstName: "Wat", lastName: "Man", imageURL: "http://www.iri.upc.edu/files/project/98/main.GIF" ) let loadFavoriteUsers = RandomUserAPI.sharedAPI .getExampleUserResultSet() .map(TableViewEditingCommand.setUsers) .catchAndReturn(TableViewEditingCommand.setUsers(users: [])) let initialLoadCommand = Observable.just(TableViewEditingCommand.setFavoriteUsers(favoriteUsers: [superMan, watMan])) .concat(loadFavoriteUsers) .observe(on: MainScheduler.instance) let uiFeedback: Feedback = bind(self) { this, state in let subscriptions = [ state.map { [ SectionModel(model: "Favorite Users", items: $0.favoriteUsers), SectionModel(model: "Normal Users", items: $0.users) ] } .bind(to: this.tableView.rx.items(dataSource: this.dataSource)), this.tableView.rx.itemSelected .withLatestFrom(state) { i, latestState in let all = [latestState.favoriteUsers, latestState.users] return all[i.section][i.row] } .subscribe(onNext: { [weak this] user in this?.showDetailsForUser(user) }) ] let events: [Observable] = [ this.tableView.rx.itemDeleted.map(TableViewEditingCommand.deleteUser), this.tableView.rx.itemMoved.map { val in TableViewEditingCommand.moveUser(from: val.0, to: val.1) } ] return Bindings(subscriptions: subscriptions, events: events) } let initialLoadFeedback: Feedback = { _ in initialLoadCommand } Observable.system( initialState: TableViewEditingCommandsViewModel(favoriteUsers: [], users: []), reduce: TableViewEditingCommandsViewModel.executeCommand, scheduler: MainScheduler.instance, scheduledFeedback: uiFeedback, initialLoadFeedback ) .subscribe() .disposed(by: disposeBag) // customization using delegate // RxTableViewDelegateBridge will forward correct messages tableView.rx.setDelegate(self) .disposed(by: disposeBag) } override func setEditing(_ editing: Bool, animated: Bool) { super.setEditing(editing, animated: animated) tableView.isEditing = editing } // MARK: Table view delegate ;) func tableView(_: UITableView, viewForHeaderInSection section: Int) -> UIView? { let title = dataSource[section] let label = UILabel(frame: CGRect.zero) // hacky I know :) label.text = " \(title)" label.textColor = UIColor.white label.backgroundColor = UIColor.darkGray label.alpha = 0.9 return label } func tableView(_: UITableView, heightForHeaderInSection _: Int) -> CGFloat { 40 } // MARK: Navigation private func showDetailsForUser(_ user: User) { let storyboard = UIStoryboard(name: "TableViewWithEditingCommands", bundle: Bundle(identifier: "RxExample-iOS")) let viewController = storyboard.instantiateViewController(withIdentifier: "DetailViewController") as! DetailViewController viewController.user = user navigationController?.pushViewController(viewController, animated: true) } // MARK: Work over Variable static func configureDataSource() -> RxTableViewSectionedReloadDataSource> { let dataSource = RxTableViewSectionedReloadDataSource>( configureCell: { (_, tv, _, user: User) in let cell = tv.dequeueReusableCell(withIdentifier: "Cell")! cell.textLabel?.text = user.firstName + " " + user.lastName return cell }, titleForHeaderInSection: { dataSource, sectionIndex in dataSource[sectionIndex].model }, canEditRowAtIndexPath: { _, _ in true }, canMoveRowAtIndexPath: { _, _ in true } ) return dataSource } } ================================================ FILE: RxExample/RxExample/Examples/TableViewWithEditingCommands/UIImageView+Extensions.swift ================================================ // // UIImageView+Extensions.swift // RxExample // // Created by carlos on 28/5/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import UIKit extension UIImageView { func makeRoundedCorners(_ radius: CGFloat) { layer.cornerRadius = radius layer.masksToBounds = true } func makeRoundedCorners() { makeRoundedCorners(frame.size.width / 2) } } ================================================ FILE: RxExample/RxExample/Examples/TableViewWithEditingCommands/User.swift ================================================ // // User.swift // RxExample // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // struct User: Equatable, CustomDebugStringConvertible { var firstName: String var lastName: String var imageURL: String init(firstName: String, lastName: String, imageURL: String) { self.firstName = firstName self.lastName = lastName self.imageURL = imageURL } } extension User { var debugDescription: String { firstName + " " + lastName } } func == (lhs: User, rhs: User) -> Bool { lhs.firstName == rhs.firstName && lhs.lastName == rhs.lastName && lhs.imageURL == rhs.imageURL } ================================================ FILE: RxExample/RxExample/Examples/UIPickerViewExample/CustomPickerViewAdapterExampleViewController.swift ================================================ // // CustomPickerViewAdapterExampleViewController.swift // RxExample // // Created by Sergey Shulga on 12/07/2017. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit final class CustomPickerViewAdapterExampleViewController: ViewController { @IBOutlet var pickerView: UIPickerView! override func viewDidLoad() { super.viewDidLoad() Observable.just([[1, 2, 3], [5, 8, 13], [21, 34]]) .bind(to: pickerView.rx.items(adapter: PickerViewViewAdapter())) .disposed(by: disposeBag) pickerView.rx.modelSelected(Int.self) .subscribe(onNext: { models in print(models) }) .disposed(by: disposeBag) } } final class PickerViewViewAdapter: NSObject, UIPickerViewDataSource, UIPickerViewDelegate, RxPickerViewDataSourceType, SectionedViewDataSourceType { typealias Element = [[CustomStringConvertible]] private var items: [[CustomStringConvertible]] = [] func model(at indexPath: IndexPath) throws -> Any { items[indexPath.section][indexPath.row] } func numberOfComponents(in _: UIPickerView) -> Int { items.count } func pickerView(_: UIPickerView, numberOfRowsInComponent component: Int) -> Int { items[component].count } func pickerView(_: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing _: UIView?) -> UIView { let label = UILabel() label.text = items[component][row].description label.textColor = UIColor.orange label.font = UIFont.preferredFont(forTextStyle: .headline) label.textAlignment = .center return label } func pickerView(_ pickerView: UIPickerView, observedEvent: Event) { Binder(self) { adapter, items in adapter.items = items pickerView.reloadAllComponents() }.on(observedEvent) } } ================================================ FILE: RxExample/RxExample/Examples/UIPickerViewExample/SimplePickerViewExampleViewController.swift ================================================ // // SimplePickerViewExampleViewController.swift // RxExample // // Created by sergdort on 10/07/2017. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit final class SimplePickerViewExampleViewController: ViewController { @IBOutlet var pickerView1: UIPickerView! @IBOutlet var pickerView2: UIPickerView! @IBOutlet var pickerView3: UIPickerView! override func viewDidLoad() { super.viewDidLoad() Observable.just([1, 2, 3]) .bind(to: pickerView1.rx.itemTitles) { _, item in "\(item)" } .disposed(by: disposeBag) pickerView1.rx.modelSelected(Int.self) .subscribe(onNext: { models in print("models selected 1: \(models)") }) .disposed(by: disposeBag) Observable.just([1, 2, 3]) .bind(to: pickerView2.rx.itemAttributedTitles) { _, item in NSAttributedString( string: "\(item)", attributes: [ NSAttributedString.Key.foregroundColor: UIColor.cyan, NSAttributedString.Key.underlineStyle: NSUnderlineStyle.double.rawValue ] ) } .disposed(by: disposeBag) pickerView2.rx.modelSelected(Int.self) .subscribe(onNext: { models in print("models selected 2: \(models)") }) .disposed(by: disposeBag) Observable.just([UIColor.red, UIColor.green, UIColor.blue]) .bind(to: pickerView3.rx.items) { _, item, _ in let view = UIView() view.backgroundColor = item return view } .disposed(by: disposeBag) pickerView3.rx.modelSelected(UIColor.self) .subscribe(onNext: { models in print("models selected 3: \(models)") }) .disposed(by: disposeBag) } } ================================================ FILE: RxExample/RxExample/Examples/UIPickerViewExample/SimpleUIPickerViewExample.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/ViewModels/SearchResultViewModel.swift ================================================ // // SearchResultViewModel.swift // RxExample // // Created by Krunoslav Zaher on 4/3/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift class SearchResultViewModel { let searchResult: WikipediaSearchResult var title: Driver var imageURLs: Driver<[URL]> let API = DefaultWikipediaAPI.sharedAPI let `$`: Dependencies = .sharedDependencies init(searchResult: WikipediaSearchResult) { self.searchResult = searchResult title = Driver.never() imageURLs = Driver.never() let URLs = configureImageURLs() imageURLs = URLs.asDriver(onErrorJustReturn: []) title = configureTitle(URLs).asDriver(onErrorJustReturn: "Error during fetching") } // private methods func configureTitle(_ imageURLs: Observable<[URL]>) -> Observable { let searchResult = searchResult let loadingValue: [URL]? = nil return imageURLs .map(Optional.init) .startWith(loadingValue) .map { URLs in if let URLs { "\(searchResult.title) (\(URLs.count) pictures)" } else { "\(searchResult.title) (loading…)" } } .retryOnBecomesReachable("⚠️ Service offline ⚠️", reachabilityService: `$`.reachabilityService) } func configureImageURLs() -> Observable<[URL]> { let searchResult = searchResult return API.articleContent(searchResult) .observe(on: `$`.backgroundWorkScheduler) .map { page in do { return try parseImageURLsfromHTMLSuitableForDisplay(page.text as NSString) } catch { return [] } } .share(replay: 1) } } ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/Views/CollectionViewImageCell.swift ================================================ // // CollectionViewImageCell.swift // RxExample // // Created by Krunoslav Zaher on 4/4/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit public class CollectionViewImageCell: UICollectionViewCell { @IBOutlet var imageOutlet: UIImageView! var disposeBag: DisposeBag? var downloadableImage: Observable? { didSet { let disposeBag = DisposeBag() downloadableImage? .asDriver(onErrorJustReturn: DownloadableImage.offlinePlaceholder) .drive(imageOutlet.rx.downloadableImageAnimated(CATransitionType.fade.rawValue)) .disposed(by: disposeBag) self.disposeBag = disposeBag } } override public func prepareForReuse() { super.prepareForReuse() downloadableImage = nil disposeBag = nil } deinit {} } ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaImageCell.xib ================================================ ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift ================================================ // // WikipediaSearchCell.swift // RxExample // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit public class WikipediaSearchCell: UITableViewCell { @IBOutlet var titleOutlet: UILabel! @IBOutlet var URLOutlet: UILabel! @IBOutlet var imagesOutlet: UICollectionView! var disposeBag: DisposeBag? let imageService = DefaultImageService.sharedImageService override public func awakeFromNib() { super.awakeFromNib() imagesOutlet.register(UINib(nibName: "WikipediaImageCell", bundle: nil), forCellWithReuseIdentifier: "ImageCell") } var viewModel: SearchResultViewModel? { didSet { let disposeBag = DisposeBag() guard let viewModel else { return } viewModel.title .map(Optional.init) .drive(titleOutlet.rx.text) .disposed(by: disposeBag) URLOutlet.text = viewModel.searchResult.URL.absoluteString let reachabilityService = Dependencies.sharedDependencies.reachabilityService viewModel.imageURLs .drive(imagesOutlet.rx.items(cellIdentifier: "ImageCell", cellType: CollectionViewImageCell.self)) { [weak self] _, url, cell in cell.downloadableImage = self?.imageService.imageFromURL(url, reachabilityService: reachabilityService) ?? Observable.empty() #if DEBUG // cell.installHackBecauseOfAutomationLeaksOnIOS10(firstViewThatDoesntLeak: self!.superview!.superview!) #endif } .disposed(by: disposeBag) self.disposeBag = disposeBag #if DEBUG installHackBecauseOfAutomationLeaksOnIOS10(firstViewThatDoesntLeak: superview!.superview!) #endif } } override public func prepareForReuse() { super.prepareForReuse() viewModel = nil disposeBag = nil } deinit {} } private protocol ReusableView: AnyObject { var disposeBag: DisposeBag? { get } func prepareForReuse() } extension WikipediaSearchCell: ReusableView {} extension CollectionViewImageCell: ReusableView {} private extension ReusableView { func installHackBecauseOfAutomationLeaksOnIOS10(firstViewThatDoesntLeak: UIView) { if #available(iOS 10.0, *) { if OSApplication.isInUITest { // !!! on iOS 10 automation tests leak cells, 🍻 automation team // !!! fugly workaround // ... no, I'm not assuming prepareForReuse is always called before init, this is // just a workaround because that method already has cleanup logic :( // Remember that leaking UISwitch? // https://github.com/ReactiveX/RxSwift/issues/842 // Well it just got some new buddies to hang around with firstViewThatDoesntLeak.rx.deallocated.subscribe(onNext: { [weak self] _ in self?.prepareForReuse() }) .disposed(by: disposeBag!) } } } } ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.xib ================================================ ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchViewController.swift ================================================ // // WikipediaSearchViewController.swift // RxExample // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit class WikipediaSearchViewController: ViewController { @IBOutlet var searchBar: UISearchBar! @IBOutlet var resultsTableView: UITableView! @IBOutlet var emptyView: UIView! override func awakeFromNib() { super.awakeFromNib() } // lifecycle override func viewDidLoad() { super.viewDidLoad() edgesForExtendedLayout = .all configureTableDataSource() configureKeyboardDismissesOnScroll() configureNavigateOnRowClick() configureActivityIndicatorsShow() } func configureTableDataSource() { resultsTableView.register(UINib(nibName: "WikipediaSearchCell", bundle: nil), forCellReuseIdentifier: "WikipediaSearchCell") resultsTableView.rowHeight = 194 resultsTableView.hideEmptyCells() // This is for clarity only, don't use static dependencies let API = DefaultWikipediaAPI.sharedAPI let results = searchBar.rx.text.orEmpty .asDriver() .throttle(.milliseconds(300)) .distinctUntilChanged() .flatMapLatest { query in API.getSearchResults(query) .retry(3) .retryOnBecomesReachable([], reachabilityService: Dependencies.sharedDependencies.reachabilityService) .startWith([]) // clears results on new search term .asDriver(onErrorJustReturn: []) } .map { results in results.map(SearchResultViewModel.init) } results .drive(resultsTableView.rx.items(cellIdentifier: "WikipediaSearchCell", cellType: WikipediaSearchCell.self)) { _, viewModel, cell in cell.viewModel = viewModel } .disposed(by: disposeBag) results .map { $0.count != 0 } .drive(emptyView.rx.isHidden) .disposed(by: disposeBag) } func configureKeyboardDismissesOnScroll() { let searchBar = searchBar resultsTableView.rx.contentOffset .asDriver() .drive(onNext: { _ in if searchBar?.isFirstResponder ?? false { _ = searchBar?.resignFirstResponder() } }) .disposed(by: disposeBag) } func configureNavigateOnRowClick() { let wireframe = DefaultWireframe.shared resultsTableView.rx.modelSelected(SearchResultViewModel.self) .asDriver() .drive(onNext: { searchResult in wireframe.open(url: searchResult.searchResult.URL) }) .disposed(by: disposeBag) } func configureActivityIndicatorsShow() { Driver.combineLatest( DefaultWikipediaAPI.sharedAPI.loadingWikipediaData, DefaultImageService.sharedImageService.loadingImage ) { $0 || $1 } .distinctUntilChanged() .drive(UIApplication.shared.rx.isNetworkActivityIndicatorVisible) .disposed(by: disposeBag) } } ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaAPI/WikipediaAPI.swift ================================================ // // WikipediaAPI.swift // RxExample // // Created by Krunoslav Zaher on 3/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift func apiError(_ error: String) -> NSError { NSError(domain: "WikipediaAPI", code: -1, userInfo: [NSLocalizedDescriptionKey: error]) } public let WikipediaParseError = apiError("Error during parsing") protocol WikipediaAPI { func getSearchResults(_ query: String) -> Observable<[WikipediaSearchResult]> func articleContent(_ searchResult: WikipediaSearchResult) -> Observable } class DefaultWikipediaAPI: WikipediaAPI { static let sharedAPI = DefaultWikipediaAPI() // Singleton let `$`: Dependencies = .sharedDependencies let loadingWikipediaData = ActivityIndicator() private init() {} private func JSON(_ url: URL) -> Observable { `$`.URLSession .rx.json(url: url) .trackActivity(loadingWikipediaData) } // Example wikipedia response http://en.wikipedia.org/w/api.php?action=opensearch&search=Rx func getSearchResults(_ query: String) -> Observable<[WikipediaSearchResult]> { let escapedQuery = query.URLEscaped let urlContent = "http://en.wikipedia.org/w/api.php?action=opensearch&search=\(escapedQuery)" let url = URL(string: urlContent)! return JSON(url) .observe(on: `$`.backgroundWorkScheduler) .map { json in guard let json = json as? [AnyObject] else { throw exampleError("Parsing error") } return try WikipediaSearchResult.parseJSON(json) } .observe(on: `$`.mainScheduler) } // http://en.wikipedia.org/w/api.php?action=parse&page=rx&format=json func articleContent(_ searchResult: WikipediaSearchResult) -> Observable { let escapedPage = searchResult.title.URLEscaped guard let url = URL(string: "http://en.wikipedia.org/w/api.php?action=parse&page=\(escapedPage)&format=json") else { return Observable.error(apiError("Can't create url")) } return JSON(url) .map { jsonResult in guard let json = jsonResult as? NSDictionary else { throw exampleError("Parsing error") } return try WikipediaPage.parseJSON(json) } .observe(on: `$`.mainScheduler) } } ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaAPI/WikipediaPage.swift ================================================ // // WikipediaPage.swift // RxExample // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift import Foundation struct WikipediaPage { let title: String let text: String // tedious parsing part static func parseJSON(_ json: NSDictionary) throws -> WikipediaPage { guard let parse = json.value(forKey: "parse"), let title = (parse as AnyObject).value(forKey: "title") as? String, let t = (parse as AnyObject).value(forKey: "text"), let text = (t as AnyObject).value(forKey: "*") as? String else { throw apiError("Error parsing page content") } return WikipediaPage(title: title, text: text) } } ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaAPI/WikipediaSearchResult.swift ================================================ // // WikipediaSearchResult.swift // RxExample // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift import Foundation struct WikipediaSearchResult: CustomDebugStringConvertible { let title: String let description: String let URL: Foundation.URL // tedious parsing part static func parseJSON(_ json: [AnyObject]) throws -> [WikipediaSearchResult] { let rootArrayTyped = json.compactMap { $0 as? [AnyObject] } guard rootArrayTyped.count == 3 else { throw WikipediaParseError } let (titles, descriptions, urls) = (rootArrayTyped[0], rootArrayTyped[1], rootArrayTyped[2]) let titleDescriptionAndUrl: [((AnyObject, AnyObject), AnyObject)] = Array(zip(zip(titles, descriptions), urls)) return try titleDescriptionAndUrl.map { result -> WikipediaSearchResult in let ((title, description), url) = result guard let titleString = title as? String, let descriptionString = description as? String, let urlString = url as? String, let URL = Foundation.URL(string: urlString) else { throw WikipediaParseError } return WikipediaSearchResult(title: titleString, description: descriptionString, URL: URL) } } } extension WikipediaSearchResult { var debugDescription: String { "[\(title)](\(URL))" } } ================================================ FILE: RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaSearch.storyboard ================================================ ================================================ FILE: RxExample/RxExample/Examples/macOS simple example/IntroductionExampleViewController.swift ================================================ // // IntroductionExampleViewController.swift // RxExample // // Created by Krunoslav Zaher on 5/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import AppKit import Cocoa import RxCocoa import RxSwift class IntroductionExampleViewController: ViewController { @IBOutlet var a: NSTextField! @IBOutlet var b: NSTextField! @IBOutlet var c: NSTextField! @IBOutlet var leftTextView: NSTextView! @IBOutlet var rightTextView: NSTextView! @IBOutlet var speechEnabled: NSButton! @IBOutlet var slider: NSSlider! @IBOutlet var sliderValue: NSTextField! @IBOutlet var disposeButton: NSButton! override func viewDidLoad() { super.viewDidLoad() // c = a + b let sum = Observable.combineLatest(a.rx.text.orEmpty, b.rx.text.orEmpty) { (a: String, b: String) -> (a: Int, b: Int) in return (Int(a) ?? 0, Int(b) ?? 0) } // bind result to UI sum .map { pair in "\(pair.a + pair.b)" } .bind(to: c.rx.text) .disposed(by: disposeBag) // Also, tell it out loud let speech = NSSpeechSynthesizer() Observable.combineLatest(sum, speechEnabled.rx.state) { (operands: $0, state: $1) } .flatMapLatest { pair -> Observable in let (a, b) = pair.operands if pair.state == NSControl.StateValue.off { return .empty() } return .just("\(a) + \(b) = \(a + b)") } .subscribe(onNext: { result in if speech.isSpeaking { speech.stopSpeaking() } speech.startSpeaking(result) }) .disposed(by: disposeBag) slider.rx.value .subscribe(onNext: { value in self.sliderValue.stringValue = "\(Int(value))" }) .disposed(by: disposeBag) sliderValue.rx.text.orEmpty .subscribe(onNext: { value in let doubleValue = value.toDouble() ?? 0.0 self.slider.doubleValue = doubleValue self.sliderValue.stringValue = "\(Int(doubleValue))" }) .disposed(by: disposeBag) // Synchronize text in two different textviews. let textViewValue = BehaviorRelay(value: "System Truth") _ = leftTextView.rx.string <-> textViewValue _ = rightTextView.rx.string <-> textViewValue textViewValue.asObservable() .subscribe(onNext: { value in print("Text: \(value)") }) .disposed(by: disposeBag) disposeButton.rx.tap .subscribe(onNext: { [weak self] _ in print("Unbind everything") self?.disposeBag = DisposeBag() }) .disposed(by: disposeBag) } } ================================================ FILE: RxExample/RxExample/Feedbacks.swift ================================================ // // Feedbacks.swift // RxExample // // Created by Krunoslav Zaher on 5/1/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift // Taken from RxFeedback repo /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns a value, that value is being passed into `effects` lambda to decide which effects should be performed. In case new `query` is different from the previous one, new effects are calculated by using `effects` lambda and then performed. When `query` returns `nil`, feedback loops doesn't perform any effect. - parameter query: Part of state that controls feedback loop. - parameter areEqual: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query result. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Query?, areEqual: @escaping (Query, Query) -> Bool, effects: @escaping (Query) -> Observable ) -> (ObservableSchedulerContext) -> Observable { { state in state.map(query) .distinctUntilChanged { lhs, rhs in switch (lhs, rhs) { case (.none, .none): true case (.none, .some): false case (.some, .none): false case let (.some(lhs), .some(rhs)): areEqual(lhs, rhs) } } .flatMapLatest { (control: Query?) -> Observable in guard let control else { return Observable.empty() } return effects(control) .enqueue(state.scheduler) } } } /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns a value, that value is being passed into `effects` lambda to decide which effects should be performed. In case new `query` is different from the previous one, new effects are calculated by using `effects` lambda and then performed. When `query` returns `nil`, feedback loops doesn't perform any effect. - parameter query: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query result. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Query?, effects: @escaping (Query) -> Observable ) -> (ObservableSchedulerContext) -> Observable { react(query: query, areEqual: { $0 == $1 }, effects: effects) } /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns a value, that value is being passed into `effects` lambda to decide which effects should be performed. In case new `query` is different from the previous one, new effects are calculated by using `effects` lambda and then performed. When `query` returns `nil`, feedback loops doesn't perform any effect. - parameter query: Part of state that controls feedback loop. - parameter areEqual: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query result. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Query?, areEqual: @escaping (Query, Query) -> Bool, effects: @escaping (Query) -> Signal ) -> (Driver) -> Signal { { state in let observableSchedulerContext = ObservableSchedulerContext( source: state.asObservable(), scheduler: Signal.SharingStrategy.scheduler.async ) return react(query: query, areEqual: areEqual, effects: { effects($0).asObservable() })(observableSchedulerContext) .asSignal(onErrorSignalWith: .empty()) } } /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns a value, that value is being passed into `effects` lambda to decide which effects should be performed. In case new `query` is different from the previous one, new effects are calculated by using `effects` lambda and then performed. When `query` returns `nil`, feedback loops doesn't perform any effect. - parameter query: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query result. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Query?, effects: @escaping (Query) -> Signal ) -> (Driver) -> Signal { { state in let observableSchedulerContext = ObservableSchedulerContext( source: state.asObservable(), scheduler: Signal.SharingStrategy.scheduler.async ) return react(query: query, effects: { effects($0).asObservable() })(observableSchedulerContext) .asSignal(onErrorSignalWith: .empty()) } } /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns a value, that value is being passed into `effects` lambda to decide which effects should be performed. In case new `query` is different from the previous one, new effects are calculated by using `effects` lambda and then performed. When `query` returns `nil`, feedback loops doesn't perform any effect. - parameter query: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query result. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Query?, effects: @escaping (Query) -> Observable ) -> (ObservableSchedulerContext) -> Observable { { state in state.map(query) .distinctUntilChanged { $0 != nil } .flatMapLatest { (control: Query?) -> Observable in guard let control else { return Observable.empty() } return effects(control) .enqueue(state.scheduler) } } } /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns a value, that value is being passed into `effects` lambda to decide which effects should be performed. In case new `query` is different from the previous one, new effects are calculated by using `effects` lambda and then performed. When `query` returns `nil`, feedback loops doesn't perform any effect. - parameter query: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query result. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Query?, effects: @escaping (Query) -> Signal ) -> (Driver) -> Signal { { state in let observableSchedulerContext = ObservableSchedulerContext( source: state.asObservable(), scheduler: Signal.SharingStrategy.scheduler.async ) return react(query: query, effects: { effects($0).asObservable() })(observableSchedulerContext) .asSignal(onErrorSignalWith: .empty()) } } /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns some set of values, each value is being passed into `effects` lambda to decide which effects should be performed. * Effects are not interrupted for elements in the new `query` that were present in the `old` query. * Effects are cancelled for elements present in `old` query but not in `new` query. * In case new elements are present in `new` query (and not in `old` query) they are being passed to the `effects` lambda and resulting effects are being performed. - parameter query: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query element. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Set, effects: @escaping (Query) -> Observable ) -> (ObservableSchedulerContext) -> Observable { { state in let query = state.map(query) .share(replay: 1) let newQueries = Observable.zip(query, query.startWith(Set())) { $0.subtracting($1) } let asyncScheduler = state.scheduler.async return newQueries.flatMap { controls in Observable.merge(controls.map { control -> Observable in return effects(control) .enqueue(state.scheduler) .takeUntilWithCompletedAsync(query.filter { !$0.contains(control) }, scheduler: asyncScheduler) }) } } } private extension ObservableType { // This is important to avoid reentrancy issues. Completed event is only used for cleanup func takeUntilWithCompletedAsync(_ other: Observable, scheduler: ImmediateSchedulerType) -> Observable { // this little piggy will delay completed event let completeAsSoonAsPossible = Observable.empty().observe(on: scheduler) return other .take(1) .map { _ in completeAsSoonAsPossible } // this little piggy will ensure self is being run first .startWith(asObservable()) // this little piggy will ensure that new events are being blocked immediately .switchLatest() } } /** * State: State type of the system. * Query: Subset of state used to control the feedback loop. When `query` returns some set of values, each value is being passed into `effects` lambda to decide which effects should be performed. * Effects are not interrupted for elements in the new `query` that were present in the `old` query. * Effects are cancelled for elements present in `old` query but not in `new` query. * In case new elements are present in `new` query (and not in `old` query) they are being passed to the `effects` lambda and resulting effects are being performed. - parameter query: Part of state that controls feedback loop. - parameter effects: Chooses which effects to perform for certain query element. - returns: Feedback loop performing the effects. */ public func react( query: @escaping (State) -> Set, effects: @escaping (Query) -> Signal ) -> (Driver) -> Signal { { (state: Driver) -> Signal in let observableSchedulerContext = ObservableSchedulerContext( source: state.asObservable(), scheduler: Signal.SharingStrategy.scheduler.async ) return react(query: query, effects: { effects($0).asObservable() })(observableSchedulerContext) .asSignal(onErrorSignalWith: .empty()) } } private extension Observable { func enqueue(_ scheduler: ImmediateSchedulerType) -> Observable { self // observe on is here because results should be cancelable .observe(on: scheduler.async) // subscribe on is here because side-effects also need to be cancelable // (smooths out any glitches caused by start-cancel immediately) .subscribe(on: scheduler.async) } } /** Contains subscriptions and events. - `subscriptions` map a system state to UI presentation. - `events` map events from UI to events of a given system. */ public class Bindings: Disposable { private let subscriptions: [Disposable] fileprivate let events: [Observable] /** - parameters: - subscriptions: mappings of a system state to UI presentation. - events: mappings of events from UI to events of a given system */ public init(subscriptions: [Disposable], events: [Observable]) { self.subscriptions = subscriptions self.events = events } /** - parameters: - subscriptions: mappings of a system state to UI presentation. - events: mappings of events from UI to events of a given system */ public init(subscriptions: [Disposable], events: [Signal]) { self.subscriptions = subscriptions self.events = events.map { $0.asObservable() } } public func dispose() { for subscription in subscriptions { subscription.dispose() } } } /** Bi-directional binding of a system State to external state machine and events from it. */ public func bind(_ bindings: @escaping (ObservableSchedulerContext) -> (Bindings)) -> (ObservableSchedulerContext) -> Observable { { (state: ObservableSchedulerContext) -> Observable in return Observable.using { () -> Bindings in return bindings(state) } observableFactory: { (bindings: Bindings) -> Observable in return Observable.merge(bindings.events) .enqueue(state.scheduler) } } } /** Bi-directional binding of a system State to external state machine and events from it. Strongify owner. */ public func bind(_ owner: WeakOwner, _ bindings: @escaping (WeakOwner, ObservableSchedulerContext) -> (Bindings)) -> (ObservableSchedulerContext) -> Observable where WeakOwner: AnyObject { bind(bindingsStrongify(owner, bindings)) } /** Bi-directional binding of a system State to external state machine and events from it. */ public func bind(_ bindings: @escaping (Driver) -> (Bindings)) -> (Driver) -> Signal { { (state: Driver) -> Signal in return Observable.using { () -> Bindings in return bindings(state) } observableFactory: { (bindings: Bindings) -> Observable in return Observable.merge(bindings.events) } .enqueue(Signal.SharingStrategy.scheduler) .asSignal(onErrorSignalWith: .empty()) } } /** Bi-directional binding of a system State to external state machine and events from it. Strongify owner. */ public func bind(_ owner: WeakOwner, _ bindings: @escaping (WeakOwner, Driver) -> (Bindings)) -> (Driver) -> Signal where WeakOwner: AnyObject { bind(bindingsStrongify(owner, bindings)) } private func bindingsStrongify(_ owner: WeakOwner, _ bindings: @escaping (WeakOwner, O) -> (Bindings)) -> (O) -> (Bindings) where WeakOwner: AnyObject { { [weak owner] state -> Bindings in guard let strongOwner = owner else { return Bindings(subscriptions: [], events: [Observable]()) } return bindings(strongOwner, state) } } ================================================ FILE: RxExample/RxExample/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "20x20", "scale" : "2x" }, { "idiom" : "iphone", "size" : "20x20", "scale" : "3x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "1x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "Icon-Small@3x.png", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon-40@2x.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon-60@2x.png", "scale" : "3x" }, { "idiom" : "iphone", "size" : "57x57", "scale" : "1x" }, { "idiom" : "iphone", "size" : "57x57", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "Icon-60@2x-1.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "Icon-60@3x.png", "scale" : "3x" }, { "idiom" : "ipad", "size" : "20x20", "scale" : "1x" }, { "idiom" : "ipad", "size" : "20x20", "scale" : "2x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "Icon-Small.png", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon-40.png", "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon-40@2x-1.png", "scale" : "2x" }, { "idiom" : "ipad", "size" : "50x50", "scale" : "1x" }, { "idiom" : "ipad", "size" : "50x50", "scale" : "2x" }, { "idiom" : "ipad", "size" : "72x72", "scale" : "1x" }, { "idiom" : "ipad", "size" : "72x72", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon-76.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon-76@2x.png", "scale" : "2x" }, { "size" : "83.5x83.5", "idiom" : "ipad", "filename" : "Rx_Logo-iPad.png", "scale" : "2x" }, { "size" : "1024x1024", "idiom" : "ios-marketing", "filename" : "Rx_Logo_L.png", "scale" : "1x" }, { "size" : "24x24", "idiom" : "watch", "scale" : "2x", "role" : "notificationCenter", "subtype" : "38mm" }, { "size" : "27.5x27.5", "idiom" : "watch", "scale" : "2x", "role" : "notificationCenter", "subtype" : "42mm" }, { "size" : "29x29", "idiom" : "watch", "filename" : "Icon-Small@2x-1.png", "role" : "companionSettings", "scale" : "2x" }, { "size" : "29x29", "idiom" : "watch", "role" : "companionSettings", "scale" : "3x" }, { "size" : "40x40", "idiom" : "watch", "scale" : "2x", "role" : "appLauncher", "subtype" : "38mm" }, { "size" : "44x44", "idiom" : "watch", "scale" : "2x", "role" : "appLauncher", "subtype" : "40mm" }, { "size" : "50x50", "idiom" : "watch", "scale" : "2x", "role" : "appLauncher", "subtype" : "44mm" }, { "size" : "86x86", "idiom" : "watch", "scale" : "2x", "role" : "quickLook", "subtype" : "38mm" }, { "size" : "98x98", "idiom" : "watch", "scale" : "2x", "role" : "quickLook", "subtype" : "42mm" }, { "size" : "108x108", "idiom" : "watch", "scale" : "2x", "role" : "quickLook", "subtype" : "44mm" }, { "idiom" : "watch-marketing", "size" : "1024x1024", "scale" : "1x" }, { "idiom" : "mac", "size" : "16x16", "scale" : "1x" }, { "idiom" : "mac", "size" : "16x16", "scale" : "2x" }, { "idiom" : "mac", "size" : "32x32", "scale" : "1x" }, { "idiom" : "mac", "size" : "32x32", "scale" : "2x" }, { "idiom" : "mac", "size" : "128x128", "scale" : "1x" }, { "idiom" : "mac", "size" : "128x128", "scale" : "2x" }, { "idiom" : "mac", "size" : "256x256", "scale" : "1x" }, { "idiom" : "mac", "size" : "256x256", "scale" : "2x" }, { "size" : "512x512", "idiom" : "mac", "filename" : "Rx_Logo_M.png", "scale" : "1x" }, { "idiom" : "mac", "size" : "512x512", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: RxExample/RxExample/Images.xcassets/ReactiveExtensionsLogo.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "scale" : "2x", "filename" : "ReactiveExtensionsLogo.png" }, { "idiom" : "universal", "scale" : "3x", "filename" : "ReactiveExtensionsLogo-2.png" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: RxExample/RxExample/Info-iOS.plist ================================================ UIUserInterfaceStyle Light CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS NSAppTransportSecurity NSAllowsArbitraryLoads NSCameraUsageDescription We need camera NSLocationAlwaysAndWhenInUseUsageDescription We need location NSLocationAlwaysUsageDescription We need location NSLocationWhenInUseUsageDescription We need location NSPhotoLibraryUsageDescription We need photo library UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: RxExample/RxExample/Info-macOS.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 NSMainStoryboardFile Main NSPrincipalClass NSApplication ================================================ FILE: RxExample/RxExample/Lenses.swift ================================================ // // Lenses.swift // RxExample // // Created by Krunoslav Zaher on 5/20/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // // These are kind of "Swift" lenses. We don't need to generate a lot of code this way and can just use Swift `var`. protocol Mutable {} extension Mutable { func mutateOne(transform: (inout Self) -> some Any) -> Self { var newSelf = self _ = transform(&newSelf) return newSelf } func mutate(transform: (inout Self) -> Void) -> Self { var newSelf = self transform(&newSelf) return newSelf } func mutate(transform: (inout Self) throws -> Void) rethrows -> Self { var newSelf = self try transform(&newSelf) return newSelf } } ================================================ FILE: RxExample/RxExample/Observable+Extensions.swift ================================================ // // Observable+Extensions.swift // RxExample // // Created by Krunoslav Zaher on 3/14/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift // taken from RxFeedback repo public extension ObservableType where Element == Any { /// Feedback loop typealias Feedback = (ObservableSchedulerContext) -> Observable typealias FeedbackLoop = Feedback /** System simulation will be started upon subscription and stopped after subscription is disposed. System state is represented as a `State` parameter. Events are represented by `Event` parameter. - parameter initialState: Initial state of the system. - parameter reduce: Calculates new system state from existing state and a transition event (system integrator, reducer). - parameter scheduler: Scheduler on which observable sequence receives elements - parameter scheduledFeedback: Feedback loops that produce events depending on current system state. - returns: Current state of the system. */ static func system( initialState: State, reduce: @escaping (State, Event) -> State, scheduler: ImmediateSchedulerType, scheduledFeedback: [Feedback] ) -> Observable { Observable.deferred { let replaySubject = ReplaySubject.create(bufferSize: 1) let asyncScheduler = scheduler.async let events: Observable = Observable.merge(scheduledFeedback.map { feedback in let state = ObservableSchedulerContext(source: replaySubject.asObservable(), scheduler: asyncScheduler) return feedback(state) }) // This is protection from accidental ignoring of scheduler so // reentracy errors can be avoided .observe(on: CurrentThreadScheduler.instance) return events.scan(initialState, accumulator: reduce) .do(onNext: { output in replaySubject.onNext(output) }, onSubscribed: { replaySubject.onNext(initialState) }) .subscribe(on: scheduler) .startWith(initialState) .observe(on: scheduler) } } static func system( initialState: State, reduce: @escaping (State, Event) -> State, scheduler: ImmediateSchedulerType, scheduledFeedback: Feedback... ) -> Observable { system(initialState: initialState, reduce: reduce, scheduler: scheduler, scheduledFeedback: scheduledFeedback) } } public extension SharedSequenceConvertibleType where Element == Any, SharingStrategy == DriverSharingStrategy { /// Feedback loop typealias Feedback = (Driver) -> Signal /** System simulation will be started upon subscription and stopped after subscription is disposed. System state is represented as a `State` parameter. Events are represented by `Event` parameter. - parameter initialState: Initial state of the system. - parameter reduce: Calculates new system state from existing state and a transition event (system integrator, reducer). - parameter feedback: Feedback loops that produce events depending on current system state. - returns: Current state of the system. */ static func system( initialState: State, reduce: @escaping (State, Event) -> State, feedback: [Feedback] ) -> Driver { let observableFeedbacks: [(ObservableSchedulerContext) -> Observable] = feedback.map { feedback in { sharedSequence in feedback(sharedSequence.source.asDriver(onErrorDriveWith: Driver.empty())) .asObservable() } } return Observable.system( initialState: initialState, reduce: reduce, scheduler: SharingStrategy.scheduler, scheduledFeedback: observableFeedbacks ) .asDriver(onErrorDriveWith: .empty()) } static func system( initialState: State, reduce: @escaping (State, Event) -> State, feedback: Feedback... ) -> Driver { system(initialState: initialState, reduce: reduce, feedback: feedback) } } extension ImmediateSchedulerType { var async: ImmediateSchedulerType { // This is a hack because of reentrancy. We need to make sure events are being sent async. // In case MainScheduler is being used MainScheduler.asyncInstance is used to make sure state is modified async. // If there is some unknown scheduler instance (like TestScheduler), just use it. (self as? MainScheduler).map { _ in MainScheduler.asyncInstance } ?? self } } /// Tuple of observable sequence and corresponding scheduler context on which that observable /// sequence receives elements. public struct ObservableSchedulerContext: ObservableType { public typealias Element = Element /// Source observable sequence public let source: Observable /// Scheduler on which observable sequence receives elements public let scheduler: ImmediateSchedulerType /// Initializes self with source observable sequence and scheduler /// /// - parameter source: Source observable sequence. /// - parameter scheduler: Scheduler on which source observable sequence receives elements. public init(source: Observable, scheduler: ImmediateSchedulerType) { self.source = source self.scheduler = scheduler } public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { source.subscribe(observer) } } ================================================ FILE: RxExample/RxExample/Operators.swift ================================================ // // Operators.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift #if os(iOS) import UIKit #elseif os(macOS) import AppKit #endif // Two way binding operator between control property and relay, that's all it takes. infix operator <->: DefaultPrecedence #if os(iOS) func nonMarkedText(_ textInput: UITextInput) -> String? { let start = textInput.beginningOfDocument let end = textInput.endOfDocument guard let rangeAll = textInput.textRange(from: start, to: end), let text = textInput.text(in: rangeAll) else { return nil } guard let markedTextRange = textInput.markedTextRange else { return text } guard let startRange = textInput.textRange(from: start, to: markedTextRange.start), let endRange = textInput.textRange(from: markedTextRange.end, to: end) else { return text } return (textInput.text(in: startRange) ?? "") + (textInput.text(in: endRange) ?? "") } func <-> (textInput: TextInput, relay: BehaviorRelay) -> Disposable { let bindToUIDisposable = relay.bind(to: textInput.text) let bindToRelay = textInput.text .subscribe(onNext: { [weak base = textInput.base] _ in guard let base else { return } let nonMarkedTextValue = nonMarkedText(base) /** In some cases `textInput.textRangeFromPosition(start, toPosition: end)` will return nil even though the underlying value is not nil. This appears to be an Apple bug. If it's not, and we are doing something wrong, please let us know. The can be reproduced easily if replace bottom code with if nonMarkedTextValue != relay.value { relay.accept(nonMarkedTextValue ?? "") } and you hit "Done" button on keyboard. */ if let nonMarkedTextValue, nonMarkedTextValue != relay.value { relay.accept(nonMarkedTextValue) } }, onCompleted: { bindToUIDisposable.dispose() }) return Disposables.create(bindToUIDisposable, bindToRelay) } #endif func <-> (property: ControlProperty, relay: BehaviorRelay) -> Disposable { if T.self == String.self { #if DEBUG && !os(macOS) fatalError( "It is ok to delete this message, but this is here to warn that you are maybe trying to bind to some `rx.text` property directly to relay.\n" + "That will usually work ok, but for some languages that use IME, that simplistic method could cause unexpected issues because it will return intermediate results while text is being inputed.\n" + "REMEDY: Just use `textField <-> relay` instead of `textField.rx.text <-> relay`.\n" + "Find out more here: https://github.com/ReactiveX/RxSwift/issues/649\n" ) #endif } let bindToUIDisposable = relay.bind(to: property) let bindToRelay = property .subscribe(onNext: { n in relay.accept(n) }, onCompleted: { bindToUIDisposable.dispose() }) return Disposables.create(bindToUIDisposable, bindToRelay) } ================================================ FILE: RxExample/RxExample/RxExample.xcdatamodeld/.xccurrentversion ================================================ ================================================ FILE: RxExample/RxExample/RxExample.xcdatamodeld/RxExample.xcdatamodel/contents ================================================ ================================================ FILE: RxExample/RxExample/Services/ActivityIndicator.swift ================================================ // // ActivityIndicator.swift // RxExample // // Created by Krunoslav Zaher on 10/18/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift private struct ActivityToken: ObservableConvertibleType, Disposable { private let _source: Observable private let _dispose: Cancelable init(source: Observable, disposeAction: @escaping () -> Void) { _source = source _dispose = Disposables.create(with: disposeAction) } func dispose() { _dispose.dispose() } func asObservable() -> Observable { _source } } /** Enables monitoring of sequence computation. If there is at least one sequence computation in progress, `true` will be sent. When all activities complete `false` will be sent. */ public class ActivityIndicator: SharedSequenceConvertibleType { public typealias Element = Bool public typealias SharingStrategy = DriverSharingStrategy private let _lock = NSRecursiveLock() private let _relay = BehaviorRelay(value: 0) private let _loading: SharedSequence public init() { _loading = _relay.asDriver() .map { $0 > 0 } .distinctUntilChanged() } fileprivate func trackActivityOfObservable(_ source: Source) -> Observable { Observable.using({ () -> ActivityToken in self.increment() return ActivityToken(source: source.asObservable(), disposeAction: self.decrement) }) { t in t.asObservable() } } private func increment() { _lock.lock() _relay.accept(_relay.value + 1) _lock.unlock() } private func decrement() { _lock.lock() _relay.accept(_relay.value - 1) _lock.unlock() } public func asSharedSequence() -> SharedSequence { _loading } } public extension ObservableConvertibleType { func trackActivity(_ activityIndicator: ActivityIndicator) -> Observable { activityIndicator.trackActivityOfObservable(self) } } ================================================ FILE: RxExample/RxExample/Services/DownloadableImage.swift ================================================ // // DownloadableImage.swift // RxExample // // Created by Vodovozov Gleb on 10/31/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift #if os(iOS) import UIKit #elseif os(macOS) import Cocoa #endif enum DownloadableImage { case content(image: Image) case offlinePlaceholder } ================================================ FILE: RxExample/RxExample/Services/GeolocationService.swift ================================================ // // GeolocationService.swift // RxExample // // Created by Carlos García on 19/01/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import CoreLocation import RxCocoa import RxSwift class GeolocationService { static let instance = GeolocationService() private(set) var authorized: Driver private(set) var location: Driver private let locationManager = CLLocationManager() private init() { locationManager.distanceFilter = kCLDistanceFilterNone locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation authorized = Observable.deferred { [weak locationManager] in let status = CLLocationManager.authorizationStatus() guard let locationManager else { return Observable.just(status) } return locationManager .rx.didChangeAuthorizationStatus .startWith(status) } .asDriver(onErrorJustReturn: CLAuthorizationStatus.notDetermined) .map { switch $0 { case .authorizedAlways: true case .authorizedWhenInUse: true default: false } } location = locationManager.rx.didUpdateLocations .asDriver(onErrorJustReturn: []) .flatMap { $0.last.map(Driver.just) ?? Driver.empty() } .map(\.coordinate) locationManager.requestAlwaysAuthorization() locationManager.startUpdatingLocation() } } ================================================ FILE: RxExample/RxExample/Services/HtmlParsing.swift ================================================ // // HtmlParsing.swift // RxExample // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation func parseImageURLsfromHTML(_ html: NSString) throws -> [URL] { let regularExpression = try NSRegularExpression(pattern: "]*src=\"([^\"]+)\"[^>]*>", options: []) let matches = regularExpression.matches(in: html as String, options: [], range: NSMakeRange(0, html.length)) return matches.map { match -> URL? in if match.numberOfRanges != 2 { return nil } let url = html.substring(with: match.range(at: 1)) var absoluteURLString = url if url.hasPrefix("//") { absoluteURLString = "http:" + url } return URL(string: absoluteURLString) }.filter { $0 != nil }.map { $0! } } func parseImageURLsfromHTMLSuitableForDisplay(_ html: NSString) throws -> [URL] { try parseImageURLsfromHTML(html).filter { $0.absoluteString.range(of: ".svg.") == nil } } ================================================ FILE: RxExample/RxExample/Services/ImageService.swift ================================================ // // ImageService.swift // RxExample // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift #if os(iOS) import UIKit #elseif os(macOS) import Cocoa #endif protocol ImageService { func imageFromURL(_ url: URL, reachabilityService: ReachabilityService) -> Observable } class DefaultImageService: ImageService { static let sharedImageService = DefaultImageService() // Singleton let `$`: Dependencies = .sharedDependencies // 1st level cache private let _imageCache = NSCache() // 2nd level cache private let _imageDataCache = NSCache() let loadingImage = ActivityIndicator() private init() { // cost is approx memory usage _imageDataCache.totalCostLimit = 10 * MB _imageCache.countLimit = 20 } private func decodeImage(_ imageData: Data) -> Observable { Observable.just(imageData) .observe(on: `$`.backgroundWorkScheduler) .map { data in guard let image = Image(data: data) else { // some error throw apiError("Decoding image error") } return image.forceLazyImageDecompression() } } private func _imageFromURL(_ url: URL) -> Observable { Observable.deferred { let maybeImage = self._imageCache.object(forKey: url as AnyObject) as? Image let decodedImage: Observable // best case scenario, it's already decoded an in memory if let image = maybeImage { decodedImage = Observable.just(image) } else { let cachedData = self._imageDataCache.object(forKey: url as AnyObject) as? Data // does image data cache contain anything if let cachedData { decodedImage = self.decodeImage(cachedData) } else { // fetch from network decodedImage = self.`$`.URLSession.rx.data(request: URLRequest(url: url)) .do(onNext: { data in self._imageDataCache.setObject(data as AnyObject, forKey: url as AnyObject) }) .flatMap(self.decodeImage) .trackActivity(self.loadingImage) } } return decodedImage.do(onNext: { image in self._imageCache.setObject(image, forKey: url as AnyObject) }) } } /** Service that tries to download image from URL. In case there were some problems with network connectivity and image wasn't downloaded, automatic retry will be fired when networks becomes available. After image is successfully downloaded, sequence is completed. */ func imageFromURL(_ url: URL, reachabilityService: ReachabilityService) -> Observable { _imageFromURL(url) .map { DownloadableImage.content(image: $0) } .retryOnBecomesReachable(DownloadableImage.offlinePlaceholder, reachabilityService: reachabilityService) .startWith(.content(image: Image())) } } ================================================ FILE: RxExample/RxExample/Services/PseudoRandomGenerator.swift ================================================ // // PseudoRandomGenerator.swift // RxExample // // Created by Krunoslav Zaher on 6/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // // https://en.wikipedia.org/wiki/Random_number_generation class PseudoRandomGenerator { var m_w: UInt32 /* must not be zero, nor 0x464fffff */ var m_z: UInt32 /* must not be zero, nor 0x9068ffff */ init(_ m_w: UInt32, _ m_z: UInt32) { self.m_w = m_w self.m_z = m_z } func get_random() -> Int { m_z = 36969 &* (m_z & 65535) &+ (m_z >> 16) m_w = 18000 &* (m_w & 65535) &+ (m_w >> 16) let val = ((m_z << 16) &+ m_w) return Int(val % (1 << 30)) /* 32-bit result */ } } ================================================ FILE: RxExample/RxExample/Services/Randomizer.swift ================================================ // // Randomizer.swift // RxExample // // Created by Krunoslav Zaher on 6/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // typealias NumberSection = AnimatableSectionModel let insertItems = true let deleteItems = true let moveItems = true let reloadItems = true let deleteSections = true let insertSections = true let explicitlyMoveSections = true let reloadSections = true class Randomizer { var sections: [NumberSection] var rng: PseudoRandomGenerator var unusedItems: [Int] var unusedSections: [String] init(rng: PseudoRandomGenerator, sections: [NumberSection]) { self.rng = rng self.sections = sections unusedSections = [] unusedItems = [] } func countTotalItemsInSections(_ sections: [NumberSection]) -> Int { sections.reduce(0) { p, s in p + s.items.count } } func randomize() { var nextUnusedSections = [String]() var nextUnusedItems = [Int]() let sectionCount = sections.count let itemCount = countTotalItemsInSections(sections) let startItemCount = itemCount + unusedItems.count let startSectionCount = sections.count + unusedSections.count // insert sections for section in unusedSections { let index = rng.get_random() % (sections.count + 1) if insertSections { sections.insert(NumberSection(model: section, items: []), at: index) } else { nextUnusedSections.append(section) } } // insert/reload items for unusedValue in unusedItems { let sectionIndex = rng.get_random() % sections.count let section = sections[sectionIndex] let itemCount = section.items.count // insert if rng.get_random() % 2 == 0 { let itemIndex = rng.get_random() % (itemCount + 1) if insertItems { sections[sectionIndex].items.insert(unusedValue, at: itemIndex) } else { nextUnusedItems.append(unusedValue) } } // update else { if itemCount == 0 { sections[sectionIndex].items.insert(unusedValue, at: 0) continue } let itemIndex = rng.get_random() % itemCount if reloadItems { nextUnusedItems.append(sections[sectionIndex].items.remove(at: itemIndex)) sections[sectionIndex].items.insert(unusedValue, at: itemIndex) } else { nextUnusedItems.append(unusedValue) } } } assert(countTotalItemsInSections(sections) + nextUnusedItems.count == startItemCount) assert(sections.count + nextUnusedSections.count == startSectionCount) let itemActionCount = itemCount / 7 let sectionActionCount = sectionCount / 3 // move items for _ in 0 ..< itemActionCount { if sections.count == 0 { continue } let sourceSectionIndex = rng.get_random() % sections.count let destinationSectionIndex = rng.get_random() % sections.count let sectionItemCount = sections[sourceSectionIndex].items.count if sectionItemCount == 0 { continue } let sourceItemIndex = rng.get_random() % sectionItemCount let nextRandom = rng.get_random() if moveItems { let item = sections[sourceSectionIndex].items.remove(at: sourceItemIndex) let targetItemIndex = nextRandom % (sections[destinationSectionIndex].items.count + 1) sections[destinationSectionIndex].items.insert(item, at: targetItemIndex) } } assert(countTotalItemsInSections(sections) + nextUnusedItems.count == startItemCount) assert(sections.count + nextUnusedSections.count == startSectionCount) // delete items for _ in 0 ..< itemActionCount { if sections.count == 0 { continue } let sourceSectionIndex = rng.get_random() % sections.count let sectionItemCount = sections[sourceSectionIndex].items.count if sectionItemCount == 0 { continue } let sourceItemIndex = rng.get_random() % sectionItemCount if deleteItems { nextUnusedItems.append(sections[sourceSectionIndex].items.remove(at: sourceItemIndex)) } } assert(countTotalItemsInSections(sections) + nextUnusedItems.count == startItemCount) assert(sections.count + nextUnusedSections.count == startSectionCount) // move sections for _ in 0 ..< sectionActionCount { if sections.count == 0 { continue } let sectionIndex = rng.get_random() % sections.count let targetIndex = rng.get_random() % sections.count if explicitlyMoveSections { let section = sections.remove(at: sectionIndex) sections.insert(section, at: targetIndex) } } assert(countTotalItemsInSections(sections) + nextUnusedItems.count == startItemCount) assert(sections.count + nextUnusedSections.count == startSectionCount) // delete sections for _ in 0 ..< sectionActionCount { if sections.count == 0 { continue } let sectionIndex = rng.get_random() % sections.count if deleteSections { let section = sections.remove(at: sectionIndex) for item in section.items { nextUnusedItems.append(item) } nextUnusedSections.append(section.model) } } assert(countTotalItemsInSections(sections) + nextUnusedItems.count == startItemCount) assert(sections.count + nextUnusedSections.count == startSectionCount) unusedSections = nextUnusedSections unusedItems = nextUnusedItems } } ================================================ FILE: RxExample/RxExample/Services/Reachability.swift ================================================ /* Copyright © 2014, Ashley Mills All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import Foundation import SystemConfiguration public enum ReachabilityError: Error { case failedToCreateWithAddress(sockaddr_in) case failedToCreateWithHostname(String) case unableToSetCallback case unableToSetDispatchQueue } public let ReachabilityChangedNotification = Notification.Name("ReachabilityChangedNotification") func callback(reachability _: SCNetworkReachability, flags _: SCNetworkReachabilityFlags, info: UnsafeMutableRawPointer?) { guard let info else { return } let reachability = Unmanaged.fromOpaque(info).takeUnretainedValue() DispatchQueue.main.async { reachability.reachabilityChanged() } } public class Reachability { public typealias NetworkReachable = (Reachability) -> Void public typealias NetworkUnreachable = (Reachability) -> Void public enum NetworkStatus: CustomStringConvertible { case notReachable, reachableViaWiFi, reachableViaWWAN public var description: String { switch self { case .reachableViaWWAN: "Cellular" case .reachableViaWiFi: "WiFi" case .notReachable: "No Connection" } } } public var whenReachable: NetworkReachable? public var whenUnreachable: NetworkUnreachable? public var reachableOnWWAN: Bool // The notification center on which "reachability changed" events are being posted public var notificationCenter: NotificationCenter = .default public var currentReachabilityString: String { "\(currentReachabilityStatus)" } public var currentReachabilityStatus: NetworkStatus { guard isReachable else { return .notReachable } if isReachableViaWiFi { return .reachableViaWiFi } if isRunningOnDevice { return .reachableViaWWAN } return .notReachable } private var previousFlags: SCNetworkReachabilityFlags? private var isRunningOnDevice: Bool = { #if targetEnvironment(simulator) return false #else return true #endif }() private var notifierRunning = false private var reachabilityRef: SCNetworkReachability? private let reachabilitySerialQueue = DispatchQueue(label: "uk.co.ashleymills.reachability") public required init(reachabilityRef: SCNetworkReachability) { reachableOnWWAN = true self.reachabilityRef = reachabilityRef } public convenience init?(hostname: String) { guard let ref = SCNetworkReachabilityCreateWithName(nil, hostname) else { return nil } self.init(reachabilityRef: ref) } public convenience init?() { var zeroAddress = sockaddr() zeroAddress.sa_len = UInt8(MemoryLayout.size) zeroAddress.sa_family = sa_family_t(AF_INET) guard let ref: SCNetworkReachability = withUnsafePointer(to: &zeroAddress, { SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0)) }) else { return nil } self.init(reachabilityRef: ref) } deinit { stopNotifier() reachabilityRef = nil whenReachable = nil whenUnreachable = nil } } public extension Reachability { // MARK: - *** Notifier methods *** func startNotifier() throws { guard let reachabilityRef, !notifierRunning else { return } var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil) context.info = UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque()) if !SCNetworkReachabilitySetCallback(reachabilityRef, callback, &context) { stopNotifier() throw ReachabilityError.unableToSetCallback } if !SCNetworkReachabilitySetDispatchQueue(reachabilityRef, reachabilitySerialQueue) { stopNotifier() throw ReachabilityError.unableToSetDispatchQueue } // Perform an initial check reachabilitySerialQueue.async { self.reachabilityChanged() } notifierRunning = true } func stopNotifier() { defer { notifierRunning = false } guard let reachabilityRef else { return } SCNetworkReachabilitySetCallback(reachabilityRef, nil, nil) SCNetworkReachabilitySetDispatchQueue(reachabilityRef, nil) } // MARK: - *** Connection test methods *** var isReachable: Bool { guard isReachableFlagSet else { return false } if isConnectionRequiredAndTransientFlagSet { return false } if isRunningOnDevice { if isOnWWANFlagSet, !reachableOnWWAN { // We don't want to connect when on 3G. return false } } return true } var isReachableViaWWAN: Bool { // Check we're not on the simulator, we're REACHABLE and check we're on WWAN isRunningOnDevice && isReachableFlagSet && isOnWWANFlagSet } var isReachableViaWiFi: Bool { // Check we're reachable guard isReachableFlagSet else { return false } // If reachable we're reachable, but not on an iOS device (i.e. simulator), we must be on WiFi guard isRunningOnDevice else { return true } // Check we're NOT on WWAN return !isOnWWANFlagSet } var description: String { let W = isRunningOnDevice ? (isOnWWANFlagSet ? "W" : "-") : "X" let R = isReachableFlagSet ? "R" : "-" let c = isConnectionRequiredFlagSet ? "c" : "-" let t = isTransientConnectionFlagSet ? "t" : "-" let i = isInterventionRequiredFlagSet ? "i" : "-" let C = isConnectionOnTrafficFlagSet ? "C" : "-" let D = isConnectionOnDemandFlagSet ? "D" : "-" let l = isLocalAddressFlagSet ? "l" : "-" let d = isDirectFlagSet ? "d" : "-" return "\(W)\(R) \(c)\(t)\(i)\(C)\(D)\(l)\(d)" } } private extension Reachability { func reachabilityChanged() { let flags = reachabilityFlags guard previousFlags != flags else { return } let block = isReachable ? whenReachable : whenUnreachable block?(self) notificationCenter.post(name: ReachabilityChangedNotification, object: self) previousFlags = flags } var isOnWWANFlagSet: Bool { #if os(iOS) return reachabilityFlags.contains(.isWWAN) #else return false #endif } var isReachableFlagSet: Bool { reachabilityFlags.contains(.reachable) } var isConnectionRequiredFlagSet: Bool { reachabilityFlags.contains(.connectionRequired) } var isInterventionRequiredFlagSet: Bool { reachabilityFlags.contains(.interventionRequired) } var isConnectionOnTrafficFlagSet: Bool { reachabilityFlags.contains(.connectionOnTraffic) } var isConnectionOnDemandFlagSet: Bool { reachabilityFlags.contains(.connectionOnDemand) } var isConnectionOnTrafficOrDemandFlagSet: Bool { !reachabilityFlags.intersection([.connectionOnTraffic, .connectionOnDemand]).isEmpty } var isTransientConnectionFlagSet: Bool { reachabilityFlags.contains(.transientConnection) } var isLocalAddressFlagSet: Bool { reachabilityFlags.contains(.isLocalAddress) } var isDirectFlagSet: Bool { reachabilityFlags.contains(.isDirect) } var isConnectionRequiredAndTransientFlagSet: Bool { reachabilityFlags.intersection([.connectionRequired, .transientConnection]) == [.connectionRequired, .transientConnection] } var reachabilityFlags: SCNetworkReachabilityFlags { guard let reachabilityRef else { return SCNetworkReachabilityFlags() } var flags = SCNetworkReachabilityFlags() let gotFlags = withUnsafeMutablePointer(to: &flags) { SCNetworkReachabilityGetFlags(reachabilityRef, UnsafeMutablePointer($0)) } if gotFlags { return flags } else { return SCNetworkReachabilityFlags() } } } ================================================ FILE: RxExample/RxExample/Services/ReachabilityService.swift ================================================ // // ReachabilityService.swift // RxExample // // Created by Vodovozov Gleb on 10/22/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch import RxSwift public enum ReachabilityStatus { case reachable(viaWiFi: Bool) case unreachable } extension ReachabilityStatus { var reachable: Bool { switch self { case .reachable: true case .unreachable: false } } } protocol ReachabilityService { var reachability: Observable { get } } enum ReachabilityServiceError: Error { case failedToCreate } class DefaultReachabilityService: ReachabilityService { private let _reachabilitySubject: BehaviorSubject var reachability: Observable { _reachabilitySubject.asObservable() } let _reachability: Reachability init() throws { guard let reachabilityRef = Reachability() else { throw ReachabilityServiceError.failedToCreate } let reachabilitySubject = BehaviorSubject(value: .unreachable) // so main thread isn't blocked when reachability via WiFi is checked let backgroundQueue = DispatchQueue(label: "reachability.wificheck") reachabilityRef.whenReachable = { _ in backgroundQueue.async { reachabilitySubject.on(.next(.reachable(viaWiFi: reachabilityRef.isReachableViaWiFi))) } } reachabilityRef.whenUnreachable = { _ in backgroundQueue.async { reachabilitySubject.on(.next(.unreachable)) } } try reachabilityRef.startNotifier() _reachability = reachabilityRef _reachabilitySubject = reachabilitySubject } deinit { _reachability.stopNotifier() } } extension ObservableConvertibleType { func retryOnBecomesReachable(_ valueOnFailure: Element, reachabilityService: ReachabilityService) -> Observable { asObservable() .catch { e -> Observable in reachabilityService.reachability .skip(1) .filter(\.reachable) .flatMap { _ in Observable.error(e) } .startWith(valueOnFailure) } .retry() } } ================================================ FILE: RxExample/RxExample/Services/UIImage+Extensions.swift ================================================ // // UIImage+Extensions.swift // RxExample // // Created by Krunoslav Zaher on 11/1/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) import UIKit #endif extension Image { func forceLazyImageDecompression() -> Image { #if os(iOS) UIGraphicsBeginImageContext(CGSize(width: 1, height: 1)) draw(at: CGPoint.zero) UIGraphicsEndImageContext() #endif return self } } ================================================ FILE: RxExample/RxExample/Services/UIImageView+DownloadableImage.swift ================================================ // // UIImageView+DownloadableImage.swift // RxExample // // Created by Vodovozov Gleb on 11/1/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if os(iOS) || os(tvOS) import RxCocoa import RxSwift import UIKit extension Reactive where Base: UIImageView { var downloadableImage: Binder { downloadableImageAnimated(nil) } func downloadableImageAnimated(_: String?) -> Binder { Binder(base) { imageView, image in for subview in imageView.subviews { subview.removeFromSuperview() } switch image { case let .content(image): (imageView as UIImageView).rx.image.on(.next(image)) case .offlinePlaceholder: let label = UILabel(frame: imageView.bounds) label.textAlignment = .center label.font = UIFont.systemFont(ofSize: 35) label.text = "⚠️" imageView.addSubview(label) } } } } #endif ================================================ FILE: RxExample/RxExample/Services/Wireframe.swift ================================================ // // Wireframe.swift // RxExample // // Created by Krunoslav Zaher on 4/3/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift #if os(iOS) import UIKit #elseif os(macOS) import Cocoa #endif enum RetryResult { case retry case cancel } protocol Wireframe { func open(url: URL) func promptFor(_ message: String, cancelAction: Action, actions: [Action]) -> Observable } class DefaultWireframe: Wireframe { static let shared = DefaultWireframe() func open(url: URL) { #if os(iOS) UIApplication.shared.open(url) #elseif os(macOS) NSWorkspace.shared.open(url) #endif } #if os(iOS) private static func rootViewController() -> UIViewController { // cheating, I know UIApplication.shared.keyWindow!.rootViewController! } #endif static func presentAlert(_ message: String) { #if os(iOS) let alertView = UIAlertController(title: "RxExample", message: message, preferredStyle: .alert) alertView.addAction(UIAlertAction(title: "OK", style: .cancel) { _ in }) rootViewController().present(alertView, animated: true, completion: nil) #endif } func promptFor(_ message: String, cancelAction: Action, actions: [Action]) -> Observable { #if os(iOS) return Observable.create { observer in let alertView = UIAlertController(title: "RxExample", message: message, preferredStyle: .alert) alertView.addAction(UIAlertAction(title: cancelAction.description, style: .cancel) { _ in observer.on(.next(cancelAction)) }) for action in actions { alertView.addAction(UIAlertAction(title: action.description, style: .default) { _ in observer.on(.next(action)) }) } DefaultWireframe.rootViewController().present(alertView, animated: true, completion: nil) return Disposables.create { alertView.dismiss(animated: false, completion: nil) } } #elseif os(macOS) return Observable.error(NSError(domain: "Unimplemented", code: -1, userInfo: nil)) #endif } } extension RetryResult: CustomStringConvertible { var description: String { switch self { case .retry: "Retry" case .cancel: "Cancel" } } } ================================================ FILE: RxExample/RxExample/String+URL.swift ================================================ // // String+URL.swift // RxExample // // Created by Krunoslav Zaher on 12/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // extension String { var URLEscaped: String { addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "" } } ================================================ FILE: RxExample/RxExample/Version.swift ================================================ // // Version.swift // RxExample // // Created by Krunoslav Zaher on 5/20/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // import Foundation class Unique: NSObject {} struct Version: Hashable { private let _unique: Unique let value: Value init(_ value: Value) { _unique = Unique() self.value = value } func hash(into hasher: inout Hasher) { hasher.combine(_unique) } static func == (lhs: Version, rhs: Version) -> Bool { lhs._unique === rhs._unique } } extension Version { func mutate(transform: (inout Value) -> Void) -> Version { var newSelf = value transform(&newSelf) return Version(newSelf) } func mutate(transform: (inout Value) throws -> Void) rethrows -> Version { var newSelf = value try transform(&newSelf) return Version(newSelf) } } ================================================ FILE: RxExample/RxExample/ViewController.swift ================================================ // // ViewController.swift // RxExample // // Created by Krunoslav Zaher on 4/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift #if os(iOS) import UIKit typealias OSViewController = UIViewController #elseif os(macOS) import Cocoa typealias OSViewController = NSViewController #endif class ViewController: OSViewController { var disposeBag = DisposeBag() } ================================================ FILE: RxExample/RxExample/iOS/AppDelegate.swift ================================================ // // AppDelegate.swift // RxExample // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { if UIApplication.isInUITest { UIView.setAnimationsEnabled(false) } RxImagePickerDelegateProxy.register { RxImagePickerDelegateProxy(imagePicker: $0) } #if DEBUG _ = Observable.interval(.seconds(1), scheduler: MainScheduler.instance) .subscribe(onNext: { _ in print("Resource count \(RxSwift.Resources.total)") }) #endif return true } } ================================================ FILE: RxExample/RxExample/iOS/BaseNavigationController.swift ================================================ // // BaseNavigationController.swift // RxExample // // Created by Volodymyr Andriienko on 17/07/2024. // Copyright © 2024 Krunoslav Zaher. All rights reserved. // import UIKit open class BaseNavigationController: UINavigationController { override open func viewDidLoad() { super.viewDidLoad() if #available(iOS 13.0, *) { let appearance = UINavigationBarAppearance() appearance.configureWithOpaqueBackground() navigationBar.standardAppearance = appearance navigationBar.scrollEdgeAppearance = appearance navigationBar.compactAppearance = appearance if #available(iOS 15.0, *) { navigationBar.compactScrollEdgeAppearance = appearance } } } } ================================================ FILE: RxExample/RxExample/iOS/LaunchScreen.xib ================================================ ================================================ FILE: RxExample/RxExample/iOS/Main.storyboard ================================================ ================================================ FILE: RxExample/RxExample/iOS/RootViewController.swift ================================================ // // RootViewController.swift // RxExample // // Created by Krunoslav Zaher on 4/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import UIKit public class RootViewController: UITableViewController { override public func viewDidLoad() { super.viewDidLoad() // force load _ = GitHubSearchRepositoriesAPI.sharedAPI _ = DefaultWikipediaAPI.sharedAPI _ = DefaultImageService.sharedImageService _ = DefaultWireframe.shared _ = MainScheduler.instance _ = Dependencies.sharedDependencies.reachabilityService let geoService = GeolocationService.instance geoService.authorized.drive(onNext: { _ in }).dispose() geoService.location.drive(onNext: { _ in }).dispose() } } ================================================ FILE: RxExample/RxExample/iOS/UITableView+Extensions.swift ================================================ // // UITableView+Extensions.swift // RxExample // // Created by Krunoslav Zaher on 8/20/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import UIKit extension UITableView { func hideEmptyCells() { tableFooterView = UIView(frame: .zero) } } ================================================ FILE: RxExample/RxExample/macOS/AppDelegate.swift ================================================ // // AppDelegate.swift // RxExample // // Created by Krunoslav Zaher on 5/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Cocoa @main class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(aNotification _: Notification) { // Insert code here to initialize your application } func applicationWillTerminate(aNotification _: Notification) { // Insert code here to tear down your application } } ================================================ FILE: RxExample/RxExample/macOS/Main.storyboard ================================================ Change values and see what happens. ================================================ FILE: RxExample/RxExample-iOSTests/CLLocationManager+RxTests.swift ================================================ // // CLLocationManager+RxTests.swift // RxExample // // Created by Krunoslav Zaher on 12/13/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import CoreLocation import RxCocoa import RxExample_iOS import RxSwift import XCTest class CLLocationManagerTests: RxTest {} // delegate methods extension CLLocationManagerTests { func testDidUpdateLocations() { var completed = false var location: CLLocation? let targetLocation = CLLocation(latitude: 90, longitude: 180) autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didUpdateLocations.subscribe(onNext: { l in location = l[0] }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didUpdateLocations: [targetLocation]) } XCTAssertEqual(location?.coordinate.latitude, targetLocation.coordinate.latitude) XCTAssertEqual(location?.coordinate.longitude, targetLocation.coordinate.longitude) XCTAssertTrue(completed) } func testDidFailWithError() { var completed = false var error: Error? autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didFailWithError.subscribe(onNext: { e in error = e }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didFailWithError: testError) } XCTAssertEqual(error! as NSError, testError) XCTAssertTrue(completed) } #if os(iOS) || os(macOS) func testDidFinishDeferredUpdatesWithError() { var completed = false var error: Error? autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didFinishDeferredUpdatesWithError.subscribe(onNext: { e in error = e }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didFinishDeferredUpdatesWithError: testError) } XCTAssertEqual(error! as NSError, testError) XCTAssertTrue(completed) } func testDidFinishDeferredUpdatesWithError_noError() { var completed = false var error: Error? autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didFinishDeferredUpdatesWithError.subscribe(onNext: { e in error = e }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didFinishDeferredUpdatesWithError: nil) } XCTAssertEqual(error.map { $0 as NSError }, nil) XCTAssertTrue(completed) } #endif #if os(iOS) func testDidPauseLocationUpdates() { var completed = false var updates: ()? autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didPauseLocationUpdates.subscribe(onNext: { u in updates = u }, onCompleted: { completed = true }) manager.delegate!.locationManagerDidPauseLocationUpdates!(manager) } XCTAssertTrue(updates != nil) XCTAssertTrue(completed) } func testDidResumeLocationUpdates() { var completed = false var updates: ()? autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didResumeLocationUpdates.subscribe(onNext: { _ in updates = () }, onCompleted: { completed = true }) manager.delegate!.locationManagerDidResumeLocationUpdates!(manager) } XCTAssertTrue(updates != nil) XCTAssertTrue(completed) } func testDidUpdateHeading() { var completed = false var heading: CLHeading? let targetHeading = CLHeading() autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didUpdateHeading.subscribe(onNext: { n in heading = n }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didUpdateHeading: targetHeading) } XCTAssertEqual(heading, targetHeading) XCTAssertTrue(completed) } func testDidEnterRegion() { var completed = false var value: CLRegion? let targetValue = CLCircularRegion(center: CLLocationCoordinate2D(latitude: 90, longitude: 180), radius: 10, identifier: "unit tests in cloud") autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didEnterRegion.subscribe(onNext: { n in value = n }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didEnterRegion: targetValue) } XCTAssertEqual(value, targetValue) XCTAssertTrue(completed) } func testDidExitRegion() { var completed = false var value: CLRegion? let targetValue = CLCircularRegion(center: CLLocationCoordinate2D(latitude: 90, longitude: 180), radius: 10, identifier: "unit tests in cloud") autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didExitRegion.subscribe(onNext: { n in value = n }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didExitRegion: targetValue) } XCTAssertEqual(value, targetValue) XCTAssertTrue(completed) } #endif #if os(iOS) || os(macOS) func testDidDetermineStateForRegion() { var completed = false var value: (CLRegionState, CLRegion)? let targetValue = (CLRegionState.inside, CLCircularRegion(center: CLLocationCoordinate2D(latitude: 90, longitude: 180), radius: 10, identifier: "unit tests in cloud")) autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didDetermineStateForRegion.subscribe(onNext: { n in value = (n.state, n.region) }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didDetermineState: targetValue.0, for: targetValue.1) } XCTAssertEqual(value?.0, targetValue.0) XCTAssertEqual(value?.1, targetValue.1) XCTAssertTrue(completed) } func testMonitorOfKnownRegionDidFailWithError() { var completed = false var region: CLRegion? var error: Error? let targetRegion = CLCircularRegion(center: CLLocationCoordinate2D(latitude: 90, longitude: 180), radius: 10, identifier: "unit tests in cloud") autoreleasepool { let manager = CLLocationManager() _ = manager.rx.monitoringDidFailForRegionWithError.subscribe(onNext: { l in region = l.region error = l.error }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, monitoringDidFailFor: targetRegion, withError: testError) } XCTAssertEqual(targetRegion, region) XCTAssertEqual(error! as NSError, testError) XCTAssertTrue(completed) } func testMonitorOfUnknownRegionDidFailWithError() { var completed = false var region: CLRegion? var error: Error? let targetRegion: CLRegion? = nil autoreleasepool { let manager = CLLocationManager() _ = manager.rx.monitoringDidFailForRegionWithError.subscribe(onNext: { l in region = l.region error = l.error }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, monitoringDidFailFor: targetRegion, withError: testError) } XCTAssertEqual(targetRegion, region) XCTAssertEqual(error! as NSError, testError) XCTAssertTrue(completed) } func testStartMonitoringForRegion() { var completed = false var value: CLRegion? let targetValue = CLCircularRegion(center: CLLocationCoordinate2D(latitude: 90, longitude: 180), radius: 10, identifier: "unit tests in cloud") autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didStartMonitoringForRegion.subscribe(onNext: { n in value = n }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didStartMonitoringFor: targetValue) } XCTAssertEqual(value, targetValue) XCTAssertTrue(completed) } #endif #if os(iOS) func testDidRangeBeaconsInRegion() { var completed = false var value: ([CLBeacon], CLBeaconRegion)? let targetValue = ( // [CLBeacon()] // TODO: This crashes on Xcode 8.0 beta version // this is temporary workaround [] as [CLBeacon], CLBeaconRegion(proximityUUID: UUID(uuidString: "68753A44-4D6F-1226-9C60-0050E4C00067")!, identifier: "1231231") ) autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didRangeBeaconsInRegion.subscribe(onNext: { n in value = n }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didRangeBeacons: targetValue.0, in: targetValue.1) } XCTAssertEqual(value!.0, targetValue.0) XCTAssertEqual(value!.1, targetValue.1) XCTAssertTrue(completed) } func testRangingBeaconsDidFailForRegionWithError() { var completed = false var value: (CLBeaconRegion, Error)? let targetValue = ( CLBeaconRegion(proximityUUID: UUID(uuidString: "68753A44-4D6F-1226-9C60-0050E4C00067")!, identifier: "1231231"), testError ) autoreleasepool { let manager = CLLocationManager() _ = manager.rx.rangingBeaconsDidFailForRegionWithError.subscribe(onNext: { n in value = n }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, rangingBeaconsDidFailFor: targetValue.0, withError: targetValue.1) } XCTAssertEqual(value!.0, targetValue.0) XCTAssertEqual(value!.1 as NSError, targetValue.1) XCTAssertTrue(completed) } func testDidVisit() { var completed = false var value: CLVisit? let targetValue = CLVisit() autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didVisit.subscribe(onNext: { n in value = n }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didVisit: targetValue) } XCTAssertEqual(value, targetValue) XCTAssertTrue(completed) } #endif func testDidChangeAuthorizationStatus() { var completed = false var authorizationStatus: CLAuthorizationStatus? #if os(tvOS) let targetAuthorizationStatus = CLAuthorizationStatus.authorizedAlways #elseif os(iOS) let targetAuthorizationStatus = CLAuthorizationStatus.authorizedAlways #else let targetAuthorizationStatus = CLAuthorizationStatus.authorized #endif autoreleasepool { let manager = CLLocationManager() _ = manager.rx.didChangeAuthorizationStatus.subscribe(onNext: { status in authorizationStatus = status }, onCompleted: { completed = true }) manager.delegate!.locationManager!(manager, didChangeAuthorization: targetAuthorizationStatus) } XCTAssertEqual(authorizationStatus, targetAuthorizationStatus) XCTAssertTrue(completed) } } ================================================ FILE: RxExample/RxExample-iOSTests/Info.plist ================================================ NSLocationAlwaysAndWhenInUseUsageDescription We use it NSLocationWhenInUseUsageDescription We use it CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: RxExample/RxExample-iOSTests/Mocks/MockGitHubAPI.swift ================================================ // // MockGitHubAPI.swift // RxExample // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift class MockGitHubAPI: GitHubAPI { let _usernameAvailable: (String) -> Observable let _signup: ((String, String)) -> Observable init( usernameAvailable: @escaping (String) -> Observable = notImplemented(), signup: @escaping ((String, String)) -> Observable = notImplemented() ) { _usernameAvailable = usernameAvailable _signup = signup } func usernameAvailable(_ username: String) -> Observable { _usernameAvailable(username) } func signup(_ username: String, password: String) -> Observable { _signup((username, password)) } } ================================================ FILE: RxExample/RxExample-iOSTests/Mocks/MockWireframe.swift ================================================ // // MockWireframe.swift // RxExample // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation import RxSwift class MockWireframe: Wireframe { let _openURL: (URL) -> Void let _promptFor: (String, Any, [Any]) -> Observable init( openURL: @escaping (URL) -> Void = notImplementedSync(), promptFor: @escaping (String, Any, [Any]) -> Observable = notImplemented() ) { _openURL = openURL _promptFor = promptFor } func open(url: URL) { _openURL(url) } func promptFor(_ message: String, cancelAction: Action, actions: [Action]) -> Observable { _promptFor(message, cancelAction, actions.map { $0 as Any }).map { $0 as! Action } } } ================================================ FILE: RxExample/RxExample-iOSTests/Mocks/NotImplementedStubs.swift ================================================ // // NotImplementedStubs.swift // RxExample // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxSwift import RxTest import Foundation func genericFatal(_ message: String) -> T { if Int(arc4random() % 4) == -1 { print("This is hack to remove warning") } _ = fatalError(message) } // MARK: Generic support code // MARK: Not implemented stubs func notImplemented() -> (T1) -> Observable { { _ -> Observable in return genericFatal("Not implemented") } } func notImplemented() -> (T1, T2) -> Observable { { _, _ -> Observable in return genericFatal("Not implemented") } } func notImplemented() -> (T1, T2, T3) -> Observable { { _, _, _ -> Observable in return genericFatal("Not implemented") } } func notImplementedSync() -> (T1) -> Void { { _ in genericFatal("Not implemented") } } ================================================ FILE: RxExample/RxExample-iOSTests/Mocks/ValidationResult+Equatable.swift ================================================ // // ValidationResult+Equatable.swift // RxExample // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // // MARK: Equatable extension ValidationResult: Equatable {} func == (lhs: ValidationResult, rhs: ValidationResult) -> Bool { switch (lhs, rhs) { case (.ok, .ok): true case (.empty, .empty): true case (.validating, .validating): true case (.failed, .failed): true default: false } } ================================================ FILE: RxExample/RxExample-iOSTests/RxExample_iOSTests.swift ================================================ // // RxExample_iOSTests.swift // RxExample // // Created by Krunoslav Zaher on 12/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import XCTest import RxCocoa import RxSwift import RxTest let resolution: TimeInterval = 0.2 // seconds // MARK: Concrete tests /** This is just an example of one way how this can be done. */ class RxExample_iOSTests: XCTestCase { let booleans = ["t": true, "f": false] let events = ["x": ()] let errors = [ "#1": NSError(domain: "Some unknown error maybe", code: -1, userInfo: nil), "#u": NSError(domain: NSURLErrorDomain, code: NSURLErrorTimedOut, userInfo: nil) ] let validations = [ "e": ValidationResult.empty, "f": ValidationResult.failed(message: ""), "o": ValidationResult.ok(message: "Validated"), "v": ValidationResult.validating ] let stringValues = [ "u1": "verysecret", "u2": "secretuser", "u3": "secretusername", "p1": "huge secret", "p2": "secret", "e": "" ] //////////////////////////////////////////////////////////////////////////////// // This is test of enabled user interface elements. // I guess you could do this for view models, but this is probably overkill to // do. // // It's probably more suitable for some vital components of your system, but // the principle is the same. //////////////////////////////////////////////////////////////////////////////// func testGitHubSignup_vanillaObservables_1_testEnabledUserInterfaceElements() { let scheduler = TestScheduler(initialClock: 0, resolution: resolution, simulateProcessingDelay: false) // mock the universe let mockAPI = mockGithubAPI(scheduler: scheduler) // expected events and test data let ( usernameEvents, passwordEvents, repeatedPasswordEvents, loginTapEvents, expectedValidatedUsernameEvents, expectedSignupEnabledEvents ) = ( scheduler.parseEventsAndTimes(timeline: "e---u1----u2-----u3-----------------", values: stringValues).first!, scheduler.parseEventsAndTimes(timeline: "e----------------------p1-----------", values: stringValues).first!, scheduler.parseEventsAndTimes(timeline: "e---------------------------p2---p1-", values: stringValues).first!, scheduler.parseEventsAndTimes(timeline: "------------------------------------", values: events).first!, scheduler.parseEventsAndTimes(timeline: "e---v--f--v--f---v--o----------------", values: validations).first!, scheduler.parseEventsAndTimes(timeline: "f--------------------------------t---", values: booleans).first! ) let wireframe = MockWireframe() let validationService = GitHubDefaultValidationService(API: mockAPI) let viewModel = GithubSignupViewModel1( input: ( username: scheduler.createHotObservable(usernameEvents).asObservable(), password: scheduler.createHotObservable(passwordEvents).asObservable(), repeatedPassword: scheduler.createHotObservable(repeatedPasswordEvents).asObservable(), loginTaps: scheduler.createHotObservable(loginTapEvents).asObservable() ), dependency: ( API: mockAPI, validationService: validationService, wireframe: wireframe ) ) // run experiment let recordedSignupEnabled = scheduler.record(source: viewModel.signupEnabled) let recordedValidatedUsername = scheduler.record(source: viewModel.validatedUsername) scheduler.start() // validate XCTAssertEqual(recordedValidatedUsername.events, expectedValidatedUsernameEvents) XCTAssertEqual(recordedSignupEnabled.events, expectedSignupEnabledEvents) } func testGitHubSignup_drivers_2_testEnabledUserInterfaceElements() { let scheduler = TestScheduler(initialClock: 0, resolution: resolution, simulateProcessingDelay: false) // mock the universe let mockAPI = mockGithubAPI(scheduler: scheduler) // expected events and test data let ( usernameEvents, passwordEvents, repeatedPasswordEvents, loginTapEvents, expectedValidatedUsernameEvents, expectedSignupEnabledEvents ) = ( scheduler.parseEventsAndTimes(timeline: "e---u1----u2-----u3-----------------", values: stringValues).first!, scheduler.parseEventsAndTimes(timeline: "e----------------------p1-----------", values: stringValues).first!, scheduler.parseEventsAndTimes(timeline: "e---------------------------p2---p1-", values: stringValues).first!, scheduler.parseEventsAndTimes(timeline: "------------------------------------", values: events).first!, scheduler.parseEventsAndTimes(timeline: "e---v--f--v--f---v--o----------------", values: validations).first!, scheduler.parseEventsAndTimes(timeline: "f--------------------------------t---", values: booleans).first! ) let wireframe = MockWireframe() let validationService = GitHubDefaultValidationService(API: mockAPI) /** This is important because driver will try to ensure that elements are being pumped on main scheduler, and that sometimes means that it will get queued using `dispatch_async` to main dispatch queue and not get flushed until end of the test. This method enables using mock schedulers for while testing drivers. */ SharingScheduler.mock(scheduler: scheduler) { let viewModel = GithubSignupViewModel2( input: ( username: scheduler.createHotObservable(usernameEvents).asDriver(onErrorJustReturn: ""), password: scheduler.createHotObservable(passwordEvents).asDriver(onErrorJustReturn: ""), repeatedPassword: scheduler.createHotObservable(repeatedPasswordEvents).asDriver(onErrorJustReturn: ""), loginTaps: scheduler.createHotObservable(loginTapEvents).asSignal(onErrorJustReturn: ()) ), dependency: ( API: mockAPI, validationService: validationService, wireframe: wireframe ) ) // run experiment let recordedSignupEnabled = scheduler.record(source: viewModel.signupEnabled) let recordedValidatedUsername = scheduler.record(source: viewModel.validatedUsername) scheduler.start() // validate XCTAssertEqual(recordedValidatedUsername.events, expectedValidatedUsernameEvents) XCTAssertEqual(recordedSignupEnabled.events, expectedSignupEnabledEvents) } } } // MARK: Mocks extension RxExample_iOSTests { func mockGithubAPI(scheduler: TestScheduler) -> GitHubAPI { MockGitHubAPI( usernameAvailable: scheduler.mock(values: booleans, errors: errors) { username -> String in if username == "secretusername" { return "---t" } else if username == "secretuser" { return "---#1" } else { return "---f" } }, signup: scheduler.mock(values: booleans, errors: errors) { (args: (String, String)) -> String in let (username, password) = args if username == "secretusername", password == "secret" { return "--t" } else { return "--f" } } ) } } // MARK: Mocks ================================================ FILE: RxExample/RxExample-iOSTests/RxTest.swift ================================================ // // RxTest.swift // RxExample // // Created by Krunoslav Zaher on 9/11/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import XCTest class RxTest: XCTestCase {} let testError = NSError(domain: "dummyError", code: -232, userInfo: nil) let testError1 = NSError(domain: "dummyError1", code: -233, userInfo: nil) let testError2 = NSError(domain: "dummyError2", code: -234, userInfo: nil) ================================================ FILE: RxExample/RxExample-iOSTests/TestScheduler+MarbleTests.swift ================================================ // // TestScheduler+MarbleTests.swift // RxExample // // Created by Krunoslav Zaher on 12/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import RxCocoa import RxSwift import RxTest /** There are examples like this all over the web, but I think that I've first something like this here https://github.com/ReactiveX/RxJS/blob/master/doc/writing-marble-tests.md These tests are called marble tests. */ extension TestScheduler { /** Transformation from this format: ---a---b------c----- to this format schedule onNext(1) @ 0.6s schedule onNext(2) @ 1.4s schedule onNext(3) @ 7.0s .... ] You can also specify retry data in this format: ---a---b------c----#|----a--#|----b - letters and digits mark values - `#` marks unknown error - `|` marks sequence completed */ func parseEventsAndTimes(timeline: String, values: [String: T], errors: [String: Swift.Error] = [:]) -> [[Recorded>]] { // print("parsing: \(timeline)") typealias RecordedEvent = Recorded> let timelines = timeline.components(separatedBy: "|") let allExceptLast = timelines[0 ..< timelines.count - 1] return (allExceptLast.map { $0 + "|" } + [timelines.last!]) .filter { $0.count > 0 } .map { timeline -> [Recorded>] in let segments = timeline.components(separatedBy: "-") let (time: _, events: events) = segments.reduce((time: 0, events: [RecordedEvent]())) { state, event in let tickIncrement = event.count + 1 if event.count == 0 { return (state.time + tickIncrement, state.events) } if event == "#" { let errorEvent = RecordedEvent(time: state.time, value: Event.error(NSError(domain: "Any error domain", code: -1, userInfo: nil))) return (state.time + tickIncrement, state.events + [errorEvent]) } if event == "|" { let completed = RecordedEvent(time: state.time, value: Event.completed) return (state.time + tickIncrement, state.events + [completed]) } guard let next = values[event] else { guard let error = errors[event] else { fatalError("Value with key \(event) not registered as value:\n\(values)\nor error:\n\(errors)") } let nextEvent = RecordedEvent(time: state.time, value: Event.error(error)) return (state.time + tickIncrement, state.events + [nextEvent]) } let nextEvent = RecordedEvent(time: state.time, value: Event.next(next)) return (state.time + tickIncrement, state.events + [nextEvent]) } // print("parsed: \(events)") return events } } /** Creates driver for marble test. - parameter timeline: Timeline in the form `---a---b------c--|` - parameter values: Dictionary of values in timeline. `[a:1, b:2]` - returns: Driver specified by timeline and values. */ func createDriver(timeline: String, values: [String: T]) -> Driver { createObservable(timeline: timeline, values: values, errors: [:]).asDriver(onErrorRecover: { _ -> Driver in genericFatal("This can't error out") }) } /** Creates observable for marble tests. - parameter timeline: Timeline in the form `---a---b------c--|` - parameter values: Dictionary of values in timeline. `[a:1, b:2]` - parameter errors: Dictionary of errors in timeline. - returns: Observable sequence specified by timeline and values. */ func createObservable(timeline: String, values: [String: T], errors: [String: Swift.Error] = [:]) -> Observable { let events = parseEventsAndTimes(timeline: timeline, values: values, errors: errors) return createObservable(events) } /** Creates observable for marble tests. - parameter events: Recorded events to replay. - returns: Observable sequence specified by timeline and values. */ func createObservable(_ events: [Recorded>]) -> Observable { createObservable([events]) } /** Creates observable for marble tests. - parameter events: Recorded events to replay. This overloads enables modeling of retries. `---a---b------c----#|----a--#|----b` When next observer is subscribed, next sequence will be replayed. If all sequences have been replayed and new observer is subscribed, `fatalError` will be raised. - returns: Observable sequence specified by timeline and values. */ func createObservable(_ events: [[Recorded>]]) -> Observable { var attemptCount = 0 print("created for \(events)") return Observable.create { observer in if attemptCount >= events.count { fatalError("This is attempt # \(attemptCount + 1), but timeline only allows \(events.count).\n\(events)") } let scheduledEvents = events[attemptCount].map { event in self.scheduleRelative((), dueTime: resolution * TimeInterval(event.time)) { _ in observer.on(event.value) return Disposables.create() } } attemptCount += 1 return Disposables.create(scheduledEvents) } } /** Enables simple construction of mock implementations from marble timelines. - parameter Arg: Type of arguments of mocked method. - parameter Ret: Return type of mocked method. `Observable` - parameter values: Dictionary of values in timeline. `[a:1, b:2]` - parameter errors: Dictionary of errors in timeline. - parameter timelineSelector: Method implementation. The returned string value represents timeline of returned observable sequence. `---a---b------c----#|----a--#|----b` - returns: Implementation of method that accepts arguments with parameter `Arg` and returns observable sequence with parameter `Ret`. */ func mock(values: [String: Ret], errors: [String: Swift.Error] = [:], timelineSelector: @escaping (Arg) -> String) -> (Arg) -> Observable { { (parameters: Arg) -> Observable in let timeline = timelineSelector(parameters) return self.createObservable(timeline: timeline, values: values, errors: errors) } } /** Builds testable observer for s specific observable sequence, binds it's results and sets up disposal. - parameter source: Observable sequence to observe. - returns: Observer that records all events for observable sequence. */ func record(source: Source) -> TestableObserver { let observer = createObserver(Source.Element.self) let disposable = source.asObservable().bind(to: observer) scheduleAt(100_000) { disposable.dispose() } return observer } } ================================================ FILE: RxExample/RxExample-iOSTests/UIImagePickerController+RxTests.swift ================================================ // // UIImagePickerController+RxTests.swift // RxExample // // Created by Segii Shulga on 1/6/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // #if os(iOS) import RxCocoa import RxExample_iOS import RxSwift import UIKit import XCTest class UIImagePickerControllerTests: RxTest {} extension UIImagePickerControllerTests { func testDidFinishPickingMediaWithInfo() { var completed = false var info: [String: AnyObject]? let pickedInfo = [UIImagePickerControllerOriginalImage: UIImage()] autoreleasepool { let imagePickerController = UIImagePickerController() _ = imagePickerController.rx.didFinishPickingMediaWithInfo .subscribe(onNext: { i in info = i }, onCompleted: { completed = true }) imagePickerController.delegate! .imagePickerController!(imagePickerController, didFinishPickingMediaWithInfo: pickedInfo) } XCTAssertTrue(info?[UIImagePickerControllerOriginalImage] === pickedInfo[UIImagePickerControllerOriginalImage]) XCTAssertTrue(completed) } func testDidCancel() { var completed = false var canceled = false autoreleasepool { let imagePickerController = UIImagePickerController() _ = imagePickerController.rx.didCancel .subscribe(onNext: { _ in canceled = true }, onCompleted: { completed = true }) imagePickerController.delegate!.imagePickerControllerDidCancel!(imagePickerController) } XCTAssertTrue(canceled) XCTAssertTrue(completed) } } #endif ================================================ FILE: RxExample/RxExample-iOSUITests/FlowTests.swift ================================================ // // FlowTests.swift // RxExample // // Created by Krunoslav Zaher on 8/20/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import XCTest class FlowTests: XCTestCase { var app: XCUIApplication! override func setUp() { super.setUp() continueAfterFailure = false app = XCUIApplication() app.launchEnvironment = ["isUITest": ""] app.launch() } override func tearDown() { sleep(1) } } extension FlowTests { func testGitHubSignUp() { app.tables.allElementsBoundByIndex[0].cells.allElementsBoundByIndex[3].tap() let username = app.textFields.allElementsBoundByIndex[0] let password = app.secureTextFields.allElementsBoundByIndex[0] let repeatedPassword = app.secureTextFields.allElementsBoundByIndex[1] username.tap() username.typeText("rxrevolution") password.tap() password.typeText("mypassword") repeatedPassword.tap() repeatedPassword.typeText("mypassword") app.windows.allElementsBoundByIndex[0].coordinate(withNormalizedOffset: CGVector(dx: 14.50, dy: 80.00)).tap() app.buttons["Sign up"].tap() waitForElementToAppear(app.alerts.element(boundBy: 0)) app.alerts.allElementsBoundByIndex[0].buttons.allElementsBoundByIndex[0].tap() goBack() } func testSearchWikipedia() { app.tables.allElementsBoundByIndex[0].cells.allElementsBoundByIndex[13].tap() let searchField = app.tables.children(matching: .searchField).element searchField.tap() searchField.typeSlow(text: "banana") searchField.clearText() searchField.typeSlow(text: "Yosemite") searchField.clearText() goBack() } func testMasterDetail() { app.tables.allElementsBoundByIndex[0].cells.allElementsBoundByIndex[11].tap() waitForElementToAppear(app.tables.allElementsBoundByIndex[0].cells.element(boundBy: 5), timeout: 10.0) let editButton = app.navigationBars.buttons["Edit"] editButton.tap() func reorderButtonForIndex(_ index: Int) -> XCUIElement { app.tables.cells.allElementsBoundByIndex[index].buttons.allElementsBoundByIndex.filter { element in element.label.hasPrefix("Reorder ") }.first! } reorderButtonForIndex(5).press(forDuration: 1.5, thenDragTo: reorderButtonForIndex(2)) reorderButtonForIndex(7).press(forDuration: 1.5, thenDragTo: reorderButtonForIndex(4)) reorderButtonForIndex(1).press(forDuration: 1.5, thenDragTo: reorderButtonForIndex(3)) let doneButton = app.navigationBars.buttons["Done"] doneButton.tap() app.tables.allElementsBoundByIndex[0].cells.allElementsBoundByIndex[6].tap() goBack() goBack() } func testAnimatedPartialUpdates() { app.tables.allElementsBoundByIndex[0].cells.allElementsBoundByIndex[12].tap() wait(interval: 1.0) let randomize = app.navigationBars.buttons["Randomize"] waitForElementToAppear(randomize, timeout: 5) randomize.tap() randomize.tap() randomize.tap() randomize.tap() randomize.tap() randomize.tap() randomize.tap() randomize.tap() randomize.tap() goBack() } func testVisitEveryScreen() { let cells = app.tables.allElementsBoundByIndex[0].cells.allElementsBoundByIndex XCTAssertTrue(cells.count > 0) for i in 0 ..< cells.count { cells[i].tap() goBack() } } } extension FlowTests { func testControls() { for test in [ _testUISwitch, _testUITextView, _testUITextField, _testDatePicker, _testBarButtonItemTap, _testButtonTap, _testSegmentedControl, _testSlider ] { goToControlsView() test() goBack() } } func goToControlsView() { let tableView = app.tables.element(boundBy: 0) waitForElementToAppear(tableView) tableView.cells.allElementsBoundByIndex[5].tap() } func checkDebugLabelValue(_ expected: String, hasPrefix: Bool = false) { let textValue = app.staticTexts["debugLabel"].value as? String if hasPrefix { XCTAssertTrue((textValue ?? "").hasPrefix(expected)) } else { XCTAssertEqual(textValue, expected) } } func _testDatePicker() { let picker = app.datePickers.allElementsBoundByIndex[0] picker.pickerWheels.element(boundBy: 0).coordinate(withNormalizedOffset: CGVector(dx: 0.49, dy: 0.65)).tap() picker.pickerWheels.element(boundBy: 1).coordinate(withNormalizedOffset: CGVector(dx: 0.35, dy: 0.64)).tap() picker.pickerWheels.element(boundBy: 2).coordinate(withNormalizedOffset: CGVector(dx: 0.46, dy: 0.64)).tap() wait(interval: 1.0) checkDebugLabelValue("UIDatePicker date 1970-01-02 01:01:00 +0000") } func _testBarButtonItemTap() { app.navigationBars.buttons["TapMe"].tap() checkDebugLabelValue("UIBarButtonItem Tapped") } func _testButtonTap() { app.scrollViews.buttons["TapMe"].tap() checkDebugLabelValue("UIButton Tapped") } func _testSegmentedControl() { let segmentedControl = app.scrollViews.segmentedControls.allElementsBoundByIndex[0] segmentedControl.buttons["Second"].tap() checkDebugLabelValue("UISegmentedControl value 1") segmentedControl.buttons["First"].tap() checkDebugLabelValue("UISegmentedControl value 0") } @available(*, deprecated, message: "Something broke with Xcode 9.4 automation :(") func _testUISwitch() { // let switchControl = app.switches["TestSwitch"]; // switchControl.doubleTap() // checkDebugLabelValue("UISwitch value false") // switchControl.tap() // switchControl.tap() // checkDebugLabelValue("UISwitch value true") } func _testUITextField() { let textField = app.textFields.allElementsBoundByIndex[0] textField.tap() textField.typeText("f") checkDebugLabelValue("UITextField text f") let textField2 = app.textFields.allElementsBoundByIndex[1] textField2.tap() textField2.typeText("f2") checkDebugLabelValue("UITextField attributedText f2{", hasPrefix: true) } func _testUITextView() { let textView = app.textViews.allElementsBoundByIndex[0] textView.tap() textView.typeText("f") checkDebugLabelValue("UITextView text f") goBack() goToControlsView() let textView2 = app.textViews.allElementsBoundByIndex[1] textView2.tap() textView2.typeText("f2") checkDebugLabelValue("UITextView attributedText f2{", hasPrefix: true) } func _testSlider() { let slider = app.sliders.allElementsBoundByIndex[0] slider.adjust(toNormalizedSliderPosition: 0) checkDebugLabelValue("UISlider value 0.0", hasPrefix: true) } } extension FlowTests { func goBack() { wait(interval: 1.0) let window = app.windows.element(boundBy: 0) window.coordinate(withNormalizedOffset: .zero).withOffset(CGVector(dx: 40, dy: 30)).tap() wait(interval: 1.5) } func waitForElementToAppear(_ element: XCUIElement, timeout: TimeInterval = 2, file: String = #file, line: Int = #line) { let existsPredicate = NSPredicate(format: "exists == true") expectation( for: existsPredicate, evaluatedWith: element, handler: nil ) waitForExpectations(timeout: timeout) { error in if error != nil { let message = "Failed to find \(element) after \(timeout) seconds." self.recordFailure(withDescription: message, inFile: file, atLine: line, expected: true) } } } func wait(interval: TimeInterval) { RunLoop.current.run(until: Date().addingTimeInterval(interval)) } } extension XCUIElement { func clearText() { let backspace = "\u{8}" let backspaces = Array((value as? String) ?? "").map { _ in backspace } typeText(backspaces.joined(separator: "")) } func typeSlow(text: String) { for i in text { typeText(String(i)) } } } ================================================ FILE: RxExample/RxExample-iOSUITests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleVersion 1 ================================================ FILE: RxExample/RxExample-macOSUITests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleVersion 1 ================================================ FILE: RxExample/RxExample-macOSUITests/RxExample_macOSUITests.swift ================================================ // // RxExample_macOSUITests.swift // RxExample // // Created by Krunoslav Zaher on 10/30/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import XCTest class RxExample_macOSUITests: 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. } } ================================================ FILE: RxExample/RxExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 0744CDD41C4DB5F000720FD2 /* GeolocationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0744CDD31C4DB5F000720FD2 /* GeolocationService.swift */; }; 0744CDED1C4DB78600720FD2 /* GeolocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0744CDEC1C4DB78600720FD2 /* GeolocationViewController.swift */; }; 075F13101B4E9D5A000D7861 /* APIWrappersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075F130F1B4E9D5A000D7861 /* APIWrappersViewController.swift */; }; 07A5C3DB1B70B703001EFE5C /* CalculatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07A5C3DA1B70B703001EFE5C /* CalculatorViewController.swift */; }; 07E3C2331B03605B0010338D /* Dependencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E3C2321B03605B0010338D /* Dependencies.swift */; }; 252C9F781F14111800F5F951 /* SimplePickerViewExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 252C9F771F14111800F5F951 /* SimplePickerViewExampleViewController.swift */; }; 252C9F7A1F14115B00F5F951 /* SimpleUIPickerViewExample.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 252C9F791F14115B00F5F951 /* SimpleUIPickerViewExample.storyboard */; }; 2864D5F21D995FCD004F8484 /* Application+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2864D5F11D995FCD004F8484 /* Application+Extensions.swift */; }; 2864D5F31D995FCD004F8484 /* Application+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2864D5F11D995FCD004F8484 /* Application+Extensions.swift */; }; 8479BC721C3BDAD400FB8B54 /* ImagePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8479BC701C3BCB9800FB8B54 /* ImagePickerController.swift */; }; 927A78B82117A5E700A45638 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BCD3DE1C1480E9005F1280 /* Operators.swift */; }; A34040282C47AC34009E3F74 /* BaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A34040202C47AC2F009E3F74 /* BaseNavigationController.swift */; }; A5CD038F1F1670E50005A376 /* CustomPickerViewAdapterExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CD038E1F1670E50005A376 /* CustomPickerViewAdapterExampleViewController.swift */; }; AE51C1C91DE735D8005BAF5F /* APIWrappers.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1C81DE735D8005BAF5F /* APIWrappers.storyboard */; }; AE51C1CB1DE735E3005BAF5F /* Calculator.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1CA1DE735E3005BAF5F /* Calculator.storyboard */; }; AE51C1CD1DE735EF005BAF5F /* Geolocation.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1CC1DE735EF005BAF5F /* Geolocation.storyboard */; }; AE51C1CF1DE735FD005BAF5F /* GitHubSearchRepositories.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1CE1DE735FD005BAF5F /* GitHubSearchRepositories.storyboard */; }; AE51C1D21DE73608005BAF5F /* GitHubSignup1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1D01DE73608005BAF5F /* GitHubSignup1.storyboard */; }; AE51C1D31DE73608005BAF5F /* GitHubSignup2.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1D11DE73608005BAF5F /* GitHubSignup2.storyboard */; }; AE51C1D51DE73613005BAF5F /* ImagePicker.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1D41DE73613005BAF5F /* ImagePicker.storyboard */; }; AE51C1D71DE73623005BAF5F /* Numbers.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1D61DE73623005BAF5F /* Numbers.storyboard */; }; AE51C1D91DE73633005BAF5F /* SimpleTableViewExample.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1D81DE73633005BAF5F /* SimpleTableViewExample.storyboard */; }; AE51C1DB1DE7363C005BAF5F /* SimpleTableViewExampleSectioned.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1DA1DE7363C005BAF5F /* SimpleTableViewExampleSectioned.storyboard */; }; AE51C1DD1DE73649005BAF5F /* SimpleValidation.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1DC1DE73649005BAF5F /* SimpleValidation.storyboard */; }; AE51C1DF1DE73655005BAF5F /* PartialUpdates.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1DE1DE73655005BAF5F /* PartialUpdates.storyboard */; }; AE51C1E11DE73660005BAF5F /* TableViewWithEditingCommands.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1E01DE73660005BAF5F /* TableViewWithEditingCommands.storyboard */; }; AE51C1E31DE73667005BAF5F /* WikipediaSearch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE51C1E21DE73667005BAF5F /* WikipediaSearch.storyboard */; }; B1604CB51BE49F8D002E1279 /* DownloadableImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1604CB41BE49F8D002E1279 /* DownloadableImage.swift */; }; B1604CC31BE5B8BD002E1279 /* ReachabilityService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B18F3BE11BDB2E8F000AAC79 /* ReachabilityService.swift */; }; B1604CC91BE5BBFA002E1279 /* UIImageView+DownloadableImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1604CC81BE5BBFA002E1279 /* UIImageView+DownloadableImage.swift */; }; B1604CCA1BE5BC18002E1279 /* DownloadableImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1604CB41BE49F8D002E1279 /* DownloadableImage.swift */; }; B18F3BBC1BD92EC8000AAC79 /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = B18F3BBB1BD92EC8000AAC79 /* Reachability.swift */; }; B18F3BBF1BD93DFF000AAC79 /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = B18F3BBB1BD92EC8000AAC79 /* Reachability.swift */; }; B18F3BE21BDB2E8F000AAC79 /* ReachabilityService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B18F3BE11BDB2E8F000AAC79 /* ReachabilityService.swift */; }; C803973A1BD3E17D009D8B26 /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */; }; C809E97A1BE6841C0058D948 /* Wireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = C809E9791BE6841C0058D948 /* Wireframe.swift */; }; C809E97D1BE697100058D948 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C809E97C1BE697100058D948 /* UIImage+Extensions.swift */; }; C809E97F1BE69B660058D948 /* Wireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = C809E9791BE6841C0058D948 /* Wireframe.swift */; }; C809E9801BE69BA30058D948 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C809E97C1BE697100058D948 /* UIImage+Extensions.swift */; }; C817727F1E7DEE5100EA679B /* GitHubSearchRepositories.swift in Sources */ = {isa = PBXBuildFile; fileRef = C817727E1E7DEE5100EA679B /* GitHubSearchRepositories.swift */; }; C819DAE91ED0DDD50043A770 /* Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = C819DAE81ED0DDD50043A770 /* Version.swift */; }; C819DAFA1ED0DE920043A770 /* Lenses.swift in Sources */ = {isa = PBXBuildFile; fileRef = C819DAF91ED0DE920043A770 /* Lenses.swift */; }; C822B1D91C14CBEA0088A01A /* Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822B1D81C14CBEA0088A01A /* Protocols.swift */; }; C822B1DC1C14CD1C0088A01A /* DefaultImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822B1DB1C14CD1C0088A01A /* DefaultImplementations.swift */; }; C822B1DF1C14CEAA0088A01A /* BindingExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822B1DE1C14CEAA0088A01A /* BindingExtensions.swift */; }; C822B1E31C14E4810088A01A /* SimpleTableViewExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822B1E21C14E4810088A01A /* SimpleTableViewExampleViewController.swift */; }; C822B1E71C14E7250088A01A /* SimpleTableViewExampleSectionedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822B1E61C14E7250088A01A /* SimpleTableViewExampleSectionedViewController.swift */; }; C82E1DB31DC69E8D004A6413 /* RxExample_macOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82E1DB21DC69E8D004A6413 /* RxExample_macOSUITests.swift */; }; C82FF1221F93E84600BDB34D /* SectionModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1021F93E84600BDB34D /* SectionModelType.swift */; }; C82FF1231F93E84600BDB34D /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1031F93E84600BDB34D /* Utilities.swift */; }; C82FF1241F93E84600BDB34D /* IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1041F93E84600BDB34D /* IdentifiableType.swift */; }; C82FF1251F93E84600BDB34D /* SectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1051F93E84600BDB34D /* SectionModel.swift */; }; C82FF1261F93E84600BDB34D /* Diff.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1061F93E84600BDB34D /* Diff.swift */; }; C82FF1271F93E84600BDB34D /* AnimatableSectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1071F93E84600BDB34D /* AnimatableSectionModel.swift */; }; C82FF1281F93E84600BDB34D /* IdentifiableValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1091F93E84600BDB34D /* IdentifiableValue.swift */; }; C82FF1291F93E84600BDB34D /* ItemPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF10A1F93E84600BDB34D /* ItemPath.swift */; }; C82FF12A1F93E84600BDB34D /* Optional+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF10B1F93E84600BDB34D /* Optional+Extensions.swift */; }; C82FF12B1F93E84600BDB34D /* AnimatableSectionModelType+ItemPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF10C1F93E84600BDB34D /* AnimatableSectionModelType+ItemPath.swift */; }; C82FF12C1F93E84600BDB34D /* Changeset.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF10D1F93E84600BDB34D /* Changeset.swift */; }; C82FF12E1F93E84600BDB34D /* AnimatableSectionModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF10F1F93E84600BDB34D /* AnimatableSectionModelType.swift */; }; C82FF12F1F93E84600BDB34D /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1111F93E84600BDB34D /* Array+Extensions.swift */; }; C82FF1301F93E84600BDB34D /* AnimationConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1121F93E84600BDB34D /* AnimationConfiguration.swift */; }; C82FF1311F93E84600BDB34D /* FloatingPointType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1131F93E84600BDB34D /* FloatingPointType+IdentifiableType.swift */; }; C82FF1321F93E84600BDB34D /* RxTableViewSectionedAnimatedDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1141F93E84600BDB34D /* RxTableViewSectionedAnimatedDataSource.swift */; }; C82FF1331F93E84600BDB34D /* RxCollectionViewSectionedReloadDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1151F93E84600BDB34D /* RxCollectionViewSectionedReloadDataSource.swift */; }; C82FF1341F93E84600BDB34D /* DataSources.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1161F93E84600BDB34D /* DataSources.swift */; }; C82FF1351F93E84600BDB34D /* String+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1171F93E84600BDB34D /* String+IdentifiableType.swift */; }; C82FF1361F93E84600BDB34D /* RxPickerViewAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1181F93E84600BDB34D /* RxPickerViewAdapter.swift */; }; C82FF1371F93E84600BDB34D /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1191F93E84600BDB34D /* Deprecated.swift */; }; C82FF1381F93E84600BDB34D /* CollectionViewSectionedDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF11B1F93E84600BDB34D /* CollectionViewSectionedDataSource.swift */; }; C82FF1391F93E84600BDB34D /* UI+SectionedViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF11C1F93E84600BDB34D /* UI+SectionedViewType.swift */; }; C82FF13A1F93E84600BDB34D /* IntegerType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF11D1F93E84600BDB34D /* IntegerType+IdentifiableType.swift */; }; C82FF13C1F93E84600BDB34D /* RxCollectionViewSectionedAnimatedDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF11F1F93E84600BDB34D /* RxCollectionViewSectionedAnimatedDataSource.swift */; }; C82FF13D1F93E84600BDB34D /* TableViewSectionedDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1201F93E84600BDB34D /* TableViewSectionedDataSource.swift */; }; C82FF13E1F93E84600BDB34D /* RxTableViewSectionedReloadDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82FF1211F93E84600BDB34D /* RxTableViewSectionedReloadDataSource.swift */; }; C83367231AD029AE00C668A7 /* Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = C833670F1AD029AE00C668A7 /* Example.swift */; }; C83367241AD029AE00C668A7 /* HtmlParsing.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83367111AD029AE00C668A7 /* HtmlParsing.swift */; }; C83367251AD029AE00C668A7 /* ImageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83367121AD029AE00C668A7 /* ImageService.swift */; }; C843A08E1C1CE39900CBA4BD /* GitHubSearchRepositoriesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C843A08C1C1CE39900CBA4BD /* GitHubSearchRepositoriesAPI.swift */; }; C843A0901C1CE39900CBA4BD /* GitHubSearchRepositoriesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C843A08D1C1CE39900CBA4BD /* GitHubSearchRepositoriesViewController.swift */; }; C843A0931C1CE58700CBA4BD /* UINavigationController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C843A0921C1CE58700CBA4BD /* UINavigationController+Extensions.swift */; }; C849EF641C3190360048AC4A /* RxExample_iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF631C3190360048AC4A /* RxExample_iOSTests.swift */; }; C849EF801C3193B10048AC4A /* GitHubSignupViewController1.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF7E1C3193B10048AC4A /* GitHubSignupViewController1.swift */; }; C849EF821C3193B10048AC4A /* GithubSignupViewModel1.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF7F1C3193B10048AC4A /* GithubSignupViewModel1.swift */; }; C849EF861C3195180048AC4A /* GitHubSignupViewController2.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF841C3195180048AC4A /* GitHubSignupViewController2.swift */; }; C849EF881C3195180048AC4A /* GithubSignupViewModel2.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF851C3195180048AC4A /* GithubSignupViewModel2.swift */; }; C849EF901C319E9A0048AC4A /* GithubSignupViewModel1.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF7F1C3193B10048AC4A /* GithubSignupViewModel1.swift */; }; C849EF911C319E9A0048AC4A /* Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822B1D81C14CBEA0088A01A /* Protocols.swift */; }; C849EF921C319E9A0048AC4A /* DefaultImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = C822B1DB1C14CD1C0088A01A /* DefaultImplementations.swift */; }; C849EF951C319E9D0048AC4A /* GithubSignupViewModel2.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF851C3195180048AC4A /* GithubSignupViewModel2.swift */; }; C849EF981C31A3340048AC4A /* RxTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8864C5A1C275A200073016D /* RxTest.framework */; }; C849EF991C31A63C0048AC4A /* Wireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = C809E9791BE6841C0058D948 /* Wireframe.swift */; }; C849EF9A1C31A7680048AC4A /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */; }; C849EF9C1C31A8750048AC4A /* String+URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF9B1C31A8750048AC4A /* String+URL.swift */; }; C849EF9D1C31A8750048AC4A /* String+URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF9B1C31A8750048AC4A /* String+URL.swift */; }; C849EF9F1C31A8750048AC4A /* String+URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = C849EF9B1C31A8750048AC4A /* String+URL.swift */; }; C84E5BA61E7893A4001F659A /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84E5BA51E7893A4001F659A /* Observable+Extensions.swift */; }; C84E5BA71E7893A4001F659A /* Observable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84E5BA51E7893A4001F659A /* Observable+Extensions.swift */; }; C864BAD71C3332F10083833C /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C864BAD11C3332F10083833C /* DetailViewController.swift */; }; C864BAD91C3332F10083833C /* RandomUserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C864BAD21C3332F10083833C /* RandomUserAPI.swift */; }; C864BADD1C3332F10083833C /* TableViewWithEditingCommandsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C864BAD41C3332F10083833C /* TableViewWithEditingCommandsViewController.swift */; }; C864BADF1C3332F10083833C /* UIImageView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C864BAD51C3332F10083833C /* UIImageView+Extensions.swift */; }; C864BAE11C3332F10083833C /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = C864BAD61C3332F10083833C /* User.swift */; }; C86781CC1DB824D500B2029A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781CA1DB824D500B2029A /* AppDelegate.swift */; }; C86781CE1DB824E500B2029A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C86781CB1DB824D500B2029A /* Main.storyboard */; }; C86781D11DB8250400B2029A /* IntroductionExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86781D01DB8250400B2029A /* IntroductionExampleViewController.swift */; }; C86E2F3E1AE5A0CA00C31024 /* SearchResultViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F321AE5A0CA00C31024 /* SearchResultViewModel.swift */; }; C86E2F451AE5A0CA00C31024 /* WikipediaAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F3B1AE5A0CA00C31024 /* WikipediaAPI.swift */; }; C86E2F461AE5A0CA00C31024 /* WikipediaPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F3C1AE5A0CA00C31024 /* WikipediaPage.swift */; }; C86E2F471AE5A0CA00C31024 /* WikipediaSearchResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F3D1AE5A0CA00C31024 /* WikipediaSearchResult.swift */; }; C886A68B1D85AC9400653EE4 /* UIImagePickerController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C886A68A1D85AC9400653EE4 /* UIImagePickerController+Rx.swift */; }; C886A68E1D85AD2000653EE4 /* CLLocationManager+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C886A68C1D85AD2000653EE4 /* CLLocationManager+Rx.swift */; }; C886A68F1D85AD2000653EE4 /* RxCLLocationManagerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C886A68D1D85AD2000653EE4 /* RxCLLocationManagerDelegateProxy.swift */; }; C886A6911D85AD7E00653EE4 /* CLLocationManager+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C886A6901D85AD7E00653EE4 /* CLLocationManager+RxTests.swift */; }; C886A6931D85ADA100653EE4 /* UIImagePickerController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C886A6921D85ADA100653EE4 /* UIImagePickerController+RxTests.swift */; }; C886A6951D85AEA300653EE4 /* RxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C886A6941D85AEA300653EE4 /* RxTest.swift */; }; C88BB8BB1B07E6C90064D411 /* SearchResultViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F321AE5A0CA00C31024 /* SearchResultViewModel.swift */; }; C88BB8BC1B07E6C90064D411 /* HtmlParsing.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83367111AD029AE00C668A7 /* HtmlParsing.swift */; }; C88BB8BE1B07E6C90064D411 /* ImageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83367121AD029AE00C668A7 /* ImageService.swift */; }; C88BB8BF1B07E6C90064D411 /* WikipediaSearchResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F3D1AE5A0CA00C31024 /* WikipediaSearchResult.swift */; }; C88BB8C31B07E6C90064D411 /* Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = C833670F1AD029AE00C668A7 /* Example.swift */; }; C88BB8C41B07E6C90064D411 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C890A65C1AEC084100AFF7E6 /* ViewController.swift */; }; C88BB8C71B07E6C90064D411 /* Dependencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E3C2321B03605B0010338D /* Dependencies.swift */; }; C88BB8CA1B07E6C90064D411 /* WikipediaAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F3B1AE5A0CA00C31024 /* WikipediaAPI.swift */; }; C88BB8CC1B07E6C90064D411 /* WikipediaPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86E2F3C1AE5A0CA00C31024 /* WikipediaPage.swift */; }; C88C2B2A1D67EC5200B01A98 /* FlowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88C2B291D67EC5200B01A98 /* FlowTests.swift */; }; C88CB7261D8F253D0021D83F /* RxImagePickerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88CB7251D8F253D0021D83F /* RxImagePickerDelegateProxy.swift */; }; C890A65D1AEC084100AFF7E6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C890A65C1AEC084100AFF7E6 /* ViewController.swift */; }; C8984CD11C36BC3E001E4272 /* NumberCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8984CCE1C36BC3E001E4272 /* NumberCell.swift */; }; C8984CD31C36BC3E001E4272 /* NumberSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8984CCF1C36BC3E001E4272 /* NumberSectionView.swift */; }; C8984CD51C36BC3E001E4272 /* PartialUpdatesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8984CD01C36BC3E001E4272 /* PartialUpdatesViewController.swift */; }; C89C2BD61C321DA200EBC99C /* TestScheduler+MarbleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C2BD51C321DA200EBC99C /* TestScheduler+MarbleTests.swift */; }; C89C2BDC1C32231A00EBC99C /* MockGitHubAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C2BD81C32231A00EBC99C /* MockGitHubAPI.swift */; }; C89C2BDD1C32231A00EBC99C /* MockWireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C2BD91C32231A00EBC99C /* MockWireframe.swift */; }; C89C2BDE1C32231A00EBC99C /* NotImplementedStubs.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C2BDA1C32231A00EBC99C /* NotImplementedStubs.swift */; }; C89C2BDF1C32231A00EBC99C /* ValidationResult+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89C2BDB1C32231A00EBC99C /* ValidationResult+Equatable.swift */; }; C8A2A2C81B4049E300F11F09 /* PseudoRandomGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A2A2C71B4049E300F11F09 /* PseudoRandomGenerator.swift */; }; C8A2A2CB1B404A1200F11F09 /* Randomizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8A2A2CA1B404A1200F11F09 /* Randomizer.swift */; }; C8BCD3DF1C1480E9005F1280 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BCD3DE1C1480E9005F1280 /* Operators.swift */; }; C8BCD3E61C14A95E005F1280 /* NumbersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BCD3E51C14A95E005F1280 /* NumbersViewController.swift */; }; C8BCD3EA1C14B02A005F1280 /* SimpleValidationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BCD3E91C14B02A005F1280 /* SimpleValidationViewController.swift */; }; C8C46DA81B47F7110020D71E /* CollectionViewImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C46DA31B47F7110020D71E /* CollectionViewImageCell.swift */; }; C8C46DA91B47F7110020D71E /* WikipediaImageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C8C46DA41B47F7110020D71E /* WikipediaImageCell.xib */; }; C8C46DAA1B47F7110020D71E /* WikipediaSearchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C46DA51B47F7110020D71E /* WikipediaSearchCell.swift */; }; C8C46DAB1B47F7110020D71E /* WikipediaSearchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C8C46DA61B47F7110020D71E /* WikipediaSearchCell.xib */; }; C8C46DAC1B47F7110020D71E /* WikipediaSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C46DA71B47F7110020D71E /* WikipediaSearchViewController.swift */; }; C8CDF0C11D688DF700C18F99 /* UITableView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8CDF0C01D688DF700C18F99 /* UITableView+Extensions.swift */; }; C8D132151C42B54B00B59FFF /* UIImagePickerController+RxCreate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D132141C42B54B00B59FFF /* UIImagePickerController+RxCreate.swift */; }; C8D3DDE21FB5DB6900BFE7D4 /* Feedbacks.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8D3DDD21FB5DB6900BFE7D4 /* Feedbacks.swift */; }; C8DF92CD1B0B2F84009BCF9A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8DF92C81B0B2F84009BCF9A /* AppDelegate.swift */; }; C8DF92E31B0B32DA009BCF9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C8DF92E01B0B32DA009BCF9A /* LaunchScreen.xib */; }; C8DF92E41B0B32DA009BCF9A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C8DF92E11B0B32DA009BCF9A /* Main.storyboard */; }; C8DF92E51B0B32DA009BCF9A /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8DF92E21B0B32DA009BCF9A /* RootViewController.swift */; }; C8DF92EA1B0B38C0009BCF9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C8DF92E91B0B38C0009BCF9A /* Images.xcassets */; }; C8DF92EB1B0B38C0009BCF9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C8DF92E91B0B38C0009BCF9A /* Images.xcassets */; }; C8E9D2AF1BD3FD960079D0DB /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */; }; C8F8C48A1C277F460047640B /* Calculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8F8C4891C277F460047640B /* Calculator.swift */; }; EF8128F1226BD61900AE22C2 /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C81B3A091BC1C28400EF5A9F /* RxCocoa.framework */; }; EF8128F2226BD61900AE22C2 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C81B3A011BC1C28400EF5A9F /* RxSwift.framework */; }; EF8128F5226BD97900AE22C2 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C81B3A011BC1C28400EF5A9F /* RxSwift.framework */; }; EF8128F6226BD9E700AE22C2 /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C81B3A091BC1C28400EF5A9F /* RxCocoa.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 787BBB6A226B2A6100279500 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = A2897D53225CA1E7004EA481; remoteInfo = RxRelay; }; 8479BC651C3BC98F00FB8B54 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C83508C31C386F6F0027C24C; remoteInfo = "AllTests-iOS"; }; 8479BC671C3BC98F00FB8B54 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C83509841C38740E0027C24C; remoteInfo = "AllTests-tvOS"; }; 8479BC691C3BC98F00FB8B54 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C83509941C38742C0027C24C; remoteInfo = "AllTests-OSX"; }; 8479BC6B1C3BC98F00FB8B54 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C85BA04B1C3878740075D68E; remoteInfo = PerformanceTests; }; C810DCBE1E3D612900D53105 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C8E8BA551E2C181A00A4AC2C; remoteInfo = Benchmarks; }; C81B3A001BC1C28400EF5A9F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C8A56AD71AD7424700B4673B; remoteInfo = "RxSwift-iOS"; }; C81B3A081BC1C28400EF5A9F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C809396D1B8A71760088E94D; remoteInfo = "RxCocoa-iOS"; }; C81B3A101BC1C28400EF5A9F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C8093BC71B8A71F00088E94D; remoteInfo = "RxBlocking-iOS"; }; C82E1DB51DC69E8D004A6413 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C83366D51AD0293800C668A7 /* Project object */; proxyType = 1; remoteGlobalIDString = C88BB8B91B07E6C90064D411; remoteInfo = "RxExample-OSX"; }; C849EF661C3190360048AC4A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C83366D51AD0293800C668A7 /* Project object */; proxyType = 1; remoteGlobalIDString = C83366DC1AD0293800C668A7; remoteInfo = "RxExample-iOS"; }; C8864C591C275A200073016D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 2; remoteGlobalIDString = C88FA50C1C25C44800CCFEA4; remoteInfo = "RxTests-iOS"; }; C88C2B2C1D67EC5200B01A98 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C83366D51AD0293800C668A7 /* Project object */; proxyType = 1; remoteGlobalIDString = C83366DC1AD0293800C668A7; remoteInfo = "RxExample-iOS"; }; C8E1EB201E30FB1600919B41 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 1; remoteGlobalIDString = C8A56AD61AD7424700B4673B; remoteInfo = "RxSwift-iOS"; }; C8E1EB361E30FB1C00919B41 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 1; remoteGlobalIDString = C80938F51B8A71760088E94D; remoteInfo = "RxCocoa-iOS"; }; C8E1EB3C1E30FB3C00919B41 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 1; remoteGlobalIDString = C88FA4FD1C25C44800CCFEA4; remoteInfo = "RxTest-iOS"; }; C8E1EB3E1E30FB4600919B41 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; proxyType = 1; remoteGlobalIDString = C88FA4FD1C25C44800CCFEA4; remoteInfo = "RxTest-iOS"; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 0744CDD31C4DB5F000720FD2 /* GeolocationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeolocationService.swift; sourceTree = ""; }; 0744CDEC1C4DB78600720FD2 /* GeolocationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeolocationViewController.swift; sourceTree = ""; }; 075F130F1B4E9D5A000D7861 /* APIWrappersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIWrappersViewController.swift; sourceTree = ""; }; 07A5C3DA1B70B703001EFE5C /* CalculatorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalculatorViewController.swift; sourceTree = ""; }; 07E3C2321B03605B0010338D /* Dependencies.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Dependencies.swift; path = Examples/Dependencies.swift; sourceTree = ""; }; 252C9F771F14111800F5F951 /* SimplePickerViewExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimplePickerViewExampleViewController.swift; sourceTree = ""; }; 252C9F791F14115B00F5F951 /* SimpleUIPickerViewExample.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = SimpleUIPickerViewExample.storyboard; sourceTree = ""; }; 2864D5F11D995FCD004F8484 /* Application+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Application+Extensions.swift"; sourceTree = ""; }; 780D63DF226B305D00BEACB0 /* RxPlaygrounds.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxPlaygrounds.swift; sourceTree = ""; }; 780D63E2226B320A00BEACB0 /* Rx.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; name = Rx.playground; path = ../Rx.playground; sourceTree = ""; }; 787BBB5A226B2A6100279500 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8479BC701C3BCB9800FB8B54 /* ImagePickerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImagePickerController.swift; sourceTree = ""; }; A34040202C47AC2F009E3F74 /* BaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseNavigationController.swift; sourceTree = ""; }; A5CD038E1F1670E50005A376 /* CustomPickerViewAdapterExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomPickerViewAdapterExampleViewController.swift; sourceTree = ""; }; AE51C1C81DE735D8005BAF5F /* APIWrappers.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = APIWrappers.storyboard; sourceTree = ""; }; AE51C1CA1DE735E3005BAF5F /* Calculator.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Calculator.storyboard; sourceTree = ""; }; AE51C1CC1DE735EF005BAF5F /* Geolocation.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Geolocation.storyboard; sourceTree = ""; }; AE51C1CE1DE735FD005BAF5F /* GitHubSearchRepositories.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = GitHubSearchRepositories.storyboard; sourceTree = ""; }; AE51C1D01DE73608005BAF5F /* GitHubSignup1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = GitHubSignup1.storyboard; sourceTree = ""; }; AE51C1D11DE73608005BAF5F /* GitHubSignup2.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = GitHubSignup2.storyboard; sourceTree = ""; }; AE51C1D41DE73613005BAF5F /* ImagePicker.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ImagePicker.storyboard; sourceTree = ""; }; AE51C1D61DE73623005BAF5F /* Numbers.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Numbers.storyboard; sourceTree = ""; }; AE51C1D81DE73633005BAF5F /* SimpleTableViewExample.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = SimpleTableViewExample.storyboard; sourceTree = ""; }; AE51C1DA1DE7363C005BAF5F /* SimpleTableViewExampleSectioned.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = SimpleTableViewExampleSectioned.storyboard; sourceTree = ""; }; AE51C1DC1DE73649005BAF5F /* SimpleValidation.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = SimpleValidation.storyboard; sourceTree = ""; }; AE51C1DE1DE73655005BAF5F /* PartialUpdates.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = PartialUpdates.storyboard; sourceTree = ""; }; AE51C1E01DE73660005BAF5F /* TableViewWithEditingCommands.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = TableViewWithEditingCommands.storyboard; sourceTree = ""; }; AE51C1E21DE73667005BAF5F /* WikipediaSearch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = WikipediaSearch.storyboard; sourceTree = ""; }; B1604CB41BE49F8D002E1279 /* DownloadableImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadableImage.swift; sourceTree = ""; }; B1604CC81BE5BBFA002E1279 /* UIImageView+DownloadableImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImageView+DownloadableImage.swift"; sourceTree = ""; }; B18F3BBB1BD92EC8000AAC79 /* Reachability.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reachability.swift; sourceTree = ""; }; B18F3BE11BDB2E8F000AAC79 /* ReachabilityService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityService.swift; sourceTree = ""; }; C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = ""; }; C809E9791BE6841C0058D948 /* Wireframe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Wireframe.swift; sourceTree = ""; }; C809E97C1BE697100058D948 /* UIImage+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Extensions.swift"; sourceTree = ""; }; C817727E1E7DEE5100EA679B /* GitHubSearchRepositories.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitHubSearchRepositories.swift; sourceTree = ""; }; C819DAE81ED0DDD50043A770 /* Version.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Version.swift; sourceTree = ""; }; C819DAF91ED0DE920043A770 /* Lenses.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Lenses.swift; sourceTree = ""; }; C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Rx.xcodeproj; path = ../Rx.xcodeproj; sourceTree = ""; }; C822B1D81C14CBEA0088A01A /* Protocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Protocols.swift; sourceTree = ""; }; C822B1DB1C14CD1C0088A01A /* DefaultImplementations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultImplementations.swift; sourceTree = ""; }; C822B1DE1C14CEAA0088A01A /* BindingExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BindingExtensions.swift; sourceTree = ""; }; C822B1E21C14E4810088A01A /* SimpleTableViewExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleTableViewExampleViewController.swift; sourceTree = ""; }; C822B1E61C14E7250088A01A /* SimpleTableViewExampleSectionedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleTableViewExampleSectionedViewController.swift; sourceTree = ""; }; C82E1DB01DC69E8D004A6413 /* RxExample-macOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RxExample-macOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C82E1DB21DC69E8D004A6413 /* RxExample_macOSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxExample_macOSUITests.swift; sourceTree = ""; }; C82E1DB41DC69E8D004A6413 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C82FF1021F93E84600BDB34D /* SectionModelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SectionModelType.swift; sourceTree = ""; }; C82FF1031F93E84600BDB34D /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; }; C82FF1041F93E84600BDB34D /* IdentifiableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdentifiableType.swift; sourceTree = ""; }; C82FF1051F93E84600BDB34D /* SectionModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SectionModel.swift; sourceTree = ""; }; C82FF1061F93E84600BDB34D /* Diff.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Diff.swift; sourceTree = ""; }; C82FF1071F93E84600BDB34D /* AnimatableSectionModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableSectionModel.swift; sourceTree = ""; }; C82FF1081F93E84600BDB34D /* Differentiator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Differentiator.h; sourceTree = ""; }; C82FF1091F93E84600BDB34D /* IdentifiableValue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdentifiableValue.swift; sourceTree = ""; }; C82FF10A1F93E84600BDB34D /* ItemPath.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemPath.swift; sourceTree = ""; }; C82FF10B1F93E84600BDB34D /* Optional+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Optional+Extensions.swift"; sourceTree = ""; }; C82FF10C1F93E84600BDB34D /* AnimatableSectionModelType+ItemPath.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AnimatableSectionModelType+ItemPath.swift"; sourceTree = ""; }; C82FF10D1F93E84600BDB34D /* Changeset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Changeset.swift; sourceTree = ""; }; C82FF10F1F93E84600BDB34D /* AnimatableSectionModelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableSectionModelType.swift; sourceTree = ""; }; C82FF1111F93E84600BDB34D /* Array+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Array+Extensions.swift"; sourceTree = ""; }; C82FF1121F93E84600BDB34D /* AnimationConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimationConfiguration.swift; sourceTree = ""; }; C82FF1131F93E84600BDB34D /* FloatingPointType+IdentifiableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FloatingPointType+IdentifiableType.swift"; sourceTree = ""; }; C82FF1141F93E84600BDB34D /* RxTableViewSectionedAnimatedDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewSectionedAnimatedDataSource.swift; sourceTree = ""; }; C82FF1151F93E84600BDB34D /* RxCollectionViewSectionedReloadDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewSectionedReloadDataSource.swift; sourceTree = ""; }; C82FF1161F93E84600BDB34D /* DataSources.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataSources.swift; sourceTree = ""; }; C82FF1171F93E84600BDB34D /* String+IdentifiableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+IdentifiableType.swift"; sourceTree = ""; }; C82FF1181F93E84600BDB34D /* RxPickerViewAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewAdapter.swift; sourceTree = ""; }; C82FF1191F93E84600BDB34D /* Deprecated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deprecated.swift; sourceTree = ""; }; C82FF11A1F93E84600BDB34D /* RxDataSources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RxDataSources.h; sourceTree = ""; }; C82FF11B1F93E84600BDB34D /* CollectionViewSectionedDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewSectionedDataSource.swift; sourceTree = ""; }; C82FF11C1F93E84600BDB34D /* UI+SectionedViewType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UI+SectionedViewType.swift"; sourceTree = ""; }; C82FF11D1F93E84600BDB34D /* IntegerType+IdentifiableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "IntegerType+IdentifiableType.swift"; sourceTree = ""; }; C82FF11F1F93E84600BDB34D /* RxCollectionViewSectionedAnimatedDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewSectionedAnimatedDataSource.swift; sourceTree = ""; }; C82FF1201F93E84600BDB34D /* TableViewSectionedDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewSectionedDataSource.swift; sourceTree = ""; }; C82FF1211F93E84600BDB34D /* RxTableViewSectionedReloadDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewSectionedReloadDataSource.swift; sourceTree = ""; }; C83366DD1AD0293800C668A7 /* RxExample-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RxExample-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; C833670F1AD029AE00C668A7 /* Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Example.swift; sourceTree = ""; }; C83367111AD029AE00C668A7 /* HtmlParsing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HtmlParsing.swift; sourceTree = ""; }; C83367121AD029AE00C668A7 /* ImageService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageService.swift; sourceTree = ""; }; C843A08C1C1CE39900CBA4BD /* GitHubSearchRepositoriesAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitHubSearchRepositoriesAPI.swift; sourceTree = ""; }; C843A08D1C1CE39900CBA4BD /* GitHubSearchRepositoriesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitHubSearchRepositoriesViewController.swift; sourceTree = ""; }; C843A0921C1CE58700CBA4BD /* UINavigationController+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extensions.swift"; sourceTree = ""; }; C849EF611C3190360048AC4A /* RxExample-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RxExample-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C849EF631C3190360048AC4A /* RxExample_iOSTests.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = RxExample_iOSTests.swift; sourceTree = ""; tabWidth = 4; }; C849EF651C3190360048AC4A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C849EF7E1C3193B10048AC4A /* GitHubSignupViewController1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitHubSignupViewController1.swift; sourceTree = ""; }; C849EF7F1C3193B10048AC4A /* GithubSignupViewModel1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GithubSignupViewModel1.swift; sourceTree = ""; }; C849EF841C3195180048AC4A /* GitHubSignupViewController2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitHubSignupViewController2.swift; sourceTree = ""; }; C849EF851C3195180048AC4A /* GithubSignupViewModel2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GithubSignupViewModel2.swift; sourceTree = ""; }; C849EF9B1C31A8750048AC4A /* String+URL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+URL.swift"; sourceTree = ""; }; C84E5BA51E7893A4001F659A /* Observable+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Extensions.swift"; sourceTree = ""; }; C864BAD11C3332F10083833C /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; C864BAD21C3332F10083833C /* RandomUserAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RandomUserAPI.swift; sourceTree = ""; }; C864BAD41C3332F10083833C /* TableViewWithEditingCommandsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewWithEditingCommandsViewController.swift; sourceTree = ""; }; C864BAD51C3332F10083833C /* UIImageView+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImageView+Extensions.swift"; sourceTree = ""; }; C864BAD61C3332F10083833C /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; C86781CA1DB824D500B2029A /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C86781CB1DB824D500B2029A /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; C86781D01DB8250400B2029A /* IntroductionExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroductionExampleViewController.swift; sourceTree = ""; }; C86E2F321AE5A0CA00C31024 /* SearchResultViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = SearchResultViewModel.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C86E2F3B1AE5A0CA00C31024 /* WikipediaAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WikipediaAPI.swift; sourceTree = ""; }; C86E2F3C1AE5A0CA00C31024 /* WikipediaPage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = WikipediaPage.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C86E2F3D1AE5A0CA00C31024 /* WikipediaSearchResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = WikipediaSearchResult.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C886A68A1D85AC9400653EE4 /* UIImagePickerController+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImagePickerController+Rx.swift"; sourceTree = ""; }; C886A68C1D85AD2000653EE4 /* CLLocationManager+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CLLocationManager+Rx.swift"; sourceTree = ""; }; C886A68D1D85AD2000653EE4 /* RxCLLocationManagerDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCLLocationManagerDelegateProxy.swift; sourceTree = ""; }; C886A6901D85AD7E00653EE4 /* CLLocationManager+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CLLocationManager+RxTests.swift"; sourceTree = ""; }; C886A6921D85ADA100653EE4 /* UIImagePickerController+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImagePickerController+RxTests.swift"; sourceTree = ""; }; C886A6941D85AEA300653EE4 /* RxTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTest.swift; sourceTree = ""; }; C88BB8DC1B07E6C90064D411 /* RxExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RxExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; C88C2B271D67EC5200B01A98 /* RxExample-iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RxExample-iOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C88C2B291D67EC5200B01A98 /* FlowTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowTests.swift; sourceTree = ""; }; C88C2B2B1D67EC5200B01A98 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C88CB7251D8F253D0021D83F /* RxImagePickerDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxImagePickerDelegateProxy.swift; sourceTree = ""; }; C890A65C1AEC084100AFF7E6 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; C8984CCE1C36BC3E001E4272 /* NumberCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberCell.swift; sourceTree = ""; }; C8984CCF1C36BC3E001E4272 /* NumberSectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberSectionView.swift; sourceTree = ""; }; C8984CD01C36BC3E001E4272 /* PartialUpdatesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PartialUpdatesViewController.swift; sourceTree = ""; }; C89C2BD51C321DA200EBC99C /* TestScheduler+MarbleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TestScheduler+MarbleTests.swift"; sourceTree = ""; }; C89C2BD81C32231A00EBC99C /* MockGitHubAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockGitHubAPI.swift; sourceTree = ""; }; C89C2BD91C32231A00EBC99C /* MockWireframe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockWireframe.swift; sourceTree = ""; }; C89C2BDA1C32231A00EBC99C /* NotImplementedStubs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotImplementedStubs.swift; sourceTree = ""; }; C89C2BDB1C32231A00EBC99C /* ValidationResult+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ValidationResult+Equatable.swift"; sourceTree = ""; }; C8A2A2C71B4049E300F11F09 /* PseudoRandomGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PseudoRandomGenerator.swift; sourceTree = ""; }; C8A2A2CA1B404A1200F11F09 /* Randomizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Randomizer.swift; sourceTree = ""; }; C8B290BE1C959D2900E923D0 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; C8BCD3DE1C1480E9005F1280 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = ""; }; C8BCD3E51C14A95E005F1280 /* NumbersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumbersViewController.swift; sourceTree = ""; }; C8BCD3E91C14B02A005F1280 /* SimpleValidationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleValidationViewController.swift; sourceTree = ""; }; C8C46DA31B47F7110020D71E /* CollectionViewImageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewImageCell.swift; sourceTree = ""; }; C8C46DA41B47F7110020D71E /* WikipediaImageCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WikipediaImageCell.xib; sourceTree = ""; }; C8C46DA51B47F7110020D71E /* WikipediaSearchCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WikipediaSearchCell.swift; sourceTree = ""; }; C8C46DA61B47F7110020D71E /* WikipediaSearchCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WikipediaSearchCell.xib; sourceTree = ""; }; C8C46DA71B47F7110020D71E /* WikipediaSearchViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WikipediaSearchViewController.swift; sourceTree = ""; }; C8CDF0C01D688DF700C18F99 /* UITableView+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableView+Extensions.swift"; sourceTree = ""; }; C8D132141C42B54B00B59FFF /* UIImagePickerController+RxCreate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImagePickerController+RxCreate.swift"; sourceTree = ""; }; C8D3DDD21FB5DB6900BFE7D4 /* Feedbacks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Feedbacks.swift; sourceTree = ""; }; C8DF92C81B0B2F84009BCF9A /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C8DF92E01B0B32DA009BCF9A /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = ""; }; C8DF92E11B0B32DA009BCF9A /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; C8DF92E21B0B32DA009BCF9A /* RootViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = ""; }; C8DF92E91B0B38C0009BCF9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; C8DF92F01B0B3E67009BCF9A /* Info-macOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-macOS.plist"; sourceTree = ""; }; C8DF92F21B0B3E71009BCF9A /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; }; C8F8C4891C277F460047640B /* Calculator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Calculator.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ C82E1DAD1DC69E8D004A6413 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C83366DA1AD0293800C668A7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( EF8128F1226BD61900AE22C2 /* RxCocoa.framework in Frameworks */, EF8128F2226BD61900AE22C2 /* RxSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C849EF5E1C3190360048AC4A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( C849EF981C31A3340048AC4A /* RxTest.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C88BB8CD1B07E6C90064D411 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( EF8128F6226BD9E700AE22C2 /* RxCocoa.framework in Frameworks */, EF8128F5226BD97900AE22C2 /* RxSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C88C2B241D67EC5200B01A98 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 0744CDEB1C4DB71300720FD2 /* GeolocationExample */ = { isa = PBXGroup; children = ( AE51C1CC1DE735EF005BAF5F /* Geolocation.storyboard */, 0744CDEC1C4DB78600720FD2 /* GeolocationViewController.swift */, ); path = GeolocationExample; sourceTree = ""; }; 075F130E1B4E9D10000D7861 /* APIWrappers */ = { isa = PBXGroup; children = ( AE51C1C81DE735D8005BAF5F /* APIWrappers.storyboard */, 075F130F1B4E9D5A000D7861 /* APIWrappersViewController.swift */, ); path = APIWrappers; sourceTree = ""; }; 07A5C3D91B70B6B8001EFE5C /* Calculator */ = { isa = PBXGroup; children = ( C8F8C4891C277F460047640B /* Calculator.swift */, AE51C1CA1DE735E3005BAF5F /* Calculator.storyboard */, 07A5C3DA1B70B703001EFE5C /* CalculatorViewController.swift */, ); path = Calculator; sourceTree = ""; }; 252C9F671F1410D600F5F951 /* UIPickerViewExample */ = { isa = PBXGroup; children = ( 252C9F771F14111800F5F951 /* SimplePickerViewExampleViewController.swift */, 252C9F791F14115B00F5F951 /* SimpleUIPickerViewExample.storyboard */, A5CD038E1F1670E50005A376 /* CustomPickerViewAdapterExampleViewController.swift */, ); path = UIPickerViewExample; sourceTree = ""; }; 787BBB58226B2A6100279500 /* Playgrounds */ = { isa = PBXGroup; children = ( 787BBB5A226B2A6100279500 /* Info.plist */, 780D63DF226B305D00BEACB0 /* RxPlaygrounds.swift */, ); path = Playgrounds; sourceTree = ""; }; 8479BC6F1C3BCB4800FB8B54 /* ImagePicker */ = { isa = PBXGroup; children = ( AE51C1D41DE73613005BAF5F /* ImagePicker.storyboard */, 8479BC701C3BCB9800FB8B54 /* ImagePickerController.swift */, C8D132141C42B54B00B59FFF /* UIImagePickerController+RxCreate.swift */, ); path = ImagePicker; sourceTree = ""; }; C81B39F21BC1C28400EF5A9F /* Products */ = { isa = PBXGroup; children = ( C81B3A011BC1C28400EF5A9F /* RxSwift.framework */, C81B3A091BC1C28400EF5A9F /* RxCocoa.framework */, 787BBB6B226B2A6100279500 /* RxRelay.framework */, C81B3A111BC1C28400EF5A9F /* RxBlocking.framework */, C8864C5A1C275A200073016D /* RxTest.framework */, 8479BC661C3BC98F00FB8B54 /* AllTests-iOS.xctest */, 8479BC681C3BC98F00FB8B54 /* AllTests-tvOS.xctest */, 8479BC6A1C3BC98F00FB8B54 /* AllTests-macOS.xctest */, 8479BC6C1C3BC98F00FB8B54 /* PerformanceTests.app */, C810DCBF1E3D612900D53105 /* Benchmarks.xctest */, ); name = Products; sourceTree = ""; }; C822B1E11C14E37B0088A01A /* SimpleTableViewExample */ = { isa = PBXGroup; children = ( AE51C1D81DE73633005BAF5F /* SimpleTableViewExample.storyboard */, C822B1E21C14E4810088A01A /* SimpleTableViewExampleViewController.swift */, ); path = SimpleTableViewExample; sourceTree = ""; }; C822B1E51C14E7120088A01A /* SimpleTableViewExampleSectioned */ = { isa = PBXGroup; children = ( AE51C1DA1DE7363C005BAF5F /* SimpleTableViewExampleSectioned.storyboard */, C822B1E61C14E7250088A01A /* SimpleTableViewExampleSectionedViewController.swift */, ); path = SimpleTableViewExampleSectioned; sourceTree = ""; }; C82E1DB11DC69E8D004A6413 /* RxExample-macOSUITests */ = { isa = PBXGroup; children = ( C82E1DB21DC69E8D004A6413 /* RxExample_macOSUITests.swift */, C82E1DB41DC69E8D004A6413 /* Info.plist */, ); path = "RxExample-macOSUITests"; sourceTree = ""; }; C82FF1011F93E84600BDB34D /* Differentiator */ = { isa = PBXGroup; children = ( C82FF1021F93E84600BDB34D /* SectionModelType.swift */, C82FF1031F93E84600BDB34D /* Utilities.swift */, C82FF1041F93E84600BDB34D /* IdentifiableType.swift */, C82FF1051F93E84600BDB34D /* SectionModel.swift */, C82FF1061F93E84600BDB34D /* Diff.swift */, C82FF1071F93E84600BDB34D /* AnimatableSectionModel.swift */, C82FF1081F93E84600BDB34D /* Differentiator.h */, C82FF1091F93E84600BDB34D /* IdentifiableValue.swift */, C82FF10A1F93E84600BDB34D /* ItemPath.swift */, C82FF10B1F93E84600BDB34D /* Optional+Extensions.swift */, C82FF10C1F93E84600BDB34D /* AnimatableSectionModelType+ItemPath.swift */, C82FF10D1F93E84600BDB34D /* Changeset.swift */, C82FF10F1F93E84600BDB34D /* AnimatableSectionModelType.swift */, ); path = Differentiator; sourceTree = ""; }; C82FF1101F93E84600BDB34D /* RxDataSources */ = { isa = PBXGroup; children = ( C82FF1111F93E84600BDB34D /* Array+Extensions.swift */, C82FF1121F93E84600BDB34D /* AnimationConfiguration.swift */, C82FF1131F93E84600BDB34D /* FloatingPointType+IdentifiableType.swift */, C82FF1141F93E84600BDB34D /* RxTableViewSectionedAnimatedDataSource.swift */, C82FF1151F93E84600BDB34D /* RxCollectionViewSectionedReloadDataSource.swift */, C82FF1161F93E84600BDB34D /* DataSources.swift */, C82FF1171F93E84600BDB34D /* String+IdentifiableType.swift */, C82FF1181F93E84600BDB34D /* RxPickerViewAdapter.swift */, C82FF1191F93E84600BDB34D /* Deprecated.swift */, C82FF11A1F93E84600BDB34D /* RxDataSources.h */, C82FF11B1F93E84600BDB34D /* CollectionViewSectionedDataSource.swift */, C82FF11C1F93E84600BDB34D /* UI+SectionedViewType.swift */, C82FF11D1F93E84600BDB34D /* IntegerType+IdentifiableType.swift */, C82FF11F1F93E84600BDB34D /* RxCollectionViewSectionedAnimatedDataSource.swift */, C82FF1201F93E84600BDB34D /* TableViewSectionedDataSource.swift */, C82FF1211F93E84600BDB34D /* RxTableViewSectionedReloadDataSource.swift */, ); path = RxDataSources; sourceTree = ""; }; C83366D41AD0293800C668A7 = { isa = PBXGroup; children = ( 780D63E2226B320A00BEACB0 /* Rx.playground */, C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */, C8B290A51C959D2900E923D0 /* RxDataSources */, C83366DF1AD0293800C668A7 /* RxExample */, C886A6751D85AC7B00653EE4 /* Extensions */, C849EF621C3190360048AC4A /* RxExample-iOSTests */, C88C2B281D67EC5200B01A98 /* RxExample-iOSUITests */, C82E1DB11DC69E8D004A6413 /* RxExample-macOSUITests */, 787BBB58226B2A6100279500 /* Playgrounds */, C83366DE1AD0293800C668A7 /* Products */, EF8128F0226BD61900AE22C2 /* Frameworks */, ); sourceTree = ""; }; C83366DE1AD0293800C668A7 /* Products */ = { isa = PBXGroup; children = ( C83366DD1AD0293800C668A7 /* RxExample-iOS.app */, C88BB8DC1B07E6C90064D411 /* RxExample.app */, C849EF611C3190360048AC4A /* RxExample-iOSTests.xctest */, C88C2B271D67EC5200B01A98 /* RxExample-iOSUITests.xctest */, C82E1DB01DC69E8D004A6413 /* RxExample-macOSUITests.xctest */, ); name = Products; sourceTree = ""; }; C83366DF1AD0293800C668A7 /* RxExample */ = { isa = PBXGroup; children = ( C8DF92E91B0B38C0009BCF9A /* Images.xcassets */, C86781C91DB824D500B2029A /* macOS */, C86E2F2E1AE5A0CA00C31024 /* Examples */, C83367101AD029AE00C668A7 /* Services */, 2864D5F11D995FCD004F8484 /* Application+Extensions.swift */, C8BCD3DE1C1480E9005F1280 /* Operators.swift */, 07E3C2321B03605B0010338D /* Dependencies.swift */, C890A65C1AEC084100AFF7E6 /* ViewController.swift */, C833670F1AD029AE00C668A7 /* Example.swift */, C849EF9B1C31A8750048AC4A /* String+URL.swift */, C8D3DDD21FB5DB6900BFE7D4 /* Feedbacks.swift */, C84E5BA51E7893A4001F659A /* Observable+Extensions.swift */, C819DAE81ED0DDD50043A770 /* Version.swift */, C819DAF91ED0DE920043A770 /* Lenses.swift */, C8DF92C71B0B2F84009BCF9A /* iOS */, C83366E01AD0293800C668A7 /* Supporting Files */, ); path = RxExample; sourceTree = ""; }; C83366E01AD0293800C668A7 /* Supporting Files */ = { isa = PBXGroup; children = ( C8DF92F21B0B3E71009BCF9A /* Info-iOS.plist */, C8DF92F01B0B3E67009BCF9A /* Info-macOS.plist */, ); name = "Supporting Files"; sourceTree = ""; }; C83367101AD029AE00C668A7 /* Services */ = { isa = PBXGroup; children = ( C809E9791BE6841C0058D948 /* Wireframe.swift */, C83367111AD029AE00C668A7 /* HtmlParsing.swift */, C83367121AD029AE00C668A7 /* ImageService.swift */, C8A2A2C71B4049E300F11F09 /* PseudoRandomGenerator.swift */, C8A2A2CA1B404A1200F11F09 /* Randomizer.swift */, C80397391BD3E17D009D8B26 /* ActivityIndicator.swift */, B18F3BBB1BD92EC8000AAC79 /* Reachability.swift */, B18F3BE11BDB2E8F000AAC79 /* ReachabilityService.swift */, B1604CB41BE49F8D002E1279 /* DownloadableImage.swift */, B1604CC81BE5BBFA002E1279 /* UIImageView+DownloadableImage.swift */, C809E97C1BE697100058D948 /* UIImage+Extensions.swift */, 0744CDD31C4DB5F000720FD2 /* GeolocationService.swift */, ); path = Services; sourceTree = ""; }; C843A08B1C1CE39900CBA4BD /* GitHubSearchRepositories */ = { isa = PBXGroup; children = ( C817727E1E7DEE5100EA679B /* GitHubSearchRepositories.swift */, AE51C1CE1DE735FD005BAF5F /* GitHubSearchRepositories.storyboard */, C843A08C1C1CE39900CBA4BD /* GitHubSearchRepositoriesAPI.swift */, C843A08D1C1CE39900CBA4BD /* GitHubSearchRepositoriesViewController.swift */, C843A0921C1CE58700CBA4BD /* UINavigationController+Extensions.swift */, ); path = GitHubSearchRepositories; sourceTree = ""; }; C849EF621C3190360048AC4A /* RxExample-iOSTests */ = { isa = PBXGroup; children = ( C89C2BD71C32231A00EBC99C /* Mocks */, C886A6921D85ADA100653EE4 /* UIImagePickerController+RxTests.swift */, C886A6901D85AD7E00653EE4 /* CLLocationManager+RxTests.swift */, C849EF631C3190360048AC4A /* RxExample_iOSTests.swift */, C89C2BD51C321DA200EBC99C /* TestScheduler+MarbleTests.swift */, C849EF651C3190360048AC4A /* Info.plist */, C886A6941D85AEA300653EE4 /* RxTest.swift */, ); path = "RxExample-iOSTests"; sourceTree = ""; }; C849EF7C1C3193B10048AC4A /* UsingDriver > 2 */ = { isa = PBXGroup; children = ( C849EF841C3195180048AC4A /* GitHubSignupViewController2.swift */, C849EF851C3195180048AC4A /* GithubSignupViewModel2.swift */, ); name = "UsingDriver > 2"; path = UsingDriver; sourceTree = ""; }; C849EF7D1C3193B10048AC4A /* UsingVanillaObservables > 1 */ = { isa = PBXGroup; children = ( C849EF7E1C3193B10048AC4A /* GitHubSignupViewController1.swift */, C849EF7F1C3193B10048AC4A /* GithubSignupViewModel1.swift */, ); name = "UsingVanillaObservables > 1"; path = UsingVanillaObservables; sourceTree = ""; }; C864BAD01C3332F10083833C /* TableViewWithEditingCommands */ = { isa = PBXGroup; children = ( AE51C1E01DE73660005BAF5F /* TableViewWithEditingCommands.storyboard */, C864BAD11C3332F10083833C /* DetailViewController.swift */, C864BAD21C3332F10083833C /* RandomUserAPI.swift */, C864BAD41C3332F10083833C /* TableViewWithEditingCommandsViewController.swift */, C864BAD51C3332F10083833C /* UIImageView+Extensions.swift */, C864BAD61C3332F10083833C /* User.swift */, ); path = TableViewWithEditingCommands; sourceTree = ""; }; C86781C91DB824D500B2029A /* macOS */ = { isa = PBXGroup; children = ( C86781CA1DB824D500B2029A /* AppDelegate.swift */, C86781CB1DB824D500B2029A /* Main.storyboard */, ); path = macOS; sourceTree = ""; }; C86781CF1DB8250400B2029A /* macOS simple example */ = { isa = PBXGroup; children = ( C86781D01DB8250400B2029A /* IntroductionExampleViewController.swift */, ); path = "macOS simple example"; sourceTree = ""; }; C86E2F2E1AE5A0CA00C31024 /* Examples */ = { isa = PBXGroup; children = ( 252C9F671F1410D600F5F951 /* UIPickerViewExample */, 8479BC6F1C3BCB4800FB8B54 /* ImagePicker */, C8BCD3E41C14A950005F1280 /* Numbers */, C8BCD3E81C14B015005F1280 /* SimpleValidation */, 0744CDEB1C4DB71300720FD2 /* GeolocationExample */, C86E2F4C1AE5A10900C31024 /* GitHubSignup */, C822B1E11C14E37B0088A01A /* SimpleTableViewExample */, C822B1E51C14E7120088A01A /* SimpleTableViewExampleSectioned */, C86781CF1DB8250400B2029A /* macOS simple example */, C864BAD01C3332F10083833C /* TableViewWithEditingCommands */, C8984CCD1C36BC3E001E4272 /* TableViewPartialUpdates */, C86E2F301AE5A0CA00C31024 /* WikipediaImageSearch */, 075F130E1B4E9D10000D7861 /* APIWrappers */, 07A5C3D91B70B6B8001EFE5C /* Calculator */, C843A08B1C1CE39900CBA4BD /* GitHubSearchRepositories */, ); path = Examples; sourceTree = ""; }; C86E2F301AE5A0CA00C31024 /* WikipediaImageSearch */ = { isa = PBXGroup; children = ( AE51C1E21DE73667005BAF5F /* WikipediaSearch.storyboard */, C86E2F311AE5A0CA00C31024 /* ViewModels */, C86E2F341AE5A0CA00C31024 /* Views */, C86E2F3A1AE5A0CA00C31024 /* WikipediaAPI */, ); path = WikipediaImageSearch; sourceTree = ""; }; C86E2F311AE5A0CA00C31024 /* ViewModels */ = { isa = PBXGroup; children = ( C86E2F321AE5A0CA00C31024 /* SearchResultViewModel.swift */, ); path = ViewModels; sourceTree = ""; }; C86E2F341AE5A0CA00C31024 /* Views */ = { isa = PBXGroup; children = ( C8C46DA31B47F7110020D71E /* CollectionViewImageCell.swift */, C8C46DA41B47F7110020D71E /* WikipediaImageCell.xib */, C8C46DA51B47F7110020D71E /* WikipediaSearchCell.swift */, C8C46DA61B47F7110020D71E /* WikipediaSearchCell.xib */, C8C46DA71B47F7110020D71E /* WikipediaSearchViewController.swift */, ); path = Views; sourceTree = ""; }; C86E2F3A1AE5A0CA00C31024 /* WikipediaAPI */ = { isa = PBXGroup; children = ( C86E2F3B1AE5A0CA00C31024 /* WikipediaAPI.swift */, C86E2F3C1AE5A0CA00C31024 /* WikipediaPage.swift */, C86E2F3D1AE5A0CA00C31024 /* WikipediaSearchResult.swift */, ); path = WikipediaAPI; sourceTree = ""; }; C86E2F4C1AE5A10900C31024 /* GitHubSignup */ = { isa = PBXGroup; children = ( AE51C1D01DE73608005BAF5F /* GitHubSignup1.storyboard */, AE51C1D11DE73608005BAF5F /* GitHubSignup2.storyboard */, C849EF7C1C3193B10048AC4A /* UsingDriver > 2 */, C849EF7D1C3193B10048AC4A /* UsingVanillaObservables > 1 */, C822B1D81C14CBEA0088A01A /* Protocols.swift */, C822B1DB1C14CD1C0088A01A /* DefaultImplementations.swift */, C822B1DE1C14CEAA0088A01A /* BindingExtensions.swift */, ); path = GitHubSignup; sourceTree = ""; }; C886A6751D85AC7B00653EE4 /* Extensions */ = { isa = PBXGroup; children = ( C88CB7251D8F253D0021D83F /* RxImagePickerDelegateProxy.swift */, C886A68C1D85AD2000653EE4 /* CLLocationManager+Rx.swift */, C886A68D1D85AD2000653EE4 /* RxCLLocationManagerDelegateProxy.swift */, C886A68A1D85AC9400653EE4 /* UIImagePickerController+Rx.swift */, ); path = Extensions; sourceTree = ""; }; C88C2B281D67EC5200B01A98 /* RxExample-iOSUITests */ = { isa = PBXGroup; children = ( C88C2B291D67EC5200B01A98 /* FlowTests.swift */, C88C2B2B1D67EC5200B01A98 /* Info.plist */, ); path = "RxExample-iOSUITests"; sourceTree = ""; }; C8984CCD1C36BC3E001E4272 /* TableViewPartialUpdates */ = { isa = PBXGroup; children = ( AE51C1DE1DE73655005BAF5F /* PartialUpdates.storyboard */, C8984CCE1C36BC3E001E4272 /* NumberCell.swift */, C8984CCF1C36BC3E001E4272 /* NumberSectionView.swift */, C8984CD01C36BC3E001E4272 /* PartialUpdatesViewController.swift */, ); path = TableViewPartialUpdates; sourceTree = ""; }; C89C2BD71C32231A00EBC99C /* Mocks */ = { isa = PBXGroup; children = ( C89C2BD81C32231A00EBC99C /* MockGitHubAPI.swift */, C89C2BD91C32231A00EBC99C /* MockWireframe.swift */, C89C2BDA1C32231A00EBC99C /* NotImplementedStubs.swift */, C89C2BDB1C32231A00EBC99C /* ValidationResult+Equatable.swift */, ); path = Mocks; sourceTree = ""; }; C8B290A51C959D2900E923D0 /* RxDataSources */ = { isa = PBXGroup; children = ( C82FF1011F93E84600BDB34D /* Differentiator */, C82FF1101F93E84600BDB34D /* RxDataSources */, C8B290BE1C959D2900E923D0 /* README.md */, ); path = RxDataSources; sourceTree = ""; }; C8BCD3E41C14A950005F1280 /* Numbers */ = { isa = PBXGroup; children = ( AE51C1D61DE73623005BAF5F /* Numbers.storyboard */, C8BCD3E51C14A95E005F1280 /* NumbersViewController.swift */, ); path = Numbers; sourceTree = ""; }; C8BCD3E81C14B015005F1280 /* SimpleValidation */ = { isa = PBXGroup; children = ( AE51C1DC1DE73649005BAF5F /* SimpleValidation.storyboard */, C8BCD3E91C14B02A005F1280 /* SimpleValidationViewController.swift */, ); path = SimpleValidation; sourceTree = ""; }; C8DF92C71B0B2F84009BCF9A /* iOS */ = { isa = PBXGroup; children = ( C8DF92E01B0B32DA009BCF9A /* LaunchScreen.xib */, C8DF92E11B0B32DA009BCF9A /* Main.storyboard */, C8DF92E21B0B32DA009BCF9A /* RootViewController.swift */, C8DF92C81B0B2F84009BCF9A /* AppDelegate.swift */, A34040202C47AC2F009E3F74 /* BaseNavigationController.swift */, C8CDF0C01D688DF700C18F99 /* UITableView+Extensions.swift */, ); path = iOS; sourceTree = ""; }; EF8128F0226BD61900AE22C2 /* Frameworks */ = { isa = PBXGroup; children = ( ); name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ C82E1DAF1DC69E8D004A6413 /* RxExample-macOSUITests */ = { isa = PBXNativeTarget; buildConfigurationList = C82E1DB71DC69E8D004A6413 /* Build configuration list for PBXNativeTarget "RxExample-macOSUITests" */; buildPhases = ( C82E1DAC1DC69E8D004A6413 /* Sources */, C82E1DAD1DC69E8D004A6413 /* Frameworks */, C82E1DAE1DC69E8D004A6413 /* Resources */, ); buildRules = ( ); dependencies = ( C82E1DB61DC69E8D004A6413 /* PBXTargetDependency */, ); name = "RxExample-macOSUITests"; productName = "RxExample-macOSUITests"; productReference = C82E1DB01DC69E8D004A6413 /* RxExample-macOSUITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; C83366DC1AD0293800C668A7 /* RxExample-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = C83366FF1AD0293900C668A7 /* Build configuration list for PBXNativeTarget "RxExample-iOS" */; buildPhases = ( C83366D91AD0293800C668A7 /* Sources */, C83366DA1AD0293800C668A7 /* Frameworks */, C83366DB1AD0293800C668A7 /* Resources */, ); buildRules = ( ); dependencies = ( C8E1EB371E30FB1C00919B41 /* PBXTargetDependency */, C8E1EB211E30FB1600919B41 /* PBXTargetDependency */, ); name = "RxExample-iOS"; productName = RxExample; productReference = C83366DD1AD0293800C668A7 /* RxExample-iOS.app */; productType = "com.apple.product-type.application"; }; C849EF601C3190360048AC4A /* RxExample-iOSTests */ = { isa = PBXNativeTarget; buildConfigurationList = C849EF7B1C3190360048AC4A /* Build configuration list for PBXNativeTarget "RxExample-iOSTests" */; buildPhases = ( C849EF5D1C3190360048AC4A /* Sources */, C849EF5E1C3190360048AC4A /* Frameworks */, C849EF5F1C3190360048AC4A /* Resources */, ); buildRules = ( ); dependencies = ( C8E1EB3D1E30FB3C00919B41 /* PBXTargetDependency */, C849EF671C3190360048AC4A /* PBXTargetDependency */, ); name = "RxExample-iOSTests"; productName = "RxExample-iOSTests"; productReference = C849EF611C3190360048AC4A /* RxExample-iOSTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; C88BB8B91B07E6C90064D411 /* RxExample-OSX */ = { isa = PBXNativeTarget; buildConfigurationList = C88BB8D91B07E6C90064D411 /* Build configuration list for PBXNativeTarget "RxExample-OSX" */; buildPhases = ( C88BB8BA1B07E6C90064D411 /* Sources */, C88BB8CD1B07E6C90064D411 /* Frameworks */, C88BB8D01B07E6C90064D411 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "RxExample-OSX"; productName = RxExample; productReference = C88BB8DC1B07E6C90064D411 /* RxExample.app */; productType = "com.apple.product-type.application"; }; C88C2B261D67EC5200B01A98 /* RxExample-iOSUITests */ = { isa = PBXNativeTarget; buildConfigurationList = C88C2B2E1D67EC5200B01A98 /* Build configuration list for PBXNativeTarget "RxExample-iOSUITests" */; buildPhases = ( C88C2B231D67EC5200B01A98 /* Sources */, C88C2B241D67EC5200B01A98 /* Frameworks */, C88C2B251D67EC5200B01A98 /* Resources */, ); buildRules = ( ); dependencies = ( C8E1EB3F1E30FB4600919B41 /* PBXTargetDependency */, C88C2B2D1D67EC5200B01A98 /* PBXTargetDependency */, ); name = "RxExample-iOSUITests"; productName = "RxExample-iOSUITests"; productReference = C88C2B271D67EC5200B01A98 /* RxExample-iOSUITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ C83366D51AD0293800C668A7 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0810; LastUpgradeCheck = 1250; ORGANIZATIONNAME = "Krunoslav Zaher"; TargetAttributes = { C82E1DAF1DC69E8D004A6413 = { CreatedOnToolsVersion = 8.1; DevelopmentTeam = ""; ProvisioningStyle = Automatic; TestTargetID = C88BB8B91B07E6C90064D411; }; C83366DC1AD0293800C668A7 = { CreatedOnToolsVersion = 6.2; DevelopmentTeam = 2V65Z4JB29; LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; C849EF601C3190360048AC4A = { CreatedOnToolsVersion = 7.2; DevelopmentTeam = ""; LastSwiftMigration = 0800; TestTargetID = C83366DC1AD0293800C668A7; }; C88BB8B91B07E6C90064D411 = { LastSwiftMigration = 0800; }; C88C2B261D67EC5200B01A98 = { CreatedOnToolsVersion = 8.0; DevelopmentTeam = ""; ProvisioningStyle = Automatic; TestTargetID = C83366DC1AD0293800C668A7; }; }; }; buildConfigurationList = C83366D81AD0293800C668A7 /* Build configuration list for PBXProject "RxExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = C83366D41AD0293800C668A7; productRefGroup = C83366DE1AD0293800C668A7 /* Products */; projectDirPath = ""; projectReferences = ( { ProductGroup = C81B39F21BC1C28400EF5A9F /* Products */; ProjectRef = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */; }, ); projectRoot = ""; targets = ( C83366DC1AD0293800C668A7 /* RxExample-iOS */, C88BB8B91B07E6C90064D411 /* RxExample-OSX */, C849EF601C3190360048AC4A /* RxExample-iOSTests */, C88C2B261D67EC5200B01A98 /* RxExample-iOSUITests */, C82E1DAF1DC69E8D004A6413 /* RxExample-macOSUITests */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ 787BBB6B226B2A6100279500 /* RxRelay.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = RxRelay.framework; remoteRef = 787BBB6A226B2A6100279500 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 8479BC661C3BC98F00FB8B54 /* AllTests-iOS.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = "AllTests-iOS.xctest"; remoteRef = 8479BC651C3BC98F00FB8B54 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 8479BC681C3BC98F00FB8B54 /* AllTests-tvOS.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = "AllTests-tvOS.xctest"; remoteRef = 8479BC671C3BC98F00FB8B54 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 8479BC6A1C3BC98F00FB8B54 /* AllTests-macOS.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = "AllTests-macOS.xctest"; remoteRef = 8479BC691C3BC98F00FB8B54 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 8479BC6C1C3BC98F00FB8B54 /* PerformanceTests.app */ = { isa = PBXReferenceProxy; fileType = wrapper.application; name = PerformanceTests.app; path = Microoptimizations.app; remoteRef = 8479BC6B1C3BC98F00FB8B54 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; C810DCBF1E3D612900D53105 /* Benchmarks.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = Benchmarks.xctest; remoteRef = C810DCBE1E3D612900D53105 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; C81B3A011BC1C28400EF5A9F /* RxSwift.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = RxSwift.framework; remoteRef = C81B3A001BC1C28400EF5A9F /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; C81B3A091BC1C28400EF5A9F /* RxCocoa.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = RxCocoa.framework; remoteRef = C81B3A081BC1C28400EF5A9F /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; C81B3A111BC1C28400EF5A9F /* RxBlocking.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = RxBlocking.framework; remoteRef = C81B3A101BC1C28400EF5A9F /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; C8864C5A1C275A200073016D /* RxTest.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = RxTest.framework; remoteRef = C8864C591C275A200073016D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ C82E1DAE1DC69E8D004A6413 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C83366DB1AD0293800C668A7 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( C8C46DAB1B47F7110020D71E /* WikipediaSearchCell.xib in Resources */, AE51C1E31DE73667005BAF5F /* WikipediaSearch.storyboard in Resources */, AE51C1D71DE73623005BAF5F /* Numbers.storyboard in Resources */, AE51C1CF1DE735FD005BAF5F /* GitHubSearchRepositories.storyboard in Resources */, AE51C1DB1DE7363C005BAF5F /* SimpleTableViewExampleSectioned.storyboard in Resources */, AE51C1D51DE73613005BAF5F /* ImagePicker.storyboard in Resources */, AE51C1CD1DE735EF005BAF5F /* Geolocation.storyboard in Resources */, AE51C1D31DE73608005BAF5F /* GitHubSignup2.storyboard in Resources */, 252C9F7A1F14115B00F5F951 /* SimpleUIPickerViewExample.storyboard in Resources */, AE51C1DD1DE73649005BAF5F /* SimpleValidation.storyboard in Resources */, C8DF92E31B0B32DA009BCF9A /* LaunchScreen.xib in Resources */, C8C46DA91B47F7110020D71E /* WikipediaImageCell.xib in Resources */, AE51C1C91DE735D8005BAF5F /* APIWrappers.storyboard in Resources */, C8DF92EA1B0B38C0009BCF9A /* Images.xcassets in Resources */, C8DF92E41B0B32DA009BCF9A /* Main.storyboard in Resources */, AE51C1E11DE73660005BAF5F /* TableViewWithEditingCommands.storyboard in Resources */, AE51C1D91DE73633005BAF5F /* SimpleTableViewExample.storyboard in Resources */, AE51C1CB1DE735E3005BAF5F /* Calculator.storyboard in Resources */, AE51C1DF1DE73655005BAF5F /* PartialUpdates.storyboard in Resources */, AE51C1D21DE73608005BAF5F /* GitHubSignup1.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; C849EF5F1C3190360048AC4A /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; C88BB8D01B07E6C90064D411 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( C8DF92EB1B0B38C0009BCF9A /* Images.xcassets in Resources */, C86781CE1DB824E500B2029A /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; C88C2B251D67EC5200B01A98 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ C82E1DAC1DC69E8D004A6413 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C82E1DB31DC69E8D004A6413 /* RxExample_macOSUITests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C83366D91AD0293800C668A7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0744CDD41C4DB5F000720FD2 /* GeolocationService.swift in Sources */, B1604CC91BE5BBFA002E1279 /* UIImageView+DownloadableImage.swift in Sources */, C886A68F1D85AD2000653EE4 /* RxCLLocationManagerDelegateProxy.swift in Sources */, C86E2F3E1AE5A0CA00C31024 /* SearchResultViewModel.swift in Sources */, C83367241AD029AE00C668A7 /* HtmlParsing.swift in Sources */, C8F8C48A1C277F460047640B /* Calculator.swift in Sources */, C82FF1261F93E84600BDB34D /* Diff.swift in Sources */, C843A08E1C1CE39900CBA4BD /* GitHubSearchRepositoriesAPI.swift in Sources */, C82FF1311F93E84600BDB34D /* FloatingPointType+IdentifiableType.swift in Sources */, C849EF801C3193B10048AC4A /* GitHubSignupViewController1.swift in Sources */, C8DF92E51B0B32DA009BCF9A /* RootViewController.swift in Sources */, C822B1DC1C14CD1C0088A01A /* DefaultImplementations.swift in Sources */, C82FF12F1F93E84600BDB34D /* Array+Extensions.swift in Sources */, 2864D5F21D995FCD004F8484 /* Application+Extensions.swift in Sources */, C819DAFA1ED0DE920043A770 /* Lenses.swift in Sources */, C82FF1231F93E84600BDB34D /* Utilities.swift in Sources */, C84E5BA61E7893A4001F659A /* Observable+Extensions.swift in Sources */, C886A68E1D85AD2000653EE4 /* CLLocationManager+Rx.swift in Sources */, C82FF12E1F93E84600BDB34D /* AnimatableSectionModelType.swift in Sources */, C8C46DA81B47F7110020D71E /* CollectionViewImageCell.swift in Sources */, C82FF1341F93E84600BDB34D /* DataSources.swift in Sources */, C8984CD31C36BC3E001E4272 /* NumberSectionView.swift in Sources */, C822B1E31C14E4810088A01A /* SimpleTableViewExampleViewController.swift in Sources */, C8C46DAC1B47F7110020D71E /* WikipediaSearchViewController.swift in Sources */, 07A5C3DB1B70B703001EFE5C /* CalculatorViewController.swift in Sources */, C849EF861C3195180048AC4A /* GitHubSignupViewController2.swift in Sources */, C864BAD71C3332F10083833C /* DetailViewController.swift in Sources */, C822B1DF1C14CEAA0088A01A /* BindingExtensions.swift in Sources */, C864BAD91C3332F10083833C /* RandomUserAPI.swift in Sources */, A5CD038F1F1670E50005A376 /* CustomPickerViewAdapterExampleViewController.swift in Sources */, C886A68B1D85AC9400653EE4 /* UIImagePickerController+Rx.swift in Sources */, C864BADF1C3332F10083833C /* UIImageView+Extensions.swift in Sources */, C82FF1391F93E84600BDB34D /* UI+SectionedViewType.swift in Sources */, C8BCD3DF1C1480E9005F1280 /* Operators.swift in Sources */, C843A0901C1CE39900CBA4BD /* GitHubSearchRepositoriesViewController.swift in Sources */, C803973A1BD3E17D009D8B26 /* ActivityIndicator.swift in Sources */, C82FF1241F93E84600BDB34D /* IdentifiableType.swift in Sources */, C82FF13E1F93E84600BDB34D /* RxTableViewSectionedReloadDataSource.swift in Sources */, C8CDF0C11D688DF700C18F99 /* UITableView+Extensions.swift in Sources */, C849EF821C3193B10048AC4A /* GithubSignupViewModel1.swift in Sources */, C82FF13A1F93E84600BDB34D /* IntegerType+IdentifiableType.swift in Sources */, C864BADD1C3332F10083833C /* TableViewWithEditingCommandsViewController.swift in Sources */, C822B1D91C14CBEA0088A01A /* Protocols.swift in Sources */, C8BCD3E61C14A95E005F1280 /* NumbersViewController.swift in Sources */, C849EF881C3195180048AC4A /* GithubSignupViewModel2.swift in Sources */, C809E97A1BE6841C0058D948 /* Wireframe.swift in Sources */, C843A0931C1CE58700CBA4BD /* UINavigationController+Extensions.swift in Sources */, C82FF1321F93E84600BDB34D /* RxTableViewSectionedAnimatedDataSource.swift in Sources */, C82FF12B1F93E84600BDB34D /* AnimatableSectionModelType+ItemPath.swift in Sources */, C82FF12A1F93E84600BDB34D /* Optional+Extensions.swift in Sources */, C822B1E71C14E7250088A01A /* SimpleTableViewExampleSectionedViewController.swift in Sources */, C83367251AD029AE00C668A7 /* ImageService.swift in Sources */, C819DAE91ED0DDD50043A770 /* Version.swift in Sources */, C82FF13C1F93E84600BDB34D /* RxCollectionViewSectionedAnimatedDataSource.swift in Sources */, C82FF1271F93E84600BDB34D /* AnimatableSectionModel.swift in Sources */, C82FF1331F93E84600BDB34D /* RxCollectionViewSectionedReloadDataSource.swift in Sources */, C817727F1E7DEE5100EA679B /* GitHubSearchRepositories.swift in Sources */, C86E2F471AE5A0CA00C31024 /* WikipediaSearchResult.swift in Sources */, C8984CD11C36BC3E001E4272 /* NumberCell.swift in Sources */, C82FF1381F93E84600BDB34D /* CollectionViewSectionedDataSource.swift in Sources */, C8A2A2C81B4049E300F11F09 /* PseudoRandomGenerator.swift in Sources */, C8D132151C42B54B00B59FFF /* UIImagePickerController+RxCreate.swift in Sources */, 252C9F781F14111800F5F951 /* SimplePickerViewExampleViewController.swift in Sources */, A34040282C47AC34009E3F74 /* BaseNavigationController.swift in Sources */, C8984CD51C36BC3E001E4272 /* PartialUpdatesViewController.swift in Sources */, C82FF1371F93E84600BDB34D /* Deprecated.swift in Sources */, C88CB7261D8F253D0021D83F /* RxImagePickerDelegateProxy.swift in Sources */, C82FF1221F93E84600BDB34D /* SectionModelType.swift in Sources */, C82FF1361F93E84600BDB34D /* RxPickerViewAdapter.swift in Sources */, 8479BC721C3BDAD400FB8B54 /* ImagePickerController.swift in Sources */, C864BAE11C3332F10083833C /* User.swift in Sources */, 0744CDED1C4DB78600720FD2 /* GeolocationViewController.swift in Sources */, C83367231AD029AE00C668A7 /* Example.swift in Sources */, C890A65D1AEC084100AFF7E6 /* ViewController.swift in Sources */, C8C46DAA1B47F7110020D71E /* WikipediaSearchCell.swift in Sources */, C82FF12C1F93E84600BDB34D /* Changeset.swift in Sources */, B1604CB51BE49F8D002E1279 /* DownloadableImage.swift in Sources */, 075F13101B4E9D5A000D7861 /* APIWrappersViewController.swift in Sources */, C8D3DDE21FB5DB6900BFE7D4 /* Feedbacks.swift in Sources */, C82FF1251F93E84600BDB34D /* SectionModel.swift in Sources */, B18F3BE21BDB2E8F000AAC79 /* ReachabilityService.swift in Sources */, B18F3BBC1BD92EC8000AAC79 /* Reachability.swift in Sources */, 07E3C2331B03605B0010338D /* Dependencies.swift in Sources */, C82FF1291F93E84600BDB34D /* ItemPath.swift in Sources */, C849EF9C1C31A8750048AC4A /* String+URL.swift in Sources */, C86E2F451AE5A0CA00C31024 /* WikipediaAPI.swift in Sources */, C8DF92CD1B0B2F84009BCF9A /* AppDelegate.swift in Sources */, C86E2F461AE5A0CA00C31024 /* WikipediaPage.swift in Sources */, C82FF13D1F93E84600BDB34D /* TableViewSectionedDataSource.swift in Sources */, C82FF1351F93E84600BDB34D /* String+IdentifiableType.swift in Sources */, C809E97D1BE697100058D948 /* UIImage+Extensions.swift in Sources */, C8A2A2CB1B404A1200F11F09 /* Randomizer.swift in Sources */, C8BCD3EA1C14B02A005F1280 /* SimpleValidationViewController.swift in Sources */, C82FF1301F93E84600BDB34D /* AnimationConfiguration.swift in Sources */, C82FF1281F93E84600BDB34D /* IdentifiableValue.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C849EF5D1C3190360048AC4A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C89C2BD61C321DA200EBC99C /* TestScheduler+MarbleTests.swift in Sources */, C886A6951D85AEA300653EE4 /* RxTest.swift in Sources */, C849EF901C319E9A0048AC4A /* GithubSignupViewModel1.swift in Sources */, C849EF641C3190360048AC4A /* RxExample_iOSTests.swift in Sources */, C886A6911D85AD7E00653EE4 /* CLLocationManager+RxTests.swift in Sources */, C849EF921C319E9A0048AC4A /* DefaultImplementations.swift in Sources */, C849EF991C31A63C0048AC4A /* Wireframe.swift in Sources */, C89C2BDC1C32231A00EBC99C /* MockGitHubAPI.swift in Sources */, C89C2BDE1C32231A00EBC99C /* NotImplementedStubs.swift in Sources */, C849EF9A1C31A7680048AC4A /* ActivityIndicator.swift in Sources */, C849EF951C319E9D0048AC4A /* GithubSignupViewModel2.swift in Sources */, C886A6931D85ADA100653EE4 /* UIImagePickerController+RxTests.swift in Sources */, C89C2BDD1C32231A00EBC99C /* MockWireframe.swift in Sources */, C89C2BDF1C32231A00EBC99C /* ValidationResult+Equatable.swift in Sources */, C849EF911C319E9A0048AC4A /* Protocols.swift in Sources */, C849EF9F1C31A8750048AC4A /* String+URL.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C88BB8BA1B07E6C90064D411 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C809E97F1BE69B660058D948 /* Wireframe.swift in Sources */, C86781CC1DB824D500B2029A /* AppDelegate.swift in Sources */, C88BB8BB1B07E6C90064D411 /* SearchResultViewModel.swift in Sources */, C88BB8BC1B07E6C90064D411 /* HtmlParsing.swift in Sources */, C8E9D2AF1BD3FD960079D0DB /* ActivityIndicator.swift in Sources */, C849EF9D1C31A8750048AC4A /* String+URL.swift in Sources */, C88BB8BE1B07E6C90064D411 /* ImageService.swift in Sources */, B1604CC31BE5B8BD002E1279 /* ReachabilityService.swift in Sources */, 2864D5F31D995FCD004F8484 /* Application+Extensions.swift in Sources */, C86781D11DB8250400B2029A /* IntroductionExampleViewController.swift in Sources */, C88BB8BF1B07E6C90064D411 /* WikipediaSearchResult.swift in Sources */, B18F3BBF1BD93DFF000AAC79 /* Reachability.swift in Sources */, C88BB8C31B07E6C90064D411 /* Example.swift in Sources */, C88BB8C41B07E6C90064D411 /* ViewController.swift in Sources */, C88BB8C71B07E6C90064D411 /* Dependencies.swift in Sources */, C88BB8CA1B07E6C90064D411 /* WikipediaAPI.swift in Sources */, C809E9801BE69BA30058D948 /* UIImage+Extensions.swift in Sources */, 927A78B82117A5E700A45638 /* Operators.swift in Sources */, B1604CCA1BE5BC18002E1279 /* DownloadableImage.swift in Sources */, C84E5BA71E7893A4001F659A /* Observable+Extensions.swift in Sources */, C88BB8CC1B07E6C90064D411 /* WikipediaPage.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C88C2B231D67EC5200B01A98 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C88C2B2A1D67EC5200B01A98 /* FlowTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ C82E1DB61DC69E8D004A6413 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C88BB8B91B07E6C90064D411 /* RxExample-OSX */; targetProxy = C82E1DB51DC69E8D004A6413 /* PBXContainerItemProxy */; }; C849EF671C3190360048AC4A /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C83366DC1AD0293800C668A7 /* RxExample-iOS */; targetProxy = C849EF661C3190360048AC4A /* PBXContainerItemProxy */; }; C88C2B2D1D67EC5200B01A98 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C83366DC1AD0293800C668A7 /* RxExample-iOS */; targetProxy = C88C2B2C1D67EC5200B01A98 /* PBXContainerItemProxy */; }; C8E1EB211E30FB1600919B41 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "RxSwift-iOS"; targetProxy = C8E1EB201E30FB1600919B41 /* PBXContainerItemProxy */; }; C8E1EB371E30FB1C00919B41 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "RxCocoa-iOS"; targetProxy = C8E1EB361E30FB1C00919B41 /* PBXContainerItemProxy */; }; C8E1EB3D1E30FB3C00919B41 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "RxTest-iOS"; targetProxy = C8E1EB3C1E30FB3C00919B41 /* PBXContainerItemProxy */; }; C8E1EB3F1E30FB4600919B41 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "RxTest-iOS"; targetProxy = C8E1EB3E1E30FB4600919B41 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ C82E1DB81DC69E8D004A6413 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "RxExample-macOSUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.RxExample-macOSUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; TEST_TARGET_NAME = "RxExample-OSX"; }; name = Debug; }; C82E1DB91DC69E8D004A6413 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "RxExample-macOSUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.RxExample-macOSUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TEST_TARGET_NAME = "RxExample-OSX"; }; name = Release; }; C82E1DBA1DC69E8D004A6413 /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "RxExample-macOSUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "io.rx.RxExample-macOSUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TEST_TARGET_NAME = "RxExample-OSX"; }; name = "Release-Tests"; }; C83366FD1AD0293900C668A7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; 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; INFOPLIST_FILE = RxExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; OTHER_SWIFT_FLAGS = "-D DEBUG -D TRACE_RESOURCES"; PRODUCT_NAME = RxExample; SDKROOT = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; }; name = Debug; }; C83366FE1AD0293900C668A7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; 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; INFOPLIST_FILE = RxExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; OTHER_SWIFT_FLAGS = "-D RELEASE"; PRODUCT_NAME = RxExample; SDKROOT = ""; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; VALIDATE_PRODUCT = YES; }; name = Release; }; C83367001AD0293900C668A7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 2V65Z4JB29; INFOPLIST_FILE = "RxExample/Info-iOS.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.example.4.3.0; PRODUCT_NAME = "RxExample-iOS"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; }; name = Debug; }; C83367011AD0293900C668A7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 2V65Z4JB29; INFOPLIST_FILE = "RxExample/Info-iOS.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.example.4.3.0; PRODUCT_NAME = "RxExample-iOS"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; C849EF681C3190360048AC4A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "RxExample-iOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "kzaher.RxExample-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RxExample-iOS.app/RxExample-iOS"; }; name = Debug; }; C849EF691C3190360048AC4A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "RxExample-iOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "kzaher.RxExample-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RxExample-iOS.app/RxExample-iOS"; }; name = Release; }; C849EF6A1C3190360048AC4A /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "RxExample-iOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "kzaher.RxExample-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RxExample-iOS.app/RxExample-iOS"; }; name = "Release-Tests"; }; C88BB8DA1B07E6C90064D411 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "RxExample/Info-macOS.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @executable_path/../Frameworks"; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.example.osx; SDKROOT = macosx; }; name = Debug; }; C88BB8DB1B07E6C90064D411 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "RxExample/Info-macOS.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @executable_path/../Frameworks"; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.example.osx; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; C88C2B2F1D67EC5200B01A98 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "RxExample-iOSUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rx.RxExample-iOSUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; TEST_TARGET_NAME = "RxExample-iOS"; }; name = Debug; }; C88C2B301D67EC5200B01A98 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "RxExample-iOSUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rx.RxExample-iOSUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TEST_TARGET_NAME = "RxExample-iOS"; }; name = Release; }; C88C2B311D67EC5200B01A98 /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "RxExample-iOSUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "rx.RxExample-iOSUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TEST_TARGET_NAME = "RxExample-iOS"; }; name = "Release-Tests"; }; C8DF92ED1B0B3DFA009BCF9A /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ""; 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; INFOPLIST_FILE = RxExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; OTHER_SWIFT_FLAGS = "-D TRACE_RESOURCES"; PRODUCT_NAME = RxExample; SDKROOT = ""; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,4"; VALIDATE_PRODUCT = YES; }; name = "Release-Tests"; }; C8DF92EE1B0B3DFA009BCF9A /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 2V65Z4JB29; INFOPLIST_FILE = "RxExample/Info-iOS.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.example.4.3.0; PRODUCT_NAME = "RxExample-iOS"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = "Release-Tests"; }; C8DF92EF1B0B3DFA009BCF9A /* Release-Tests */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "RxExample/Info-macOS.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @executable_path/../Frameworks"; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = io.rx.example.osx; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = "Release-Tests"; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C82E1DB71DC69E8D004A6413 /* Build configuration list for PBXNativeTarget "RxExample-macOSUITests" */ = { isa = XCConfigurationList; buildConfigurations = ( C82E1DB81DC69E8D004A6413 /* Debug */, C82E1DB91DC69E8D004A6413 /* Release */, C82E1DBA1DC69E8D004A6413 /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C83366D81AD0293800C668A7 /* Build configuration list for PBXProject "RxExample" */ = { isa = XCConfigurationList; buildConfigurations = ( C83366FD1AD0293900C668A7 /* Debug */, C83366FE1AD0293900C668A7 /* Release */, C8DF92ED1B0B3DFA009BCF9A /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C83366FF1AD0293900C668A7 /* Build configuration list for PBXNativeTarget "RxExample-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( C83367001AD0293900C668A7 /* Debug */, C83367011AD0293900C668A7 /* Release */, C8DF92EE1B0B3DFA009BCF9A /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C849EF7B1C3190360048AC4A /* Build configuration list for PBXNativeTarget "RxExample-iOSTests" */ = { isa = XCConfigurationList; buildConfigurations = ( C849EF681C3190360048AC4A /* Debug */, C849EF691C3190360048AC4A /* Release */, C849EF6A1C3190360048AC4A /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C88BB8D91B07E6C90064D411 /* Build configuration list for PBXNativeTarget "RxExample-OSX" */ = { isa = XCConfigurationList; buildConfigurations = ( C88BB8DA1B07E6C90064D411 /* Debug */, C88BB8DB1B07E6C90064D411 /* Release */, C8DF92EF1B0B3DFA009BCF9A /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C88C2B2E1D67EC5200B01A98 /* Build configuration list for PBXNativeTarget "RxExample-iOSUITests" */ = { isa = XCConfigurationList; buildConfigurations = ( C88C2B2F1D67EC5200B01A98 /* Debug */, C88C2B301D67EC5200B01A98 /* Release */, C88C2B311D67EC5200B01A98 /* Release-Tests */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = C83366D51AD0293800C668A7 /* Project object */; } ================================================ FILE: RxExample/RxExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS.xcscheme ================================================ ================================================ FILE: RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOSTests.xcscheme ================================================ ================================================ FILE: RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOSUITests.xcscheme ================================================ ================================================ FILE: RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-macOS.xcscheme ================================================ ================================================ FILE: RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-macOSUITests.xcscheme ================================================ ================================================ FILE: RxRelay/BehaviorRelay.swift ================================================ // // BehaviorRelay.swift // RxRelay // // 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 { 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 try! subject.value() } /// Initializes behavior relay with initial value. public init(value: Element) { subject = BehaviorSubject(value: value) } /// Subscribes observer public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { subject.subscribe(observer) } /// - returns: Canonical interface for push style sequence public func asObservable() -> Observable { subject.asObservable() } /// Convert to an `Infallible` /// /// - returns: `Infallible` public func asInfallible() -> Infallible { asInfallible(onErrorFallbackTo: .empty()) } } ================================================ FILE: RxRelay/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString $(RX_VERSION) CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: RxRelay/Observable+Bind.swift ================================================ // // Observable+Bind.swift // RxRelay // // Created by Shai Mishali on 09/04/2019. // Copyright © 2019 Krunoslav Zaher. All rights reserved. // import RxSwift public extension ObservableType { /** Creates new subscription and sends elements to publish relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target publish relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ func bind(to relays: PublishRelay...) -> Disposable { bind(to: relays) } /** Creates new subscription and sends elements to publish relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target publish relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ func bind(to relays: PublishRelay...) -> Disposable { map { $0 as Element? }.bind(to: relays) } /** Creates new subscription and sends elements to publish relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target publish relays for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ private func bind(to relays: [PublishRelay]) -> Disposable { subscribe { e in switch e { case let .next(element): for relay in relays { relay.accept(element) } case let .error(error): rxFatalErrorInDebug("Binding error to publish relay: \(error)") case .completed: break } } } /** Creates new subscription and sends elements to behavior relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target behavior relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ func bind(to relays: BehaviorRelay...) -> Disposable { bind(to: relays) } /** Creates new subscription and sends elements to behavior relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target behavior relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ func bind(to relays: BehaviorRelay...) -> Disposable { map { $0 as Element? }.bind(to: relays) } /** Creates new subscription and sends elements to behavior relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target behavior relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ private func bind(to relays: [BehaviorRelay]) -> Disposable { subscribe { e in switch e { case let .next(element): for relay in relays { relay.accept(element) } case let .error(error): rxFatalErrorInDebug("Binding error to behavior relay: \(error)") case .completed: break } } } /** Creates new subscription and sends elements to replay relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target replay relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ func bind(to relays: ReplayRelay...) -> Disposable { bind(to: relays) } /** Creates new subscription and sends elements to replay relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target replay relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ func bind(to relays: ReplayRelay...) -> Disposable { map { $0 as Element? }.bind(to: relays) } /** Creates new subscription and sends elements to replay relay(s). In case error occurs in debug mode, `fatalError` will be raised. In case error occurs in release mode, `error` will be logged. - parameter relays: Target replay relay for sequence elements. - returns: Disposable object that can be used to unsubscribe the observer. */ private func bind(to relays: [ReplayRelay]) -> Disposable { subscribe { e in switch e { case let .next(element): for relay in relays { relay.accept(element) } case let .error(error): rxFatalErrorInDebug("Binding error to behavior relay: \(error)") case .completed: break } } } } ================================================ FILE: RxRelay/PublishRelay.swift ================================================ // // PublishRelay.swift // RxRelay // // 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 { private let subject: PublishSubject /// Accepts `event` and emits it to subscribers public func accept(_ event: Element) { subject.onNext(event) } /// Initializes with internal empty subject. public init() { subject = PublishSubject() } /// Subscribes observer public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { subject.subscribe(observer) } /// - returns: Canonical interface for push style sequence public func asObservable() -> Observable { subject.asObservable() } /// Convert to an `Infallible` /// /// - returns: `Infallible` public func asInfallible() -> Infallible { asInfallible(onErrorFallbackTo: .empty()) } } ================================================ FILE: RxRelay/ReplayRelay.swift ================================================ // // ReplayRelay.swift // RxRelay // // Created by Zsolt Kovacs on 12/22/19. // Copyright © 2019 Krunoslav Zaher. All rights reserved. // import RxSwift /// ReplayRelay is a wrapper for `ReplaySubject`. /// /// Unlike `ReplaySubject` it can't terminate with an error or complete. public final class ReplayRelay: ObservableType { private let subject: ReplaySubject /// Accepts `event` and emits it to subscribers public func accept(_ event: Element) { subject.onNext(event) } private init(subject: ReplaySubject) { self.subject = subject } /// Creates new instance of `ReplayRelay` that replays at most `bufferSize` last elements sent to it. /// /// - parameter bufferSize: Maximal number of elements to replay to observers after subscription. /// - returns: New instance of replay relay. public static func create(bufferSize: Int) -> ReplayRelay { ReplayRelay(subject: ReplaySubject.create(bufferSize: bufferSize)) } /// Creates a new instance of `ReplayRelay` that buffers all the sent to it. /// To avoid filling up memory, developer needs to make sure that the use case will only ever store a 'reasonable' /// number of elements. public static func createUnbound() -> ReplayRelay { ReplayRelay(subject: ReplaySubject.createUnbounded()) } /// Subscribes observer public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { subject.subscribe(observer) } /// - returns: Canonical interface for push style sequence public func asObservable() -> Observable { subject.asObserver() } /// Convert to an `Infallible` /// /// - returns: `Infallible` public func asInfallible() -> Infallible { asInfallible(onErrorFallbackTo: .empty()) } } ================================================ FILE: RxRelay/Utils.swift ================================================ // // Utils.swift // RxRelay // // Created by Shai Mishali on 09/04/2019. // Copyright © 2019 Krunoslav Zaher. All rights reserved. // import Foundation 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 } ================================================ FILE: RxSwift/AnyObserver.swift ================================================ // // 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 { /// 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) { observer = eventHandler } /// Construct an instance whose `on(event)` calls `observer.on(event)` /// /// - parameter observer: Observer that receives sequence events. public init(_ observer: Observer) where Observer.Element == Element { self.observer = observer.on } /// Send `event` to this observer. /// /// - parameter event: Event instance. public func on(_ event: Event) { observer(event) } /// Erases type of observer and returns canonical observer. /// /// - returns: type erased observer. public func asObserver() -> AnyObserver { self } } extension AnyObserver { /// Collection of `AnyObserver`s typealias s = Bag<(Event) -> Void> } public extension ObserverType { /// Erases type of observer and returns canonical observer. /// /// - returns: type erased observer. func asObserver() -> AnyObserver { 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. func mapObserver(_ transform: @escaping (Result) throws -> Element) -> AnyObserver { AnyObserver { e in self.on(e.map(transform)) } } } ================================================ FILE: RxSwift/Binder.swift ================================================ // // Binder.swift // RxSwift // // Created by Krunoslav Zaher on 9/17/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // /** 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 Element = Value private let binding: (Event) -> Void /// 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) -> Void) { self.binding = { [weak target] event in switch event { case let .next(element): _ = scheduler.schedule(element) { element in if let target { binding(target, element) } return Disposables.create() } case let .error(error): rxFatalErrorInDebug("Binding error: \(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 { AnyObserver(eventHandler: on) } } ================================================ FILE: RxSwift/Cancelable.swift ================================================ // // 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 } } ================================================ FILE: RxSwift/Concurrency/AsyncLock.swift ================================================ // // 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 private var _lock = SpinLock() private var queue: Queue = Queue(capacity: 0) private var isExecuting: Bool = false private var hasFaulted: Bool = false /** Locks the current instance, preventing other threads from modifying it until `unlock()` is called. This method is used to create a critical section where only one thread is allowed to access the protected resources at a time. Example usage: ```swift let lock = AsyncLock() lock.lock() // Critical section lock.unlock() ``` */ func lock() { _lock.lock() } /** Unlocks the current instance, allowing other threads to access the protected resources. This method is called after a `lock()` to release the critical section, ensuring that other waiting threads can proceed. Example usage: ```swift let lock = AsyncLock() lock.lock() // Critical section lock.unlock() ``` */ func unlock() { _lock.unlock() } // MARK: - Queue Methods /** Enqueues an action into the internal queue for deferred execution. If no actions are currently being executed, the method returns the action for immediate execution. Otherwise, the action is enqueued for deferred execution when the lock is available. - Parameter action: The action to enqueue. - Returns: The action if it can be executed immediately, or `nil` if it has been enqueued. Example usage: ```swift let lock = AsyncLock() if let action = lock.enqueue(someAction) { action.invoke() // Execute the action immediately if it's not deferred. } ``` */ private func enqueue(_ action: I) -> I? { lock(); defer { self.unlock() } if hasFaulted { return nil } if isExecuting { queue.enqueue(action) return nil } isExecuting = true return action } /** Dequeues the next action for execution, if available. If the queue is empty, this method resets the `isExecuting` flag to indicate that no actions are currently being executed. - Returns: The next action from the queue, or `nil` if the queue is empty. Example usage: ```swift let nextAction = lock.dequeue() nextAction?.invoke() // Execute the next action if one is available. ``` */ private func dequeue() -> I? { lock(); defer { self.unlock() } if !queue.isEmpty { return queue.dequeue() } else { isExecuting = false return nil } } /** Invokes the provided action, ensuring that actions are executed sequentially. The first action is executed immediately if no other actions are currently running. If other actions are already in the queue, the new action is enqueued and executed sequentially after the current actions are completed. - Parameter action: The action to be invoked. Example usage: ```swift let lock = AsyncLock() lock.invoke(someAction) // Invoke or enqueue the action. ``` */ func invoke(_ action: I) { let firstEnqueuedAction = enqueue(action) if let firstEnqueuedAction { firstEnqueuedAction.invoke() } else { // action is enqueued, it's somebody else's concern now return } while true { let nextAction = dequeue() if let nextAction { nextAction.invoke() } else { return } } } // MARK: - Dispose Methods /** Disposes of the `AsyncLock` by clearing the internal queue and preventing further actions from being executed. This method ensures that all pending actions are discarded, and the lock enters a faulted state where no new actions can be enqueued or executed. Example usage: ```swift let lock = AsyncLock() lock.dispose() // Clear the queue and prevent further actions. ``` */ func dispose() { synchronizedDispose() } /** Synchronously disposes of the internal queue and marks the lock as faulted. This method is typically used internally to handle disposal of the lock in a thread-safe manner. Example usage: ```swift lock.synchronized_dispose() ``` */ func synchronized_dispose() { queue = Queue(capacity: 0) hasFaulted = true } } ================================================ FILE: RxSwift/Concurrency/Lock.swift ================================================ // // 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: () -> T) -> T { lock(); defer { self.unlock() } return action() } } ================================================ FILE: RxSwift/Concurrency/LockOwnerType.swift ================================================ // // LockOwnerType.swift // RxSwift // // Created by Krunoslav Zaher on 10/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol LockOwnerType: AnyObject, Lock { var lock: RecursiveLock { get } } extension LockOwnerType { func lock() { lock.lock() } func unlock() { lock.unlock() } } ================================================ FILE: RxSwift/Concurrency/SynchronizedDisposeType.swift ================================================ // // SynchronizedDisposeType.swift // RxSwift // // Created by Krunoslav Zaher on 10/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol SynchronizedDisposeType: AnyObject, Disposable, Lock { func synchronized_dispose() } extension SynchronizedDisposeType { func synchronizedDispose() { lock(); defer { self.unlock() } synchronized_dispose() } } ================================================ FILE: RxSwift/Concurrency/SynchronizedOnType.swift ================================================ // // SynchronizedOnType.swift // RxSwift // // Created by Krunoslav Zaher on 10/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol SynchronizedOnType: AnyObject, ObserverType, Lock { func synchronized_on(_ event: Event) } extension SynchronizedOnType { func synchronizedOn(_ event: Event) { lock(); defer { self.unlock() } synchronized_on(event) } } ================================================ FILE: RxSwift/Concurrency/SynchronizedUnsubscribeType.swift ================================================ // // SynchronizedUnsubscribeType.swift // RxSwift // // Created by Krunoslav Zaher on 10/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol SynchronizedUnsubscribeType: AnyObject { associatedtype DisposeKey func synchronizedUnsubscribe(_ disposeKey: DisposeKey) } ================================================ FILE: RxSwift/ConnectableObservableType.swift ================================================ // // 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 } ================================================ FILE: RxSwift/Date+Dispatch.swift ================================================ // // Date+Dispatch.swift // RxSwift // // Created by Krunoslav Zaher on 4/14/19. // Copyright © 2019 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation extension DispatchTimeInterval { var convertToSecondsFactor: Double { switch self { case .nanoseconds: return 1_000_000_000.0 case .microseconds: return 1_000_000.0 case .milliseconds: return 1000.0 case .seconds: return 1.0 case .never: fatalError() @unknown default: fatalError() } } func map(_ transform: (Int, Double) -> Int) -> DispatchTimeInterval { switch self { case let .nanoseconds(value): return .nanoseconds(transform(value, 1_000_000_000.0)) case let .microseconds(value): return .microseconds(transform(value, 1_000_000.0)) case let .milliseconds(value): return .milliseconds(transform(value, 1000.0)) case let .seconds(value): return .seconds(transform(value, 1.0)) case .never: return .never @unknown default: fatalError() } } var isNow: Bool { switch self { case let .nanoseconds(value), let .microseconds(value), let .milliseconds(value), let .seconds(value): return value == 0 case .never: return false @unknown default: fatalError() } } func reduceWithSpanBetween(earlierDate: Date, laterDate: Date) -> DispatchTimeInterval { map { value, factor in let interval = laterDate.timeIntervalSince(earlierDate) let remainder = Double(value) - interval * factor guard remainder > 0 else { return 0 } return Int(remainder.rounded(.toNearestOrAwayFromZero)) } } } extension Date { func addingDispatchInterval(_ dispatchInterval: DispatchTimeInterval) -> Date { switch dispatchInterval { case let .nanoseconds(value), let .microseconds(value), let .milliseconds(value), let .seconds(value): return addingTimeInterval(TimeInterval(value) / dispatchInterval.convertToSecondsFactor) case .never: return Date.distantFuture @unknown default: fatalError() } } } ================================================ FILE: RxSwift/Disposable.swift ================================================ // // Disposable.swift // RxSwift // // Created by Krunoslav Zaher on 2/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // /// Represents a disposable resource. public protocol Disposable { /// Dispose resource. func dispose() } ================================================ FILE: RxSwift/Disposables/AnonymousDisposable.swift ================================================ // // 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. private final class AnonymousDisposable: DisposeBase, Cancelable { typealias DisposeAction = () -> Void private let disposed = AtomicInt(0) private var disposeAction: DisposeAction? /// - returns: Was resource disposed. var isDisposed: Bool { isFlagSet(disposed, 1) } /// Constructs a new disposable with the given action used for disposal. /// /// - parameter disposeAction: Disposal action which will be run upon calling `dispose`. private init(_ disposeAction: @escaping DisposeAction) { self.disposeAction = disposeAction super.init() } // Non-deprecated version of the constructor, used by `Disposables.create(with:)` fileprivate init(disposeAction: @escaping DisposeAction) { self.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 fetchOr(disposed, 1) == 0 { if let action = disposeAction { disposeAction = nil action() } } } } public extension Disposables { /// Constructs a new disposable with the given action used for disposal. /// /// - parameter dispose: Disposal action which will be run upon calling `dispose`. static func create(with dispose: @escaping () -> Void) -> Cancelable { AnonymousDisposable(disposeAction: dispose) } } ================================================ FILE: RxSwift/Disposables/BinaryDisposable.swift ================================================ // // 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 let disposed = AtomicInt(0) // state private var disposable1: Disposable? private var disposable2: Disposable? /// - returns: Was resource disposed. var isDisposed: Bool { isFlagSet(disposed, 1) } /// Constructs new binary disposable from two disposables. /// /// - parameter disposable1: First disposable /// - parameter disposable2: Second disposable init(_ disposable1: Disposable, _ disposable2: Disposable) { self.disposable1 = disposable1 self.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 fetchOr(disposed, 1) == 0 { disposable1?.dispose() disposable2?.dispose() disposable1 = nil disposable2 = nil } } } public extension Disposables { /// Creates a disposable with the given disposables. static func create(_ disposable1: Disposable, _ disposable2: Disposable) -> Cancelable { BinaryDisposable(disposable1, disposable2) } } ================================================ FILE: RxSwift/Disposables/BooleanDisposable.swift ================================================ // // 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 { static let BooleanDisposableTrue = BooleanDisposable(isDisposed: true) private let disposed: AtomicInt /// Initializes a new instance of the `BooleanDisposable` class public init() { disposed = AtomicInt(0) } /// Initializes a new instance of the `BooleanDisposable` class with given value public init(isDisposed: Bool) { disposed = AtomicInt(isDisposed ? 1 : 0) } /// - returns: Was resource disposed. public var isDisposed: Bool { isFlagSet(disposed, 1) } /// Sets the status to disposed, which can be observer through the `isDisposed` property. public func dispose() { fetchOr(disposed, 1) } } ================================================ FILE: RxSwift/Disposables/CompositeDisposable.swift ================================================ // // 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.performLocked { self.disposables == nil } } override public 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. _ = disposables!.insert(disposable1) _ = 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. _ = disposables!.insert(disposable1) _ = disposables!.insert(disposable2) _ = 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. _ = self.disposables!.insert(disposable1) _ = self.disposables!.insert(disposable2) _ = self.disposables!.insert(disposable3) _ = self.disposables!.insert(disposable4) for disposable in disposables { _ = self.disposables!.insert(disposable) } } /// Initializes a new instance of composite disposable with the specified number of disposables. public init(disposables: [Disposable]) { for disposable in disposables { _ = self.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.performLocked { let bagKey = self.disposables?.insert(disposable) return bagKey.map(DisposeKey.init) } } /// - returns: Gets the number of disposables contained in the `CompositeDisposable`. public var count: Int { lock.performLocked { self.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.performLocked { self.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.performLocked { let current = self.disposables self.disposables = nil return current } } } public extension Disposables { /// Creates a disposable with the given disposables. static func create(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable) -> Cancelable { CompositeDisposable(disposable1, disposable2, disposable3) } /// Creates a disposable with the given disposables. 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. static func create(_ disposables: [Disposable]) -> Cancelable { switch disposables.count { case 2: Disposables.create(disposables[0], disposables[1]) default: CompositeDisposable(disposables: disposables) } } } ================================================ FILE: RxSwift/Disposables/Disposables.swift ================================================ // // 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() {} } ================================================ FILE: RxSwift/Disposables/DisposeBag.swift ================================================ // // DisposeBag.swift // RxSwift // // Created by Krunoslav Zaher on 3/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public extension Disposable { /// Adds `self` to `bag` /// /// - parameter bag: `DisposeBag` to add `self` to. 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. override public 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.performLocked { if self.isDisposed { return disposable } self.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.performLocked { let disposables = self.disposables self.disposables.removeAll(keepingCapacity: false) self.isDisposed = true return disposables } } deinit { self.dispose() } } public extension DisposeBag { /// Convenience init allows a list of disposables to be gathered for disposal. convenience init(disposing disposables: Disposable...) { self.init() self.disposables += disposables } /// Convenience init which utilizes a function builder to let you pass in a list of /// disposables to make a DisposeBag of. convenience init(@DisposableBuilder builder: () -> [Disposable]) { self.init(disposing: builder()) } /// Convenience init allows an array of disposables to be gathered for disposal. convenience init(disposing disposables: [Disposable]) { self.init() self.disposables += disposables } /// Convenience function allows a list of disposables to be gathered for disposal. func insert(_ disposables: Disposable...) { insert(disposables) } /// Convenience function allows a list of disposables to be gathered for disposal. func insert(@DisposableBuilder builder: () -> [Disposable]) { insert(builder()) } /// Convenience function allows an array of disposables to be gathered for disposal. func insert(_ disposables: [Disposable]) { lock.performLocked { if self.isDisposed { disposables.forEach { $0.dispose() } } else { self.disposables += disposables } } } @resultBuilder struct DisposableBuilder { public static func buildBlock(_ disposables: Disposable...) -> [Disposable] { disposables } } } ================================================ FILE: RxSwift/Disposables/DisposeBase.swift ================================================ // // 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 _ = Resources.incrementTotal() #endif } deinit { #if TRACE_RESOURCES _ = Resources.decrementTotal() #endif } } ================================================ FILE: RxSwift/Disposables/NopDisposable.swift ================================================ // // 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 private struct NopDisposable: Disposable { fileprivate static let noOp: Disposable = NopDisposable() private init() {} /// Does nothing. func dispose() {} } public extension Disposables { /** Creates a disposable that does nothing on disposal. */ static func create() -> Disposable { NopDisposable.noOp } } ================================================ FILE: RxSwift/Disposables/RefCountDisposable.swift ================================================ // // 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.performLocked { self.disposable == nil } } /// Initializes a new instance of the `RefCountDisposable`. public init(disposable: Disposable) { self.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 { lock.performLocked { if self.disposable != nil { do { _ = try incrementChecked(&self.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.performLocked { if let oldDisposable = self.disposable, !self.primaryDisposed { self.primaryDisposed = true if self.count == 0 { self.disposable = nil return oldDisposable } } return nil } if let disposable = oldDisposable { disposable.dispose() } } fileprivate func release() { let oldDisposable: Disposable? = lock.performLocked { if let oldDisposable = self.disposable { do { _ = try decrementChecked(&self.count) } catch { rxFatalError("RefCountDisposable decrement on release failed") } guard self.count >= 0 else { rxFatalError("RefCountDisposable counter is lower than 0") } if self.primaryDisposed, self.count == 0 { self.disposable = nil return oldDisposable } } return nil } if let disposable = oldDisposable { disposable.dispose() } } } final class RefCountInnerDisposable: DisposeBase, Disposable { private let parent: RefCountDisposable private let isDisposed = AtomicInt(0) init(_ parent: RefCountDisposable) { self.parent = parent super.init() } func dispose() { if fetchOr(isDisposed, 1) == 0 { parent.release() } } } ================================================ FILE: RxSwift/Disposables/ScheduledDisposable.swift ================================================ // // 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 let disposed = AtomicInt(0) // state private var disposable: Disposable? /// - returns: Was resource disposed. public var isDisposed: Bool { isFlagSet(disposed, 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 self.disposable = disposable } /// Disposes the wrapped disposable on the provided scheduler. public func dispose() { _ = scheduler.schedule(self, action: disposeScheduledDisposable) } func disposeInner() { if fetchOr(disposed, 1) == 0 { disposable!.dispose() disposable = nil } } } ================================================ FILE: RxSwift/Disposables/SerialDisposable.swift ================================================ // // 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 disposed = false /// - returns: Was resource disposed. public var isDisposed: Bool { disposed } /// 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 { lock.performLocked { self.current ?? Disposables.create() } } set(newDisposable) { let disposable: Disposable? = lock.performLocked { if self.isDisposed { return newDisposable } else { let toDispose = self.current self.current = newDisposable return toDispose } } if let disposable { disposable.dispose() } } } /// Disposes the underlying disposable as well as all future replacements. public func dispose() { _dispose()?.dispose() } private func _dispose() -> Disposable? { lock.performLocked { guard !self.isDisposed else { return nil } self.disposed = true let current = self.current self.current = nil return current } } } ================================================ FILE: RxSwift/Disposables/SingleAssignmentDisposable.swift ================================================ // // 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 { private struct DisposeState: OptionSet { let rawValue: Int32 static let disposed = DisposeState(rawValue: 1 << 0) static let disposableSet = DisposeState(rawValue: 1 << 1) } // state private let state = AtomicInt(0) private var disposable = nil as Disposable? /// - returns: A value that indicates whether the object is disposed. public var isDisposed: Bool { isFlagSet(state, DisposeState.disposed.rawValue) } /// Initializes a new instance of the `SingleAssignmentDisposable`. override public 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) { self.disposable = disposable let previousState = fetchOr(state, DisposeState.disposableSet.rawValue) if (previousState & DisposeState.disposableSet.rawValue) != 0 { rxFatalError("oldState.disposable != nil") } if (previousState & DisposeState.disposed.rawValue) != 0 { disposable.dispose() self.disposable = nil } } /// Disposes the underlying disposable. public func dispose() { let previousState = fetchOr(state, DisposeState.disposed.rawValue) if (previousState & DisposeState.disposed.rawValue) != 0 { return } if (previousState & DisposeState.disposableSet.rawValue) != 0 { guard let disposable else { rxFatalError("Disposable not set") } disposable.dispose() self.disposable = nil } } } ================================================ FILE: RxSwift/Disposables/SubscriptionDisposable.swift ================================================ // // 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) { self.owner = owner self.key = key } func dispose() { owner?.synchronizedUnsubscribe(key) } } ================================================ FILE: RxSwift/Errors.swift ================================================ // // 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) /// Arithmetic 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 } public extension RxError { /// A textual representation of `self`, suitable for debugging. var debugDescription: String { switch self { case .unknown: "Unknown error occurred." case let .disposed(object): "Object `\(object)` was already disposed." case .overflow: "Arithmetic overflow occurred." case .argumentOutOfRange: "Argument out of range." case .noElements: "Sequence doesn't contain any elements." case .moreThanOneElement: "Sequence contains more than one element." case .timeout: "Sequence timeout." } } } ================================================ FILE: RxSwift/Event.swift ================================================ // // 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)** @frozen 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 { /// Description of event. public var debugDescription: String { switch self { case let .next(value): "next(\(value))" case let .error(error): "error(\(error))" case .completed: "completed" } } } public extension Event { /// Is `completed` or `error` event. var isStopEvent: Bool { switch self { case .next: false case .error, .completed: true } } /// If `next` event, returns element value. var element: Element? { if case let .next(value) = self { return value } return nil } /// If `error` event, returns error. var error: Swift.Error? { if case let .error(error) = self { return error } return nil } /// If `completed` event, returns `true`. var isCompleted: Bool { if case .completed = self { return true } return false } } public extension Event { /// Maps sequence elements using transform. If error happens during the transform, `.error` /// will be returned as value. func map(_ transform: (Element) throws -> Result) -> Event { do { switch self { case let .next(element): return try .next(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 Element /// Event representation of this instance var event: Event { get } } extension Event: EventConvertible { /// Event representation of this instance public var event: Event { self } } ================================================ FILE: RxSwift/Extensions/Bag+Rx.swift ================================================ // // 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) -> Void>, _ event: Event) { bag._value0?(event) if bag._onlyFastPath { return } let pairs = bag._pairs for i in 0 ..< pairs.count { pairs[i].value(event) } if let dictionary = bag._dictionary { for element in dictionary.values { element(event) } } } /// Dispatches `dispose` to all disposables contained inside bag. func disposeAll(in bag: Bag) { bag._value0?.dispose() if bag._onlyFastPath { return } let pairs = bag._pairs for i in 0 ..< pairs.count { pairs[i].value.dispose() } if let dictionary = bag._dictionary { for element in dictionary.values { element.dispose() } } } ================================================ FILE: RxSwift/GroupedObservable.swift ================================================ // // 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 share a common key. /// `GroupedObservable` is typically created by the `groupBy` operator. /// Each `GroupedObservable` instance represents a collection of elements /// that are grouped by a specific key. /// /// Example usage: /// ``` /// let observable = Observable.of("Apple", "Banana", "Apricot", "Blueberry", "Avocado") /// /// let grouped = observable.groupBy { fruit in /// fruit.first! // Grouping by the first letter of each fruit /// } /// /// _ = grouped.subscribe { group in /// print("Group: \(group.key)") /// _ = group.subscribe { event in /// print(event) /// } /// } /// ``` /// This will print: /// ``` /// Group: A /// next(Apple) /// next(Apricot) /// next(Avocado) /// Group: B /// next(Banana) /// next(Blueberry) /// ``` public struct GroupedObservable: ObservableType { /// The key associated with this grouped observable sequence. /// All elements emitted by this observable share this common key. public let key: Key private let source: Observable /// Initializes a grouped observable sequence with a key and a source observable sequence. /// /// - Parameters: /// - key: The key associated with this grouped observable sequence. /// - source: The observable sequence of elements for the specified key. /// /// Example usage: /// ``` /// let sourceObservable = Observable.of("Apple", "Apricot", "Avocado") /// let groupedObservable = GroupedObservable(key: "A", source: sourceObservable) /// /// _ = groupedObservable.subscribe { event in /// print(event) /// } /// ``` /// This will print: /// ``` /// next(Apple) /// next(Apricot) /// next(Avocado) /// ``` public init(key: Key, source: Observable) { self.key = key self.source = source } /// Subscribes an observer to receive events emitted by the source observable sequence. /// /// - Parameter observer: The observer that will receive the events of the source observable. /// - Returns: A `Disposable` representing the subscription, which can be used to cancel the subscription. /// /// Example usage: /// ``` /// let fruitsObservable = Observable.of("Apple", "Banana", "Apricot", "Blueberry", "Avocado") /// let grouped = fruitsObservable.groupBy { $0.first! } // Group by first letter /// /// _ = grouped.subscribe { group in /// if group.key == "A" { /// _ = group.subscribe { event in /// print(event) /// } /// } /// } /// ``` /// This will print: /// ``` /// next(Apple) /// next(Apricot) /// next(Avocado) /// ``` public func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { source.subscribe(observer) } /// Converts this `GroupedObservable` into a regular `Observable` sequence. /// This allows you to work with the sequence without directly interacting with the key. /// /// - Returns: The underlying `Observable` sequence of elements for the specified key. /// /// Example usage: /// ``` /// let fruitsObservable = Observable.of("Apple", "Banana", "Apricot", "Blueberry", "Avocado") /// let grouped = fruitsObservable.groupBy { $0.first! } // Group by first letter /// /// _ = grouped.subscribe { group in /// if group.key == "A" { /// let regularObservable = group.asObservable() /// _ = regularObservable.subscribe { event in /// print(event) /// } /// } /// } /// ``` /// This will print: /// ``` /// next(Apple) /// next(Apricot) /// next(Avocado) /// ``` public func asObservable() -> Observable { source } } ================================================ FILE: RxSwift/ImmediateSchedulerType.swift ================================================ // // 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 } public 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). */ func scheduleRecursive(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> Void) -> Void) -> Disposable { let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self) recursiveScheduler.schedule(state) return Disposables.create(with: recursiveScheduler.dispose) } } ================================================ FILE: RxSwift/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString $(RX_VERSION) CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: RxSwift/Observable+Concurrency.swift ================================================ // // Observable+Concurrency.swift // RxSwift // // Created by Shai Mishali on 22/09/2021. // Copyright © 2021 Krunoslav Zaher. All rights reserved. // #if swift(>=5.7) import Foundation @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) public extension ObservableConvertibleType { /// Allows iterating over the values of an Observable /// asynchronously via Swift's concurrency features (`async/await`) /// /// A sample usage would look like so: /// /// ```swift /// do { /// for try await value in observable.values { /// // Handle emitted values /// } /// } catch { /// // Handle error /// } /// ``` var values: AsyncThrowingStream { AsyncThrowingStream { continuation in var isFinished = false let disposable = asObservable().subscribe( onNext: { value in continuation.yield(value) }, onError: { error in isFinished = true continuation.finish(throwing: error) }, onCompleted: { isFinished = true continuation.finish() }, onDisposed: { guard !isFinished else { return } continuation.finish(throwing: CancellationError()) } ) continuation.onTermination = { @Sendable termination in if case .cancelled = termination { disposable.dispose() } } } } } @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) public extension AsyncSequence { /// Convert an `AsyncSequence` to an `Observable`. /// /// Iteration runs in a detached task to prevent blocking the calling thread. /// Use `.observe(on:)` to control event delivery (e.g., `MainScheduler.instance` for UI updates). /// /// - parameter priority: Priority for the detached task /// /// - returns: An `Observable` of the async sequence's element type func asObservable(priority: TaskPriority? = nil) -> Observable { Observable.create { observer in let task = Task.detached(priority: priority) { do { for try await value in self { observer.onNext(value) } observer.onCompleted() } catch is CancellationError { observer.onCompleted() } catch { observer.onError(error) } } return Disposables.create { task.cancel() } } } } #endif ================================================ FILE: RxSwift/Observable.swift ================================================ // // 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 typealias RxObservable = RxSwift.Observable public class Observable: ObservableType { init() { #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif } public func subscribe(_: Observer) -> Disposable where Observer.Element == Element { rxAbstractMethod() } public func asObservable() -> Observable { self } deinit { #if TRACE_RESOURCES _ = Resources.decrementTotal() #endif } } ================================================ FILE: RxSwift/ObservableConvertibleType.swift ================================================ // // 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 Element /// Converts `self` to `Observable` sequence. /// /// - returns: Observable sequence that represents `self`. func asObservable() -> Observable } ================================================ FILE: RxSwift/ObservableType+Extensions.swift ================================================ // // ObservableType+Extensions.swift // RxSwift // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if DEBUG import Foundation #endif public 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. */ func subscribe(_ on: @escaping (Event) -> Void) -> Disposable { let observer = AnonymousObserver { e in on(e) } return asObservable().subscribe(observer) } /** Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence. Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence. - Note: If `object` can't be retained, none of the other closures will be invoked. - parameter object: The object to provide an unretained reference on. - 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. */ func subscribe( with object: Object, onNext: ((Object, Element) -> Void)? = nil, onError: ((Object, Swift.Error) -> Void)? = nil, onCompleted: ((Object) -> Void)? = nil, onDisposed: ((Object) -> Void)? = nil ) -> Disposable { subscribe( onNext: { [weak object] in guard let object else { return } onNext?(object, $0) }, onError: { [weak object] in guard let object else { return } onError?(object, $0) }, onCompleted: { [weak object] in guard let object else { return } onCompleted?(object) }, onDisposed: { [weak object] in guard let object else { return } onDisposed?(object) } ) } /** 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. */ func subscribe( onNext: ((Element) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil ) -> Disposable { let disposable: Disposable = if let disposed = onDisposed { Disposables.create(with: disposed) } else { Disposables.create() } #if DEBUG let synchronizationTracker = SynchronizationTracker() #endif let callStack = Hooks.recordCallStackOnError ? Hooks.customCaptureSubscriptionCallstack() : [] let observer = AnonymousObserver { event in #if DEBUG synchronizationTracker.register(synchronizationErrorMessage: .default) defer { synchronizationTracker.unregister() } #endif switch event { case let .next(value): onNext?(value) case let .error(error): if let onError { onError(error) } else { Hooks.defaultErrorHandler(callStack, error) } disposable.dispose() case .completed: onCompleted?() disposable.dispose() } } return Disposables.create( asObservable().subscribe(observer), disposable ) } } import Foundation public extension Hooks { typealias DefaultErrorHandler = (_ subscriptionCallStack: [String], _ error: Error) -> Void typealias CustomCaptureSubscriptionCallstack = () -> [String] private static let lock = RecursiveLock() private static var _defaultErrorHandler: DefaultErrorHandler = { subscriptionCallStack, error in #if DEBUG let serializedCallStack = subscriptionCallStack.joined(separator: "\n") print("Unhandled error happened: \(error)") if !serializedCallStack.isEmpty { print("subscription called from:\n\(serializedCallStack)") } #endif } private static var _customCaptureSubscriptionCallstack: CustomCaptureSubscriptionCallstack = { #if DEBUG return Thread.callStackSymbols #else return [] #endif } /// Error handler called in case onError handler wasn't provided. static var defaultErrorHandler: DefaultErrorHandler { get { lock.performLocked { _defaultErrorHandler } } set { lock.performLocked { _defaultErrorHandler = newValue } } } /// Subscription callstack block to fetch custom callstack information. static var customCaptureSubscriptionCallstack: CustomCaptureSubscriptionCallstack { get { lock.performLocked { _customCaptureSubscriptionCallstack } } set { lock.performLocked { _customCaptureSubscriptionCallstack = newValue } } } } ================================================ FILE: RxSwift/ObservableType.swift ================================================ // // 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: Observer) -> Disposable where Observer.Element == Element } public extension ObservableType { /// Default implementation of converting `ObservableType` to `Observable`. func asObservable() -> Observable { // temporary workaround // return Observable.create(subscribe: self.subscribe) Observable.create { o in self.subscribe(o) } } } ================================================ FILE: RxSwift/Observables/AddRef.swift ================================================ // // 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 = Observer.Element override init(observer: Observer, 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 { private let source: Observable private let refCount: RefCountDisposable init(source: Observable, refCount: RefCountDisposable) { self.source = source self.refCount = refCount } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == 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) } } ================================================ FILE: RxSwift/Observables/Amb.swift ================================================ // // Amb.swift // RxSwift // // Created by Krunoslav Zaher on 6/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func amb(_ sequence: Sequence) -> Observable where Sequence.Element == Observable { sequence.reduce(Observable.never()) { a, o in a.amb(o.asObservable()) } } } public 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. */ func amb (_ right: O2) -> Observable where O2.Element == Element { Amb(left: asObservable(), right: right.asObservable()) } } private enum AmbState { case neither case left case right } private final class AmbObserver: ObserverType { typealias Element = Observer.Element typealias Parent = AmbSink typealias This = AmbObserver typealias Sink = (This, Event) -> Void private let parent: Parent fileprivate var sink: Sink fileprivate var cancel: Disposable init(parent: Parent, cancel: Disposable, sink: @escaping Sink) { #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif self.parent = parent self.sink = sink self.cancel = cancel } func on(_ event: Event) { sink(self, event) if event.isStopEvent { cancel.dispose() } } deinit { #if TRACE_RESOURCES _ = Resources.decrementTotal() #endif } } private final class AmbSink: Sink { typealias Element = Observer.Element typealias Parent = Amb typealias AmbObserverType = AmbObserver private let parent: Parent private let lock = RecursiveLock() // state private var choice = AmbState.neither init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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 = { (_: AmbObserverType, event: Event) 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 } } private final class Amb: Producer { fileprivate let left: Observable fileprivate let right: Observable init(left: Observable, right: Observable) { self.left = left self.right = right } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = AmbSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/AsMaybe.swift ================================================ // // AsMaybe.swift // RxSwift // // Created by Krunoslav Zaher on 3/12/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // private final class AsMaybeSink: Sink, ObserverType { typealias Element = Observer.Element private var element: Event? 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 { forwardOn(element) } forwardOn(.completed) dispose() } } } final class AsMaybe: Producer { private let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = AsMaybeSink(observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/AsSingle.swift ================================================ // // AsSingle.swift // RxSwift // // Created by Krunoslav Zaher on 3/12/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // private final class AsSingleSink: Sink, ObserverType { typealias Element = Observer.Element private var element: Event? 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 { forwardOn(element) forwardOn(.completed) } else { forwardOn(.error(RxError.noElements)) } dispose() } } } final class AsSingle: Producer { private let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = AsSingleSink(observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Buffer.swift ================================================ // // Buffer.swift // RxSwift // // Created by Krunoslav Zaher on 9/13/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func buffer(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) -> Observable<[Element]> { BufferTimeCount(source: asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler) } } private final 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) { self.source = source self.timeSpan = timeSpan self.count = count self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == [Element] { let sink = BufferTimeCountSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } private final class BufferTimeCountSink: Sink, LockOwnerType, ObserverType, SynchronizedOnType where Observer.Element == [Element] { typealias Parent = BufferTimeCount private let parent: Parent let lock = RecursiveLock() // state private let timerD = SerialDisposable() private var buffer = [Element]() private var windowID = 0 init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { createTimer(windowID) return Disposables.create(timerD, parent.source.subscribe(self)) } func startNewWindowAndSendCurrentOne() { self.windowID = self.windowID &+ 1 let windowID = windowID let buffer = buffer self.buffer = [] forwardOn(.next(buffer)) createTimer(windowID) } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { switch event { case let .next(element): buffer.append(element) if buffer.count == parent.count { startNewWindowAndSendCurrentOne() } case let .error(error): buffer = [] forwardOn(.error(error)) dispose() case .completed: forwardOn(.next(buffer)) forwardOn(.completed) dispose() } } func createTimer(_ windowID: Int) { if timerD.isDisposed { return } if self.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) } } ================================================ FILE: RxSwift/Observables/Catch.swift ================================================ // // Catch.swift // RxSwift // // Created by Krunoslav Zaher on 4/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func `catch`(_ handler: @escaping (Swift.Error) throws -> Observable) -> Observable { Catch(source: asObservable(), handler: handler) } /** 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. */ @available(*, deprecated, renamed: "catch(_:)") func catchError(_ handler: @escaping (Swift.Error) throws -> Observable) -> Observable { `catch`(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. */ func catchAndReturn(_ element: Element) -> Observable { Catch(source: asObservable(), handler: { _ in Observable.just(element) }) } /** 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. */ @available(*, deprecated, renamed: "catchAndReturn(_:)") func catchErrorJustReturn(_ element: Element) -> Observable { catchAndReturn(element) } } public 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. */ @available(*, deprecated, renamed: "catch(onSuccess:onFailure:onDisposed:)") static func catchError(_ sequence: Sequence) -> Observable where Sequence.Element == Observable { `catch`(sequence: sequence) } /** 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. */ static func `catch`(sequence: Sequence) -> Observable where Sequence.Element == Observable { CatchSequence(sources: sequence) } } public 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. */ func retry() -> Observable { CatchSequence(sources: InfiniteSequence(repeatedValue: 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. */ func retry(_ maxAttemptCount: Int) -> Observable { CatchSequence(sources: Swift.repeatElement(asObservable(), count: maxAttemptCount)) } } // catch with callback private final class CatchSinkProxy: ObserverType { typealias Element = Observer.Element typealias Parent = CatchSink private let parent: Parent init(parent: Parent) { self.parent = parent } func on(_ event: Event) { parent.forwardOn(event) switch event { case .next: break case .error, .completed: parent.dispose() } } } private final class CatchSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = Catch private let parent: Parent private let subscription = SerialDisposable() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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 let .error(error): do { let catchSequence = try parent.handler(error) let observer = CatchSinkProxy(parent: self) subscription.disposable = catchSequence.subscribe(observer) } catch let e { self.forwardOn(.error(e)) self.dispose() } } } } private final class Catch: Producer { typealias Handler = (Swift.Error) throws -> Observable fileprivate let source: Observable fileprivate let handler: Handler init(source: Observable, handler: @escaping Handler) { self.source = source self.handler = handler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = CatchSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // catch enumerable private final class CatchSequenceSink: TailRecursiveSink, ObserverType where Sequence.Element: ObservableConvertibleType, Sequence.Element.Element == Observer.Element { typealias Element = Observer.Element typealias Parent = CatchSequence private var lastError: Swift.Error? override init(observer: Observer, cancel: Cancelable) { super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case .next: forwardOn(event) case let .error(error): lastError = error schedule(.moveNext) case .completed: forwardOn(event) dispose() } } override func subscribeToNext(_ source: Observable) -> Disposable { source.subscribe(self) } override func done() { if let lastError { forwardOn(.error(lastError)) } else { forwardOn(.completed) } dispose() } override func extract(_ observable: Observable) -> SequenceGenerator? { if let onError = observable as? CatchSequence { (onError.sources.makeIterator(), nil) } else { nil } } } private final class CatchSequence: Producer where Sequence.Element: ObservableConvertibleType { typealias Element = Sequence.Element.Element let sources: Sequence init(sources: Sequence) { self.sources = sources } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = CatchSequenceSink(observer: observer, cancel: cancel) let subscription = sink.run((sources.makeIterator(), nil)) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/CombineLatest+Collection.swift ================================================ // // CombineLatest+Collection.swift // RxSwift // // Created by Krunoslav Zaher on 8/29/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func combineLatest(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable where Collection.Element: ObservableType { 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. */ static func combineLatest(_ collection: Collection) -> Observable<[Element]> where Collection.Element: ObservableType, Collection.Element.Element == Element { CombineLatestCollectionType(sources: collection, resultSelector: { $0 }) } } final class CombineLatestCollectionTypeSink: Sink where Collection.Element: ObservableConvertibleType { typealias Result = Observer.Element typealias Parent = CombineLatestCollectionType typealias SourceElement = Collection.Element.Element 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: Observer, cancel: Cancelable) { self.parent = parent values = [SourceElement?](repeating: nil, count: parent.count) isDone = [Bool](repeating: false, count: parent.count) subscriptions = [SingleAssignmentDisposable]() 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 { self.lock.unlock() } switch event { case let .next(element): if values[atIndex] == nil { numberOfValues += 1 } values[atIndex] = element if numberOfValues < parent.count { let numberOfOthersThatAreDone = numberOfDone - (isDone[atIndex] ? 1 : 0) if numberOfOthersThatAreDone == parent.count - 1 { forwardOn(.completed) dispose() } return } do { let result = try parent.resultSelector(values.map { $0! }) forwardOn(.next(result)) } catch { forwardOn(.error(error)) dispose() } case let .error(error): forwardOn(.error(error)) dispose() case .completed: if isDone[atIndex] { return } isDone[atIndex] = true numberOfDone += 1 if numberOfDone == 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 { do { let result = try parent.resultSelector([]) forwardOn(.next(result)) forwardOn(.completed) dispose() } catch { forwardOn(.error(error)) dispose() } } return Disposables.create(subscriptions) } } final class CombineLatestCollectionType: Producer where Collection.Element: ObservableConvertibleType { typealias ResultSelector = ([Collection.Element.Element]) throws -> Result let sources: Collection let resultSelector: ResultSelector let count: Int init(sources: Collection, resultSelector: @escaping ResultSelector) { self.sources = sources self.resultSelector = resultSelector count = self.sources.count } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestCollectionTypeSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/CombineLatest+arity.swift ================================================ // 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 public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element) -> Observable { CombineLatest2( source1: source1.asObservable(), source2: source2.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func combineLatest (_ source1: O1, _ source2: O2) -> Observable<(O1.Element, O2.Element)> { CombineLatest2( source1: source1.asObservable(), source2: source2.asObservable(), resultSelector: { ($0, $1) } ) } } final class CombineLatestSink2_: CombineLatestSink { typealias Result = Observer.Element typealias Parent = CombineLatest2 let parent: Parent var latestElement1: E1! var latestElement2: E2! init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) in self.latestElement1 = e }, this: subscription1) let observer2 = CombineLatestObserver(lock: lock, parent: self, index: 1, setLatestValue: { (e: E2) 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 -> Result { try parent.resultSelector(latestElement1, latestElement2) } } final class CombineLatest2: Producer { typealias ResultSelector = (E1, E2) throws -> Result let source1: Observable let source2: Observable let resultSelector: ResultSelector init(source1: Observable, source2: Observable, resultSelector: @escaping ResultSelector) { self.source1 = source1 self.source2 = source2 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink2_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 3 public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element) -> Observable { CombineLatest3( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3) -> Observable<(O1.Element, O2.Element, O3.Element)> { CombineLatest3( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), resultSelector: { ($0, $1, $2) } ) } } final class CombineLatestSink3_: CombineLatestSink { typealias Result = Observer.Element typealias Parent = CombineLatest3 let parent: Parent var latestElement1: E1! var latestElement2: E2! var latestElement3: E3! init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) in self.latestElement1 = e }, this: subscription1) let observer2 = CombineLatestObserver(lock: lock, parent: self, index: 1, setLatestValue: { (e: E2) in self.latestElement2 = e }, this: subscription2) let observer3 = CombineLatestObserver(lock: lock, parent: self, index: 2, setLatestValue: { (e: E3) 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 -> Result { try parent.resultSelector(latestElement1, latestElement2, latestElement3) } } final class CombineLatest3: Producer { typealias ResultSelector = (E1, E2, E3) throws -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink3_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 4 public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element) -> Observable { CombineLatest4( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)> { CombineLatest4( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), resultSelector: { ($0, $1, $2, $3) } ) } } final class CombineLatestSink4_: CombineLatestSink { typealias Result = Observer.Element typealias Parent = CombineLatest4 let parent: Parent var latestElement1: E1! var latestElement2: E2! var latestElement3: E3! var latestElement4: E4! init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) in self.latestElement1 = e }, this: subscription1) let observer2 = CombineLatestObserver(lock: lock, parent: self, index: 1, setLatestValue: { (e: E2) in self.latestElement2 = e }, this: subscription2) let observer3 = CombineLatestObserver(lock: lock, parent: self, index: 2, setLatestValue: { (e: E3) in self.latestElement3 = e }, this: subscription3) let observer4 = CombineLatestObserver(lock: lock, parent: self, index: 3, setLatestValue: { (e: E4) 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 -> Result { try parent.resultSelector(latestElement1, latestElement2, latestElement3, latestElement4) } } final class CombineLatest4: Producer { typealias ResultSelector = (E1, E2, E3, E4) throws -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink4_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 5 public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element) -> Observable { CombineLatest5( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)> { 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 Result = Observer.Element typealias Parent = CombineLatest5 let parent: Parent var latestElement1: E1! var latestElement2: E2! var latestElement3: E3! var latestElement4: E4! var latestElement5: E5! init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) in self.latestElement1 = e }, this: subscription1) let observer2 = CombineLatestObserver(lock: lock, parent: self, index: 1, setLatestValue: { (e: E2) in self.latestElement2 = e }, this: subscription2) let observer3 = CombineLatestObserver(lock: lock, parent: self, index: 2, setLatestValue: { (e: E3) in self.latestElement3 = e }, this: subscription3) let observer4 = CombineLatestObserver(lock: lock, parent: self, index: 3, setLatestValue: { (e: E4) in self.latestElement4 = e }, this: subscription4) let observer5 = CombineLatestObserver(lock: lock, parent: self, index: 4, setLatestValue: { (e: E5) 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 -> Result { try parent.resultSelector(latestElement1, latestElement2, latestElement3, latestElement4, latestElement5) } } final class CombineLatest5: Producer { typealias ResultSelector = (E1, E2, E3, E4, E5) throws -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink5_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 6 public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element) -> Observable { CombineLatest6( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)> { 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 Result = Observer.Element typealias Parent = CombineLatest6 let parent: Parent var latestElement1: E1! var latestElement2: E2! var latestElement3: E3! var latestElement4: E4! var latestElement5: E5! var latestElement6: E6! init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) in self.latestElement1 = e }, this: subscription1) let observer2 = CombineLatestObserver(lock: lock, parent: self, index: 1, setLatestValue: { (e: E2) in self.latestElement2 = e }, this: subscription2) let observer3 = CombineLatestObserver(lock: lock, parent: self, index: 2, setLatestValue: { (e: E3) in self.latestElement3 = e }, this: subscription3) let observer4 = CombineLatestObserver(lock: lock, parent: self, index: 3, setLatestValue: { (e: E4) in self.latestElement4 = e }, this: subscription4) let observer5 = CombineLatestObserver(lock: lock, parent: self, index: 4, setLatestValue: { (e: E5) in self.latestElement5 = e }, this: subscription5) let observer6 = CombineLatestObserver(lock: lock, parent: self, index: 5, setLatestValue: { (e: E6) 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 -> Result { try parent.resultSelector(latestElement1, latestElement2, latestElement3, latestElement4, latestElement5, latestElement6) } } final class CombineLatest6: Producer { typealias ResultSelector = (E1, E2, E3, E4, E5, E6) throws -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink6_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 7 public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element) -> Observable { CombineLatest7( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)> { 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 Result = Observer.Element typealias Parent = CombineLatest7 let parent: Parent var latestElement1: E1! var latestElement2: E2! var latestElement3: E3! var latestElement4: E4! var latestElement5: E5! var latestElement6: E6! var latestElement7: E7! init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) in self.latestElement1 = e }, this: subscription1) let observer2 = CombineLatestObserver(lock: lock, parent: self, index: 1, setLatestValue: { (e: E2) in self.latestElement2 = e }, this: subscription2) let observer3 = CombineLatestObserver(lock: lock, parent: self, index: 2, setLatestValue: { (e: E3) in self.latestElement3 = e }, this: subscription3) let observer4 = CombineLatestObserver(lock: lock, parent: self, index: 3, setLatestValue: { (e: E4) in self.latestElement4 = e }, this: subscription4) let observer5 = CombineLatestObserver(lock: lock, parent: self, index: 4, setLatestValue: { (e: E5) in self.latestElement5 = e }, this: subscription5) let observer6 = CombineLatestObserver(lock: lock, parent: self, index: 5, setLatestValue: { (e: E6) in self.latestElement6 = e }, this: subscription6) let observer7 = CombineLatestObserver(lock: lock, parent: self, index: 6, setLatestValue: { (e: E7) 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 -> Result { try parent.resultSelector(latestElement1, latestElement2, latestElement3, latestElement4, latestElement5, latestElement6, latestElement7) } } final class CombineLatest7: Producer { typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7) throws -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink7_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 8 public 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element) -> Observable { 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 ) } } public extension ObservableType where Element == 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. */ static func combineLatest (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)> { 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 Result = Observer.Element typealias Parent = CombineLatest8 let parent: Parent var latestElement1: E1! var latestElement2: E2! var latestElement3: E3! var latestElement4: E4! var latestElement5: E5! var latestElement6: E6! var latestElement7: E7! var latestElement8: E8! init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) in self.latestElement1 = e }, this: subscription1) let observer2 = CombineLatestObserver(lock: lock, parent: self, index: 1, setLatestValue: { (e: E2) in self.latestElement2 = e }, this: subscription2) let observer3 = CombineLatestObserver(lock: lock, parent: self, index: 2, setLatestValue: { (e: E3) in self.latestElement3 = e }, this: subscription3) let observer4 = CombineLatestObserver(lock: lock, parent: self, index: 3, setLatestValue: { (e: E4) in self.latestElement4 = e }, this: subscription4) let observer5 = CombineLatestObserver(lock: lock, parent: self, index: 4, setLatestValue: { (e: E5) in self.latestElement5 = e }, this: subscription5) let observer6 = CombineLatestObserver(lock: lock, parent: self, index: 5, setLatestValue: { (e: E6) in self.latestElement6 = e }, this: subscription6) let observer7 = CombineLatestObserver(lock: lock, parent: self, index: 6, setLatestValue: { (e: E7) in self.latestElement7 = e }, this: subscription7) let observer8 = CombineLatestObserver(lock: lock, parent: self, index: 7, setLatestValue: { (e: E8) 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 -> Result { 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 -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink8_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/CombineLatest+arity.tt ================================================ // // CombineLatest+arity.swift // RxSwift // // Created by Krunoslav Zaher on 4/22/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // <% for i in 2 ... 8 { %> // <%= i %> 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<<%= (Array(1...i).map { "O\($0): ObservableType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).Element" }).joined(separator: ", ") %>) throws -> Element) -> Observable { return CombineLatest<%= i %>( <%= (Array(1...i).map { "source\($0): source\($0).asObservable()" }).joined(separator: ", ") %>, resultSelector: resultSelector ) } } extension ObservableType where Element == 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<<%= (Array(1...i).map { "O\($0): ObservableType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>) -> Observable<(<%= (Array(1...i).map { "O\($0).Element" }).joined(separator: ", ") %>)> { return CombineLatest<%= i %>( <%= (Array(1...i).map { "source\($0): source\($0).asObservable()" }).joined(separator: ", ") %>, resultSelector: { (<%= (Array(0..) } ) } } final class CombineLatestSink<%= i %>_<<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>, Observer: ObserverType> : CombineLatestSink { typealias Result = Observer.Element typealias Parent = CombineLatest<%= i %><<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>, Result> let parent: Parent <%= (Array(1...i).map { " var latestElement\($0): E\($0)! = nil" }).joined(separator: "\n") %> init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: <%= i %>, observer: observer, cancel: cancel) } func run() -> Disposable { <%= (Array(1...i).map { " let subscription\($0) = SingleAssignmentDisposable()" }).joined(separator: "\n") %> <%= (Array(1...i).map { " let observer\($0) = CombineLatestObserver(lock: self.lock, parent: self, index: \($0 - 1), setLatestValue: { (e: E\($0)) -> Void in self.latestElement\($0) = e }, this: subscription\($0))" }).joined(separator: "\n") %> <%= (Array(1...i).map { " subscription\($0).setDisposable(self.parent.source\($0).subscribe(observer\($0)))" }).joined(separator: "\n") %> return Disposables.create([ <%= (Array(1...i).map { " subscription\($0)" }).joined(separator: ",\n") %> ]) } override func getResult() throws -> Result { try self.parent.resultSelector(<%= (Array(1...i).map { "self.latestElement\($0)" }).joined(separator: ", ") %>) } } final class CombineLatest<%= i %><<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>, Result> : Producer { typealias ResultSelector = (<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>) throws -> Result <%= (Array(1...i).map { " let source\($0): Observable" }).joined(separator: "\n") %> let resultSelector: ResultSelector init(<%= (Array(1...i).map { "source\($0): Observable" }).joined(separator: ", ") %>, resultSelector: @escaping ResultSelector) { <%= (Array(1...i).map { " self.source\($0) = source\($0)" }).joined(separator: "\n") %> self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = CombineLatestSink<%= i %>_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } <% } %> ================================================ FILE: RxSwift/Observables/CombineLatest.swift ================================================ // // CombineLatest.swift // RxSwift // // Created by Krunoslav Zaher on 3/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol CombineLatestProtocol: AnyObject { func next(_ index: Int) func fail(_ error: Swift.Error) func done(_ index: Int) } class CombineLatestSink: Sink, CombineLatestProtocol { typealias Element = Observer.Element 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: Observer, cancel: Cancelable) { self.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 { self.forwardOn(.error(e)) self.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 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) { self.lock = lock self.parent = parent self.index = index self.this = this self.setLatestValue = setLatestValue } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { switch event { case let .next(value): setLatestValue(value) parent.next(index) case let .error(error): this.dispose() parent.fail(error) case .completed: this.dispose() parent.done(index) } } } ================================================ FILE: RxSwift/Observables/CompactMap.swift ================================================ // // CompactMap.swift // RxSwift // // Created by Michael Long on 04/09/2019. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public extension ObservableType { /** Projects each element of an observable sequence into an optional form and filters all optional results. - parameter transform: A transform function to apply to each source element and which returns an element or nil. - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source. */ func compactMap(_ transform: @escaping (Element) throws -> Result?) -> Observable { CompactMap(source: asObservable(), transform: transform) } } private final class CompactMapSink: Sink, ObserverType { typealias Transform = (SourceType) throws -> ResultType? typealias ResultType = Observer.Element typealias Element = SourceType private let transform: Transform init(transform: @escaping Transform, observer: Observer, cancel: Cancelable) { self.transform = transform super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(element): do { if let mappedElement = try transform(element) { forwardOn(.next(mappedElement)) } } catch let e { self.forwardOn(.error(e)) self.dispose() } case let .error(error): forwardOn(.error(error)) dispose() case .completed: forwardOn(.completed) dispose() } } } private final class CompactMap: Producer { typealias Transform = (SourceType) throws -> ResultType? private let source: Observable private let transform: Transform init(source: Observable, transform: @escaping Transform) { self.source = source self.transform = transform } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType { let sink = CompactMapSink(transform: transform, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Concat.swift ================================================ // // Concat.swift // RxSwift // // Created by Krunoslav Zaher on 3/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func concat(_ second: Source) -> Observable where Source.Element == Element { Observable.concat([asObservable(), second.asObservable()]) } } public 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. */ static func concat(_ sequence: Sequence) -> Observable where Sequence.Element == Observable { 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. */ static func concat(_ collection: Collection) -> Observable where Collection.Element == Observable { 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. */ static func concat(_ sources: Observable ...) -> Observable { Concat(sources: sources, count: Int64(sources.count)) } } private final class ConcatSink: TailRecursiveSink, ObserverType where Sequence.Element: ObservableConvertibleType, Sequence.Element.Element == Observer.Element { typealias Element = Observer.Element override init(observer: Observer, 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 { source.subscribe(self) } override func extract(_ observable: Observable) -> SequenceGenerator? { if let source = observable as? Concat { (source.sources.makeIterator(), source.count) } else { nil } } } private final class Concat: Producer where Sequence.Element: ObservableConvertibleType { typealias Element = Sequence.Element.Element fileprivate let sources: Sequence fileprivate let count: IntMax? init(sources: Sequence, count: IntMax?) { self.sources = sources self.count = count } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = ConcatSink(observer: observer, cancel: cancel) let subscription = sink.run((sources.makeIterator(), count)) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Create.swift ================================================ // // Create.swift // RxSwift // // Created by Krunoslav Zaher on 2/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func create(_ subscribe: @escaping (AnyObserver) -> Disposable) -> Observable { AnonymousObservable(subscribe) } } private final class AnonymousObservableSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = AnonymousObservable // state private let isStopped = AtomicInt(0) #if DEBUG private let synchronizationTracker = SynchronizationTracker() #endif override init(observer: Observer, cancel: Cancelable) { super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { #if DEBUG synchronizationTracker.register(synchronizationErrorMessage: .default) defer { self.synchronizationTracker.unregister() } #endif switch event { case .next: if load(isStopped) == 1 { return } forwardOn(event) case .error, .completed: if fetchOr(isStopped, 1) == 0 { forwardOn(event) dispose() } } } func run(_ parent: Parent) -> Disposable { parent.subscribeHandler(AnyObserver(self)) } } private final class AnonymousObservable: Producer { typealias SubscribeHandler = (AnyObserver) -> Disposable let subscribeHandler: SubscribeHandler init(_ subscribeHandler: @escaping SubscribeHandler) { self.subscribeHandler = subscribeHandler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = AnonymousObservableSink(observer: observer, cancel: cancel) let subscription = sink.run(self) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Debounce.swift ================================================ // // Debounce.swift // RxSwift // // Created by Krunoslav Zaher on 9/11/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func debounce(_ dueTime: RxTimeInterval, scheduler: SchedulerType) -> Observable { Debounce(source: asObservable(), dueTime: dueTime, scheduler: scheduler) } } private final class DebounceSink: Sink, ObserverType, LockOwnerType, SynchronizedOnType { typealias Element = Observer.Element typealias ParentType = Debounce private let parent: ParentType let lock = RecursiveLock() // state private var id = 0 as UInt64 private var value: Element? let cancellable = SerialDisposable() init(parent: ParentType, observer: Observer, cancel: Cancelable) { self.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 let .next(element): id = id &+ 1 let currentId = id value = element let scheduler = parent.scheduler let dueTime = parent.dueTime let d = SingleAssignmentDisposable() cancellable.disposable = d d.setDisposable(scheduler.scheduleRelative(currentId, dueTime: dueTime, action: propagate)) case .error: value = nil forwardOn(event) dispose() case .completed: if let value { self.value = nil forwardOn(.next(value)) } forwardOn(.completed) dispose() } } func propagate(_ currentId: UInt64) -> Disposable { lock.performLocked { let originalValue = self.value if let value = originalValue, self.id == currentId { self.value = nil self.forwardOn(.next(value)) } return Disposables.create() } } } private final class Debounce: Producer { fileprivate let source: Observable fileprivate let dueTime: RxTimeInterval fileprivate let scheduler: SchedulerType init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { self.source = source self.dueTime = dueTime self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = DebounceSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Debug.swift ================================================ // // Debug.swift // RxSwift // // Created by Krunoslav Zaher on 5/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function) -> Observable { Debug(source: self, identifier: identifier, trimOutput: trimOutput, file: file, line: line, function: function) } } private let dateFormat = "yyyy-MM-dd HH:mm:ss.SSS" private func logEvent(_ identifier: String, dateFormat: DateFormatter, content: String) { print("\(dateFormat.string(from: Date())): \(identifier) -> \(content)") } private final class DebugSink: Sink, ObserverType where Observer.Element == Source.Element { typealias Element = Observer.Element typealias Parent = Debug private let parent: Parent private let timestampFormatter = DateFormatter() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent timestampFormatter.dateFormat = dateFormat logEvent(self.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 !isDisposed { logEvent(parent.identifier, dateFormat: timestampFormatter, content: "isDisposed") } super.dispose() } } private final class Debug: Producer { fileprivate let identifier: String fileprivate let trimOutput: Bool private let source: Source init(source: Source, identifier: String?, trimOutput: Bool, file: String, line: UInt, function: String) { self.trimOutput = trimOutput if let identifier { self.identifier = identifier } else { let trimmedFile: String = if let lastIndex = file.lastIndex(of: "/") { String(file[file.index(after: lastIndex) ..< file.endIndex]) } else { file } self.identifier = "\(trimmedFile):\(line) (\(function))" } self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Source.Element { let sink = DebugSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Decode.swift ================================================ // // Decode.swift // RxSwift // // Created by Shai Mishali on 24/07/2020. // Copyright © 2020 Krunoslav Zaher. All rights reserved. // import Foundation public extension ObservableType where Element == Data { /// Attempt to decode the emitted `Data` using a provided decoder. /// /// - parameter type: A `Decodable`-conforming type to attempt to decode to /// - parameter decoder: A capable decoder, e.g. `JSONDecoder` or `PropertyListDecoder` /// /// - note: If using a custom decoder, it must conform to the `DataDecoder` protocol. /// /// - returns: An `Observable` of the decoded type func decode( type: Item.Type, decoder: some DataDecoder ) -> Observable { map { try decoder.decode(type, from: $0) } } } /// Represents an entity capable of decoding raw `Data` /// into a concrete `Decodable` type public protocol DataDecoder { func decode(_ type: Item.Type, from data: Data) throws -> Item } extension JSONDecoder: DataDecoder {} extension PropertyListDecoder: DataDecoder {} ================================================ FILE: RxSwift/Observables/DefaultIfEmpty.swift ================================================ // // DefaultIfEmpty.swift // RxSwift // // Created by sergdort on 23/12/2016. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // public 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 */ func ifEmpty(default: Element) -> Observable { DefaultIfEmpty(source: asObservable(), default: `default`) } } private final class DefaultIfEmptySink: Sink, ObserverType { typealias Element = Observer.Element private let `default`: Element private var isEmpty = true init(default: Element, observer: Observer, cancel: Cancelable) { self.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(self.default)) } forwardOn(.completed) dispose() } } } private final class DefaultIfEmpty: Producer { private let source: Observable private let `default`: SourceType init(source: Observable, default: SourceType) { self.source = source self.default = `default` } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceType { let sink = DefaultIfEmptySink(default: self.default, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Deferred.swift ================================================ // // Deferred.swift // RxSwift // // Created by Krunoslav Zaher on 4/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func deferred(_ observableFactory: @escaping () throws -> Observable) -> Observable { Deferred(observableFactory: observableFactory) } } private final class DeferredSink: Sink, ObserverType where Source.Element == Observer.Element { typealias Element = Observer.Element typealias Parent = Deferred override init(observer: Observer, cancel: Cancelable) { super.init(observer: observer, cancel: cancel) } func run(_ parent: Parent) -> Disposable { do { let result = try parent.observableFactory() return result.subscribe(self) } catch let e { self.forwardOn(.error(e)) self.dispose() return Disposables.create() } } func on(_ event: Event) { forwardOn(event) switch event { case .next: break case .error: dispose() case .completed: dispose() } } } private final class Deferred: Producer { typealias Factory = () throws -> Source let observableFactory: Factory init(observableFactory: @escaping Factory) { self.observableFactory = observableFactory } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Source.Element { let sink = DeferredSink(observer: observer, cancel: cancel) let subscription = sink.run(self) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Delay.swift ================================================ // // Delay.swift // RxSwift // // Created by tarunon on 2016/02/09. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func delay(_ dueTime: RxTimeInterval, scheduler: SchedulerType) -> Observable { Delay(source: asObservable(), dueTime: dueTime, scheduler: scheduler) } } private final class DelaySink: Sink, ObserverType { typealias Element = Observer.Element 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? // state private var queue = Queue<(eventTime: RxTime, event: Event)>(capacity: 0) init(observer: Observer, dueTime: RxTimeInterval, scheduler: SchedulerType, cancel: Cancelable) { self.dueTime = dueTime self.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 eventToForwardImmediately = ranAtLeastOnce ? nil : queue.dequeue()?.event let nextEventToScheduleOriginalTime: Date? = ranAtLeastOnce && !queue.isEmpty ? queue.peek().eventTime : nil if errorEvent == nil { if eventToForwardImmediately != nil {} else if nextEventToScheduleOriginalTime != nil { running = false } else { running = false active = false } } lock.unlock() if let errorEvent { forwardOn(errorEvent) dispose() return } else { if let eventToForwardImmediately { ranAtLeastOnce = true forwardOn(eventToForwardImmediately) if case .completed = eventToForwardImmediately { dispose() return } } else if let nextEventToScheduleOriginalTime { scheduler.schedule((), dueTime: dueTime.reduceWithSpanBetween(earlierDate: nextEventToScheduleOriginalTime, laterDate: self.scheduler.now)) return } else { return } } } } func on(_ event: Event) { if event.isStopEvent { sourceSubscription.dispose() } switch event { case .error: lock.lock() let shouldSendImmediately = !running queue = Queue(capacity: 0) errorEvent = event lock.unlock() if shouldSendImmediately { 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: drainQueue) } } } func run(source: Observable) -> Disposable { sourceSubscription.setDisposable(source.subscribe(self)) return Disposables.create(sourceSubscription, cancelable) } } private final class Delay: Producer { private let source: Observable private let dueTime: RxTimeInterval private let scheduler: SchedulerType init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { self.source = source self.dueTime = dueTime self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = DelaySink(observer: observer, dueTime: dueTime, scheduler: scheduler, cancel: cancel) let subscription = sink.run(source: source) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/DelaySubscription.swift ================================================ // // DelaySubscription.swift // RxSwift // // Created by Krunoslav Zaher on 6/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType) -> Observable { DelaySubscription(source: asObservable(), dueTime: dueTime, scheduler: scheduler) } } private final class DelaySubscriptionSink: Sink, ObserverType { typealias Element = Observer.Element func on(_ event: Event) { forwardOn(event) if event.isStopEvent { dispose() } } } private final class DelaySubscription: Producer { private let source: Observable private let dueTime: RxTimeInterval private let scheduler: SchedulerType init(source: Observable, dueTime: RxTimeInterval, scheduler: SchedulerType) { self.source = source self.dueTime = dueTime self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = DelaySubscriptionSink(observer: observer, cancel: cancel) let subscription = scheduler.scheduleRelative((), dueTime: dueTime) { _ in self.source.subscribe(sink) } return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Dematerialize.swift ================================================ // // Dematerialize.swift // RxSwift // // Created by Jamie Pinkham on 3/13/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // public extension ObservableType where Element: 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. */ func dematerialize() -> Observable { Dematerialize(source: asObservable()) } } private final class DematerializeSink: Sink, ObserverType where Observer.Element == T.Element { fileprivate func on(_ event: Event) { switch event { case let .next(element): forwardOn(element.event) if element.event.isStopEvent { dispose() } case .completed: forwardOn(.completed) dispose() case let .error(error): forwardOn(.error(error)) dispose() } } } private final class Dematerialize: Producer { private let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == T.Element { let sink = DematerializeSink(observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/DistinctUntilChanged.swift ================================================ // // DistinctUntilChanged.swift // RxSwift // // Created by Krunoslav Zaher on 3/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public extension ObservableType where Element: 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. */ func distinctUntilChanged() -> Observable { distinctUntilChanged { $0 } comparer: { $0 == $1 } } } public 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. */ func distinctUntilChanged(_ keySelector: @escaping (Element) throws -> some Equatable) -> Observable { 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. */ func distinctUntilChanged(_ comparer: @escaping (Element, Element) throws -> Bool) -> Observable { 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. */ func distinctUntilChanged(_ keySelector: @escaping (Element) throws -> K, comparer: @escaping (K, K) throws -> Bool) -> Observable { DistinctUntilChanged(source: asObservable(), selector: keySelector, comparer: comparer) } /** Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object. - 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 on the provided key path */ func distinctUntilChanged(at keyPath: KeyPath) -> Observable { distinctUntilChanged { $0[keyPath: keyPath] == $1[keyPath: keyPath] } } } private final class DistinctUntilChangedSink: Sink, ObserverType { typealias Element = Observer.Element private let parent: DistinctUntilChanged private var currentKey: Key? init(parent: DistinctUntilChanged, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): do { let key = try parent.selector(value) var areEqual = false if let currentKey { areEqual = try parent.comparer(currentKey, key) } if areEqual { return } currentKey = key forwardOn(event) } catch { forwardOn(.error(error)) dispose() } case .error, .completed: forwardOn(event) dispose() } } } private final class DistinctUntilChanged: Producer { typealias KeySelector = (Element) throws -> Key typealias EqualityComparer = (Key, Key) throws -> Bool private let source: Observable fileprivate let selector: KeySelector fileprivate let comparer: EqualityComparer init(source: Observable, selector: @escaping KeySelector, comparer: @escaping EqualityComparer) { self.source = source self.selector = selector self.comparer = comparer } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = DistinctUntilChangedSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Do.swift ================================================ // // Do.swift // RxSwift // // Created by Krunoslav Zaher on 2/21/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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 afterNext: Action to invoke for each element after the observable has passed an onNext event along to its downstream. - parameter onError: Action to invoke upon errored termination of the observable sequence. - parameter afterError: Action to invoke after errored termination of the observable sequence. - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence. - parameter afterCompleted: Action to invoke after 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. */ func `do`(onNext: ((Element) throws -> Void)? = nil, afterNext: ((Element) throws -> Void)? = nil, onError: ((Swift.Error) throws -> Void)? = nil, afterError: ((Swift.Error) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, afterCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil) -> Observable { Do(source: asObservable(), eventHandler: { e in switch e { case let .next(element): try onNext?(element) case let .error(e): try onError?(e) case .completed: try onCompleted?() } }, afterEventHandler: { e in switch e { case let .next(element): try afterNext?(element) case let .error(e): try afterError?(e) case .completed: try afterCompleted?() } }, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose) } } private final class DoSink: Sink, ObserverType { typealias Element = Observer.Element typealias EventHandler = (Event) throws -> Void typealias AfterEventHandler = (Event) throws -> Void private let eventHandler: EventHandler private let afterEventHandler: AfterEventHandler init(eventHandler: @escaping EventHandler, afterEventHandler: @escaping AfterEventHandler, observer: Observer, cancel: Cancelable) { self.eventHandler = eventHandler self.afterEventHandler = afterEventHandler super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { do { try eventHandler(event) forwardOn(event) try afterEventHandler(event) if event.isStopEvent { dispose() } } catch { forwardOn(.error(error)) dispose() } } } private final class Do: Producer { typealias EventHandler = (Event) throws -> Void typealias AfterEventHandler = (Event) throws -> Void private let source: Observable private let eventHandler: EventHandler private let afterEventHandler: AfterEventHandler private let onSubscribe: (() -> Void)? private let onSubscribed: (() -> Void)? private let onDispose: (() -> Void)? init(source: Observable, eventHandler: @escaping EventHandler, afterEventHandler: @escaping AfterEventHandler, onSubscribe: (() -> Void)?, onSubscribed: (() -> Void)?, onDispose: (() -> Void)?) { self.source = source self.eventHandler = eventHandler self.afterEventHandler = afterEventHandler self.onSubscribe = onSubscribe self.onSubscribed = onSubscribed self.onDispose = onDispose } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { onSubscribe?() let sink = DoSink(eventHandler: eventHandler, afterEventHandler: afterEventHandler, 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) } } ================================================ FILE: RxSwift/Observables/ElementAt.swift ================================================ // // ElementAt.swift // RxSwift // // Created by Junior B. on 21/10/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ @available(*, deprecated, renamed: "element(at:)") func elementAt(_ index: Int) -> Observable { element(at: index) } /** 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. */ func element(at index: Int) -> Observable { ElementAt(source: asObservable(), index: index, throwOnEmpty: true) } } private final class ElementAtSink: Sink, ObserverType { typealias SourceType = Observer.Element typealias Parent = ElementAt let parent: Parent var i: Int init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) dispose() } do { _ = try decrementChecked(&i) } catch let e { self.forwardOn(.error(e)) self.dispose() return } case let .error(e): forwardOn(.error(e)) dispose() case .completed: if parent.throwOnEmpty { forwardOn(.error(RxError.argumentOutOfRange)) } else { forwardOn(.completed) } dispose() } } } private final 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: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceType { let sink = ElementAtSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Empty.swift ================================================ // // Empty.swift // RxSwift // // Created by Krunoslav Zaher on 8/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func empty() -> Observable { EmptyProducer() } } private final class EmptyProducer: Producer { override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { observer.on(.completed) return Disposables.create() } } ================================================ FILE: RxSwift/Observables/Enumerated.swift ================================================ // // Enumerated.swift // RxSwift // // Created by Krunoslav Zaher on 8/6/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // public 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. */ func enumerated() -> Observable<(index: Int, element: Element)> { Enumerated(source: asObservable()) } } private final class EnumeratedSink: Sink, ObserverType where Observer.Element == (index: Int, element: Element) { var index = 0 func on(_ event: Event) { switch event { case let .next(value): do { let nextIndex = try incrementChecked(&index) let next = (index: nextIndex, element: value) forwardOn(.next(next)) } catch let e { self.forwardOn(.error(e)) self.dispose() } case .completed: forwardOn(.completed) dispose() case let .error(error): forwardOn(.error(error)) dispose() } } } private final class Enumerated: Producer<(index: Int, element: Element)> { private let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == (index: Int, element: Element) { let sink = EnumeratedSink(observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Error.swift ================================================ // // Error.swift // RxSwift // // Created by Krunoslav Zaher on 8/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func error(_ error: Swift.Error) -> Observable { ErrorProducer(error: error) } } private final class ErrorProducer: Producer { private let error: Swift.Error init(error: Swift.Error) { self.error = error } override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { observer.on(.error(error)) return Disposables.create() } } ================================================ FILE: RxSwift/Observables/Filter.swift ================================================ // // Filter.swift // RxSwift // // Created by Krunoslav Zaher on 2/17/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func filter(_ predicate: @escaping (Element) throws -> Bool) -> Observable { Filter(source: asObservable(), predicate: predicate) } } public extension ObservableType { /** Skips elements and completes (or errors) when the observable sequence 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. */ func ignoreElements() -> Observable { flatMap { _ in Observable.empty() } } } private final class FilterSink: Sink, ObserverType { typealias Predicate = (Element) throws -> Bool typealias Element = Observer.Element private let predicate: Predicate init(predicate: @escaping Predicate, observer: Observer, cancel: Cancelable) { self.predicate = predicate super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): do { let satisfies = try predicate(value) if satisfies { forwardOn(.next(value)) } } catch let e { self.forwardOn(.error(e)) self.dispose() } case .completed, .error: forwardOn(event) dispose() } } } private final class Filter: Producer { typealias Predicate = (Element) throws -> Bool private let source: Observable private let predicate: Predicate init(source: Observable, predicate: @escaping Predicate) { self.source = source self.predicate = predicate } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = FilterSink(predicate: predicate, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/First.swift ================================================ // // First.swift // RxSwift // // Created by Krunoslav Zaher on 7/31/17. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // private final class FirstSink: Sink, ObserverType where Observer.Element == Element? { typealias Parent = First func on(_ event: Event) { switch event { case let .next(value): forwardOn(.next(value)) forwardOn(.completed) dispose() case let .error(error): forwardOn(.error(error)) dispose() case .completed: forwardOn(.next(nil)) forwardOn(.completed) dispose() } } } final class First: Producer { private let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element? { let sink = FirstSink(observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Generate.swift ================================================ // // Generate.swift // RxSwift // // Created by Krunoslav Zaher on 9/2/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func generate(initialState: Element, condition: @escaping (Element) throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: @escaping (Element) throws -> Element) -> Observable { Generate(initialState: initialState, condition: condition, iterate: iterate, resultSelector: { $0 }, scheduler: scheduler) } } private final class GenerateSink: Sink { typealias Parent = Generate private let parent: Parent private var state: Sequence init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent state = parent.initialState super.init(observer: observer, cancel: cancel) } func run() -> Disposable { parent.scheduler.scheduleRecursive(true) { isFirst, recurse 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 { self.forwardOn(.error(error)) self.dispose() } } } } private final class Generate: Producer { fileprivate let initialState: Sequence fileprivate let condition: (Sequence) throws -> Bool fileprivate let iterate: (Sequence) throws -> Sequence fileprivate let resultSelector: (Sequence) throws -> Element fileprivate let scheduler: ImmediateSchedulerType init(initialState: Sequence, condition: @escaping (Sequence) throws -> Bool, iterate: @escaping (Sequence) throws -> Sequence, resultSelector: @escaping (Sequence) throws -> Element, scheduler: ImmediateSchedulerType) { self.initialState = initialState self.condition = condition self.iterate = iterate self.resultSelector = resultSelector self.scheduler = scheduler super.init() } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = GenerateSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/GroupBy.swift ================================================ // // GroupBy.swift // RxSwift // // Created by Tomi Koskinen on 01/12/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func groupBy(keySelector: @escaping (Element) throws -> Key) -> Observable> { GroupBy(source: asObservable(), selector: keySelector) } } private final class GroupedObservableImpl: Observable { private var subject: PublishSubject private var refCount: RefCountDisposable init(subject: PublishSubject, refCount: RefCountDisposable) { self.subject = subject self.refCount = refCount } override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { let release = refCount.retain() let subscription = subject.subscribe(observer) return Disposables.create(release, subscription) } } private final class GroupBySink: Sink, ObserverType where Observer.Element == GroupedObservable { typealias ResultType = Observer.Element typealias Parent = GroupBy private let parent: Parent private let subscription = SingleAssignmentDisposable() private var refCountDisposable: RefCountDisposable! private var groupedSubjectTable: [Key: PublishSubject] init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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(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 { self.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) } } } private final class GroupBy: Producer> { typealias KeySelector = (Element) throws -> Key fileprivate let source: Observable fileprivate let selector: KeySelector init(source: Observable, selector: @escaping KeySelector) { self.source = source self.selector = selector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == GroupedObservable { let sink = GroupBySink(parent: self, observer: observer, cancel: cancel) return (sink: sink, subscription: sink.run()) } } ================================================ FILE: RxSwift/Observables/Just.swift ================================================ // // Just.swift // RxSwift // // Created by Krunoslav Zaher on 8/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func just(_ element: Element) -> Observable { 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: Scheduler to send the single element on. - returns: An observable sequence containing the single specified element. */ static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Observable { JustScheduled(element: element, scheduler: scheduler) } } private final class JustScheduledSink: Sink { typealias Parent = JustScheduled private let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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() } } } } private final class JustScheduled: Producer { fileprivate let scheduler: ImmediateSchedulerType fileprivate let element: Element init(element: Element, scheduler: ImmediateSchedulerType) { self.scheduler = scheduler self.element = element } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = JustScheduledSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } private final class Just: Producer { private let element: Element init(element: Element) { self.element = element } override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { observer.on(.next(element)) observer.on(.completed) return Disposables.create() } } ================================================ FILE: RxSwift/Observables/Map.swift ================================================ // // Map.swift // RxSwift // // Created by Krunoslav Zaher on 3/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func map(_ transform: @escaping (Element) throws -> Result) -> Observable { Map(source: asObservable(), transform: transform) } } private final class MapSink: Sink, ObserverType { typealias Transform = (SourceType) throws -> ResultType typealias ResultType = Observer.Element private let transform: Transform init(transform: @escaping Transform, observer: Observer, cancel: Cancelable) { self.transform = transform super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(element): do { let mappedElement = try transform(element) forwardOn(.next(mappedElement)) } catch let e { self.forwardOn(.error(e)) self.dispose() } case let .error(error): forwardOn(.error(error)) dispose() case .completed: forwardOn(.completed) dispose() } } } private final class Map: Producer { typealias Transform = (SourceType) throws -> ResultType private let source: Observable private let transform: Transform init(source: Observable, transform: @escaping Transform) { self.source = source self.transform = transform } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType { let sink = MapSink(transform: transform, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Materialize.swift ================================================ // // Materialize.swift // RxSwift // // Created by sergdort on 08/03/2017. // Copyright © 2017 Krunoslav Zaher. All rights reserved. // public 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. */ func materialize() -> Observable> { Materialize(source: asObservable()) } } private final class MaterializeSink: Sink, ObserverType where Observer.Element == Event { func on(_ event: Event) { forwardOn(.next(event)) if event.isStopEvent { forwardOn(.completed) dispose() } } } private final class Materialize: Producer> { private let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = MaterializeSink(observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Merge.swift ================================================ // // Merge.swift // RxSwift // // Created by Krunoslav Zaher on 3/28/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func flatMap(_ selector: @escaping (Element) throws -> Source) -> Observable { FlatMap(source: asObservable(), selector: selector) } } public 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. */ func flatMapFirst(_ selector: @escaping (Element) throws -> Source) -> Observable { FlatMapFirst(source: asObservable(), selector: selector) } } public extension ObservableType where Element: 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. */ func merge() -> Observable { 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. */ func merge(maxConcurrent: Int) -> Observable { MergeLimited(source: asObservable(), maxConcurrent: maxConcurrent) } } public extension ObservableType where Element: 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. */ func concat() -> Observable { merge(maxConcurrent: 1) } } public 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. */ static func merge(_ sources: Collection) -> Observable where Collection.Element == Observable { 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. */ static func merge(_ sources: [Observable]) -> Observable { 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. */ static func merge(_ sources: Observable...) -> Observable { MergeArray(sources: sources) } } // MARK: concatMap public 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. */ func concatMap(_ selector: @escaping (Element) throws -> Source) -> Observable { ConcatMap(source: asObservable(), selector: selector) } } private final class MergeLimitedSinkIter: ObserverType, LockOwnerType, SynchronizedOnType where SourceSequence.Element == Observer.Element { typealias Element = Observer.Element typealias DisposeKey = CompositeDisposable.DisposeKey typealias Parent = MergeLimitedSink private let parent: Parent private let disposeKey: DisposeKey var lock: RecursiveLock { parent.lock } init(parent: Parent, disposeKey: DisposeKey) { self.parent = parent self.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) parent.dequeueNextAndSubscribe() } } } private final class ConcatMapSink: MergeLimitedSink where Observer.Element == SourceSequence.Element { typealias Selector = (SourceElement) throws -> SourceSequence private let selector: Selector init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) { self.selector = selector super.init(maxConcurrent: 1, observer: observer, cancel: cancel) } override func performMap(_ element: SourceElement) throws -> SourceSequence { try selector(element) } } private final class MergeLimitedBasicSink: MergeLimitedSink where Observer.Element == SourceSequence.Element { override func performMap(_ element: SourceSequence) throws -> SourceSequence { element } } private class MergeLimitedSink: Sink, ObserverType where Observer.Element == SourceSequence.Element { 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) { self.maxConcurrent = maxConcurrent super.init(observer: observer, cancel: cancel) } func run(_ source: Observable) -> Disposable { _ = group.insert(sourceSubscription) let disposable = source.subscribe(self) sourceSubscription.setDisposable(disposable) return group } @discardableResult func subscribe(_ innerSource: SourceSequence, group: CompositeDisposable) -> Disposable { let subscription = SingleAssignmentDisposable() let key = group.insert(subscription) if let key { let observer = MergeLimitedSinkIter(parent: self, disposeKey: key) let disposable = innerSource.asObservable().subscribe(observer) subscription.setDisposable(disposable) } return subscription } func dequeueNextAndSubscribe() { if let next = queue.dequeue() { // subscribing immediately can produce values immediately which can re-enter and cause stack overflows let disposable = CurrentThreadScheduler.instance.schedule(()) { _ in // lock again self.lock.performLocked { self.subscribe(next, group: self.group) } } _ = group.insert(disposable) } else { activeCount -= 1 if stopped, activeCount == 0 { forwardOn(.completed) dispose() } } } func performMap(_: SourceElement) throws -> SourceSequence { rxAbstractMethod() } @inline(__always) private final func nextElementArrived(element: SourceElement) -> SourceSequence? { lock.performLocked { let subscribe: Bool if self.activeCount < self.maxConcurrent { self.activeCount += 1 subscribe = true } else { do { let value = try self.performMap(element) self.queue.enqueue(value) } catch { self.forwardOn(.error(error)) self.dispose() } subscribe = false } if subscribe { do { return try self.performMap(element) } catch { self.forwardOn(.error(error)) self.dispose() } } return nil } } func on(_ event: Event) { switch event { case let .next(element): if let sequence = nextElementArrived(element: element) { subscribe(sequence, group: group) } case let .error(error): lock.performLocked { self.forwardOn(.error(error)) self.dispose() } case .completed: lock.performLocked { if self.activeCount == 0 { self.forwardOn(.completed) self.dispose() } else { self.sourceSubscription.dispose() } self.stopped = true } } } } private final class MergeLimited: Producer { private let source: Observable private let maxConcurrent: Int init(source: Observable, maxConcurrent: Int) { self.source = source self.maxConcurrent = maxConcurrent } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element { let sink = MergeLimitedBasicSink(maxConcurrent: maxConcurrent, observer: observer, cancel: cancel) let subscription = sink.run(source) return (sink: sink, subscription: subscription) } } // MARK: Merge private final class MergeBasicSink: MergeSink where Observer.Element == Source.Element { override func performMap(_ element: Source) throws -> Source { element } } // MARK: flatMap private final class FlatMapSink: MergeSink where Observer.Element == SourceSequence.Element { typealias Selector = (SourceElement) throws -> SourceSequence private let selector: Selector init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) { self.selector = selector super.init(observer: observer, cancel: cancel) } override func performMap(_ element: SourceElement) throws -> SourceSequence { try selector(element) } } // MARK: FlatMapFirst private final class FlatMapFirstSink: MergeSink where Observer.Element == SourceSequence.Element { typealias Selector = (SourceElement) throws -> SourceSequence private let selector: Selector override var subscribeNext: Bool { activeCount == 0 } init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) { self.selector = selector super.init(observer: observer, cancel: cancel) } override func performMap(_ element: SourceElement) throws -> SourceSequence { try selector(element) } } private final class MergeSinkIter: ObserverType where Observer.Element == SourceSequence.Element { typealias Parent = MergeSink typealias DisposeKey = CompositeDisposable.DisposeKey typealias Element = Observer.Element private let parent: Parent private let disposeKey: DisposeKey init(parent: Parent, disposeKey: DisposeKey) { self.parent = parent self.disposeKey = disposeKey } func on(_ event: Event) { parent.lock.performLocked { switch event { case let .next(value): self.parent.forwardOn(.next(value)) case let .error(error): self.parent.forwardOn(.error(error)) self.parent.dispose() case .completed: self.parent.group.remove(for: self.disposeKey) self.parent.activeCount -= 1 self.parent.checkCompleted() } } } } private class MergeSink: Sink, ObserverType where Observer.Element == SourceSequence.Element { typealias ResultType = Observer.Element typealias Element = SourceElement let lock = RecursiveLock() var subscribeNext: Bool { 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(_: SourceElement) throws -> SourceSequence { rxAbstractMethod() } @inline(__always) private final func nextElementArrived(element: SourceElement) -> SourceSequence? { lock.performLocked { if !self.subscribeNext { return nil } do { let value = try self.performMap(element) self.activeCount += 1 return value } catch let e { self.forwardOn(.error(e)) self.dispose() return nil } } } func on(_ event: Event) { switch event { case let .next(element): if let value = nextElementArrived(element: element) { subscribeInner(value.asObservable()) } case let .error(error): lock.performLocked { self.forwardOn(.error(error)) self.dispose() } case .completed: lock.performLocked { self.stopped = true self.sourceSubscription.dispose() self.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 { forwardOn(.completed) dispose() } } func run(_ source: Observable) -> Disposable { _ = group.insert(sourceSubscription) let subscription = source.subscribe(self) sourceSubscription.setDisposable(subscription) return group } } // MARK: Producers private final class FlatMap: Producer { typealias Selector = (SourceElement) throws -> SourceSequence private let source: Observable private let selector: Selector init(source: Observable, selector: @escaping Selector) { self.source = source self.selector = selector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element { let sink = FlatMapSink(selector: selector, observer: observer, cancel: cancel) let subscription = sink.run(source) return (sink: sink, subscription: subscription) } } private final class FlatMapFirst: Producer { typealias Selector = (SourceElement) throws -> SourceSequence private let source: Observable private let selector: Selector init(source: Observable, selector: @escaping Selector) { self.source = source self.selector = selector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element { 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) { self.source = source self.selector = selector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element { 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) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element { let sink = MergeBasicSink(observer: observer, cancel: cancel) let subscription = sink.run(source) return (sink: sink, subscription: subscription) } } private final class MergeArray: Producer { private let sources: [Observable] init(sources: [Observable]) { self.sources = sources } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = MergeBasicSink, Observer>(observer: observer, cancel: cancel) let subscription = sink.run(sources) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Multicast.swift ================================================ // // 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() } } public 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. */ func multicast(_ subjectSelector: @escaping () throws -> Subject, selector: @escaping (Observable) throws -> Observable) -> Observable where Subject.Observer.Element == Element { Multicast( source: asObservable(), subjectSelector: subjectSelector, selector: selector ) } } public 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. */ func publish() -> ConnectableObservable { multicast { PublishSubject() } } } public 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. */ func replay(_ bufferSize: Int) -> ConnectableObservable { 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. */ func replayAll() -> ConnectableObservable { multicast { ReplaySubject.createUnbounded() } } } public 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. */ func refCount() -> Observable { RefCount(source: self) } } public 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. */ func multicast(_ subject: Subject) -> ConnectableObservable where Subject.Observer.Element == Element { ConnectableObservableAdapter(source: 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. */ func multicast(makeSubject: @escaping () -> Subject) -> ConnectableObservable where Subject.Observer.Element == Element { ConnectableObservableAdapter(source: asObservable(), makeSubject: makeSubject) } } private final class Connection: ObserverType, Disposable { typealias Element = Subject.Observer.Element private var lock: RecursiveLock // state private var parent: ConnectableObservableAdapter? private var subscription: Disposable? private var subjectObserver: Subject.Observer private let disposed = AtomicInt(0) init(parent: ConnectableObservableAdapter, subjectObserver: Subject.Observer, lock: RecursiveLock, subscription: Disposable) { self.parent = parent self.subscription = subscription self.lock = lock self.subjectObserver = subjectObserver } func on(_ event: Event) { if isFlagSet(disposed, 1) { return } if event.isStopEvent { dispose() } subjectObserver.on(event) } func dispose() { lock.lock(); defer { lock.unlock() } fetchOr(disposed, 1) guard let parent else { return } if parent.connection === self { parent.connection = nil parent.subject = nil } self.parent = nil subscription?.dispose() subscription = nil } } private final class ConnectableObservableAdapter: ConnectableObservable { typealias ConnectionType = Connection private let source: Observable private let makeSubject: () -> Subject fileprivate let lock = RecursiveLock() fileprivate var subject: Subject? // state fileprivate var connection: ConnectionType? init(source: Observable, makeSubject: @escaping () -> Subject) { self.source = source self.makeSubject = makeSubject subject = nil connection = nil } override func connect() -> Disposable { lock.performLocked { if let connection = self.connection { return connection } let singleAssignmentDisposable = SingleAssignmentDisposable() let connection = Connection(parent: self, subjectObserver: self.lazySubject.asObserver(), lock: self.lock, subscription: singleAssignmentDisposable) self.connection = connection let subscription = self.source.subscribe(connection) singleAssignmentDisposable.setDisposable(subscription) return connection } } private var lazySubject: Subject { lock.performLocked { if let subject = self.subject { return subject } let subject = self.makeSubject() self.subject = subject return subject } } override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Subject.Element { lazySubject.subscribe(observer) } } private final class RefCountSink: Sink, ObserverType where ConnectableSource.Element == Observer.Element { typealias Element = Observer.Element typealias Parent = RefCount private let parent: Parent private var connectionIdSnapshot: Int64 = -1 init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { let subscription = parent.source.subscribe(self) parent.lock.lock(); defer { self.parent.lock.unlock() } connectionIdSnapshot = parent.connectionId if isDisposed { return Disposables.create() } if parent.count == 0 { parent.count = 1 parent.connectableSubscription = parent.source.connect() } else { 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 -= 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 == 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() } } } private final 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: ConnectableSource init(source: ConnectableSource) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ConnectableSource.Element { let sink = RefCountSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } private final class MulticastSink: Sink, ObserverType { typealias Element = Observer.Element typealias ResultType = Element typealias MulticastType = Multicast private let parent: MulticastType init(parent: MulticastType, observer: Observer, cancel: Cancelable) { self.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 { self.forwardOn(.error(e)) self.dispose() return Disposables.create() } } func on(_ event: Event) { forwardOn(event) switch event { case .next: break case .error, .completed: dispose() } } } private final class Multicast: Producer { typealias SubjectSelectorType = () throws -> Subject 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) { self.source = source self.subjectSelector = subjectSelector self.selector = selector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = MulticastSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Never.swift ================================================ // // Never.swift // RxSwift // // Created by Krunoslav Zaher on 8/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func never() -> Observable { NeverProducer() } } private final class NeverProducer: Producer { override func subscribe(_: Observer) -> Disposable where Observer.Element == Element { Disposables.create() } } ================================================ FILE: RxSwift/Observables/ObserveOn.swift ================================================ // // ObserveOn.swift // RxSwift // // Created by Krunoslav Zaher on 7/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func observe(on scheduler: ImmediateSchedulerType) -> Observable { guard let serialScheduler = scheduler as? SerialDispatchQueueScheduler else { return ObserveOn(source: asObservable(), scheduler: scheduler) } return ObserveOnSerialDispatchQueue( source: asObservable(), scheduler: serialScheduler ) } /** 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. */ @available(*, deprecated, renamed: "observe(on:)") func observeOn(_ scheduler: ImmediateSchedulerType) -> Observable { observe(on: scheduler) } } private final class ObserveOn: Producer { let scheduler: ImmediateSchedulerType let source: Observable init(source: Observable, scheduler: ImmediateSchedulerType) { self.scheduler = scheduler self.source = source #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = ObserveOnSink(scheduler: scheduler, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } #if TRACE_RESOURCES deinit { _ = Resources.decrementTotal() } #endif } enum ObserveOnState: Int32 { // pump is not running case stopped = 0 // pump is running case running = 1 } private final class ObserveOnSink: ObserverBase { typealias Element = Observer.Element let scheduler: ImmediateSchedulerType var lock = SpinLock() let observer: Observer // state var state = ObserveOnState.stopped var queue = Queue>(capacity: 10) let scheduleDisposable = SerialDisposable() let cancel: Cancelable init(scheduler: ImmediateSchedulerType, observer: Observer, cancel: Cancelable) { self.scheduler = scheduler self.observer = observer self.cancel = cancel } override func onCore(_ event: Event) { let shouldStart = lock.performLocked { () -> Bool in self.queue.enqueue(event) switch self.state { case .stopped: self.state = .running return true case .running: return false } } if shouldStart { scheduleDisposable.disposable = scheduler.scheduleRecursive((), action: run) } } func run(_: (), _ recurse: (()) -> Void) { let (nextEvent, observer) = lock.performLocked { () -> (Event?, Observer) in if !self.queue.isEmpty { return (self.queue.dequeue(), self.observer) } else { self.state = .stopped return (nil, self.observer) } } if let nextEvent, !self.cancel.isDisposed { observer.on(nextEvent) if nextEvent.isStopEvent { dispose() } } else { return } let shouldContinue = shouldContinue_synchronized() if shouldContinue { recurse(()) } } func shouldContinue_synchronized() -> Bool { lock.performLocked { let isEmpty = self.queue.isEmpty if isEmpty { self.state = .stopped } return !isEmpty } } override func dispose() { super.dispose() cancel.dispose() scheduleDisposable.dispose() } } #if TRACE_RESOURCES private let numberOfSerialDispatchObservables = AtomicInt(0) public extension Resources { /** Counts number of `SerialDispatchQueueObservables`. Purposed for unit tests. */ static var numberOfSerialDispatchQueueObservables: Int32 { load(numberOfSerialDispatchObservables) } } #endif private final class ObserveOnSerialDispatchQueueSink: ObserverBase { let scheduler: SerialDispatchQueueScheduler let observer: Observer let cancel: Cancelable var cachedScheduleLambda: (((sink: ObserveOnSerialDispatchQueueSink, event: Event)) -> Disposable)! init(scheduler: SerialDispatchQueueScheduler, observer: Observer, cancel: Cancelable) { self.scheduler = scheduler self.observer = observer self.cancel = cancel super.init() cachedScheduleLambda = { pair in guard !cancel.isDisposed else { return Disposables.create() } pair.sink.observer.on(pair.event) if pair.event.isStopEvent { pair.sink.dispose() } return Disposables.create() } } override func onCore(_ event: Event) { _ = scheduler.schedule((self, event), action: cachedScheduleLambda!) } override func dispose() { super.dispose() cancel.dispose() } } private final class ObserveOnSerialDispatchQueue: Producer { let scheduler: SerialDispatchQueueScheduler let source: Observable init(source: Observable, scheduler: SerialDispatchQueueScheduler) { self.scheduler = scheduler self.source = source #if TRACE_RESOURCES _ = Resources.incrementTotal() _ = increment(numberOfSerialDispatchObservables) #endif } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = ObserveOnSerialDispatchQueueSink(scheduler: scheduler, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } #if TRACE_RESOURCES deinit { _ = Resources.decrementTotal() _ = decrement(numberOfSerialDispatchObservables) } #endif } ================================================ FILE: RxSwift/Observables/Optional.swift ================================================ // // Optional.swift // RxSwift // // Created by tarunon on 2016/12/13. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // public 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. */ static func from(optional: Element?) -> Observable { 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: Scheduler to send the optional element on. - returns: An observable sequence containing the wrapped value or not from given optional. */ static func from(optional: Element?, scheduler: ImmediateSchedulerType) -> Observable { ObservableOptionalScheduled(optional: optional, scheduler: scheduler) } } private final class ObservableOptionalScheduledSink: Sink { typealias Element = Observer.Element typealias Parent = ObservableOptionalScheduled private let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { parent.scheduler.schedule(parent.optional) { (optional: Element?) -> 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() } } } } private final class ObservableOptionalScheduled: Producer { fileprivate let optional: Element? fileprivate let scheduler: ImmediateSchedulerType init(optional: Element?, scheduler: ImmediateSchedulerType) { self.optional = optional self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = ObservableOptionalScheduledSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } private final class ObservableOptional: Producer { private let optional: Element? init(optional: Element?) { self.optional = optional } override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { if let element = optional { observer.on(.next(element)) } observer.on(.completed) return Disposables.create() } } ================================================ FILE: RxSwift/Observables/Producer.swift ================================================ // // 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: Observer) -> Disposable where Observer.Element == 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, cancel _: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { rxAbstractMethod() } } private final class SinkDisposer: Cancelable { private enum DisposeState: Int32 { case disposed = 1 case sinkAndSubscriptionSet = 2 } private let state = AtomicInt(0) private var sink: Disposable? private var subscription: Disposable? var isDisposed: Bool { isFlagSet(state, DisposeState.disposed.rawValue) } func setSinkAndSubscription(sink: Disposable, subscription: Disposable) { self.sink = sink self.subscription = subscription let previousState = fetchOr(state, DisposeState.sinkAndSubscriptionSet.rawValue) if (previousState & DisposeState.sinkAndSubscriptionSet.rawValue) != 0 { rxFatalError("Sink and subscription were already set") } if (previousState & DisposeState.disposed.rawValue) != 0 { sink.dispose() subscription.dispose() self.sink = nil self.subscription = nil } } func dispose() { let previousState = fetchOr(state, DisposeState.disposed.rawValue) if (previousState & DisposeState.disposed.rawValue) != 0 { return } if (previousState & DisposeState.sinkAndSubscriptionSet.rawValue) != 0 { guard let sink else { rxFatalError("Sink not set") } guard let subscription else { rxFatalError("Subscription not set") } sink.dispose() subscription.dispose() self.sink = nil self.subscription = nil } } } ================================================ FILE: RxSwift/Observables/Range.swift ================================================ // // Range.swift // RxSwift // // Created by Krunoslav Zaher on 9/13/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public extension ObservableType where Element: 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. */ static func range(start: Element, count: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { RangeProducer(start: start, count: count, scheduler: scheduler) } } private final class RangeProducer: Producer { fileprivate let start: Element fileprivate let count: Element fileprivate let scheduler: ImmediateSchedulerType init(start: Element, count: Element, scheduler: ImmediateSchedulerType) { guard count >= 0 else { rxFatalError("count can't be negative") } guard start &+ (count - 1) >= start || count == 0 else { rxFatalError("overflow of count") } self.start = start self.count = count self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = RangeSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } private final class RangeSink: Sink where Observer.Element: RxAbstractInteger { typealias Parent = RangeProducer private let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { parent.scheduler.scheduleRecursive(0 as Observer.Element) { i, recurse in if i < self.parent.count { self.forwardOn(.next(self.parent.start + i)) recurse(i + 1) } else { self.forwardOn(.completed) self.dispose() } } } } ================================================ FILE: RxSwift/Observables/Reduce.swift ================================================ // // Reduce.swift // RxSwift // // Created by Krunoslav Zaher on 4/1/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func reduce(_ seed: A, accumulator: @escaping (A, Element) throws -> A, mapResult: @escaping (A) throws -> Result) -> Observable { Reduce(source: 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. */ func reduce(_ seed: A, accumulator: @escaping (A, Element) throws -> A) -> Observable { Reduce(source: asObservable(), seed: seed, accumulator: accumulator, mapResult: { $0 }) } } private final class ReduceSink: Sink, ObserverType { typealias ResultType = Observer.Element typealias Parent = Reduce private let parent: Parent private var accumulation: AccumulateType init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent accumulation = parent.seed super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): do { accumulation = try parent.accumulator(accumulation, value) } catch let e { self.forwardOn(.error(e)) self.dispose() } case let .error(e): forwardOn(.error(e)) dispose() case .completed: do { let result = try parent.mapResult(accumulation) forwardOn(.next(result)) forwardOn(.completed) dispose() } catch let e { self.forwardOn(.error(e)) self.dispose() } } } } private final class Reduce: Producer { typealias AccumulatorType = (AccumulateType, SourceType) throws -> AccumulateType typealias ResultSelectorType = (AccumulateType) throws -> ResultType private 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) { self.source = source self.seed = seed self.accumulator = accumulator self.mapResult = mapResult } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType { let sink = ReduceSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Repeat.swift ================================================ // // Repeat.swift // RxSwift // // Created by Krunoslav Zaher on 9/13/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func repeatElement(_ element: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { RepeatElement(element: element, scheduler: scheduler) } } private final class RepeatElement: Producer { fileprivate let element: Element fileprivate let scheduler: ImmediateSchedulerType init(element: Element, scheduler: ImmediateSchedulerType) { self.element = element self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = RepeatElementSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } private final class RepeatElementSink: Sink { typealias Parent = RepeatElement private let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { parent.scheduler.scheduleRecursive(parent.element) { e, recurse in self.forwardOn(.next(e)) recurse(e) } } } ================================================ FILE: RxSwift/Observables/RetryWhen.swift ================================================ // // RetryWhen.swift // RxSwift // // Created by Junior B. on 06/10/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func retry(when notificationHandler: @escaping (Observable) -> some ObservableType) -> Observable { RetryWhenSequence(sources: InfiniteSequence(repeatedValue: 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. */ @available(*, deprecated, renamed: "retry(when:)") func retryWhen(_ notificationHandler: @escaping (Observable) -> some ObservableType) -> Observable { retry(when: 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. */ func retry(when notificationHandler: @escaping (Observable) -> some ObservableType) -> Observable { RetryWhenSequence(sources: InfiniteSequence(repeatedValue: 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. */ @available(*, deprecated, renamed: "retry(when:)") func retryWhen(_ notificationHandler: @escaping (Observable) -> some ObservableType) -> Observable { RetryWhenSequence(sources: InfiniteSequence(repeatedValue: asObservable()), notificationHandler: notificationHandler) } } private final class RetryTriggerSink: ObserverType where Sequence.Element: ObservableType, Sequence.Element.Element == Observer.Element { typealias Element = TriggerObservable.Element typealias Parent = RetryWhenSequenceSinkIter private let parent: Parent init(parent: Parent) { self.parent = parent } func on(_ event: Event) { switch event { case .next: parent.parent.lastError = nil parent.parent.schedule(.moveNext) case let .error(e): parent.parent.forwardOn(.error(e)) parent.parent.dispose() case .completed: parent.parent.forwardOn(.completed) parent.parent.dispose() } } } private final class RetryWhenSequenceSinkIter: ObserverType, Disposable where Sequence.Element: ObservableType, Sequence.Element.Element == Observer.Element { typealias Element = Observer.Element typealias Parent = RetryWhenSequenceSink fileprivate let parent: Parent private let errorHandlerSubscription = SingleAssignmentDisposable() private let subscription: Disposable init(parent: Parent, subscription: Disposable) { self.parent = parent self.subscription = subscription } func on(_ event: Event) { switch event { case .next: parent.forwardOn(event) case let .error(error): parent.lastError = error if let failedWith = error as? Error { // dispose current subscription subscription.dispose() let errorHandlerSubscription = parent.notifier.subscribe(RetryTriggerSink(parent: self)) 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() } } private final class RetryWhenSequenceSink: TailRecursiveSink where Sequence.Element: ObservableType, Sequence.Element.Element == Observer.Element { typealias Element = Observer.Element typealias Parent = RetryWhenSequence let lock = RecursiveLock() private let parent: Parent fileprivate var lastError: Swift.Error? fileprivate let errorSubject = PublishSubject() private let handler: Observable fileprivate let notifier = PublishSubject() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent handler = parent.notificationHandler(errorSubject).asObservable() super.init(observer: observer, cancel: cancel) } override func done() { if let lastError { forwardOn(.error(lastError)) self.lastError = nil } else { forwardOn(.completed) } dispose() } override func extract(_: Observable) -> SequenceGenerator? { // It is important to always return `nil` here because there are side effects in the `run` method // that are dependent on particular `retryWhen` operator so single operator stack can't be reused in this // case. 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) } } private final class RetryWhenSequence: Producer where Sequence.Element: ObservableType { typealias Element = Sequence.Element.Element private let sources: Sequence fileprivate let notificationHandler: (Observable) -> TriggerObservable init(sources: Sequence, notificationHandler: @escaping (Observable) -> TriggerObservable) { self.sources = sources self.notificationHandler = notificationHandler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = RetryWhenSequenceSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run((sources.makeIterator(), nil)) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Sample.swift ================================================ // // Sample.swift // RxSwift // // Created by Krunoslav Zaher on 5/1/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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, you may provide a default value to be emitted, instead to the resulting sequence otherwise no element is sent.** - seealso: [sample operator on reactivex.io](http://reactivex.io/documentation/operators/sample.html) - parameter sampler: Sampling tick sequence. - parameter defaultValue: a value to return if there are no new elements between sampler ticks - returns: Sampled observable sequence. */ func sample(_ sampler: some ObservableType, defaultValue: Element? = nil) -> Observable { Sample(source: asObservable(), sampler: sampler.asObservable(), defaultValue: defaultValue) } } private final class SamplerSink: ObserverType, LockOwnerType, SynchronizedOnType { typealias Element = SampleType typealias Parent = SampleSequenceSink private let parent: Parent var lock: RecursiveLock { parent.lock } init(parent: Parent) { self.parent = parent } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { switch event { case .next, .completed: if let element = parent.element ?? parent.defaultValue { parent.element = nil parent.forwardOn(.next(element)) } if parent.atEnd { parent.forwardOn(.completed) parent.dispose() } case let .error(e): parent.forwardOn(.error(e)) parent.dispose() } } } private final class SampleSequenceSink: Sink, ObserverType, LockOwnerType, SynchronizedOnType { typealias Element = Observer.Element typealias Parent = Sample fileprivate let parent: Parent fileprivate let defaultValue: Element? let lock = RecursiveLock() // state fileprivate var element = nil as Element? fileprivate var atEnd = false private let sourceSubscription = SingleAssignmentDisposable() init(parent: Parent, observer: Observer, cancel: Cancelable, defaultValue: Element? = nil) { self.parent = parent self.defaultValue = defaultValue 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 let .next(element): self.element = element case .error: forwardOn(event) dispose() case .completed: atEnd = true sourceSubscription.dispose() } } } private final class Sample: Producer { fileprivate let source: Observable fileprivate let sampler: Observable fileprivate let defaultValue: Element? init(source: Observable, sampler: Observable, defaultValue: Element? = nil) { self.source = source self.sampler = sampler self.defaultValue = defaultValue } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = SampleSequenceSink(parent: self, observer: observer, cancel: cancel, defaultValue: defaultValue) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Scan.swift ================================================ // // Scan.swift // RxSwift // // Created by Krunoslav Zaher on 6/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func scan(into seed: A, accumulator: @escaping (inout A, Element) throws -> Void) -> Observable { Scan(source: asObservable(), seed: seed, accumulator: accumulator) } /** 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. */ func scan(_ seed: A, accumulator: @escaping (A, Element) throws -> A) -> Observable { Scan(source: asObservable(), seed: seed) { acc, element in let currentAcc = acc acc = try accumulator(currentAcc, element) } } } private final class ScanSink: Sink, ObserverType { typealias Accumulate = Observer.Element typealias Parent = Scan private let parent: Parent private var accumulate: Accumulate init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent accumulate = parent.seed super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(element): do { try parent.accumulator(&accumulate, element) forwardOn(.next(accumulate)) } catch { forwardOn(.error(error)) dispose() } case let .error(error): forwardOn(.error(error)) dispose() case .completed: forwardOn(.completed) dispose() } } } private final class Scan: Producer { typealias Accumulator = (inout Accumulate, Element) throws -> Void private let source: Observable fileprivate let seed: Accumulate fileprivate let accumulator: Accumulator init(source: Observable, seed: Accumulate, accumulator: @escaping Accumulator) { self.source = source self.seed = seed self.accumulator = accumulator } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Accumulate { let sink = ScanSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Sequence.swift ================================================ // // Sequence.swift // RxSwift // // Created by Krunoslav Zaher on 11/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func of(_ elements: Element ..., scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { ObservableSequence(elements: elements, scheduler: scheduler) } } public 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. */ static func from(_ array: [Element], scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable { 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. */ static func from(_ sequence: Sequence, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable where Sequence.Element == Element { ObservableSequence(elements: sequence, scheduler: scheduler) } } private final class ObservableSequenceSink: Sink where Sequence.Element == Observer.Element { typealias Parent = ObservableSequence private let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { parent.scheduler.scheduleRecursive(parent.elements.makeIterator()) { iterator, recurse in var mutableIterator = iterator if let next = mutableIterator.next() { self.forwardOn(.next(next)) recurse(mutableIterator) } else { self.forwardOn(.completed) self.dispose() } } } } private final class ObservableSequence: Producer { fileprivate let elements: Sequence fileprivate let scheduler: ImmediateSchedulerType init(elements: Sequence, scheduler: ImmediateSchedulerType) { self.elements = elements self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = ObservableSequenceSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/ShareReplayScope.swift ================================================ // // 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 immediately 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 } public 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. */ func share(replay: Int = 0, scope: SubjectLifetimeScope = .whileConnected) -> Observable { switch scope { case .forever: switch replay { case 0: multicast(PublishSubject()).refCount() default: multicast(ReplaySubject.create(bufferSize: replay)).refCount() } case .whileConnected: switch replay { case 0: ShareWhileConnected(source: asObservable()) case 1: ShareReplay1WhileConnected(source: asObservable()) default: multicast(makeSubject: { ReplaySubject.create(bufferSize: replay) }).refCount() } } } } private final class ShareReplay1WhileConnectedConnection: ObserverType, SynchronizedUnsubscribeType { 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) { self.parent = parent self.lock = lock #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif } final func on(_ event: Event) { let observers = lock.performLocked { self.synchronized_on(event) } dispatch(observers, event) } private final func synchronized_on(_ event: Event) -> Observers { if disposed { return Observers() } switch event { case let .next(element): self.element = element return observers case .error, .completed: let observers = observers synchronized_dispose() return observers } } final func connect() { subscription.setDisposable(parent.source.subscribe(self)) } private final func synchronized_dispose() { disposed = true if parent.connection === self { parent.connection = nil } observers = Observers() } final func synchronizedUnsubscribe(_ disposeKey: DisposeKey) { if lock.performLocked({ self.synchronized_unsubscribe(disposeKey) }) { subscription.dispose() } } @inline(__always) private final func synchronized_unsubscribe(_ disposeKey: DisposeKey) -> Bool { // if already unsubscribed, just return if 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 private final class ShareReplay1WhileConnected: Observable { fileprivate typealias Connection = ShareReplay1WhileConnectedConnection fileprivate let source: Observable private let lock = RecursiveLock() fileprivate var connection: Connection? init(source: Observable) { self.source = source } override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { lock.lock() let connection = synchronized_subscribe(observer) let count = connection.observers.count let disposeKey = connection.observers.insert(observer.on) let initialValueToReplay = connection.element lock.unlock() if let initialValueToReplay { observer.on(.next(initialValueToReplay)) } if count == 0 { connection.connect() } return SubscriptionDisposable(owner: connection, key: disposeKey) } @inline(__always) private func synchronized_subscribe(_: Observer) -> Connection where Observer.Element == Element { let connection: Connection if let existingConnection = self.connection { connection = existingConnection } else { connection = ShareReplay1WhileConnectedConnection( parent: self, lock: lock ) self.connection = connection } return connection } } private final class ShareWhileConnectedConnection: ObserverType, SynchronizedUnsubscribeType { 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) { self.parent = parent self.lock = lock #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif } final func on(_ event: Event) { let observers = lock.performLocked { self.synchronized_on(event) } dispatch(observers, event) } private final func synchronized_on(_ event: Event) -> Observers { if disposed { return Observers() } switch event { case .next: return observers case .error, .completed: let observers = observers synchronized_dispose() return observers } } final func connect() { subscription.setDisposable(parent.source.subscribe(self)) } final func synchronized_subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { lock.performLocked { let disposeKey = self.observers.insert(observer.on) return SubscriptionDisposable(owner: self, key: disposeKey) } } private final func synchronized_dispose() { disposed = true if parent.connection === self { parent.connection = nil } observers = Observers() } final func synchronizedUnsubscribe(_ disposeKey: DisposeKey) { if lock.performLocked({ self.synchronized_unsubscribe(disposeKey) }) { subscription.dispose() } } @inline(__always) private final func synchronized_unsubscribe(_ disposeKey: DisposeKey) -> Bool { // if already unsubscribed, just return if 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 private final class ShareWhileConnected: Observable { fileprivate typealias Connection = ShareWhileConnectedConnection fileprivate let source: Observable private let lock = RecursiveLock() fileprivate var connection: Connection? init(source: Observable) { self.source = source } override func subscribe(_ observer: Observer) -> Disposable where Observer.Element == Element { lock.lock() let connection = synchronized_subscribe(observer) let count = connection.observers.count lock.unlock() let disposable = connection.synchronized_subscribe(observer) if count == 0 { connection.connect() } return disposable } @inline(__always) private func synchronized_subscribe(_: Observer) -> Connection where Observer.Element == Element { let connection: Connection if let existingConnection = self.connection { connection = existingConnection } else { connection = ShareWhileConnectedConnection( parent: self, lock: lock ) self.connection = connection } return connection } } ================================================ FILE: RxSwift/Observables/SingleAsync.swift ================================================ // // SingleAsync.swift // RxSwift // // Created by Junior B. on 09/11/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func single() -> Observable { 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. */ func single(_ predicate: @escaping (Element) throws -> Bool) -> Observable { SingleAsync(source: asObservable(), predicate: predicate) } } private final class SingleAsyncSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = SingleAsync private let parent: Parent private var seenValue: Bool = false init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): do { let forward = try parent.predicate?(value) ?? true if !forward { return } } catch { 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 private let source: Observable fileprivate let predicate: Predicate? init(source: Observable, predicate: Predicate? = nil) { self.source = source self.predicate = predicate } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = SingleAsyncSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Sink.swift ================================================ // // Sink.swift // RxSwift // // Created by Krunoslav Zaher on 2/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // class Sink: Disposable { fileprivate let observer: Observer fileprivate let cancel: Cancelable private let disposed = AtomicInt(0) #if DEBUG private let synchronizationTracker = SynchronizationTracker() #endif init(observer: Observer, cancel: Cancelable) { #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif self.observer = observer self.cancel = cancel } final func forwardOn(_ event: Event) { #if DEBUG synchronizationTracker.register(synchronizationErrorMessage: .default) defer { self.synchronizationTracker.unregister() } #endif if isFlagSet(disposed, 1) { return } observer.on(event) } final func forwarder() -> SinkForward { SinkForward(forward: self) } final var isDisposed: Bool { isFlagSet(disposed, 1) } func dispose() { fetchOr(disposed, 1) cancel.dispose() } deinit { #if TRACE_RESOURCES _ = Resources.decrementTotal() #endif } } final class SinkForward: ObserverType { typealias Element = Observer.Element private let forward: Sink init(forward: Sink) { self.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() } } } ================================================ FILE: RxSwift/Observables/Skip.swift ================================================ // // Skip.swift // RxSwift // // Created by Krunoslav Zaher on 6/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func skip(_ count: Int) -> Observable { SkipCount(source: asObservable(), count: count) } } public 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. */ func skip(_ duration: RxTimeInterval, scheduler: SchedulerType) -> Observable { SkipTime(source: asObservable(), duration: duration, scheduler: scheduler) } } // count version private final class SkipCountSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = SkipCount let parent: Parent var remaining: Int init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent remaining = parent.count super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): if remaining <= 0 { forwardOn(.next(value)) } else { remaining -= 1 } case .error: forwardOn(event) dispose() case .completed: forwardOn(event) dispose() } } } private final class SkipCount: Producer { let source: Observable let count: Int init(source: Observable, count: Int) { self.source = source self.count = count } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = SkipCountSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } // time version private final class SkipTimeSink: Sink, ObserverType where Observer.Element == Element { typealias Parent = SkipTime let parent: Parent // state var open = false init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): if open { forwardOn(.next(value)) } case .error: forwardOn(event) dispose() case .completed: forwardOn(event) dispose() } } func tick() { open = true } 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) } } private final 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: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = SkipTimeSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/SkipUntil.swift ================================================ // // SkipUntil.swift // RxSwift // // Created by Yury Korolev on 10/3/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func skip(until other: some ObservableType) -> Observable { SkipUntil(source: asObservable(), other: other.asObservable()) } /** 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. */ @available(*, deprecated, renamed: "skip(until:)") func skipUntil(_ other: some ObservableType) -> Observable { skip(until: other) } } private final class SkipUntilSinkOther: ObserverType, LockOwnerType, SynchronizedOnType { typealias Parent = SkipUntilSink typealias Element = Other private let parent: Parent var lock: RecursiveLock { parent.lock } let subscription = SingleAssignmentDisposable() init(parent: Parent) { self.parent = parent #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { switch event { case .next: parent.forwardElements = true subscription.dispose() case let .error(e): parent.forwardOn(.error(e)) parent.dispose() case .completed: subscription.dispose() } } #if TRACE_RESOURCES deinit { _ = Resources.decrementTotal() } #endif } private final class SkipUntilSink: Sink, ObserverType, LockOwnerType, SynchronizedOnType { typealias Element = Observer.Element typealias Parent = SkipUntil let lock = RecursiveLock() private let parent: Parent fileprivate var forwardElements = false private let sourceSubscription = SingleAssignmentDisposable() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) dispose() case .completed: if forwardElements { forwardOn(event) } dispose() } } func run() -> Disposable { let sourceSubscription = parent.source.subscribe(self) let otherObserver = SkipUntilSinkOther(parent: self) let otherSubscription = parent.other.subscribe(otherObserver) self.sourceSubscription.setDisposable(sourceSubscription) otherObserver.subscription.setDisposable(otherSubscription) return Disposables.create(sourceSubscription, otherObserver.subscription) } } private final class SkipUntil: Producer { fileprivate let source: Observable fileprivate let other: Observable init(source: Observable, other: Observable) { self.source = source self.other = other } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = SkipUntilSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/SkipWhile.swift ================================================ // // SkipWhile.swift // RxSwift // // Created by Yury Korolev on 10/9/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func skip(while predicate: @escaping (Element) throws -> Bool) -> Observable { SkipWhile(source: asObservable(), predicate: predicate) } /** 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. */ @available(*, deprecated, renamed: "skip(while:)") func skipWhile(_ predicate: @escaping (Element) throws -> Bool) -> Observable { SkipWhile(source: asObservable(), predicate: predicate) } } private final class SkipWhileSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = SkipWhile private let parent: Parent private var running = false init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): if !running { do { running = try !parent.predicate(value) } catch let e { self.forwardOn(.error(e)) self.dispose() return } } if running { forwardOn(.next(value)) } case .error, .completed: forwardOn(event) dispose() } } } private final class SkipWhile: Producer { typealias Predicate = (Element) throws -> Bool private let source: Observable fileprivate let predicate: Predicate init(source: Observable, predicate: @escaping Predicate) { self.source = source self.predicate = predicate } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = SkipWhileSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/StartWith.swift ================================================ // // StartWith.swift // RxSwift // // Created by Krunoslav Zaher on 4/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func startWith(_ elements: Element ...) -> Observable { StartWith(source: asObservable(), elements: elements) } } private final 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: Observer, cancel _: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { for e in elements { observer.on(.next(e)) } return (sink: Disposables.create(), subscription: source.subscribe(observer)) } } ================================================ FILE: RxSwift/Observables/SubscribeOn.swift ================================================ // // SubscribeOn.swift // RxSwift // // Created by Krunoslav Zaher on 6/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func subscribe(on scheduler: ImmediateSchedulerType) -> Observable { SubscribeOn(source: self, scheduler: scheduler) } /** 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. */ @available(*, deprecated, renamed: "subscribe(on:)") func subscribeOn(_ scheduler: ImmediateSchedulerType) -> Observable { subscribe(on: scheduler) } } private final class SubscribeOnSink: Sink, ObserverType where Ob.Element == Observer.Element { typealias Element = Observer.Element typealias Parent = SubscribeOn let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { forwardOn(event) if event.isStopEvent { 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 } } private final class SubscribeOn: Producer { let source: Ob let scheduler: ImmediateSchedulerType init(source: Ob, scheduler: ImmediateSchedulerType) { self.source = source self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Ob.Element { let sink = SubscribeOnSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Switch.swift ================================================ // // Switch.swift // RxSwift // // Created by Krunoslav Zaher on 3/12/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func flatMapLatest(_ selector: @escaping (Element) throws -> Source) -> Observable { FlatMapLatest(source: asObservable(), selector: selector) } /** 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. */ func flatMapLatest(_ selector: @escaping (Element) throws -> Source) -> Infallible { Infallible(flatMapLatest(selector)) } } public extension ObservableType where Element: 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. */ func switchLatest() -> Observable { Switch(source: asObservable()) } } private class SwitchSink: Sink, ObserverType where Source.Element == Observer.Element { typealias Element = SourceType private let subscriptions: SingleAssignmentDisposable = .init() private let innerSubscription: SerialDisposable = .init() let lock = RecursiveLock() // state fileprivate var stopped = false fileprivate var latest = 0 fileprivate var hasLatest = false override init(observer: Observer, 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(_: SourceType) throws -> Source { rxAbstractMethod() } @inline(__always) private final func nextElementArrived(element: Element) -> (Int, Observable)? { lock.lock(); defer { self.lock.unlock() } do { let observable = try performMap(element).asObservable() hasLatest = true latest = latest &+ 1 return (latest, observable) } catch { forwardOn(.error(error)) dispose() } return nil } func on(_ event: Event) { switch event { case let .next(element): if let (latest, observable) = nextElementArrived(element: element) { let d = SingleAssignmentDisposable() innerSubscription.disposable = d let observer = SwitchSinkIter(parent: self, id: latest, this: d) let disposable = observable.subscribe(observer) d.setDisposable(disposable) } case let .error(error): lock.lock(); defer { self.lock.unlock() } forwardOn(.error(error)) dispose() case .completed: lock.lock(); defer { self.lock.unlock() } stopped = true subscriptions.dispose() if !hasLatest { forwardOn(.completed) dispose() } } } } private final class SwitchSinkIter: ObserverType, LockOwnerType, SynchronizedOnType where Source.Element == Observer.Element { typealias Element = Source.Element typealias Parent = SwitchSink private let parent: Parent private let id: Int private let this: Disposable var lock: RecursiveLock { parent.lock } init(parent: Parent, id: Int, this: Disposable) { self.parent = parent self.id = id self.this = this } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { switch event { case .next: break case .error, .completed: this.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 private final class SwitchIdentitySink: SwitchSink where Observer.Element == Source.Element { override init(observer: Observer, cancel: Cancelable) { super.init(observer: observer, cancel: cancel) } override func performMap(_ element: Source) throws -> Source { element } } private final class MapSwitchSink: SwitchSink where Observer.Element == Source.Element { typealias Selector = (SourceType) throws -> Source private let selector: Selector init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) { self.selector = selector super.init(observer: observer, cancel: cancel) } override func performMap(_ element: SourceType) throws -> Source { try selector(element) } } // MARK: Producers private final class Switch: Producer { private let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Source.Element { let sink = SwitchIdentitySink(observer: observer, cancel: cancel) let subscription = sink.run(source) return (sink: sink, subscription: subscription) } } private final class FlatMapLatest: Producer { typealias Selector = (SourceType) throws -> Source private let source: Observable private let selector: Selector init(source: Observable, selector: @escaping Selector) { self.source = source self.selector = selector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Source.Element { let sink = MapSwitchSink(selector: selector, observer: observer, cancel: cancel) let subscription = sink.run(source) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/SwitchIfEmpty.swift ================================================ // // SwitchIfEmpty.swift // RxSwift // // Created by sergdort on 23/12/2016. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // public 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 other: 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. */ func ifEmpty(switchTo other: Observable) -> Observable { SwitchIfEmpty(source: asObservable(), ifEmpty: other) } } private final class SwitchIfEmpty: Producer { private let source: Observable private let ifEmpty: Observable init(source: Observable, ifEmpty: Observable) { self.source = source self.ifEmpty = ifEmpty } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = SwitchIfEmptySink( ifEmpty: ifEmpty, observer: observer, cancel: cancel ) let subscription = sink.run(source.asObservable()) return (sink: sink, subscription: subscription) } } private final class SwitchIfEmptySink: Sink, ObserverType { typealias Element = Observer.Element private let ifEmpty: Observable private var isEmpty = true private let ifEmptySubscription = SingleAssignmentDisposable() init(ifEmpty: Observable, observer: Observer, cancel: Cancelable) { self.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)) } } } private final class SwitchIfEmptySinkIter: ObserverType { typealias Element = Observer.Element typealias Parent = SwitchIfEmptySink private let parent: Parent init(parent: Parent) { self.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() } } } ================================================ FILE: RxSwift/Observables/Take.swift ================================================ // // Take.swift // RxSwift // // Created by Krunoslav Zaher on 6/12/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func take(_ count: Int) -> Observable { if count == 0 { Observable.empty() } else { TakeCount(source: asObservable(), count: count) } } } public 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. */ func take(for duration: RxTimeInterval, scheduler: SchedulerType) -> Observable { TakeTime(source: asObservable(), duration: duration, scheduler: scheduler) } /** 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. */ @available(*, deprecated, renamed: "take(for:scheduler:)") func take(_ duration: RxTimeInterval, scheduler: SchedulerType) -> Observable { take(for: duration, scheduler: scheduler) } } // count version private final class TakeCountSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = TakeCount private let parent: Parent private var remaining: Int init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent remaining = parent.count super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(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() } } } private final class TakeCount: Producer { private let source: Observable fileprivate let count: Int init(source: Observable, count: Int) { if count < 0 { rxFatalError("count can't be negative") } self.source = source self.count = count } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = TakeCountSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } // time version private final class TakeTimeSink: Sink, LockOwnerType, ObserverType, SynchronizedOnType where Observer.Element == Element { typealias Parent = TakeTime private let parent: Parent let lock = RecursiveLock() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { switch event { case let .next(value): forwardOn(.next(value)) case .error: forwardOn(event) dispose() case .completed: forwardOn(event) dispose() } } func tick() { lock.performLocked { self.forwardOn(.completed) self.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) } } private final 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) { self.source = source self.scheduler = scheduler self.duration = duration } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = TakeTimeSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/TakeLast.swift ================================================ // // TakeLast.swift // RxSwift // // Created by Tomi Koskinen on 25/10/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func takeLast(_ count: Int) -> Observable { TakeLast(source: asObservable(), count: count) } } private final class TakeLastSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = TakeLast private let parent: Parent private var elements: Queue init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent elements = Queue(capacity: parent.count + 1) super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): elements.enqueue(value) if elements.count > parent.count { _ = elements.dequeue() } case .error: forwardOn(event) dispose() case .completed: for e in elements { forwardOn(.next(e)) } forwardOn(.completed) dispose() } } } private final class TakeLast: Producer { private let source: Observable fileprivate let count: Int init(source: Observable, count: Int) { if count < 0 { rxFatalError("count can't be negative") } self.source = source self.count = count } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = TakeLastSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/TakeWithPredicate.swift ================================================ // // TakeWithPredicate.swift // RxSwift // // Created by Krunoslav Zaher on 6/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ func take(until other: some ObservableType) -> Observable { TakeUntil(source: asObservable(), other: other.asObservable()) } /** Returns elements from an observable sequence until the specified condition is true. - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html) - parameter predicate: A function to test each element for a condition. - parameter behavior: Whether or not to include the last element matching the predicate. Defaults to `exclusive`. - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes. */ func take( until predicate: @escaping (Element) throws -> Bool, behavior: TakeBehavior = .exclusive ) -> Observable { TakeUntilPredicate( source: asObservable(), behavior: behavior, predicate: predicate ) } /** 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. */ func take( while predicate: @escaping (Element) throws -> Bool, behavior: TakeBehavior = .exclusive ) -> Observable { take(until: { try !predicate($0) }, behavior: behavior) } /** 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. */ @available(*, deprecated, renamed: "take(until:)") func takeUntil(_ other: some ObservableType) -> Observable { take(until: other) } /** Returns elements from an observable sequence until the specified condition is true. - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html) - parameter behavior: Whether or not to include the last element matching the predicate. - 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 passes. */ @available(*, deprecated, renamed: "take(until:behavior:)") func takeUntil( _ behavior: TakeBehavior, predicate: @escaping (Element) throws -> Bool ) -> Observable { take(until: predicate, behavior: behavior) } /** 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. */ @available(*, deprecated, renamed: "take(while:)") func takeWhile(_ predicate: @escaping (Element) throws -> Bool) -> Observable { take(until: { try !predicate($0) }, behavior: .exclusive) } } /// Behaviors for the take operator family. public enum TakeBehavior { /// Include the last element matching the predicate. case inclusive /// Exclude the last element matching the predicate. case exclusive } // MARK: - TakeUntil Observable private final class TakeUntilSinkOther: ObserverType, LockOwnerType, SynchronizedOnType { typealias Parent = TakeUntilSink typealias Element = Other private let parent: Parent var lock: RecursiveLock { parent.lock } fileprivate let subscription = SingleAssignmentDisposable() init(parent: Parent) { self.parent = parent #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { switch event { case .next: parent.forwardOn(.completed) parent.dispose() case let .error(e): parent.forwardOn(.error(e)) parent.dispose() case .completed: subscription.dispose() } } #if TRACE_RESOURCES deinit { _ = Resources.decrementTotal() } #endif } private final class TakeUntilSink: Sink, LockOwnerType, ObserverType, SynchronizedOnType { typealias Element = Observer.Element typealias Parent = TakeUntil private let parent: Parent let lock = RecursiveLock() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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) } } private final class TakeUntil: Producer { fileprivate let source: Observable fileprivate let other: Observable init(source: Observable, other: Observable) { self.source = source self.other = other } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = TakeUntilSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // MARK: - TakeUntil Predicate private final class TakeUntilPredicateSink: Sink, ObserverType { typealias Element = Observer.Element typealias Parent = TakeUntilPredicate private let parent: Parent private var running = true init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): if !running { return } do { running = try !parent.predicate(value) } catch let e { self.forwardOn(.error(e)) self.dispose() return } if running { forwardOn(.next(value)) } else { if parent.behavior == .inclusive { forwardOn(.next(value)) } forwardOn(.completed) dispose() } case .error, .completed: forwardOn(event) dispose() } } } private final class TakeUntilPredicate: Producer { typealias Predicate = (Element) throws -> Bool private let source: Observable fileprivate let predicate: Predicate fileprivate let behavior: TakeBehavior init( source: Observable, behavior: TakeBehavior, predicate: @escaping Predicate ) { self.source = source self.behavior = behavior self.predicate = predicate } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = TakeUntilPredicateSink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Throttle.swift ================================================ // // Throttle.swift // RxSwift // // Created by Krunoslav Zaher on 3/22/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func throttle(_ dueTime: RxTimeInterval, latest: Bool = true, scheduler: SchedulerType) -> Observable { Throttle(source: asObservable(), dueTime: dueTime, latest: latest, scheduler: scheduler) } } private final class ThrottleSink: Sink, ObserverType, LockOwnerType, SynchronizedOnType { typealias Element = Observer.Element typealias ParentType = Throttle private let parent: ParentType let lock = RecursiveLock() // state private var lastUnsentElement: Element? private var lastSentTime: Date? private var completed: Bool = false let cancellable = SerialDisposable() init(parent: ParentType, observer: Observer, cancel: Cancelable) { self.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 let .next(element): let now = parent.scheduler.now let reducedScheduledTime: RxTimeInterval = if let lastSendingTime = lastSentTime { parent.dueTime.reduceWithSpanBetween(earlierDate: lastSendingTime, laterDate: now) } else { .nanoseconds(0) } if reducedScheduledTime.isNow { sendNow(element: element) return } if !parent.latest { return } let isThereAlreadyInFlightRequest = lastUnsentElement != nil lastUnsentElement = element if isThereAlreadyInFlightRequest { return } let scheduler = parent.scheduler let d = SingleAssignmentDisposable() cancellable.disposable = d d.setDisposable(scheduler.scheduleRelative(0, dueTime: reducedScheduledTime, action: propagate)) case .error: lastUnsentElement = nil forwardOn(event) dispose() case .completed: if lastUnsentElement != nil { completed = true } else { forwardOn(.completed) dispose() } } } private func sendNow(element: Element) { lastUnsentElement = nil 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.performLocked { if let lastUnsentElement = self.lastUnsentElement { self.sendNow(element: lastUnsentElement) } if self.completed { self.forwardOn(.completed) self.dispose() } } return Disposables.create() } } private final 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) { self.source = source self.dueTime = dueTime self.latest = latest self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = ThrottleSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Timeout.swift ================================================ // // Timeout.swift // RxSwift // // Created by Tomi Koskinen on 13/11/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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. */ func timeout(_ dueTime: RxTimeInterval, scheduler: SchedulerType) -> Observable { Timeout(source: 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. */ func timeout(_ dueTime: RxTimeInterval, other: Source, scheduler: SchedulerType) -> Observable where Element == Source.Element { Timeout(source: asObservable(), dueTime: dueTime, other: other.asObservable(), scheduler: scheduler) } } private final class TimeoutSink: Sink, LockOwnerType, ObserverType { typealias Element = Observer.Element 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: Observer, cancel: Cancelable) { self.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) createTimeoutTimer() } case .error, .completed: var onEventWins = false lock.performLocked { onEventWins = !self.switched if onEventWins { self.id = self.id &+ 1 } } if onEventWins { forwardOn(event) 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) } } private final 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) { self.source = source self.dueTime = dueTime self.other = other self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = TimeoutSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Timer.swift ================================================ // // Timer.swift // RxSwift // // Created by Krunoslav Zaher on 6/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public extension ObservableType 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. - parameter scheduler: Scheduler to run the timer on. - returns: An observable sequence that produces a value after each period. */ static func interval(_ period: RxTimeInterval, scheduler: SchedulerType) -> Observable { Timer( dueTime: period, period: period, scheduler: scheduler ) } } public extension ObservableType 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. - parameter scheduler: Scheduler to run timers on. - returns: An observable sequence that produces a value after due time has elapsed and then each period. */ static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval? = nil, scheduler: SchedulerType) -> Observable { Timer( dueTime: dueTime, period: period, scheduler: scheduler ) } } import Foundation private final class TimerSink: Sink where Observer.Element: RxAbstractInteger { typealias Parent = Timer private let parent: Parent private let lock = RecursiveLock() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { parent.scheduler.schedulePeriodic(0 as Observer.Element, startAfter: parent.dueTime, period: parent.period!) { state in self.lock.performLocked { self.forwardOn(.next(state)) return state &+ 1 } } } } private final class TimerOneOffSink: Sink where Observer.Element: RxAbstractInteger { typealias Parent = Timer private let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func run() -> Disposable { parent.scheduler.scheduleRelative(self, dueTime: parent.dueTime) { [unowned self] _ -> Disposable in forwardOn(.next(0)) forwardOn(.completed) dispose() return Disposables.create() } } } private final class Timer: Producer { fileprivate let scheduler: SchedulerType fileprivate let dueTime: RxTimeInterval fileprivate let period: RxTimeInterval? init(dueTime: RxTimeInterval, period: RxTimeInterval?, scheduler: SchedulerType) { self.scheduler = scheduler self.dueTime = dueTime self.period = period } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { if period != nil { 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) } } } ================================================ FILE: RxSwift/Observables/ToArray.swift ================================================ // // ToArray.swift // RxSwift // // Created by Junior B. on 20/10/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public extension ObservableType { /** Converts an Observable into a Single 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: A Single sequence containing all the emitted elements as array. */ func toArray() -> Single<[Element]> { PrimitiveSequence(raw: ToArray(source: asObservable())) } } private final class ToArraySink: Sink, ObserverType where Observer.Element == [SourceType] { typealias Parent = ToArray let parent: Parent var list = [SourceType]() init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(observer: observer, cancel: cancel) } func on(_ event: Event) { switch event { case let .next(value): list.append(value) case let .error(e): forwardOn(.error(e)) dispose() case .completed: forwardOn(.next(list)) forwardOn(.completed) dispose() } } } private final class ToArray: Producer<[SourceType]> { let source: Observable init(source: Observable) { self.source = source } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == [SourceType] { let sink = ToArraySink(parent: self, observer: observer, cancel: cancel) let subscription = source.subscribe(sink) return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Using.swift ================================================ // // Using.swift // RxSwift // // Created by Yury Korolev on 10/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func using(_ resourceFactory: @escaping () throws -> Resource, observableFactory: @escaping (Resource) throws -> Observable) -> Observable { Using(resourceFactory: resourceFactory, observableFactory: observableFactory) } } private final class UsingSink: Sink, ObserverType { typealias SourceType = Observer.Element typealias Parent = Using private let parent: Parent init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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 { 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() } } } private final class Using: Producer { typealias Element = 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) { self.resourceFactory = resourceFactory self.observableFactory = observableFactory } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element { let sink = UsingSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Window.swift ================================================ // // Window.swift // RxSwift // // Created by Junior B. on 29/10/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation public 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`). */ func window(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) -> Observable> { WindowTimeCount(source: asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler) } } private final class WindowTimeCountSink: Sink, ObserverType, LockOwnerType, SynchronizedOnType where Observer.Element == Observable { typealias Parent = WindowTimeCount 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: Observer, cancel: Cancelable) { self.parent = parent _ = 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) _ = 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 let .next(element): subject.on(.next(element)) do { _ = try incrementChecked(&count) } catch let e { self.subject.on(.error(e as Swift.Error)) self.dispose() } if count == parent.count { newWindow = true count = 0 windowId += 1 newId = windowId startNewWindowAndCompleteCurrentOne() } case let .error(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 self.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) } } private final 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) { self.source = source self.timeSpan = timeSpan self.count = count self.scheduler = scheduler } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Observable { let sink = WindowTimeCountSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/WithLatestFrom.swift ================================================ // // WithLatestFrom.swift // RxSwift // // Created by Yury Korolev on 10/19/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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) - note: Elements emitted by self before the second source has emitted any values will be omitted. - 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. */ func withLatestFrom(_ second: Source, resultSelector: @escaping (Element, Source.Element) throws -> ResultType) -> Observable { 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) - note: Elements emitted by self before the second source has emitted any values will be omitted. - 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. */ func withLatestFrom(_ second: Source) -> Observable { WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: { $1 }) } } private final class WithLatestFromSink: Sink, ObserverType, LockOwnerType, SynchronizedOnType { typealias ResultType = Observer.Element typealias Parent = WithLatestFrom typealias Element = FirstType private let parent: Parent fileprivate var lock = RecursiveLock() fileprivate var latest: SecondType? init(parent: Parent, observer: Observer, cancel: Cancelable) { self.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 else { return } do { let res = try parent.resultSelector(value, latest) forwardOn(.next(res)) } catch let e { self.forwardOn(.error(e)) self.dispose() } case .completed: forwardOn(.completed) dispose() case let .error(error): forwardOn(.error(error)) dispose() } } } private final class WithLatestFromSecond: ObserverType, LockOwnerType, SynchronizedOnType { typealias ResultType = Observer.Element typealias Parent = WithLatestFromSink typealias Element = SecondType private let parent: Parent private let disposable: Disposable var lock: RecursiveLock { parent.lock } init(parent: Parent, disposable: Disposable) { self.parent = parent self.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() } } } private final 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) { self.first = first self.second = second self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType { let sink = WithLatestFromSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/WithUnretained.swift ================================================ // // WithUnretained.swift // RxSwift // // Created by Vincent Pradeilles on 01/01/2021. // Copyright © 2020 Krunoslav Zaher. All rights reserved. // public extension ObservableType { /** Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence. In the case the provided object cannot be retained successfully, the sequence will complete. - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle. - parameter obj: The object to provide an unretained reference on. - parameter resultSelector: A function to combine the unretained referenced on `obj` and the value of the observable sequence. - returns: An observable sequence that contains the result of `resultSelector` being called with an unretained reference on `obj` and the values of the original sequence. */ func withUnretained( _ obj: Object, resultSelector: @escaping (Object, Element) -> Out ) -> Observable { map { [weak obj] element -> Out in guard let obj else { throw UnretainedError.failedRetaining } return resultSelector(obj, element) } .catch { error -> Observable in guard let unretainedError = error as? UnretainedError, unretainedError == .failedRetaining else { return .error(error) } return .empty() } } /** Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence. In the case the provided object cannot be retained successfully, the sequence will complete. - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle. - parameter obj: The object to provide an unretained reference on. - returns: An observable sequence of tuples that contains both an unretained reference on `obj` and the values of the original sequence. */ func withUnretained(_ obj: Object) -> Observable<(Object, Element)> { withUnretained(obj) { ($0, $1) } } } private enum UnretainedError: Swift.Error { case failedRetaining } ================================================ FILE: RxSwift/Observables/Zip+Collection.swift ================================================ // // Zip+Collection.swift // RxSwift // // Created by Krunoslav Zaher on 8/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // public 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. */ static func zip(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable where Collection.Element: ObservableType { 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. */ static func zip(_ collection: Collection) -> Observable<[Element]> where Collection.Element: ObservableType, Collection.Element.Element == Element { ZipCollectionType(sources: collection, resultSelector: { $0 }) } } private final class ZipCollectionTypeSink: Sink where Collection.Element: ObservableConvertibleType { typealias Result = Observer.Element typealias Parent = ZipCollectionType typealias SourceElement = Collection.Element.Element 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: Observer, cancel: Cancelable) { self.parent = parent values = [Queue](repeating: Queue(capacity: 4), count: parent.count) isDone = [Bool](repeating: false, count: parent.count) subscriptions = [SingleAssignmentDisposable]() 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 { self.lock.unlock() } switch event { case let .next(element): values[atIndex].enqueue(element) if values[atIndex].count == 1 { numberOfValues += 1 } if numberOfValues < parent.count { if numberOfDone == parent.count - 1 { forwardOn(.completed) 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].isEmpty { numberOfValues += 1 } } let result = try parent.resultSelector(arguments) forwardOn(.next(result)) } catch { forwardOn(.error(error)) dispose() } case let .error(error): forwardOn(.error(error)) dispose() case .completed: if isDone[atIndex] { return } isDone[atIndex] = true numberOfDone += 1 if numberOfDone == 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 { forwardOn(.completed) } return Disposables.create(subscriptions) } } private final class ZipCollectionType: Producer where Collection.Element: ObservableConvertibleType { typealias ResultSelector = ([Collection.Element.Element]) throws -> Result let sources: Collection let resultSelector: ResultSelector let count: Int init(sources: Collection, resultSelector: @escaping ResultSelector) { self.sources = sources self.resultSelector = resultSelector count = self.sources.count } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipCollectionTypeSink(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Zip+arity.swift ================================================ // 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 public 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. */ static func zip (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element) -> Observable { Zip2( source1: source1.asObservable(), source2: source2.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func zip (_ source1: O1, _ source2: O2) -> Observable<(O1.Element, O2.Element)> { Zip2( source1: source1.asObservable(), source2: source2.asObservable(), resultSelector: { ($0, $1) } ) } } final class ZipSink2_: ZipSink { typealias Result = Observer.Element typealias Parent = Zip2 let parent: Parent var values1: Queue = Queue(capacity: 2) var values2: Queue = Queue(capacity: 2) init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: 2, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { case 0: !values1.isEmpty case 1: !values2.isEmpty default: rxFatalError("Unhandled case (Function)") } } 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 -> Result { try parent.resultSelector(values1.dequeue()!, values2.dequeue()!) } } final class Zip2: Producer { typealias ResultSelector = (E1, E2) throws -> Result let source1: Observable let source2: Observable let resultSelector: ResultSelector init(source1: Observable, source2: Observable, resultSelector: @escaping ResultSelector) { self.source1 = source1 self.source2 = source2 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink2_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 3 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element) -> Observable { Zip3( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3) -> Observable<(O1.Element, O2.Element, O3.Element)> { Zip3( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), resultSelector: { ($0, $1, $2) } ) } } final class ZipSink3_: ZipSink { typealias Result = Observer.Element 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: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: 3, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { case 0: !values1.isEmpty case 1: !values2.isEmpty case 2: !values3.isEmpty default: rxFatalError("Unhandled case (Function)") } } 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 -> Result { try parent.resultSelector(values1.dequeue()!, values2.dequeue()!, values3.dequeue()!) } } final class Zip3: Producer { typealias ResultSelector = (E1, E2, E3) throws -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink3_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 4 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element) -> Observable { Zip4( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)> { Zip4( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), resultSelector: { ($0, $1, $2, $3) } ) } } final class ZipSink4_: ZipSink { typealias Result = Observer.Element 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: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: 4, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { case 0: !values1.isEmpty case 1: !values2.isEmpty case 2: !values3.isEmpty case 3: !values4.isEmpty default: rxFatalError("Unhandled case (Function)") } } 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 -> Result { try parent.resultSelector(values1.dequeue()!, values2.dequeue()!, values3.dequeue()!, values4.dequeue()!) } } final class Zip4: Producer { typealias ResultSelector = (E1, E2, E3, E4) throws -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink4_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 5 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element) -> Observable { Zip5( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)> { 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 Result = Observer.Element 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: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: 5, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { case 0: !values1.isEmpty case 1: !values2.isEmpty case 2: !values3.isEmpty case 3: !values4.isEmpty case 4: !values5.isEmpty default: rxFatalError("Unhandled case (Function)") } } 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 -> Result { 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 -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink5_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 6 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element) -> Observable { Zip6( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)> { 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 Result = Observer.Element 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: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: 6, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { case 0: !values1.isEmpty case 1: !values2.isEmpty case 2: !values3.isEmpty case 3: !values4.isEmpty case 4: !values5.isEmpty case 5: !values6.isEmpty default: rxFatalError("Unhandled case (Function)") } } 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 -> Result { 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 -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink6_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 7 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element) -> Observable { Zip7( source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), resultSelector: resultSelector ) } } public extension ObservableType where Element == 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)> { 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 Result = Observer.Element 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: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: 7, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { case 0: !values1.isEmpty case 1: !values2.isEmpty case 2: !values3.isEmpty case 3: !values4.isEmpty case 4: !values5.isEmpty case 5: !values6.isEmpty case 6: !values7.isEmpty default: rxFatalError("Unhandled case (Function)") } } 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 -> Result { 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 -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink7_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } // 8 public 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element) -> Observable { 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 ) } } public extension ObservableType where Element == 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. */ static func zip (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8) -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)> { 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 Result = Observer.Element 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: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: 8, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { case 0: !values1.isEmpty case 1: !values2.isEmpty case 2: !values3.isEmpty case 3: !values4.isEmpty case 4: !values5.isEmpty case 5: !values6.isEmpty case 6: !values7.isEmpty case 7: !values8.isEmpty default: rxFatalError("Unhandled case (Function)") } } 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 -> Result { 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 -> Result 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 self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink8_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } ================================================ FILE: RxSwift/Observables/Zip+arity.tt ================================================ // // Zip+arity.swift // RxSwift // // Created by Krunoslav Zaher on 5/23/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // <% for i in 2 ... 8 { %> // <%= i %> 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<<%= (Array(1...i).map { "O\($0): ObservableType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>, resultSelector: @escaping (<%= (Array(1...i).map { "O\($0).Element" }).joined(separator: ", ") %>) throws -> Element) -> Observable { return Zip<%= i %>( <%= (Array(1...i).map { "source\($0): source\($0).asObservable()" }).joined(separator: ", ") %>, resultSelector: resultSelector ) } } extension ObservableType where Element == 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<<%= (Array(1...i).map { "O\($0): ObservableType" }).joined(separator: ", ") %>> (<%= (Array(1...i).map { "_ source\($0): O\($0)" }).joined(separator: ", ") %>) -> Observable<(<%= (Array(1...i).map { "O\($0).Element" }).joined(separator: ", ") %>)> { return Zip<%= i %>( <%= (Array(1...i).map { "source\($0): source\($0).asObservable()" }).joined(separator: ", ") %>, resultSelector: { (<%= (Array(0..) } ) } } final class ZipSink<%= i %>_<<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>, Observer: ObserverType> : ZipSink { typealias Result = Observer.Element typealias Parent = Zip<%= i %><<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>, Result> let parent: Parent <%= (Array(1...i).map { " var values\($0): Queue = Queue(capacity: 2)" }).joined(separator: "\n") %> init(parent: Parent, observer: Observer, cancel: Cancelable) { self.parent = parent super.init(arity: <%= i %>, observer: observer, cancel: cancel) } override func hasElements(_ index: Int) -> Bool { switch index { <%= (Array(0.. default: rxFatalError("Unhandled case \(index)") } } func run() -> Disposable { <%= (Array(1...i).map { " let subscription\($0) = SingleAssignmentDisposable()" }).joined(separator: "\n") %> <%= (Array(1...i).map { " let observer\($0) = ZipObserver(lock: self.lock, parent: self, index: \($0 - 1), setNextValue: { self.values\($0).enqueue($0) }, this: subscription\($0))" }).joined(separator: "\n") %> <%= (Array(1...i).map { " subscription\($0).setDisposable(self.parent.source\($0).subscribe(observer\($0)))" }).joined(separator: "\n") %> return Disposables.create([ <%= (Array(1...i).map { " subscription\($0)" }).joined(separator: ",\n") %> ]) } override func getResult() throws -> Result { try self.parent.resultSelector(<%= (Array(1...i).map { "self.values\($0).dequeue()!" }).joined(separator: ", ") %>) } } final class Zip<%= i %><<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>, Result> : Producer { typealias ResultSelector = (<%= (Array(1...i).map { "E\($0)" }).joined(separator: ", ") %>) throws -> Result <%= (Array(1...i).map { " let source\($0): Observable" }).joined(separator: "\n") %> let resultSelector: ResultSelector init(<%= (Array(1...i).map { "source\($0): Observable" }).joined(separator: ", ") %>, resultSelector: @escaping ResultSelector) { <%= (Array(1...i).map { " self.source\($0) = source\($0)" }).joined(separator: "\n") %> self.resultSelector = resultSelector } override func run(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result { let sink = ZipSink<%= i %>_(parent: self, observer: observer, cancel: cancel) let subscription = sink.run() return (sink: sink, subscription: subscription) } } <% } %> ================================================ FILE: RxSwift/Observables/Zip.swift ================================================ // // Zip.swift // RxSwift // // Created by Krunoslav Zaher on 5/23/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol ZipSinkProtocol: AnyObject { func next(_ index: Int) func fail(_ error: Swift.Error) func done(_ index: Int) } class ZipSink: Sink, ZipSinkProtocol { typealias Element = Observer.Element let arity: Int let lock = RecursiveLock() // state private var isDone: [Bool] init(arity: Int, observer: Observer, cancel: Cancelable) { isDone = [Bool](repeating: false, count: arity) self.arity = arity super.init(observer: observer, cancel: cancel) } func getResult() throws -> Element { rxAbstractMethod() } func hasElements(_: Int) -> Bool { rxAbstractMethod() } func next(_: Int) { var hasValueAll = true for i in 0 ..< arity { if !hasElements(i) { hasValueAll = false break } } if hasValueAll { do { let result = try getResult() forwardOn(.next(result)) } catch let e { self.forwardOn(.error(e)) 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 where !done { allDone = false break } if allDone { forwardOn(.completed) dispose() } } } final class ZipObserver: ObserverType, LockOwnerType, SynchronizedOnType { typealias ValueSetter = (Element) -> Void 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) { self.lock = lock self.parent = parent self.index = index self.this = this self.setNextValue = setNextValue } func on(_ event: Event) { synchronizedOn(event) } func synchronized_on(_ event: Event) { if parent != nil { switch event { case .next: break case .error: this.dispose() case .completed: this.dispose() } } if let parent { switch event { case let .next(value): setNextValue(value) parent.next(index) case let .error(error): parent.fail(error) case .completed: parent.done(index) } } } } ================================================ FILE: RxSwift/ObserverType.swift ================================================ // // 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 Element /// Notify observer about sequence event. /// /// - parameter event: Event that occurred. func on(_ event: Event) } /// Convenience API extensions to provide alternate next, error, completed events public extension ObserverType { /// Convenience method equivalent to `on(.next(element: Element))` /// /// - parameter element: Next element to send to observer(s) func onNext(_ element: Element) { on(.next(element)) } /// Convenience method equivalent to `on(.completed)` func onCompleted() { on(.completed) } /// Convenience method equivalent to `on(.error(Swift.Error))` /// - parameter error: Swift.Error to send to observer(s) func onError(_ error: Swift.Error) { on(.error(error)) } } ================================================ FILE: RxSwift/Observers/AnonymousObserver.swift ================================================ // // AnonymousObserver.swift // RxSwift // // Created by Krunoslav Zaher on 2/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // final class AnonymousObserver: ObserverBase { typealias EventHandler = (Event) -> Void private let eventHandler: EventHandler init(_ eventHandler: @escaping EventHandler) { #if TRACE_RESOURCES _ = Resources.incrementTotal() #endif self.eventHandler = eventHandler } override func onCore(_ event: Event) { eventHandler(event) } #if TRACE_RESOURCES deinit { _ = Resources.decrementTotal() } #endif } ================================================ FILE: RxSwift/Observers/ObserverBase.swift ================================================ // // ObserverBase.swift // RxSwift // // Created by Krunoslav Zaher on 2/15/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // class ObserverBase: Disposable, ObserverType { private let isStopped = AtomicInt(0) func on(_ event: Event) { switch event { case .next: if load(isStopped) == 0 { onCore(event) } case .error, .completed: if fetchOr(isStopped, 1) == 0 { onCore(event) } } } func onCore(_: Event) { rxAbstractMethod() } func dispose() { fetchOr(isStopped, 1) } } ================================================ FILE: RxSwift/Observers/TailRecursiveSink.swift ================================================ // // 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 Sequence.Element: ObservableConvertibleType, Sequence.Element.Element == Observer.Element { typealias Value = TailRecursiveSinkCommand typealias Element = Observer.Element typealias SequenceGenerator = (generator: Sequence.Iterator, remaining: IntMax?) var generators: [SequenceGenerator] = [] var disposed = false var subscription = SerialDisposable() // this is thread safe object var gate = AsyncLock>>() override init(observer: Observer, 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) -> SequenceGenerator? { rxAbstractMethod() } // should be done on gate locked private func moveNextCommand() { var next: Observable? 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 { 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(_: Observable) -> Disposable { rxAbstractMethod() } func disposeCommand() { disposed = true generators.removeAll(keepingCapacity: false) } override func dispose() { super.dispose() subscription.dispose() gate.dispose() schedule(.dispose) } } ================================================ FILE: RxSwift/Reactive.swift ================================================ // // 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. `Binder`s are also automatically synthesized using `@dynamicMemberLookup` for writable reference properties of the reactive base. */ @dynamicMemberLookup 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 } /// Automatically synthesized binder for a key path between the reactive /// base and one of its properties public subscript(dynamicMember keyPath: ReferenceWritableKeyPath) -> Binder where Base: AnyObject { Binder(self.base) { base, value in base[keyPath: keyPath] = value } } } /// A type that has reactive extensions. public protocol ReactiveCompatible { /// Extended type associatedtype ReactiveBase /// Reactive extensions. static var rx: Reactive.Type { get set } /// Reactive extensions. var rx: Reactive { get set } } public extension ReactiveCompatible { /// Reactive extensions. static var rx: Reactive.Type { get { Reactive.self } // this enables using Reactive to "mutate" base type // swiftlint:disable:next unused_setter_value set {} } /// Reactive extensions. var rx: Reactive { get { Reactive(self) } // this enables using Reactive to "mutate" base object // swiftlint:disable:next unused_setter_value set {} } } import Foundation /// Extend NSObject with `rx` proxy. extension NSObject: ReactiveCompatible {} ================================================ FILE: RxSwift/Rx.swift ================================================ // // Rx.swift // RxSwift // // Created by Krunoslav Zaher on 2/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if TRACE_RESOURCES private let resourceCount = AtomicInt(0) /// Resource utilization information public enum 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 { load(resourceCount) } /// Increments `Resources.total` resource count. /// /// - returns: New resource count public static func incrementTotal() -> Int32 { increment(resourceCount) } /// Decrements `Resources.total` resource count /// /// - returns: New resource count public static func decrementTotal() -> Int32 { decrement(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 { 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 Foundation final class SynchronizationTracker { private let lock = RecursiveLock() enum SynchronizationErrorMessages: 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 = [UnsafeMutableRawPointer: Int]() private func synchronizationError(_ message: String) { #if FATAL_SYNCHRONIZATION rxFatalError(message) #else print(message) #endif } func register(synchronizationErrorMessage: SynchronizationErrorMessages) { lock.lock(); defer { self.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 `.observe(on:MainScheduler.asyncInstance)`\n" + " or by enqueuing 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 `.observe(on:MainScheduler.asyncInstance)`\n" + " or by synchronizing sequence events in some other way.\n" ) } } func unregister() { lock.performLocked { let pointer = Unmanaged.passUnretained(Thread.current).toOpaque() self.threads[pointer] = (self.threads[pointer] ?? 1) - 1 if self.threads[pointer] == 0 { self.threads[pointer] = nil } } } } #endif /// RxSwift global hooks public enum Hooks { // Should capture call stack public static var recordCallStackOnError: Bool = false } ================================================ FILE: RxSwift/RxMutableBox.swift ================================================ // // RxMutableBox.swift // RxSwift // // Created by Krunoslav Zaher on 5/22/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // #if !canImport(Darwin) /// As Swift 5 was released, A patch to `Thread` for Linux /// changed `threadDictionary` to a `NSMutableDictionary` instead of /// a `Dictionary`: https://github.com/apple/swift-corelibs-foundation/pull/1762/files /// /// This means that on non-Darwin platforms (Linux, Android, etc.), `RxMutableBox` must be a `NSObject` /// or it won't be possible to store it in `Thread.threadDictionary`. /// /// For more information, read the discussion at: /// https://github.com/ReactiveX/RxSwift/issues/1911#issuecomment-479723298 import Foundation /// Creates mutable reference wrapper for any type. final class RxMutableBox: NSObject { /// Wrapped value var value: T /// Creates reference wrapper for `value`. /// /// - parameter value: Value to wrap. init(_ value: T) { self.value = value } } #else /// 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 { "MutatingBox(\(value))" } } #endif ================================================ FILE: RxSwift/SchedulerType.swift ================================================ // // SchedulerType.swift // RxSwift // // Created by Krunoslav Zaher on 2/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation // Type that represents time interval in the context of RxSwift. public typealias RxTimeInterval = DispatchTimeInterval /// 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) -> Void) -> Disposable { let scheduler = AnyRecursiveScheduler(scheduler: self, action: action) scheduler.schedule(state, dueTime: dueTime) return Disposables.create(with: scheduler.dispose) } } ================================================ FILE: RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift ================================================ // // ConcurrentDispatchQueueScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 7/5/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation /// 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 { Date() } let configuration: DispatchQueueConfiguration /// Constructs new `ConcurrentDispatchQueueScheduler` that wraps `queue`. /// /// - parameter queue: Target dispatch queue. /// - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer. 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. /// - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer. 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 { 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: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { 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: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) } } ================================================ FILE: RxSwift/Schedulers/ConcurrentMainScheduler.swift ================================================ // // ConcurrentMainScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 10/17/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation /** 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 { mainScheduler.now as Date } private init(mainScheduler: MainScheduler) { mainQueue = DispatchQueue.main self.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: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { 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: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { mainScheduler.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) } } ================================================ FILE: RxSwift/Schedulers/CurrentThreadScheduler.swift ================================================ // // CurrentThreadScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 8/30/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation #if !canImport(Darwin) fileprivate enum CurrentThreadSchedulerQueueKey { fileprivate static let instance = "RxSwift.CurrentThreadScheduler.Queue" } #else private class CurrentThreadSchedulerQueueKey: NSObject, NSCopying { static let instance = CurrentThreadSchedulerQueueKey() override private init() { super.init() } override var hash: Int { 0 } func copy(with _: NSZone? = nil) -> Any { 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() } 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 { 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 private(set) static var isScheduleRequired: Bool { get { 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 { queue = existingQueue } else { queue = RxMutableBox(Queue(capacity: 1)) CurrentThreadScheduler.queue = queue } let scheduledItem = ScheduledItem(action: action, state: state) queue.value.enqueue(scheduledItem) return scheduledItem } } ================================================ FILE: RxSwift/Schedulers/HistoricalScheduler.swift ================================================ // // HistoricalScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 12/27/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation /// Provides a virtual time scheduler that uses `Date` for absolute time and `TimeInterval` 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()) } } ================================================ FILE: RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift ================================================ // // HistoricalSchedulerTimeConverter.swift // RxSwift // // Created by Krunoslav Zaher on 12/27/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation /// Converts historical 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 = TimeInterval /// 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 { 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 { 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) -> TimeInterval { 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: TimeInterval) -> VirtualTimeIntervalUnit { 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 { time.addingTimeInterval(offset) } /// Compares two `Date`s. public func compareVirtualTime(_ lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison { switch lhs.compare(rhs as Date) { case .orderedAscending: .lessThan case .orderedSame: .equal case .orderedDescending: .greaterThan } } } ================================================ FILE: RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift ================================================ // // DispatchQueueConfiguration.swift // RxSwift // // Created by Krunoslav Zaher on 7/23/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation struct DispatchQueueConfiguration { let queue: DispatchQueue let leeway: DispatchTimeInterval } 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: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { let deadline = DispatchTime.now() + dueTime let compositeDisposable = CompositeDisposable() let timer = DispatchSource.makeTimerSource(queue: queue) timer.schedule(deadline: deadline, leeway: leeway) // TODO: // This looks horrible, and yes, it is. // It looks like Apple has made a conceptual 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: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { let initial = DispatchTime.now() + startAfter var timerState = state let timer = DispatchSource.makeTimerSource(queue: queue) timer.schedule(deadline: initial, repeating: period, leeway: leeway) // TODO: // This looks horrible, and yes, it is. // It looks like Apple has made a conceptual 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 } } ================================================ FILE: RxSwift/Schedulers/Internal/InvocableScheduledItem.swift ================================================ // // 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) { self.invocable = invocable self.state = state } func invoke() { invocable.invoke(state) } } ================================================ FILE: RxSwift/Schedulers/Internal/InvocableType.swift ================================================ // // 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) } ================================================ FILE: RxSwift/Schedulers/Internal/ScheduledItem.swift ================================================ // // 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 { disposable.isDisposed } init(action: @escaping Action, state: T) { self.action = action self.state = state } func invoke() { disposable.setDisposable(action(state)) } func dispose() { disposable.dispose() } } ================================================ FILE: RxSwift/Schedulers/Internal/ScheduledItemType.swift ================================================ // // ScheduledItemType.swift // RxSwift // // Created by Krunoslav Zaher on 11/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol ScheduledItemType: Cancelable, InvocableType { func invoke() } ================================================ FILE: RxSwift/Schedulers/MainScheduler.swift ================================================ // // MainScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 2/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch #if !os(Linux) import Foundation #endif /** 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 let 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 static 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.") } } /// In case this method is running on a background thread it will throw an exception. public static func ensureRunningOnMainThread(errorMessage: String? = nil) { #if !os(Linux) // isMainThread is not implemented in Linux Foundation guard Thread.isMainThread else { rxFatalError(errorMessage ?? "Running on background thread.") } #endif } override func scheduleInternal(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { let previousNumberEnqueued = increment(numberEnqueued) if DispatchQueue.isMain, previousNumberEnqueued == 0 { let disposable = action(state) decrement(numberEnqueued) return disposable } let cancel = SingleAssignmentDisposable() mainQueue.async { if !cancel.isDisposed { cancel.setDisposable(action(state)) } decrement(self.numberEnqueued) } return cancel } } ================================================ FILE: RxSwift/Schedulers/OperationQueueScheduler.swift ================================================ // // OperationQueueScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 4/4/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation /// 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 public let queuePriority: Operation.QueuePriority /// Constructs new instance of `OperationQueueScheduler` that performs work on `operationQueue`. /// /// - parameter operationQueue: Operation queue targeted to perform work on. /// - parameter queuePriority: Queue priority which will be assigned to new operations. public init(operationQueue: OperationQueue, queuePriority: Operation.QueuePriority = .normal) { self.operationQueue = operationQueue self.queuePriority = queuePriority } /** 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)) } operation.queuePriority = queuePriority operationQueue.addOperation(operation) return cancel } } ================================================ FILE: RxSwift/Schedulers/RecursiveScheduler.swift ================================================ // // RecursiveScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 6/7/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // private 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) { self.action = action self.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.performLocked { () -> 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(state, self) } return Disposables.create() } lock.performLocked { switch scheduleState { case .added: rxFatalError("Invalid state") case .initial: if let removeKey = self.group.insert(d) { scheduleState = .added(removeKey) } else { scheduleState = .done } 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.performLocked { () -> 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(state, self) } return Disposables.create() } lock.performLocked { switch scheduleState { case .added: rxFatalError("Invalid state") case .initial: if let removeKey = self.group.insert(d) { scheduleState = .added(removeKey) } else { scheduleState = .done } case .done: break } } } func dispose() { lock.performLocked { self.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) { self.action = action self.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.performLocked { () -> 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(state, self.schedule) } return Disposables.create() } lock.performLocked { switch scheduleState { case .added: rxFatalError("Invalid state") case .initial: if let removeKey = self.group.insert(d) { scheduleState = .added(removeKey) } else { scheduleState = .done } case .done: break } } } func dispose() { lock.performLocked { self.action = nil } group.dispose() } } ================================================ FILE: RxSwift/Schedulers/SchedulerServices+Emulation.swift ================================================ // // 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 let pendingTickCount = AtomicInt(0) init(scheduler: SchedulerType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping RecursiveAction, state: State) { self.scheduler = scheduler self.startAfter = startAfter self.period = period self.action = action self.state = state } func start() -> Disposable { scheduler.scheduleRecursive(SchedulePeriodicRecursiveCommand.tick, dueTime: startAfter, action: tick) } func tick(_ command: SchedulePeriodicRecursiveCommand, scheduler: RecursiveScheduler) { // 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 increment(pendingTickCount) == 0 { tick(.dispatchStart, scheduler: scheduler) } case .dispatchStart: state = action(state) // Start work and schedule check is this last batch of work if decrement(pendingTickCount) > 1 { // This gives priority to scheduler emulation, it's not perfect, but helps scheduler.schedule(SchedulePeriodicRecursiveCommand.dispatchStart) } } } } ================================================ FILE: RxSwift/Schedulers/SerialDispatchQueueScheduler.swift ================================================ // // SerialDispatchQueueScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 2/8/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Dispatch import Foundation /** 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 { Date() } let configuration: DispatchQueueConfiguration /** Constructs new `SerialDispatchQueueScheduler` that wraps `serialQueue`. - parameter serialQueue: Target dispatch queue. - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer. */ 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. - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer. */ 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. - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer. */ 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 one 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. - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer. */ @available(macOS 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 { scheduleInternal(state, action: action) } func scheduleInternal(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { 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: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { 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: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) } } ================================================ FILE: RxSwift/Schedulers/VirtualTimeConverterType.swift ================================================ // // VirtualTimeConverterType.swift // RxSwift // // Created by Krunoslav Zaher on 12/23/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation /// 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 `TimeInterval`. - parameter virtualTimeInterval: Virtual time interval to convert to `TimeInterval`. - returns: `TimeInterval` corresponding to virtual time interval. */ func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> TimeInterval /** Converts from `TimeInterval` to virtual time interval. - parameter timeInterval: `TimeInterval` to convert to virtual time interval. - returns: Virtual time interval corresponding to time interval. */ func convertToVirtualTimeInterval(_ timeInterval: TimeInterval) -> 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 additional 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 additional 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 { self == .lessThan } /// lhs > rhs var greaterThan: Bool { self == .greaterThan } /// lhs == rhs var equal: Bool { self == .equal } } ================================================ FILE: RxSwift/Schedulers/VirtualTimeScheduler.swift ================================================ // // VirtualTimeScheduler.swift // RxSwift // // Created by Krunoslav Zaher on 2/14/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation /// 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 currentClock: VirtualTime private var schedulerQueue: PriorityQueue> private var converter: Converter private var nextId = 0 private let thread: Thread /// - returns: Current time. public var now: RxTime { converter.convertFromVirtualTime(clock) } /// - returns: Scheduler's absolute time clock value. public var clock: VirtualTime { currentClock } /// Creates a new virtual time scheduler. /// /// - parameter initialClock: Initial value for the clock. public init(initialClock: VirtualTime, converter: Converter) { currentClock = initialClock running = false self.converter = converter thread = Thread.current schedulerQueue = PriorityQueue(hasHigherPriority: { switch converter.compareVirtualTime($0.time, $1.time) { case .lessThan: true case .equal: $0.id < $1.id case .greaterThan: false } }, isEqual: { $0 === $1 }) #if TRACE_RESOURCES _ = 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 { scheduleRelative(state, dueTime: .microseconds(0)) { a in 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 = now.addingDispatchInterval(dueTime) let absoluteTime = converter.convertToVirtualTime(time) let adjustedTime = 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(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: VirtualTime, action: @escaping (StateType) -> Disposable) -> Disposable { ensureRunningOnCorrectThread() let compositeDisposable = CompositeDisposable() let item = VirtualSchedulerItem(action: { action(state) }, 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: VirtualTime) -> VirtualTime { time } /// Starts the virtual time scheduler. public func start() { if running { return } ensureRunningOnCorrectThread() running = true repeat { guard let next = findNext() else { break } if converter.compareVirtualTime(next.time, clock).greaterThan { currentClock = 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) { if running { fatalError("Scheduler is already running") } ensureRunningOnCorrectThread() running = true repeat { guard let next = findNext() else { break } if converter.compareVirtualTime(next.time, virtualTime).greaterThan { break } if converter.compareVirtualTime(next.time, clock).greaterThan { currentClock = next.time } next.invoke() schedulerQueue.remove(next) } while running currentClock = virtualTime running = false } /// Advances the scheduler's clock by the specified relative time. public func sleep(_ virtualInterval: VirtualTimeInterval) { ensureRunningOnCorrectThread() let sleepTo = converter.offsetVirtualTime(clock, offset: virtualInterval) if converter.compareVirtualTime(sleepTo, clock).lessThen { fatalError("Can't sleep to past.") } currentClock = sleepTo } /// Stops the virtual time scheduler. public func stop() { ensureRunningOnCorrectThread() running = false } #if TRACE_RESOURCES deinit { _ = Resources.decrementTotal() } #endif private func ensureRunningOnCorrectThread() { guard Thread.current == thread else { rxFatalError("Executing on the wrong thread. Please ensure all work on the same thread.") } } } // MARK: description extension VirtualTimeScheduler: CustomDebugStringConvertible { /// A textual representation of `self`, suitable for debugging. public var debugDescription: String { schedulerQueue.debugDescription } } final class VirtualSchedulerItem

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

AsyncSubject

public final class AsyncSubject<Element>:
    Observable<Element>,
    SubjectType,
    ObserverType,
    SynchronizedUnsubscribeType

An AsyncSubject emits the last value (and only the last value) emitted by the source Observable, and only after that source Observable completes.

(If the source Observable does not emit any values, the AsyncSubject also completes without emitting any values.)

  • Undocumented

    Declaration

    Swift

    public typealias SubjectObserverType = AsyncSubject<Element>
  • Indicates whether the subject has any observers

    Declaration

    Swift

    public var hasObservers: Bool { get }
  • Creates a subject.

    Declaration

    Swift

    override public init()
  • Notifies all subscribed observers about next event.

    Declaration

    Swift

    public func on(_ event: Event<Element>)

    Parameters

    event

    Event to send to the observers.

  • Subscribes an observer to the subject.

    Declaration

    Swift

    override public func subscribe<Observer>(_ observer: Observer) -> Disposable where Element == Observer.Element, Observer : ObserverType

    Parameters

    observer

    Observer to subscribe to the subject.

    Return Value

    Disposable object that can be used to unsubscribe the observer from the subject.

  • Returns observer interface for subject.

    Declaration

    Swift

    public func asObserver() -> AsyncSubject<Element>
================================================ FILE: docs/Classes/BehaviorSubject.html ================================================ BehaviorSubject Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

BehaviorSubject

public final class BehaviorSubject<Element>:
    Observable<Element>,
    SubjectType,
    ObserverType,
    SynchronizedUnsubscribeType,
    Cancelable

Represents a value that changes over time.

Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.

  • Undocumented

    Declaration

    Swift

    public typealias SubjectObserverType = BehaviorSubject<Element>
  • Indicates whether the subject has any observers

    Declaration

    Swift

    public var hasObservers: Bool { get }
  • Indicates whether the subject has been disposed.

    Declaration

    Swift

    public var isDisposed: Bool { get }
  • Initializes a new instance of the subject that caches its last value and starts with the specified value.

    Declaration

    Swift

    public init(value: Element)

    Parameters

    value

    Initial value sent to observers when no other value has been received by the subject yet.

  • Gets the current value or throws an error.

    Declaration

    Swift

    public func value() throws -> Element

    Return Value

    Latest value.

  • Notifies all subscribed observers about next event.

    Declaration

    Swift

    public func on(_ event: Event<Element>)

    Parameters

    event

    Event to send to the observers.

  • Subscribes an observer to the subject.

    Declaration

    Swift

    override public func subscribe<Observer>(_ observer: Observer) -> Disposable where Element == Observer.Element, Observer : ObserverType

    Parameters

    observer

    Observer to subscribe to the subject.

    Return Value

    Disposable object that can be used to unsubscribe the observer from the subject.

  • Returns observer interface for subject.

    Declaration

    Swift

    public func asObserver() -> BehaviorSubject<Element>
  • Unsubscribe all observers and release resources.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/BooleanDisposable.html ================================================ BooleanDisposable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

BooleanDisposable

public final class BooleanDisposable : Cancelable

Represents a disposable resource that can be checked for disposal status.

  • Initializes a new instance of the BooleanDisposable class

    Declaration

    Swift

    public init()
  • Initializes a new instance of the BooleanDisposable class with given value

    Declaration

    Swift

    public init(isDisposed: Bool)
  • Declaration

    Swift

    public var isDisposed: Bool { get }

    Return Value

    Was resource disposed.

  • Sets the status to disposed, which can be observer through the isDisposed property.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/CompositeDisposable.html ================================================ CompositeDisposable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

CompositeDisposable

public final class CompositeDisposable : DisposeBase, Cancelable

Represents a group of disposable resources that are disposed together.

  • Key used to remove disposable from composite disposable

    Declaration

    Swift

    public struct DisposeKey
  • Declaration

    Swift

    public var isDisposed: Bool { get }
  • Undocumented

    Declaration

    Swift

    override public init()
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(_ disposable1: Disposable, _ disposable2: Disposable)
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable)
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable, _ disposable4: Disposable, _ disposables: Disposable...)
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(disposables: [Disposable])
  • Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.

    Declaration

    Swift

    public func insert(_ disposable: Disposable) -> DisposeKey?

    Parameters

    disposable

    Disposable to add.

    Return Value

    Key that can be used to remove disposable from composite disposable. In case dispose bag was already disposed nil will be returned.

  • Declaration

    Swift

    public var count: Int { get }

    Return Value

    Gets the number of disposables contained in the CompositeDisposable.

  • Removes and disposes the disposable identified by disposeKey from the CompositeDisposable.

    Declaration

    Swift

    public func remove(for disposeKey: DisposeKey)

    Parameters

    disposeKey

    Key used to identify disposable to be removed.

  • Disposes all disposables in the group and removes them from the group.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/ConcurrentDispatchQueueScheduler.html ================================================ ConcurrentDispatchQueueScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ConcurrentDispatchQueueScheduler

public class ConcurrentDispatchQueueScheduler : SchedulerType

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.

  • Undocumented

    Declaration

    Swift

    public typealias TimeInterval = Foundation.TimeInterval
  • Undocumented

    Declaration

    Swift

    public typealias Time = Date
  • now

    Declaration

    Swift

    public var now: Date { get }
  • Constructs new ConcurrentDispatchQueueScheduler that wraps queue.

    Declaration

    Swift

    public init(queue: DispatchQueue, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0))

    Parameters

    queue

    Target dispatch queue.

    leeway

    The amount of time, in nanoseconds, that the system will defer the timer.

  • Convenience init for scheduler that wraps one of the global concurrent dispatch queues.

    Declaration

    Swift

    public convenience init(qos: DispatchQoS, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0))

    Parameters

    qos

    Target global dispatch queue, by quality of service class.

    leeway

    The amount of time, in nanoseconds, that the system will defer the timer.

  • Schedules an action to be executed immediately.

    Declaration

    Swift

    public final func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed.

    Declaration

    Swift

    public final func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    dueTime

    Relative time after which to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules a periodic piece of work.

    Declaration

    Swift

    public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    startAfter

    Period after which initial work should be run.

    period

    Period for running the work periodically.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

================================================ FILE: docs/Classes/ConcurrentMainScheduler.html ================================================ ConcurrentMainScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ConcurrentMainScheduler

public final class ConcurrentMainScheduler : SchedulerType

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.

  • Undocumented

    Declaration

    Swift

    public typealias TimeInterval = Foundation.TimeInterval
  • Undocumented

    Declaration

    Swift

    public typealias Time = Date
  • now

    Declaration

    Swift

    public var now: Date { get }

    Return Value

    Current time.

  • Singleton instance of ConcurrentMainScheduler

    Declaration

    Swift

    public static let instance: ConcurrentMainScheduler
  • Schedules an action to be executed immediately.

    Declaration

    Swift

    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed.

    Declaration

    Swift

    public final func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    dueTime

    Relative time after which to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules a periodic piece of work.

    Declaration

    Swift

    public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    startAfter

    Period after which initial work should be run.

    period

    Period for running the work periodically.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

================================================ FILE: docs/Classes/ConnectableObservable.html ================================================ ConnectableObservable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ConnectableObservable

public class ConnectableObservable<Element>:
    Observable<Element>,
    ConnectableObservableType

Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence.

  • 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.

    Declaration

    Swift

    public func connect() -> Disposable

    Return Value

    Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence.

================================================ FILE: docs/Classes/CurrentThreadScheduler.html ================================================ CurrentThreadScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

CurrentThreadScheduler

public class CurrentThreadScheduler : ImmediateSchedulerType

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.

  • The singleton instance of the current thread scheduler.

    Declaration

    Swift

    public static let instance: CurrentThreadScheduler
  • Gets a value that indicates whether the caller must call a schedule method.

    Declaration

    Swift

    public private(set) static var isScheduleRequired: Bool { get set }
  • 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.

    Declaration

    Swift

    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

================================================ FILE: docs/Classes/DisposeBag/DisposableBuilder.html ================================================ DisposableBuilder Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

DisposableBuilder

@resultBuilder
struct DisposableBuilder

Undocumented

================================================ FILE: docs/Classes/DisposeBag.html ================================================ DisposeBag Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

DisposeBag

public final class DisposeBag : DisposeBase

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.

  • Constructs new empty dispose bag.

    Declaration

    Swift

    override public init()
  • Adds disposable to be disposed when dispose bag is being deinited.

    Declaration

    Swift

    public func insert(_ disposable: Disposable)

    Parameters

    disposable

    Disposable to add.

  • Convenience init allows a list of disposables to be gathered for disposal.

    Declaration

    Swift

    convenience init(disposing disposables: Disposable...)
  • Convenience init which utilizes a function builder to let you pass in a list of disposables to make a DisposeBag of.

    Declaration

    Swift

    convenience init(@DisposeBag.DisposableBuilder builder: () -> [Disposable])
  • Convenience init allows an array of disposables to be gathered for disposal.

    Declaration

    Swift

    convenience init(disposing disposables: [Disposable])
  • Convenience function allows a list of disposables to be gathered for disposal.

    Declaration

    Swift

    func insert(_ disposables: Disposable...)
  • Convenience function allows a list of disposables to be gathered for disposal.

    Declaration

    Swift

    func insert(@DisposeBag.DisposableBuilder builder: () -> [Disposable])
  • Convenience function allows an array of disposables to be gathered for disposal.

    Declaration

    Swift

    func insert(_ disposables: [Disposable])
  • Undocumented

    See more

    Declaration

    Swift

    @resultBuilder
    struct DisposableBuilder
================================================ FILE: docs/Classes/HistoricalScheduler.html ================================================ HistoricalScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

HistoricalScheduler

public class HistoricalScheduler : VirtualTimeScheduler<HistoricalSchedulerTimeConverter>

Provides a virtual time scheduler that uses Date for absolute time and TimeInterval for relative time.

  • Creates a new historical scheduler with initial clock value.

    Declaration

    Swift

    public init(initialClock: RxTime = Date(timeIntervalSince1970: 0))

    Parameters

    initialClock

    Initial value for virtual clock.

================================================ FILE: docs/Classes/MainScheduler.html ================================================ MainScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

MainScheduler

public final class MainScheduler : SerialDispatchQueueScheduler

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.

  • Initializes new instance of MainScheduler.

    Declaration

    Swift

    public init()
  • Singleton instance of MainScheduler

    Declaration

    Swift

    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.

    Declaration

    Swift

    public static let asyncInstance: SerialDispatchQueueScheduler
  • In case this method is called on a background thread it will throw an exception.

    Declaration

    Swift

    public static func ensureExecutingOnScheduler(errorMessage: String? = nil)
  • In case this method is running on a background thread it will throw an exception.

    Declaration

    Swift

    public static func ensureRunningOnMainThread(errorMessage: String? = nil)
================================================ FILE: docs/Classes/Observable.html ================================================ Observable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

================================================ FILE: docs/Classes/OperationQueueScheduler.html ================================================ OperationQueueScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

OperationQueueScheduler

public class OperationQueueScheduler : ImmediateSchedulerType

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.

  • Undocumented

    Declaration

    Swift

    public let operationQueue: OperationQueue
  • Undocumented

    Declaration

    Swift

    public let queuePriority: Operation.QueuePriority
  • Constructs new instance of OperationQueueScheduler that performs work on operationQueue.

    Declaration

    Swift

    public init(operationQueue: OperationQueue, queuePriority: Operation.QueuePriority = .normal)

    Parameters

    operationQueue

    Operation queue targeted to perform work on.

    queuePriority

    Queue priority which will be assigned to new operations.

  • Schedules an action to be executed recursively.

    Declaration

    Swift

    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    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.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

================================================ FILE: docs/Classes/PublishSubject.html ================================================ PublishSubject Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

PublishSubject

public final class PublishSubject<Element>:
    Observable<Element>,
    SubjectType,
    Cancelable,
    ObserverType,
    SynchronizedUnsubscribeType

Represents an object that is both an observable sequence as well as an observer.

Each notification is broadcasted to all subscribed observers.

  • Undocumented

    Declaration

    Swift

    public typealias SubjectObserverType = PublishSubject<Element>
  • Indicates whether the subject has any observers

    Declaration

    Swift

    public var hasObservers: Bool { get }
  • Indicates whether the subject has been isDisposed.

    Declaration

    Swift

    public var isDisposed: Bool { get }
  • Creates a subject.

    Declaration

    Swift

    override public init()
  • Notifies all subscribed observers about next event.

    Declaration

    Swift

    public func on(_ event: Event<Element>)

    Parameters

    event

    Event to send to the observers.

  • Subscribes an observer to the subject.

    Declaration

    Swift

    override public func subscribe<Observer>(_ observer: Observer) -> Disposable where Element == Observer.Element, Observer : ObserverType

    Parameters

    observer

    Observer to subscribe to the subject.

    Return Value

    Disposable object that can be used to unsubscribe the observer from the subject.

  • Returns observer interface for subject.

    Declaration

    Swift

    public func asObserver() -> PublishSubject<Element>
  • Unsubscribe all observers and release resources.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/RefCountDisposable.html ================================================ RefCountDisposable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RefCountDisposable

public final class RefCountDisposable : DisposeBase, Cancelable

Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.

  • Declaration

    Swift

    public var isDisposed: Bool { get }

    Return Value

    Was resource disposed.

  • Initializes a new instance of the RefCountDisposable.

    Declaration

    Swift

    public init(disposable: Disposable)
  • 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.

    Declaration

    Swift

    public func retain() -> Disposable
  • Disposes the underlying disposable only when all dependent disposables have been disposed.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/ReplaySubject.html ================================================ ReplaySubject Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ReplaySubject

public class ReplaySubject<Element>:
    Observable<Element>,
    SubjectType,
    ObserverType,
    Disposable

Represents an object that is both an observable sequence as well as an observer.

Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.

  • Undocumented

    Declaration

    Swift

    public typealias SubjectObserverType = ReplaySubject<Element>
  • Indicates whether the subject has any observers

    Declaration

    Swift

    public var hasObservers: Bool { get }
  • Notifies all subscribed observers about next event.

    Declaration

    Swift

    public func on(_: Event<Element>)

    Parameters

    event

    Event to send to the observers.

  • Returns observer interface for subject.

    Declaration

    Swift

    public func asObserver() -> ReplaySubject<Element>
  • Unsubscribe all observers and release resources.

    Declaration

    Swift

    public func dispose()
  • Creates new instance of ReplaySubject that replays at most bufferSize last elements of sequence.

    Declaration

    Swift

    public static func create(bufferSize: Int) -> ReplaySubject<Element>

    Parameters

    bufferSize

    Maximal number of elements to replay to observer after subscription.

    Return Value

    New instance of replay subject.

  • Creates a new instance of ReplaySubject that buffers all the elements of a sequence. To avoid filling up memory, developer needs to make sure that the use case will only ever store a ‘reasonable’ number of elements.

    Declaration

    Swift

    public static func createUnbounded() -> ReplaySubject<Element>
================================================ FILE: docs/Classes/ScheduledDisposable.html ================================================ ScheduledDisposable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ScheduledDisposable

public final class ScheduledDisposable : Cancelable

Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler.

  • Undocumented

    Declaration

    Swift

    public let scheduler: ImmediateSchedulerType
  • Declaration

    Swift

    public var isDisposed: Bool { get }

    Return Value

    Was resource disposed.

  • Initializes a new instance of the ScheduledDisposable that uses a scheduler on which to dispose the disposable.

    Declaration

    Swift

    public init(scheduler: ImmediateSchedulerType, disposable: Disposable)

    Parameters

    scheduler

    Scheduler where the disposable resource will be disposed on.

    disposable

    Disposable resource to dispose on the given scheduler.

  • Disposes the wrapped disposable on the provided scheduler.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/SerialDispatchQueueScheduler.html ================================================ SerialDispatchQueueScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

SerialDispatchQueueScheduler

public class SerialDispatchQueueScheduler : SchedulerType

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.

  • Undocumented

    Declaration

    Swift

    public typealias TimeInterval = Foundation.TimeInterval
  • Undocumented

    Declaration

    Swift

    public typealias Time = Date
  • now

    Declaration

    Swift

    public var now: Date { get }

    Return Value

    Current time.

  • Constructs new SerialDispatchQueueScheduler with internal serial queue named internalSerialQueueName.

    Additional dispatch queue properties can be set after dispatch queue is created using serialQueueConfiguration.

    Declaration

    Swift

    public convenience init(internalSerialQueueName: String, serialQueueConfiguration: ((DispatchQueue) -> Void)? = nil, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0))

    Parameters

    internalSerialQueueName

    Name of internal serial dispatch queue.

    serialQueueConfiguration

    Additional configuration of internal serial dispatch queue.

    leeway

    The amount of time, in nanoseconds, that the system will defer the timer.

  • Constructs new SerialDispatchQueueScheduler named internalSerialQueueName that wraps queue.

    Declaration

    Swift

    public convenience init(queue: DispatchQueue, internalSerialQueueName: String, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0))

    Parameters

    queue

    Possibly concurrent dispatch queue used to perform work.

    internalSerialQueueName

    Name of internal serial dispatch queue proxy.

    leeway

    The amount of time, in nanoseconds, that the system will defer the timer.

  • Constructs new SerialDispatchQueueScheduler that wraps one of the global concurrent dispatch queues.

    Declaration

    Swift

    @available(macOS 10.10, *)
    public convenience init(qos: DispatchQoS, internalSerialQueueName: String = "rx.global_dispatch_queue.serial", leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0))

    Parameters

    qos

    Identifier for global dispatch queue with specified quality of service class.

    internalSerialQueueName

    Custom name for internal serial dispatch queue proxy.

    leeway

    The amount of time, in nanoseconds, that the system will defer the timer.

  • Schedules an action to be executed immediately.

    Declaration

    Swift

    public final func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed.

    Declaration

    Swift

    public final func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    dueTime

    Relative time after which to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules a periodic piece of work.

    Declaration

    Swift

    public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    startAfter

    Period after which initial work should be run.

    period

    Period for running the work periodically.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

================================================ FILE: docs/Classes/SerialDisposable.html ================================================ SerialDisposable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

SerialDisposable

public final class SerialDisposable : DisposeBase, Cancelable

Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.

  • Declaration

    Swift

    public var isDisposed: Bool { get }

    Return Value

    Was resource disposed.

  • Initializes a new instance of the SerialDisposable.

    Declaration

    Swift

    override public 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.

    Declaration

    Swift

    public var disposable: Disposable { get set }
  • Disposes the underlying disposable as well as all future replacements.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/SingleAssignmentDisposable.html ================================================ SingleAssignmentDisposable Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

SingleAssignmentDisposable

public final class SingleAssignmentDisposable : DisposeBase, Cancelable

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.

  • Declaration

    Swift

    public var isDisposed: Bool { get }

    Return Value

    A value that indicates whether the object is disposed.

  • Initializes a new instance of the SingleAssignmentDisposable.

    Declaration

    Swift

    override public 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.

    Declaration

    Swift

    public func setDisposable(_ disposable: Disposable)
  • Disposes the underlying disposable.

    Declaration

    Swift

    public func dispose()
================================================ FILE: docs/Classes/VirtualTimeScheduler.html ================================================ VirtualTimeScheduler Class Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

VirtualTimeScheduler

open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>:
    SchedulerType
extension VirtualTimeScheduler: CustomDebugStringConvertible

Base class for virtual time schedulers using a priority queue for scheduled items.

  • Undocumented

    Declaration

    Swift

    public typealias VirtualTime = Converter.VirtualTimeUnit
  • Undocumented

    Declaration

    Swift

    public typealias VirtualTimeInterval = Converter.VirtualTimeIntervalUnit
  • now

    Declaration

    Swift

    public var now: RxTime { get }

    Return Value

    Current time.

  • Declaration

    Swift

    public var clock: VirtualTime { get }

    Return Value

    Scheduler’s absolute time clock value.

  • Creates a new virtual time scheduler.

    Declaration

    Swift

    public init(initialClock: VirtualTime, converter: Converter)

    Parameters

    initialClock

    Initial value for the clock.

  • Schedules an action to be executed immediately.

    Declaration

    Swift

    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed.

    Declaration

    Swift

    public func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    dueTime

    Relative time after which to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed after relative time has passed.

    Declaration

    Swift

    public func scheduleRelativeVirtual<StateType>(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    time

    Absolute time when to execute the action. If this is less or equal then now, now + 1 will be used.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed at absolute virtual time.

    Declaration

    Swift

    public func scheduleAbsoluteVirtual<StateType>(_ state: StateType, time: VirtualTime, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    time

    Absolute time when to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Adjusts time of scheduling before adding item to schedule queue.

    Declaration

    Swift

    open func adjustScheduledTime(_ time: VirtualTime) -> VirtualTime
  • Starts the virtual time scheduler.

    Declaration

    Swift

    public func start()
  • Advances the scheduler’s clock to the specified time, running all work till that point.

    Declaration

    Swift

    public func advanceTo(_ virtualTime: VirtualTime)

    Parameters

    virtualTime

    Absolute time to advance the scheduler’s clock to.

  • Advances the scheduler’s clock by the specified relative time.

    Declaration

    Swift

    public func sleep(_ virtualInterval: VirtualTimeInterval)
  • Stops the virtual time scheduler.

    Declaration

    Swift

    public func stop()

description

  • A textual representation of self, suitable for debugging.

    Declaration

    Swift

    public var debugDescription: String { get }
================================================ FILE: docs/Enums/CompletableEvent.html ================================================ CompletableEvent Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

CompletableEvent

@frozen
public enum CompletableEvent

Undocumented

  • Sequence terminated with an error. (underlying observable sequence emits: .error(Error))

    Declaration

    Swift

    case error(Swift.Error)
  • Sequence completed successfully.

    Declaration

    Swift

    case completed
================================================ FILE: docs/Enums/Event.html ================================================ Event Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Event

@frozen
public enum Event<Element>
extension Event: CustomDebugStringConvertible
extension Event: EventConvertible

Represents a sequence event.

Sequence grammar: next* (error | completed)

  • Next element is produced.

    Declaration

    Swift

    case next(Element)
  • Sequence terminated with an error.

    Declaration

    Swift

    case error(Swift.Error)
  • Sequence completed successfully.

    Declaration

    Swift

    case completed
  • Description of event.

    Declaration

    Swift

    public var debugDescription: String { get }
  • Is completed or error event.

    Declaration

    Swift

    var isStopEvent: Bool { get }
  • If next event, returns element value.

    Declaration

    Swift

    var element: Element? { get }
  • If error event, returns error.

    Declaration

    Swift

    var error: Swift.Error? { get }
  • If completed event, returns true.

    Declaration

    Swift

    var isCompleted: Bool { get }
  • Maps sequence elements using transform. If error happens during the transform, .error will be returned as value.

    Declaration

    Swift

    func map<Result>(_ transform: (Element) throws -> Result) -> Event<Result>
  • Event representation of this instance

    Declaration

    Swift

    public var event: Event<Element> { get }
================================================ FILE: docs/Enums/Hooks.html ================================================ Hooks Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Hooks

public enum Hooks

RxSwift global hooks

================================================ FILE: docs/Enums/InfallibleEvent.html ================================================ InfallibleEvent Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

InfallibleEvent

public enum InfallibleEvent<Element>
extension InfallibleEvent: EventConvertible

Undocumented

  • Next element is produced.

    Declaration

    Swift

    case next(Element)
  • Sequence completed successfully.

    Declaration

    Swift

    case completed
  • Declaration

    Swift

    public var event: Event<Element> { get }
================================================ FILE: docs/Enums/MaybeEvent.html ================================================ MaybeEvent Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

MaybeEvent

@frozen
public enum MaybeEvent<Element>

Undocumented

  • One and only sequence element is produced. (underlying observable sequence emits: .next(Element), .completed)

    Declaration

    Swift

    case success(Element)
  • Sequence terminated with an error. (underlying observable sequence emits: .error(Error))

    Declaration

    Swift

    case error(Swift.Error)
  • Sequence completed successfully.

    Declaration

    Swift

    case completed
================================================ FILE: docs/Enums/Resources.html ================================================ Resources Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

================================================ FILE: docs/Enums/RxError.html ================================================ RxError Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxError

public enum RxError:
    Swift.Error,
    CustomDebugStringConvertible

Generic Rx error codes.

  • Unknown error occurred.

    Declaration

    Swift

    case unknown
  • Performing an action on disposed object.

    Declaration

    Swift

    case disposed(object: AnyObject)
  • Arithmetic overflow error.

    Declaration

    Swift

    case overflow
  • Argument out of range error.

    Declaration

    Swift

    case argumentOutOfRange
  • Sequence doesn’t contain any elements.

    Declaration

    Swift

    case noElements
  • Sequence contains more than one element.

    Declaration

    Swift

    case moreThanOneElement
  • Timeout error.

    Declaration

    Swift

    case timeout
  • A textual representation of self, suitable for debugging.

    Declaration

    Swift

    var debugDescription: String { get }
================================================ FILE: docs/Enums/SingleEvent.html ================================================ SingleEvent Enumeration Reference

RxSwift 6.1.0-beta.1 Docs (95% documented)

View on GitHub

SingleEvent

public enum SingleEvent<Element>

Undocumented

  • One and only sequence element is produced. (underlying observable sequence emits: .next(Element), .completed)

    Declaration

    Swift

    case success(Element)
  • Sequence terminated with an error. (underlying observable sequence emits: .error(Error))

    Declaration

    Swift

    case error(Swift.Error)
================================================ FILE: docs/Enums/SubjectLifetimeScope.html ================================================ SubjectLifetimeScope Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

SubjectLifetimeScope

public enum SubjectLifetimeScope

Subject lifetime scope

  • 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<TimeInterval> 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
    
    

    Declaration

    Swift

    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 immediately receive replayed elements and terminal event. No new subscriptions to source observable sequence will be attempted.
    let xs = Observable.deferred { () -> Observable<TimeInterval> 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
    

    Declaration

    Swift

    case forever
================================================ FILE: docs/Enums/TakeBehavior.html ================================================ TakeBehavior Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

TakeBehavior

public enum TakeBehavior

Behaviors for the take operator family.

  • Include the last element matching the predicate.

    Declaration

    Swift

    case inclusive
  • Exclude the last element matching the predicate.

    Declaration

    Swift

    case exclusive
================================================ FILE: docs/Enums/TakeUntilBehavior.html ================================================ TakeUntilBehavior Enumeration Reference

RxSwift 6.1.0-beta.1 Docs (95% documented)

View on GitHub

TakeUntilBehavior

public enum TakeUntilBehavior

Behaviors for the takeUntil(_ behavior:predicate:) operator.

  • Include the last element matching the predicate.

    Declaration

    Swift

    case inclusive
  • Exclude the last element matching the predicate.

    Declaration

    Swift

    case exclusive
================================================ FILE: docs/Enums/VirtualTimeComparison.html ================================================ VirtualTimeComparison Enumeration Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

VirtualTimeComparison

public enum VirtualTimeComparison

Virtual time comparison result.

This is additional abstraction because Date is unfortunately not comparable. Extending Date with Comparable would be too risky because of possible collisions with other libraries.

  • lhs < rhs.

    Declaration

    Swift

    case lessThan
  • lhs == rhs.

    Declaration

    Swift

    case equal
  • lhs > rhs.

    Declaration

    Swift

    case greaterThan
================================================ FILE: docs/Extensions/AsyncSequence.html ================================================ AsyncSequence Extension Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

AsyncSequence

public extension AsyncSequence
  • Convert an AsyncSequence to an Observable.

    Iteration runs in a detached task to prevent blocking the calling thread. Use .observe(on:) to control event delivery (e.g., MainScheduler.instance for UI updates).

    Declaration

    Swift

    func asObservable(priority: TaskPriority? = nil) -> Observable<Element>

    Parameters

    priority

    Priority for the detached task

    Return Value

    An Observable of the async sequence’s element type

================================================ FILE: docs/Other Classes.html ================================================ Other Classes Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

================================================ FILE: docs/Other Enums.html ================================================ Other Enumerations Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Other Enumerations

The following enumerations are available globally.

  • Generic Rx error codes.

    See more

    Declaration

    Swift

    public enum RxError:
        Swift.Error,
        CustomDebugStringConvertible
  • RxSwift global hooks

    See more

    Declaration

    Swift

    public enum Hooks
  • Resource utilization information

    See more
  • Subject lifetime scope

    See more

    Declaration

    Swift

    public enum SubjectLifetimeScope
  • Behaviors for the take operator family.

    See more

    Declaration

    Swift

    public enum TakeBehavior
  • Virtual time comparison result.

    This is additional abstraction because Date is unfortunately not comparable. Extending Date with Comparable would be too risky because of possible collisions with other libraries.

    See more

    Declaration

    Swift

    public enum VirtualTimeComparison
  • Undocumented

    See more

    Declaration

    Swift

    public enum InfallibleEvent<Element>
    extension InfallibleEvent: EventConvertible
  • Sequence containing 0 elements

    Declaration

    Swift

    public enum CompletableTrait
  • Undocumented

    See more

    Declaration

    Swift

    @frozen
    public enum CompletableEvent
  • Sequence containing 0 or 1 elements

    Declaration

    Swift

    public enum MaybeTrait
  • Undocumented

    See more

    Declaration

    Swift

    @frozen
    public enum MaybeEvent<Element>
  • Sequence containing exactly 1 element

    Declaration

    Swift

    public enum SingleTrait
================================================ FILE: docs/Other Extensions.html ================================================ Other Extensions Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

================================================ FILE: docs/Other Global Variables.html ================================================ Other Global Variables Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Other Global Variables

The following global variables are available globally.

================================================ FILE: docs/Other Protocols.html ================================================ Other Protocols Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Other Protocols

The following protocols are available globally.

================================================ FILE: docs/Other Structs.html ================================================ Other Structures Reference

RxSwift 6.9.0 Docs (95% documented)

GitHub View on GitHub

Other Structures

The following structures are available globally.

================================================ FILE: docs/Other Typealiases.html ================================================ Other Type Aliases Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Other Type Aliases

The following type aliases are available globally.

  • A type-erased ObservableType.

    It represents a push style sequence.

    Declaration

    Swift

    public typealias RxObservable<Element> = RxSwift.Observable<Element>
  • Undocumented

    Declaration

    Swift

    public typealias RxTimeInterval = DispatchTimeInterval
  • Type that represents absolute time in the context of RxSwift.

    Declaration

    Swift

    public typealias RxTime = Date
  • Undocumented

    Declaration

    Swift

    public typealias RxAbstractInteger = FixedWidthInteger
  • Undocumented

    Declaration

    Swift

    public typealias SingleEvent<Element> = Result<Element, Swift.Error>
================================================ FILE: docs/Protocols/Cancelable.html ================================================ Cancelable Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Cancelable

public protocol Cancelable : Disposable

Represents disposable resource with state tracking.

  • Was resource disposed.

    Declaration

    Swift

    var isDisposed: Bool { get }
================================================ FILE: docs/Protocols/ConnectableObservableType.html ================================================ ConnectableObservableType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ConnectableObservableType

public protocol ConnectableObservableType : ObservableType

Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence.

  • 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.

    Declaration

    Swift

    func connect() -> Disposable

    Return Value

    Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence.

  • refCount() Extension method

    Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

    Declaration

    Swift

    func refCount() -> Observable<Element>

    Return Value

    An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

================================================ FILE: docs/Protocols/DataDecoder.html ================================================ DataDecoder Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

DataDecoder

public protocol DataDecoder

Represents an entity capable of decoding raw Data into a concrete Decodable type

  • Undocumented

    Declaration

    Swift

    func decode<Item>(_ type: Item.Type, from data: Data) throws -> Item where Item : Decodable
================================================ FILE: docs/Protocols/Disposable.html ================================================ Disposable Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Disposable

public protocol Disposable

Represents a disposable resource.

================================================ FILE: docs/Protocols/EventConvertible.html ================================================ EventConvertible Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

EventConvertible

public protocol EventConvertible

A type that can be converted to Event<Element>.

  • Type of element in event

    Declaration

    Swift

    associatedtype Element
  • Event representation of this instance

    Declaration

    Swift

    var event: Event<Element> { get }
================================================ FILE: docs/Protocols/ImmediateSchedulerType.html ================================================ ImmediateSchedulerType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ImmediateSchedulerType

public protocol ImmediateSchedulerType

Represents an object that immediately schedules units of work.

  • Schedules an action to be executed immediately.

    Declaration

    Swift

    func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • scheduleRecursive(_:action:) Extension method

    Schedules an action to be executed recursively.

    Declaration

    Swift

    func scheduleRecursive<State>(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> Void) -> Void) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    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.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

================================================ FILE: docs/Protocols/InfallibleType.html ================================================ InfallibleType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

InfallibleType

public protocol InfallibleType : ObservableConvertibleType

Infallible is an Observable-like push-style interface which is guaranteed to not emit error events.

Unlike SharedSequence, it does not share its resources or replay its events, but acts as a standard Observable.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Infallible<Element>
        where Collection.Element: InfallibleType

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • combineLatest(_:) Extension method

    Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<Collection: Swift.Collection>(_ collection: Collection) -> Infallible<[Element]>
        where Collection.Element: InfallibleType, Collection.Element.Element == Element

    Return Value

    An observable sequence containing the result of combining elements of the sources.

Infallible

  • values Extension method

    Allows iterating over the values of an Infallible asynchronously via Swift’s concurrency features (async/await)

    A sample usage would look like so:

    for await value in observable.values {
        // Handle emitted values
    }
    

    Declaration

    Swift

    var values: AsyncStream<Element> { get }

Static allocation

  • just(_:) Extension method

    Returns an infallible sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element) -> Infallible<Element>

    Parameters

    element

    Single element in the resulting infallible sequence.

    Return Value

    An infallible sequence containing the single specified element.

  • just(_:scheduler:) Extension method

    Returns an infallible sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Infallible<Element>

    Parameters

    element

    Single element in the resulting infallible sequence.

    scheduler

    Scheduler to send the single element on.

    Return Value

    An infallible sequence containing the single specified element.

  • never() Extension method

    Returns a non-terminating infallible sequence, which can be used to denote an infinite duration.

    Declaration

    Swift

    static func never() -> Infallible<Element>

    Return Value

    An infallible sequence whose observers will never get called.

  • empty() Extension method

    Returns an empty infallible sequence, using the specified scheduler to send out the single Completed message.

    Declaration

    Swift

    static func empty() -> Infallible<Element>

    Return Value

    An infallible sequence with no elements.

  • deferred(_:) Extension method

    Returns an infallible sequence that invokes the specified factory function whenever a new observer subscribes.

    Declaration

    Swift

    static func deferred(_ observableFactory: @escaping () throws -> Infallible<Element>)
        -> Infallible<Element>

    Parameters

    observableFactory

    Observable factory function to invoke for each observer that subscribes to the resulting sequence.

    Return Value

    An observable sequence whose observers trigger an invocation of the given observable factory function.

Filter

  • filter(_:) Extension method

    Filters the elements of an observable sequence based on a predicate.

    Declaration

    Swift

    func filter(_ predicate: @escaping (Element) -> Bool)
        -> Infallible<Element>

    Parameters

    predicate

    A function to test each source element for a condition.

    Return Value

    An observable sequence that contains elements from the input sequence that satisfy the condition.

Map

  • map(_:) Extension method

    Projects each element of an observable sequence into a new form.

    Declaration

    Swift

    func map<Result>(_ transform: @escaping (Element) -> Result)
        -> Infallible<Result>

    Parameters

    transform

    A transform function to apply to each source element.

    Return Value

    An observable sequence whose elements are the result of invoking the transform function on each element of source.

  • compactMap(_:) Extension method

    Projects each element of an observable sequence into an optional form and filters all optional results.

    Declaration

    Swift

    func compactMap<Result>(_ transform: @escaping (Element) -> Result?)
        -> Infallible<Result>

    Parameters

    transform

    A transform function to apply to each source element and which returns an element or nil.

    Return Value

    An observable sequence whose elements are the result of filtering the transform function for each element of the source.

Distinct

  • distinctUntilChanged(_:) Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.

    Declaration

    Swift

    func distinctUntilChanged(_ keySelector: @escaping (Element) throws -> some Equatable)
        -> Infallible<Element>

    Parameters

    keySelector

    A function to compute the comparison key for each element.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.

  • distinctUntilChanged(_:) Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to the comparer.

    Declaration

    Swift

    func distinctUntilChanged(_ comparer: @escaping (Element, Element) throws -> Bool)
        -> Infallible<Element>

    Parameters

    comparer

    Equality comparer for computed key values.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on comparer, from the source sequence.

  • Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.

    Declaration

    Swift

    func distinctUntilChanged<K>(_ keySelector: @escaping (Element) throws -> K, comparer: @escaping (K, K) throws -> Bool)
        -> Infallible<Element>

    Parameters

    keySelector

    A function to compute the comparison key for each element.

    comparer

    Equality comparer for computed key values.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.

  • distinctUntilChanged(at:) Extension method

    Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object.

    Declaration

    Swift

    func distinctUntilChanged(at keyPath: KeyPath<Element, some Equatable>) ->
        Infallible<Element>

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on equality operator on the provided key path

Throttle

  • debounce(_:scheduler:) Extension method

    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.

    Declaration

    Swift

    func debounce(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Infallible<Element>

    Parameters

    dueTime

    Throttling duration for each element.

    scheduler

    Scheduler to run the throttle timers on.

    Return Value

    The throttled sequence.

  • 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.

    Declaration

    Swift

    func throttle(_ dueTime: RxTimeInterval, latest: Bool = true, scheduler: SchedulerType)
        -> Infallible<Element>

    Parameters

    dueTime

    Throttling duration for each element.

    latest

    Should latest element received in a dueTime wide time window since last element emission be emitted.

    scheduler

    Scheduler to run the throttle timers on.

    Return Value

    The throttled sequence.

FlatMap

  • flatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func flatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)
        -> Infallible<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

  • flatMapLatest(_:) Extension method

    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

    Declaration

    Swift

    func flatMapLatest<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)
        -> Infallible<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    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.

  • flatMapFirst(_:) Extension method

    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.

    Declaration

    Swift

    func flatMapFirst<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)
        -> Infallible<Source.Element>

    Parameters

    selector

    A transform function to apply to element that was observed while no observable is executing in parallel.

    Return Value

    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.

Concat

  • concat(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    func concat<Source>(_ second: Source) -> Infallible<Element> where Source : ObservableConvertibleType, Self.Element == Source.Element

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

  • concat(_:) Extension method

    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()

    Declaration

    Swift

    static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Infallible<Element>
        where Sequence.Element == Infallible<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    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()

    Declaration

    Swift

    static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Infallible<Element>
        where Collection.Element == Infallible<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    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()

    Declaration

    Swift

    static func concat(_ sources: Infallible<Element>...) -> Infallible<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func concatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)
        -> Infallible<Source.Element>

    Return Value

    An observable sequence that contains the elements of each observed inner sequence, in sequential order.

Merge

  • merge(_:) Extension method

    Merges elements from all observable sequences from collection into a single observable sequence.

    Declaration

    Swift

    static func merge<Collection>(_ sources: Collection) -> Infallible<Element> where Collection : Collection, Collection.Element == Infallible<Self.Element>

    Parameters

    sources

    Collection of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

  • merge(_:) Extension method

    Merges elements from all infallible sequences from array into a single infallible sequence.

    Declaration

    Swift

    static func merge(_ sources: [Infallible<Element>]) -> Infallible<Element>

    Parameters

    sources

    Array of infallible sequences to merge.

    Return Value

    The infallible sequence that merges the elements of the infallible sequences.

  • merge(_:) Extension method

    Merges elements from all infallible sequences into a single infallible sequence.

    Declaration

    Swift

    static func merge(_ sources: Infallible<Element>...) -> Infallible<Element>

    Parameters

    sources

    Collection of infallible sequences to merge.

    Return Value

    The infallible sequence that merges the elements of the infallible sequences.

Scan

  • scan(into:accumulator:) Extension method

    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.

    Declaration

    Swift

    func scan<Seed>(into seed: Seed, accumulator: @escaping (inout Seed, Element) -> Void)
        -> Infallible<Seed>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    An accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing the accumulated values.

  • scan(_:accumulator:) Extension method

    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.

    Declaration

    Swift

    func scan<Seed>(_ seed: Seed, accumulator: @escaping (Seed, Element) -> Seed)
        -> Infallible<Seed>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    An accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing the accumulated values.

Start with

  • startWith(_:) Extension method

    Prepends a value to an observable sequence.

    Declaration

    Swift

    func startWith(_ element: Element) -> Infallible<Element>

    Parameters

    element

    Element to prepend to the specified sequence.

    Return Value

    The source sequence prepended with the specified values.

Take and Skip {

  • take(until:) Extension method

    Returns the elements from the source observable sequence until the other observable sequence produces an element.

    Declaration

    Swift

    func take(until other: some InfallibleType)
        -> Infallible<Element>

    Parameters

    other

    Observable sequence that terminates propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.

  • take(until:) Extension method

    Returns the elements from the source observable sequence until the other observable sequence produces an element.

    Declaration

    Swift

    func take(until other: some ObservableType)
        -> Infallible<Element>

    Parameters

    other

    Observable sequence that terminates propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.

  • take(until:behavior:) Extension method

    Returns elements from an observable sequence until the specified condition is true.

    Declaration

    Swift

    func take(
        until predicate: @escaping (Element) throws -> Bool,
        behavior: TakeBehavior = .exclusive
    )
        -> Infallible<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    behavior

    Whether or not to include the last element matching the predicate. Defaults to exclusive.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.

  • take(while:behavior:) Extension method

    Returns elements from an observable sequence as long as a specified condition is true.

    Declaration

    Swift

    func take(
        while predicate: @escaping (Element) throws -> Bool,
        behavior: TakeBehavior = .exclusive
    )
        -> Infallible<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

  • take(_:) Extension method

    Returns a specified number of contiguous elements from the start of an observable sequence.

    Declaration

    Swift

    func take(_ count: Int) -> Infallible<Element>

    Parameters

    count

    The number of elements to return.

    Return Value

    An observable sequence that contains the specified number of elements from the start of the input sequence.

  • take(for:scheduler:) Extension method

    Takes elements for the specified duration from the start of the infallible source sequence, using the specified scheduler to run timers.

    Declaration

    Swift

    func take(for duration: RxTimeInterval, scheduler: SchedulerType)
        -> Infallible<Element>

    Parameters

    duration

    Duration for taking elements from the start of the sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An infallible sequence with the elements taken during the specified duration from the start of the source sequence.

  • skip(while:) Extension method

    Bypasses elements in an infallible sequence as long as a specified condition is true and then returns the remaining elements.

    Declaration

    Swift

    func skip(while predicate: @escaping (Element) throws -> Bool) -> Infallible<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An infallible 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.

  • skip(until:) Extension method

    Returns the elements from the source infallible sequence that are emitted after the other infallible sequence produces an element.

    Declaration

    Swift

    func skip(until other: some ObservableType)
        -> Infallible<Element>

    Parameters

    other

    Infallible sequence that starts propagation of elements of the source sequence.

    Return Value

    An infallible sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.

Share

  • share(replay:scope:) Extension method

    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.

    Declaration

    Swift

    func share(replay: Int = 0, scope: SubjectLifetimeScope = .whileConnected)
        -> Infallible<Element>

    Parameters

    replay

    Maximum element count of the replay buffer.

    scope

    Lifetime scope of sharing subject. For more information see SubjectLifetimeScope enum.

    Return Value

    An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.

withUnretained

  • Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

    In the case the provided object cannot be retained successfully, the sequence will complete.

    Note

    Be careful when using this operator in a sequence that has a buffer or replay, for example share(replay: 1), as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.

    Declaration

    Swift

    func withUnretained<Object: AnyObject, Out>(
        _ obj: Object,
        resultSelector: @escaping (Object, Element) -> Out
    ) -> Infallible<Out>

    Parameters

    obj

    The object to provide an unretained reference on.

    resultSelector

    A function to combine the unretained referenced on obj and the value of the observable sequence.

    Return Value

    An observable sequence that contains the result of resultSelector being called with an unretained reference on obj and the values of the original sequence.

  • withUnretained(_:) Extension method

    Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

    In the case the provided object cannot be retained successfully, the sequence will complete.

    Note

    Be careful when using this operator in a sequence that has a buffer or replay, for example share(replay: 1), as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.

    Declaration

    Swift

    func withUnretained<Object>(_ obj: Object) -> Infallible<(Object, Element)> where Object : AnyObject

    Parameters

    obj

    The object to provide an unretained reference on.

    Return Value

    An observable sequence of tuples that contains both an unretained reference on obj and the values of the original sequence.

withLatestFrom

  • Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.

    Note

    Elements emitted by self before the second source has emitted any values will be omitted.

    Declaration

    Swift

    func withLatestFrom<Source, ResultType>(_ second: Source, resultSelector: @escaping (Element, Source.Element) throws -> ResultType) -> Infallible<ResultType> where Source : InfallibleType

    Parameters

    second

    Second observable source.

    resultSelector

    Function to invoke for each element from the self combined with the latest element from the second source, if any.

    Return Value

    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.

  • withLatestFrom(_:) Extension method

    Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when self emits an element.

    Note

    Elements emitted by self before the second source has emitted any values will be omitted.

    Declaration

    Swift

    func withLatestFrom<Source>(_ second: Source) -> Infallible<Source.Element> where Source : InfallibleType

    Parameters

    second

    Second observable source.

    Return Value

    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.

Zip

  • zip(_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, resultSelector: @escaping (E1, E2) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2, E3>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:_:_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2, E3, E4>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<E1, E2, E3, E4, E5>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<E1, E2, E3, E4, E5, E6>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, _ source6: Infallible<E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, _ source6: Infallible<E6>, _ source7: Infallible<E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, _ source6: Infallible<E6>, _ source7: Infallible<E7>, _ source8: Infallible<E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Subscribes an element handler, a completion handler and disposed handler to an observable sequence.

    Error callback is not exposed because Infallible can’t error out.

    Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.

    Note

    If object can’t be retained, none of the other closures will be invoked.

    Declaration

    Swift

    func subscribe<Object: AnyObject>(
        with object: Object,
        onNext: ((Object, Element) -> Void)? = nil,
        onCompleted: ((Object) -> Void)? = nil,
        onDisposed: ((Object) -> Void)? = nil
    ) -> Disposable

    Parameters

    object

    The object to provide an unretained reference on.

    onNext

    Action to invoke for each element in the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence. gracefully completed, errored, or if the generation is canceled by disposing subscription)

    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)

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes an element handler, a completion handler and disposed handler to an observable sequence.

    Error callback is not exposed because Infallible can’t error out.

    Declaration

    Swift

    func subscribe(
        onNext: ((Element) -> Void)? = nil,
        onCompleted: (() -> Void)? = nil,
        onDisposed: (() -> Void)? = nil
    ) -> Disposable

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence. gracefully completed, errored, or if the generation is canceled by disposing subscription)

    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)

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • subscribe(_:) Extension method

    Subscribes an event handler to an observable sequence.

    Declaration

    Swift

    func subscribe(_ on: @escaping (InfallibleEvent<Element>) -> Void) -> Disposable

    Parameters

    on

    Action to invoke for each event in the observable sequence.

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

Available where Element == Any

  • combineLatest(_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: InfallibleType, O2: InfallibleType>
    (_ source1: O1, _ source2: O2)
        -> Infallible<(O1.Element, O2.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: InfallibleType, O2: InfallibleType, O3: InfallibleType>
    (_ source1: O1, _ source2: O2, _ source3: O3)
        -> Infallible<(O1.Element, O2.Element, O3.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: InfallibleType, O2: InfallibleType, O3: InfallibleType, O4: InfallibleType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)
        -> Infallible<(O1.Element, O2.Element, O3.Element, O4.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: InfallibleType, O2: InfallibleType, O3: InfallibleType, O4: InfallibleType, O5: InfallibleType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)
        -> Infallible<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: InfallibleType, O2: InfallibleType, O3: InfallibleType, O4: InfallibleType, O5: InfallibleType, O6: InfallibleType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)
        -> Infallible<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: InfallibleType, O2: InfallibleType, O3: InfallibleType, O4: InfallibleType, O5: InfallibleType, O6: InfallibleType, O7: InfallibleType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)
        -> Infallible<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: InfallibleType, O2: InfallibleType, O3: InfallibleType, O4: InfallibleType, O5: InfallibleType, O6: InfallibleType, O7: InfallibleType, O8: InfallibleType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)
        -> Infallible<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

Available where Element: Equatable

  • distinctUntilChanged() Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to equality operator.

    Declaration

    Swift

    func distinctUntilChanged()
        -> Infallible<Element>

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence.

================================================ FILE: docs/Protocols/ObservableConvertibleType.html ================================================ ObservableConvertibleType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ObservableConvertibleType

public protocol ObservableConvertibleType

Type that can be converted to observable sequence (Observable<Element>).

================================================ FILE: docs/Protocols/ObservableType.html ================================================ ObservableType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ObservableType

public protocol ObservableType : ObservableConvertibleType

Represents a push style sequence.

  • 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.

    Declaration

    Swift

    func subscribe<Observer>(_ observer: Observer) -> Disposable where Observer : ObserverType, Self.Element == Observer.Element

    Return Value

    Subscription for observer that can be used to cancel production of sequence elements and free resources.

  • subscribe(_:) Extension method

    Subscribes an event handler to an observable sequence.

    Declaration

    Swift

    func subscribe(_ on: @escaping (Event<Element>) -> Void) -> Disposable

    Parameters

    on

    Action to invoke for each event in the observable sequence.

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

    Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.

    Note

    If object can’t be retained, none of the other closures will be invoked.

    Declaration

    Swift

    func subscribe<Object: AnyObject>(
        with object: Object,
        onNext: ((Object, Element) -> Void)? = nil,
        onError: ((Object, Swift.Error) -> Void)? = nil,
        onCompleted: ((Object) -> Void)? = nil,
        onDisposed: ((Object) -> Void)? = nil
    ) -> Disposable

    Parameters

    object

    The object to provide an unretained reference on.

    onNext

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

    Declaration

    Swift

    func subscribe(
        onNext: ((Element) -> Void)? = nil,
        onError: ((Swift.Error) -> Void)? = nil,
        onCompleted: (() -> Void)? = nil,
        onDisposed: (() -> Void)? = nil
    ) -> Disposable

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • asObservable() Extension method

    Default implementation of converting ObservableType to Observable.

    Declaration

    Swift

    func asObservable() -> Observable<Element>
  • amb(_:) Extension method

    Propagates the observable sequence that reacts first.

    Declaration

    Swift

    static func amb<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence that surfaces any of the given sequences, whichever reacted first.

  • amb(_:) Extension method

    Propagates the observable sequence that reacts first.

    Declaration

    Swift

    func amb<O2: ObservableType>
    (_ right: O2)
        -> Observable<Element> where O2.Element == Element

    Parameters

    right

    Second observable sequence.

    Return Value

    An observable sequence that surfaces either of the given sequences, whichever reacted first.

  • 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.

    Declaration

    Swift

    func buffer(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType)
        -> Observable<[Element]>

    Parameters

    timeSpan

    Maximum time length of a buffer.

    count

    Maximum element count of a buffer.

    scheduler

    Scheduler to run buffering timers on.

    Return Value

    An observable sequence of buffers.

  • catch(_:) Extension method

    Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

    Declaration

    Swift

    func `catch`(_ handler: @escaping (Swift.Error) throws -> Observable<Element>)
        -> Observable<Element>

    Parameters

    handler

    Error handler function, producing another observable sequence.

    Return Value

    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.

  • catchError(_:) Extension method

    Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catch(_:﹚")
    func catchError(_ handler: @escaping (Swift.Error) throws -> Observable<Element>)
        -> Observable<Element>

    Parameters

    handler

    Error handler function, producing another observable sequence.

    Return Value

    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.

  • catchAndReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    func catchAndReturn(_ element: Element)
        -> Observable<Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

  • catchErrorJustReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catchAndReturn(_:﹚")
    func catchErrorJustReturn(_ element: Element)
        -> Observable<Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

  • catchError(_:) Extension method

    Continues an observable sequence that is terminated by an error with the next observable sequence.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catch(onSuccess:onFailure:onDisposed:﹚")
    static func catchError<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.

  • catch(sequence:) Extension method

    Continues an observable sequence that is terminated by an error with the next observable sequence.

    Declaration

    Swift

    static func `catch`<Sequence: Swift.Sequence>(sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.

  • retry() Extension method

    Repeats the source observable sequence until it successfully terminates.

    This could potentially create an infinite sequence.

    Declaration

    Swift

    func retry() -> Observable<Element>

    Return Value

    Observable sequence to repeat until it successfully terminates.

  • retry(_:) Extension method

    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)

    Declaration

    Swift

    func retry(_ maxAttemptCount: Int)
        -> Observable<Element>

    Parameters

    maxAttemptCount

    Maximum number of times to repeat the sequence.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable<Element>
        where Collection.Element: ObservableType

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • combineLatest(_:) Extension method

    Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<Collection: Swift.Collection>(_ collection: Collection) -> Observable<[Element]>
        where Collection.Element: ObservableType, Collection.Element.Element == Element

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType>
    (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • compactMap(_:) Extension method

    Projects each element of an observable sequence into an optional form and filters all optional results.

    Declaration

    Swift

    func compactMap<Result>(_ transform: @escaping (Element) throws -> Result?)
        -> Observable<Result>

    Parameters

    transform

    A transform function to apply to each source element and which returns an element or nil.

    Return Value

    An observable sequence whose elements are the result of filtering the transform function for each element of the source.

  • concat(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    func concat<Source>(_ second: Source) -> Observable<Element> where Source : ObservableConvertibleType, Self.Element == Source.Element

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

  • concat(_:) Extension method

    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()

    Declaration

    Swift

    static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>
        where Sequence.Element == Observable<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    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()

    Declaration

    Swift

    static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Observable<Element>
        where Collection.Element == Observable<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    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()

    Declaration

    Swift

    static func concat(_ sources: Observable<Element>...) -> Observable<Element>

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

create

  • create(_:) Extension method

    Creates an observable sequence from a specified subscribe method implementation.

    Declaration

    Swift

    static func create(_ subscribe: @escaping (AnyObserver<Element>) -> Disposable) -> Observable<Element>

    Parameters

    subscribe

    Implementation of the resulting observable sequence’s subscribe method.

    Return Value

    The observable sequence with the specified implementation for the subscribe method.

  • debounce(_:scheduler:) Extension method

    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.

    Declaration

    Swift

    func debounce(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Throttling duration for each element.

    scheduler

    Scheduler to run the throttle timers on.

    Return Value

    The throttled sequence.

  • Prints received events for all observers on standard output.

    Declaration

    Swift

    func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function)
        -> Observable<Element>

    Parameters

    identifier

    Identifier that is printed together with event description to standard output.

    trimOutput

    Should output be trimmed to max 40 characters.

    Return Value

    An observable sequence whose events are printed to standard output.

  • ifEmpty(default:) Extension method

    Emits elements from the source observable sequence, or a default element if the source observable sequence is empty.

    Declaration

    Swift

    func ifEmpty(default: Element) -> Observable<Element>

    Parameters

    default

    Default element to be sent if the source does not emit any elements

    Return Value

    An observable sequence which emits default element end completes in case the original sequence is empty

  • deferred(_:) Extension method

    Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.

    Declaration

    Swift

    static func deferred(_ observableFactory: @escaping () throws -> Observable<Element>)
        -> Observable<Element>

    Parameters

    observableFactory

    Observable factory function to invoke for each observer that subscribes to the resulting sequence.

    Return Value

    An observable sequence whose observers trigger an invocation of the given observable factory function.

  • delay(_:scheduler:) Extension method

    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.

    Declaration

    Swift

    func delay(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Relative time shift of the source by.

    scheduler

    Scheduler to run the subscription delay timer on.

    Return Value

    the source Observable shifted in time by the specified delay.

  • Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.

    Declaration

    Swift

    func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Relative time shift of the subscription.

    scheduler

    Scheduler to run the subscription delay timer on.

    Return Value

    Time-shifted sequence.

  • distinctUntilChanged(_:) Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.

    Declaration

    Swift

    func distinctUntilChanged(_ keySelector: @escaping (Element) throws -> some Equatable)
        -> Observable<Element>

    Parameters

    keySelector

    A function to compute the comparison key for each element.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.

  • distinctUntilChanged(_:) Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to the comparer.

    Declaration

    Swift

    func distinctUntilChanged(_ comparer: @escaping (Element, Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    comparer

    Equality comparer for computed key values.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on comparer, from the source sequence.

  • Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.

    Declaration

    Swift

    func distinctUntilChanged<K>(_ keySelector: @escaping (Element) throws -> K, comparer: @escaping (K, K) throws -> Bool)
        -> Observable<Element>

    Parameters

    keySelector

    A function to compute the comparison key for each element.

    comparer

    Equality comparer for computed key values.

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.

  • distinctUntilChanged(at:) Extension method

    Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object.

    Declaration

    Swift

    func distinctUntilChanged(at keyPath: KeyPath<Element, some Equatable>) ->
        Observable<Element>

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on equality operator on the provided key path

  • Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

    Declaration

    Swift

    func `do`(onNext: ((Element) throws -> Void)? = nil, afterNext: ((Element) throws -> Void)? = nil, onError: ((Swift.Error) throws -> Void)? = nil, afterError: ((Swift.Error) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, afterCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil)
        -> Observable<Element>

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    afterNext

    Action to invoke for each element after the observable has passed an onNext event along to its downstream.

    onError

    Action to invoke upon errored termination of the observable sequence.

    afterError

    Action to invoke after errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    afterCompleted

    Action to invoke after graceful termination of the observable sequence.

    onSubscribe

    Action to invoke before subscribing to source observable sequence.

    onSubscribed

    Action to invoke after subscribing to source observable sequence.

    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.

    Return Value

    The source sequence with the side-effecting behavior applied.

  • elementAt(_:) Extension method

    Returns a sequence emitting only element n emitted by an Observable

    Declaration

    Swift

    @available(*, deprecated, renamed: "element(at:﹚")
    func elementAt(_ index: Int)
        -> Observable<Element>

    Parameters

    index

    The index of the required element (starting from 0).

    Return Value

    An observable sequence that emits the desired element as its own sole emission.

  • element(at:) Extension method

    Returns a sequence emitting only element n emitted by an Observable

    Declaration

    Swift

    func element(at index: Int)
        -> Observable<Element>

    Parameters

    index

    The index of the required element (starting from 0).

    Return Value

    An observable sequence that emits the desired element as its own sole emission.

  • empty() Extension method

    Returns an empty observable sequence, using the specified scheduler to send out the single Completed message.

    Declaration

    Swift

    static func empty() -> Observable<Element>

    Return Value

    An observable sequence with no elements.

  • enumerated() Extension method

    Enumerates the elements of an observable sequence.

    Declaration

    Swift

    func enumerated()
        -> Observable<(index: Int, element: Element)>

    Return Value

    An observable sequence that contains tuples of source sequence elements and their indexes.

  • error(_:) Extension method

    Returns an observable sequence that terminates with an error.

    Declaration

    Swift

    static func error(_ error: Swift.Error) -> Observable<Element>

    Return Value

    The observable sequence that terminates with specified error.

  • filter(_:) Extension method

    Filters the elements of an observable sequence based on a predicate.

    Declaration

    Swift

    func filter(_ predicate: @escaping (Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each source element for a condition.

    Return Value

    An observable sequence that contains elements from the input sequence that satisfy the condition.

  • ignoreElements() Extension method

    Skips elements and completes (or errors) when the observable sequence completes (or errors). Equivalent to filter that always returns false.

    Declaration

    Swift

    func ignoreElements()
        -> Observable<Never>

    Return Value

    An observable sequence that skips all elements of the source sequence.

  • 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.

    Declaration

    Swift

    static func generate(initialState: Element, condition: @escaping (Element) throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: @escaping (Element) throws -> Element) -> Observable<Element>

    Parameters

    initialState

    Initial state.

    condition

    Condition to terminate generation (upon returning false).

    iterate

    Iteration step function.

    scheduler

    Scheduler on which to run the generator loop.

    Return Value

    The generated sequence.

  • groupBy(keySelector:) Extension method

    Undocumented

    Declaration

    Swift

    func groupBy<Key: Hashable>(keySelector: @escaping (Element) throws -> Key)
        -> Observable<GroupedObservable<Key, Element>>
  • just(_:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element) -> Observable<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    Return Value

    An observable sequence containing the single specified element.

  • just(_:scheduler:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Observable<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    scheduler

    Scheduler to send the single element on.

    Return Value

    An observable sequence containing the single specified element.

  • map(_:) Extension method

    Projects each element of an observable sequence into a new form.

    Declaration

    Swift

    func map<Result>(_ transform: @escaping (Element) throws -> Result)
        -> Observable<Result>

    Parameters

    transform

    A transform function to apply to each source element.

    Return Value

    An observable sequence whose elements are the result of invoking the transform function on each element of source.

  • materialize() Extension method

    Convert any Observable into an Observable of its events.

    Declaration

    Swift

    func materialize() -> Observable<Event<Element>>

    Return Value

    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.

  • flatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func flatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

  • flatMapFirst(_:) Extension method

    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.

    Declaration

    Swift

    func flatMapFirst<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Parameters

    selector

    A transform function to apply to element that was observed while no observable is executing in parallel.

    Return Value

    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.

  • merge(_:) Extension method

    Merges elements from all observable sequences from collection into a single observable sequence.

    Declaration

    Swift

    static func merge<Collection>(_ sources: Collection) -> Observable<Element> where Collection : Collection, Collection.Element == Observable<Self.Element>

    Parameters

    sources

    Collection of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

  • merge(_:) Extension method

    Merges elements from all observable sequences from array into a single observable sequence.

    Declaration

    Swift

    static func merge(_ sources: [Observable<Element>]) -> Observable<Element>

    Parameters

    sources

    Array of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

  • merge(_:) Extension method

    Merges elements from all observable sequences into a single observable sequence.

    Declaration

    Swift

    static func merge(_ sources: Observable<Element>...) -> Observable<Element>

    Parameters

    sources

    Collection of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

concatMap

  • concatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func concatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Return Value

    An observable sequence that contains the elements of each observed inner sequence, in sequential order.

  • multicast(_:selector:) Extension method

    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.

    Declaration

    Swift

    func multicast<Subject: SubjectType, Result>(_ subjectSelector: @escaping () throws -> Subject, selector: @escaping (Observable<Subject.Element>) throws -> Observable<Result>)
        -> Observable<Result> where Subject.Observer.Element == Element

    Parameters

    subjectSelector

    Factory function to create an intermediate subject through which the source sequence’s elements will be multicast to the selector function.

    selector

    Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject.

    Return Value

    An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.

  • publish() Extension method

    Returns a connectable observable sequence that shares a single subscription to the underlying sequence.

    This operator is a specialization of multicast using a PublishSubject.

    Declaration

    Swift

    func publish() -> ConnectableObservable<Element>

    Return Value

    A connectable observable sequence that shares a single subscription to the underlying sequence.

  • replay(_:) Extension method

    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.

    Declaration

    Swift

    func replay(_ bufferSize: Int)
        -> ConnectableObservable<Element>

    Parameters

    bufferSize

    Maximum element count of the replay buffer.

    Return Value

    A connectable observable sequence that shares a single subscription to the underlying sequence.

  • replayAll() Extension method

    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.

    Declaration

    Swift

    func replayAll()
        -> ConnectableObservable<Element>

    Return Value

    A connectable observable sequence that shares a single subscription to the underlying sequence.

  • multicast(_:) Extension method

    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.

    Declaration

    Swift

    func multicast<Subject: SubjectType>(_ subject: Subject)
        -> ConnectableObservable<Subject.Element> where Subject.Observer.Element == Element

    Parameters

    subject

    Subject to push source elements into.

    Return Value

    A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.

  • multicast(makeSubject:) Extension method

    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.

    Declaration

    Swift

    func multicast<Subject: SubjectType>(makeSubject: @escaping () -> Subject)
        -> ConnectableObservable<Subject.Element> where Subject.Observer.Element == Element

    Parameters

    makeSubject

    Factory function used to instantiate a subject for each connection.

    Return Value

    A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.

  • never() Extension method

    Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

    Declaration

    Swift

    static func never() -> Observable<Element>

    Return Value

    An observable sequence whose observers will never get called.

  • observe(on:) Extension method

    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.

    Declaration

    Swift

    func observe(on scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to notify observers on.

    Return Value

    The source sequence whose observations happen on the specified scheduler.

  • observeOn(_:) Extension method

    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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "observe(on:﹚")
    func observeOn(_ scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to notify observers on.

    Return Value

    The source sequence whose observations happen on the specified scheduler.

  • from(optional:) Extension method

    Converts a optional to an observable sequence.

    Declaration

    Swift

    static func from(optional: Element?) -> Observable<Element>

    Parameters

    optional

    Optional element in the resulting observable sequence.

    Return Value

    An observable sequence containing the wrapped value or not from given optional.

  • from(optional:scheduler:) Extension method

    Converts a optional to an observable sequence.

    Declaration

    Swift

    static func from(optional: Element?, scheduler: ImmediateSchedulerType) -> Observable<Element>

    Parameters

    optional

    Optional element in the resulting observable sequence.

    scheduler

    Scheduler to send the optional element on.

    Return Value

    An observable sequence containing the wrapped value or not from given optional.

  • 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.

    Declaration

    Swift

    func reduce<A, Result>(_ seed: A, accumulator: @escaping (A, Element) throws -> A, mapResult: @escaping (A) throws -> Result)
        -> Observable<Result>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    A accumulator function to be invoked on each element.

    mapResult

    A function to transform the final accumulator value into the result value.

    Return Value

    An observable sequence containing a single element with the final accumulator value.

  • reduce(_:accumulator:) Extension method

    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.

    Declaration

    Swift

    func reduce<A>(_ seed: A, accumulator: @escaping (A, Element) throws -> A)
        -> Observable<A>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    A accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing a single element with the final accumulator value.

  • repeatElement(_:scheduler:) Extension method

    Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages.

    Declaration

    Swift

    static func repeatElement(_ element: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Parameters

    element

    Element to repeat.

    scheduler

    Scheduler to run the producer loop on.

    Return Value

    An observable sequence that repeats the given element infinitely.

  • retry(when:) Extension method

    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.

    Declaration

    Swift

    func retry<Error: Swift.Error>(when notificationHandler: @escaping (Observable<Error>) -> some ObservableType)
        -> Observable<Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • retryWhen(_:) Extension method

    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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "retry(when:﹚")
    func retryWhen<Error: Swift.Error>(_ notificationHandler: @escaping (Observable<Error>) -> some ObservableType)
        -> Observable<Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • retry(when:) Extension method

    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.

    Declaration

    Swift

    func retry(when notificationHandler: @escaping (Observable<Swift.Error>) -> some ObservableType)
        -> Observable<Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • retryWhen(_:) Extension method

    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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "retry(when:﹚")
    func retryWhen(_ notificationHandler: @escaping (Observable<Swift.Error>) -> some ObservableType)
        -> Observable<Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • sample(_:defaultValue:) Extension method

    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, you may provide a default value to be emitted, instead to the resulting sequence otherwise no element is sent.

    Declaration

    Swift

    func sample(_ sampler: some ObservableType, defaultValue: Element? = nil)
        -> Observable<Element>

    Parameters

    sampler

    Sampling tick sequence.

    defaultValue

    a value to return if there are no new elements between sampler ticks

    Return Value

    Sampled observable sequence.

  • scan(into:accumulator:) Extension method

    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.

    Declaration

    Swift

    func scan<A>(into seed: A, accumulator: @escaping (inout A, Element) throws -> Void)
        -> Observable<A>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    An accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing the accumulated values.

  • scan(_:accumulator:) Extension method

    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.

    Declaration

    Swift

    func scan<A>(_ seed: A, accumulator: @escaping (A, Element) throws -> A)
        -> Observable<A>

    Parameters

    seed

    The initial accumulator value.

    accumulator

    An accumulator function to be invoked on each element.

    Return Value

    An observable sequence containing the accumulated values.

of

  • of(_:scheduler:) Extension method

    This method creates a new Observable instance with a variable number of elements.

    Declaration

    Swift

    static func of(_ elements: Element..., scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Parameters

    elements

    Elements to generate.

    scheduler

    Scheduler to send elements on. If nil, elements are sent immediately on subscription.

    Return Value

    The observable sequence whose elements are pulled from the given arguments.

  • from(_:scheduler:) Extension method

    Converts an array to an observable sequence.

    Declaration

    Swift

    static func from(_ array: [Element], scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Return Value

    The observable sequence whose elements are pulled from the given enumerable sequence.

  • from(_:scheduler:) Extension method

    Converts a sequence to an observable sequence.

    Declaration

    Swift

    static func from<Sequence>(_ sequence: Sequence, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element> where Sequence : Sequence, Self.Element == Sequence.Element

    Return Value

    The observable sequence whose elements are pulled from the given enumerable sequence.

  • share(replay:scope:) Extension method

    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.

    Declaration

    Swift

    func share(replay: Int = 0, scope: SubjectLifetimeScope = .whileConnected)
        -> Observable<Element>

    Parameters

    replay

    Maximum element count of the replay buffer.

    scope

    Lifetime scope of sharing subject. For more information see SubjectLifetimeScope enum.

    Return Value

    An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.

  • single() Extension method

    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.

    Declaration

    Swift

    func single()
        -> Observable<Element>

    Return Value

    An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted.

  • single(_:) Extension method

    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.

    Declaration

    Swift

    func single(_ predicate: @escaping (Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each source element for a condition.

    Return Value

    An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted.

  • skip(_:) Extension method

    Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.

    Declaration

    Swift

    func skip(_ count: Int)
        -> Observable<Element>

    Parameters

    count

    The number of elements to skip before returning the remaining elements.

    Return Value

    An observable sequence that contains the elements that occur after the specified index in the input sequence.

  • skip(_:scheduler:) Extension method

    Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

    Declaration

    Swift

    func skip(_ duration: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    duration

    Duration for skipping elements from the start of the sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence with the elements skipped during the specified duration from the start of the source sequence.

  • skip(until:) Extension method

    Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.

    Declaration

    Swift

    func skip(until other: some ObservableType)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that starts propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.

  • skipUntil(_:) Extension method

    Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "skip(until:﹚")
    func skipUntil(_ other: some ObservableType)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that starts propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.

  • skip(while:) Extension method

    Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.

    Declaration

    Swift

    func skip(while predicate: @escaping (Element) throws -> Bool) -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    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.

  • skipWhile(_:) Extension method

    Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.

    Declaration

    Swift

    @available(*, deprecated, renamed: "skip(while:﹚")
    func skipWhile(_ predicate: @escaping (Element) throws -> Bool) -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    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.

  • startWith(_:) Extension method

    Prepends a sequence of values to an observable sequence.

    Declaration

    Swift

    func startWith(_ elements: Element ...)
        -> Observable<Element>

    Parameters

    elements

    Elements to prepend to the specified sequence.

    Return Value

    The source sequence prepended with the specified values.

  • subscribe(on:) Extension method

    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.

    Declaration

    Swift

    func subscribe(on scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to perform subscription and unsubscription actions on.

    Return Value

    The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.

  • subscribeOn(_:) Extension method

    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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "subscribe(on:﹚")
    func subscribeOn(_ scheduler: ImmediateSchedulerType)
        -> Observable<Element>

    Parameters

    scheduler

    Scheduler to perform subscription and unsubscription actions on.

    Return Value

    The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.

  • flatMapLatest(_:) Extension method

    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

    Declaration

    Swift

    func flatMapLatest<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Observable<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    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.

  • flatMapLatest(_:) Extension method

    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

    Declaration

    Swift

    func flatMapLatest<Source: InfallibleType>(_ selector: @escaping (Element) throws -> Source)
        -> Infallible<Source.Element>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    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.

  • ifEmpty(switchTo:) Extension method

    Returns the elements of the specified sequence or switchTo sequence if the sequence is empty.

    Declaration

    Swift

    func ifEmpty(switchTo other: Observable<Element>) -> Observable<Element>

    Parameters

    other

    Observable sequence being returned when source sequence is empty.

    Return Value

    Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.

  • take(_:) Extension method

    Returns a specified number of contiguous elements from the start of an observable sequence.

    Declaration

    Swift

    func take(_ count: Int)
        -> Observable<Element>

    Parameters

    count

    The number of elements to return.

    Return Value

    An observable sequence that contains the specified number of elements from the start of the input sequence.

  • take(for:scheduler:) Extension method

    Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

    Declaration

    Swift

    func take(for duration: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    duration

    Duration for taking elements from the start of the sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence with the elements taken during the specified duration from the start of the source sequence.

  • take(_:scheduler:) Extension method

    Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(for:scheduler:﹚")
    func take(_ duration: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    duration

    Duration for taking elements from the start of the sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence with the elements taken during the specified duration from the start of the source sequence.

  • takeLast(_:) Extension method

    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.

    Declaration

    Swift

    func takeLast(_ count: Int)
        -> Observable<Element>

    Parameters

    count

    Number of elements to take from the end of the source sequence.

    Return Value

    An observable sequence containing the specified number of elements from the end of the source sequence.

  • take(until:) Extension method

    Returns the elements from the source observable sequence until the other observable sequence produces an element.

    Declaration

    Swift

    func take(until other: some ObservableType)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that terminates propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.

  • take(until:behavior:) Extension method

    Returns elements from an observable sequence until the specified condition is true.

    Declaration

    Swift

    func take(
        until predicate: @escaping (Element) throws -> Bool,
        behavior: TakeBehavior = .exclusive
    )
        -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    behavior

    Whether or not to include the last element matching the predicate. Defaults to exclusive.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.

  • take(while:behavior:) Extension method

    Returns elements from an observable sequence as long as a specified condition is true.

    Declaration

    Swift

    func take(
        while predicate: @escaping (Element) throws -> Bool,
        behavior: TakeBehavior = .exclusive
    )
        -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

  • takeUntil(_:) Extension method

    Returns the elements from the source observable sequence until the other observable sequence produces an element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(until:﹚")
    func takeUntil(_ other: some ObservableType)
        -> Observable<Element>

    Parameters

    other

    Observable sequence that terminates propagation of elements of the source sequence.

    Return Value

    An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.

  • takeUntil(_:predicate:) Extension method

    Returns elements from an observable sequence until the specified condition is true.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(until:behavior:﹚")
    func takeUntil(
        _ behavior: TakeBehavior,
        predicate: @escaping (Element) throws -> Bool
    )
        -> Observable<Element>

    Parameters

    behavior

    Whether or not to include the last element matching the predicate.

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.

  • takeWhile(_:) Extension method

    Returns elements from an observable sequence as long as a specified condition is true.

    Declaration

    Swift

    @available(*, deprecated, renamed: "take(while:﹚")
    func takeWhile(_ predicate: @escaping (Element) throws -> Bool)
        -> Observable<Element>

    Parameters

    predicate

    A function to test each element for a condition.

    Return Value

    An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

  • 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.

    Declaration

    Swift

    func throttle(_ dueTime: RxTimeInterval, latest: Bool = true, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Throttling duration for each element.

    latest

    Should latest element received in a dueTime wide time window since last element emission be emitted.

    scheduler

    Scheduler to run the throttle timers on.

    Return Value

    The throttled sequence.

  • timeout(_:scheduler:) Extension method

    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.

    Declaration

    Swift

    func timeout(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Maximum duration between values before a timeout occurs.

    scheduler

    Scheduler to run the timeout timer on.

    Return Value

    An observable sequence with a RxError.timeout in case of a timeout.

  • timeout(_:other:scheduler:) Extension method

    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.

    Declaration

    Swift

    func timeout<Source: ObservableConvertibleType>(_ dueTime: RxTimeInterval, other: Source, scheduler: SchedulerType)
        -> Observable<Element> where Element == Source.Element

    Parameters

    dueTime

    Maximum duration between values before a timeout occurs.

    other

    Sequence to return in case of a timeout.

    scheduler

    Scheduler to run the timeout timer on.

    Return Value

    The source sequence switching to the other sequence in case of a timeout.

  • toArray() Extension method

    Converts an Observable into a Single that emits the whole sequence as a single array and then terminates.

    For aggregation behavior see reduce.

    Declaration

    Swift

    func toArray()
        -> Single<[Element]>

    Return Value

    A Single sequence containing all the emitted elements as array.

  • using(_:observableFactory:) Extension method

    Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence’s lifetime.

    Declaration

    Swift

    static func using<Resource>(_ resourceFactory: @escaping () throws -> Resource, observableFactory: @escaping (Resource) throws -> Observable<Element>) -> Observable<Element> where Resource : Disposable

    Parameters

    resourceFactory

    Factory function to obtain a resource object.

    observableFactory

    Factory function to obtain an observable sequence that depends on the obtained resource.

    Return Value

    An observable sequence whose lifetime controls the lifetime of the dependent resource object.

  • 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.

    Declaration

    Swift

    func window(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType)
        -> Observable<Observable<Element>>

    Parameters

    timeSpan

    Maximum time length of a window.

    count

    Maximum element count of a window.

    scheduler

    Scheduler to run windowing timers on.

    Return Value

    An observable sequence of windows (instances of Observable).

  • Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.

    Note

    Elements emitted by self before the second source has emitted any values will be omitted.

    Declaration

    Swift

    func withLatestFrom<Source, ResultType>(_ second: Source, resultSelector: @escaping (Element, Source.Element) throws -> ResultType) -> Observable<ResultType> where Source : ObservableConvertibleType

    Parameters

    second

    Second observable source.

    resultSelector

    Function to invoke for each element from the self combined with the latest element from the second source, if any.

    Return Value

    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.

  • withLatestFrom(_:) Extension method

    Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when self emits an element.

    Note

    Elements emitted by self before the second source has emitted any values will be omitted.

    Declaration

    Swift

    func withLatestFrom<Source>(_ second: Source) -> Observable<Source.Element> where Source : ObservableConvertibleType

    Parameters

    second

    Second observable source.

    Return Value

    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.

  • Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

    In the case the provided object cannot be retained successfully, the sequence will complete.

    Note

    Be careful when using this operator in a sequence that has a buffer or replay, for example share(replay: 1), as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.

    Declaration

    Swift

    func withUnretained<Object: AnyObject, Out>(
        _ obj: Object,
        resultSelector: @escaping (Object, Element) -> Out
    ) -> Observable<Out>

    Parameters

    obj

    The object to provide an unretained reference on.

    resultSelector

    A function to combine the unretained referenced on obj and the value of the observable sequence.

    Return Value

    An observable sequence that contains the result of resultSelector being called with an unretained reference on obj and the values of the original sequence.

  • withUnretained(_:) Extension method

    Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

    In the case the provided object cannot be retained successfully, the sequence will complete.

    Note

    Be careful when using this operator in a sequence that has a buffer or replay, for example share(replay: 1), as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.

    Declaration

    Swift

    func withUnretained<Object>(_ obj: Object) -> Observable<(Object, Element)> where Object : AnyObject

    Parameters

    obj

    The object to provide an unretained reference on.

    Return Value

    An observable sequence of tuples that contains both an unretained reference on obj and the values of the original sequence.

  • zip(_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable<Element>
        where Collection.Element: ObservableType

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:) Extension method

    Merges the specified observable sequences into one observable sequence whenever all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    static func zip<Collection: Swift.Collection>(_ collection: Collection) -> Observable<[Element]>
        where Collection.Element: ObservableType, Collection.Element.Element == Element

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType>
    (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:_:_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • 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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)
        -> Observable<Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • asSingle() Extension method

    The asSingle operator throws a RxError.noElements or RxError.moreThanOneElement if the source Observable does not emit exactly one element before successfully completing.

    Declaration

    Swift

    func asSingle() -> Single<Element>

    Return Value

    An observable sequence that emits a single element when the source Observable has completed, or throws an exception if more (or none) of them are emitted.

  • first() Extension method

    The first operator emits only the very first item emitted by this Observable, or nil if this Observable completes without emitting anything.

    Declaration

    Swift

    func first() -> Single<Element?>

    Return Value

    An observable sequence that emits a single element or nil if the source observable sequence completes without emitting any items.

  • asMaybe() Extension method

    The asMaybe operator throws a RxError.moreThanOneElement if the source Observable does not emit at most one element before successfully completing.

    Declaration

    Swift

    func asMaybe() -> Maybe<Element>

    Return Value

    An observable sequence that emits a single element, completes when the source Observable has completed, or throws an exception if more of them are emitted.

Available where Element == Any

  • combineLatest(_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType>
    (_ source1: O1, _ source2: O2)
        -> Observable<(O1.Element, O2.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3)
        -> Observable<(O1.Element, O2.Element, O3.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • combineLatest(_:_:_:_:_:_:) Extension method

    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

Available where Element == Data

  • decode(type:decoder:) Extension method

    Attempt to decode the emitted Data using a provided decoder.

    Note

    If using a custom decoder, it must conform to the DataDecoder protocol.

    Declaration

    Swift

    func decode<Item: Decodable>(
        type: Item.Type,
        decoder: some DataDecoder
    ) -> Observable<Item>

    Parameters

    type

    A Decodable-conforming type to attempt to decode to

    decoder

    A capable decoder, e.g. JSONDecoder or PropertyListDecoder

    Return Value

    An Observable of the decoded type

Available where Element: EventConvertible

Available where Element: Equatable

  • distinctUntilChanged() Extension method

    Returns an observable sequence that contains only distinct contiguous elements according to equality operator.

    Declaration

    Swift

    func distinctUntilChanged()
        -> Observable<Element>

    Return Value

    An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence.

Available where Element: ObservableConvertibleType

  • merge() Extension method

    Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.

    Declaration

    Swift

    func merge() -> Observable<Element.Element>

    Return Value

    The observable sequence that merges the elements of the observable sequences.

  • merge(maxConcurrent:) Extension method

    Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.

    Declaration

    Swift

    func merge(maxConcurrent: Int)
        -> Observable<Element.Element>

    Parameters

    maxConcurrent

    Maximum number of inner observable sequences being subscribed to concurrently.

    Return Value

    The observable sequence that merges the elements of the inner sequences.

  • concat() Extension method

    Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.

    Declaration

    Swift

    func concat() -> Observable<Element.Element>

    Return Value

    An observable sequence that contains the elements of each observed inner sequence, in sequential order.

Available where Element: RxAbstractInteger

  • Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to generate and send out observer messages.

    Declaration

    Swift

    static func range(start: Element, count: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element>

    Parameters

    start

    The value of the first integer in the sequence.

    count

    The number of sequential integers to generate.

    scheduler

    Scheduler to run the generator loop on.

    Return Value

    An observable sequence that contains a range of sequential integral numbers.

Available where Element: ObservableConvertibleType

  • switchLatest() Extension method

    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.

    Declaration

    Swift

    func switchLatest() -> Observable<Element.Element>

    Return Value

    The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.

Available where Element: RxAbstractInteger

  • interval(_:scheduler:) Extension method

    Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.

    Declaration

    Swift

    static func interval(_ period: RxTimeInterval, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    period

    Period for producing the values in the resulting sequence.

    scheduler

    Scheduler to run the timer on.

    Return Value

    An observable sequence that produces a value after each period.

  • timer(_:period:scheduler:) Extension method

    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.

    Declaration

    Swift

    static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval? = nil, scheduler: SchedulerType)
        -> Observable<Element>

    Parameters

    dueTime

    Relative time at which to produce the first value.

    period

    Period to produce subsequent values.

    scheduler

    Scheduler to run timers on.

    Return Value

    An observable sequence that produces a value after due time has elapsed and then each period.

Available where Element == Any

  • zip(_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType>
    (_ source1: O1, _ source2: O2)
        -> Observable<(O1.Element, O2.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3)
        -> Observable<(O1.Element, O2.Element, O3.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • zip(_:_:_:_:_:_:_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>
    (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)
        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

Available where Element == Never

  • asCompletable() Extension method

    Declaration

    Swift

    func asCompletable()
        -> Completable

    Return Value

    An observable sequence that completes.

================================================ FILE: docs/Protocols/ObserverType.html ================================================ ObserverType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ObserverType

public protocol ObserverType

Supports push-style iteration over an observable sequence.

  • The type of elements in sequence that observer can observe.

    Declaration

    Swift

    associatedtype Element
  • Notify observer about sequence event.

    Declaration

    Swift

    func on(_ event: Event<Element>)

    Parameters

    event

    Event that occurred.

  • asObserver() Extension method

    Erases type of observer and returns canonical observer.

    Declaration

    Swift

    func asObserver() -> AnyObserver<Element>

    Return Value

    type erased observer.

  • mapObserver(_:) Extension method

    Transforms observer of type R to type E using custom transform method. Each event sent to result observer is transformed and sent to self.

    Declaration

    Swift

    func mapObserver<Result>(_ transform: @escaping (Result) throws -> Element) -> AnyObserver<Result>

    Return Value

    observer that transforms events.

  • onNext(_:) Extension method

    Convenience method equivalent to on(.next(element: Element))

    Declaration

    Swift

    func onNext(_ element: Element)

    Parameters

    element

    Next element to send to observer(s)

  • onCompleted() Extension method

    Convenience method equivalent to on(.completed)

    Declaration

    Swift

    func onCompleted()
  • onError(_:) Extension method

    Convenience method equivalent to on(.error(Swift.Error))

    Declaration

    Swift

    func onError(_ error: Swift.Error)

    Parameters

    error

    Swift.Error to send to observer(s)

================================================ FILE: docs/Protocols/PrimitiveSequenceType.html ================================================ PrimitiveSequenceType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

PrimitiveSequenceType

public protocol PrimitiveSequenceType

Observable sequences containing 0 or 1 element

  • Additional constraints

    Declaration

    Swift

    associatedtype Trait
  • Sequence element type

    Declaration

    Swift

    associatedtype Element
  • Declaration

    Swift

    var primitiveSequence: PrimitiveSequence<Trait, Element> { get }

    Return Value

    Observable sequence that represents self.

Available where Trait == CompletableTrait, Element == Never

  • andThen(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    func andThen<Element>(_ second: Single<Element>) -> Single<Element>

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

  • andThen(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    func andThen<Element>(_ second: Maybe<Element>) -> Maybe<Element>

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

  • andThen(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    func andThen(_ second: Completable) -> Completable

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

  • andThen(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    func andThen<Element>(_ second: Observable<Element>) -> Observable<Element>

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

Available where Trait == CompletableTrait, Element == Swift.Never

  • CompletableObserver Extension method

    Undocumented

    Declaration

    Swift

    typealias CompletableObserver = (CompletableEvent) -> Void
  • create(subscribe:) Extension method

    Creates an observable sequence from a specified subscribe method implementation.

    Declaration

    Swift

    static func create(subscribe: @escaping (@escaping CompletableObserver) -> Disposable) -> PrimitiveSequence<Trait, Element>

    Parameters

    subscribe

    Implementation of the resulting observable sequence’s subscribe method.

    Return Value

    The observable sequence with the specified implementation for the subscribe method.

  • subscribe(_:) Extension method

    Subscribes observer to receive events for this sequence.

    Declaration

    Swift

    func subscribe(_ observer: @escaping (CompletableEvent) -> Void) -> Disposable

    Return Value

    Subscription for observer that can be used to cancel production of sequence elements and free resources.

  • Subscribes a completion handler and an error handler for this sequence.

    Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.

    Note

    If object can’t be retained, none of the other closures will be invoked.

    Declaration

    Swift

    func subscribe<Object: AnyObject>(
        with object: Object,
        onCompleted: ((Object) -> Void)? = nil,
        onError: ((Object, Swift.Error) -> Void)? = nil,
        onDisposed: ((Object) -> Void)? = nil
    ) -> Disposable

    Parameters

    object

    The object to provide an unretained reference on.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes a completion handler and an error handler for this sequence.

    Declaration

    Swift

    func subscribe(
        onCompleted: (() -> Void)? = nil,
        onError: ((Swift.Error) -> Void)? = nil,
        onDisposed: (() -> Void)? = nil
    ) -> Disposable

    Parameters

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • error(_:) Extension method

    Returns an observable sequence that terminates with an error.

    Declaration

    Swift

    static func error(_ error: Swift.Error) -> Completable

    Return Value

    The observable sequence that terminates with specified error.

  • never() Extension method

    Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

    Declaration

    Swift

    static func never() -> Completable

    Return Value

    An observable sequence whose observers will never get called.

  • empty() Extension method

    Returns an empty observable sequence, using the specified scheduler to send out the single Completed message.

    Declaration

    Swift

    static func empty() -> Completable

    Return Value

    An observable sequence with no elements.

  • Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

    Declaration

    Swift

    func `do`(
        onError: ((Swift.Error) throws -> Void)? = nil,
        afterError: ((Swift.Error) throws -> Void)? = nil,
        onCompleted: (() throws -> Void)? = nil,
        afterCompleted: (() throws -> Void)? = nil,
        onSubscribe: (() -> Void)? = nil,
        onSubscribed: (() -> Void)? = nil,
        onDispose: (() -> Void)? = nil
    )
        -> Completable

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    afterError

    Action to invoke after errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    afterCompleted

    Action to invoke after graceful termination of the observable sequence.

    onSubscribe

    Action to invoke before subscribing to source observable sequence.

    onSubscribed

    Action to invoke after subscribing to source observable sequence.

    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.

    Return Value

    The source sequence with the side-effecting behavior applied.

  • concat(_:) Extension method

    Concatenates the second observable sequence to self upon successful termination of self.

    Declaration

    Swift

    func concat(_ second: Completable) -> Completable

    Parameters

    second

    Second observable sequence.

    Return Value

    An observable sequence that contains the elements of self, followed by those of the second sequence.

  • concat(_:) Extension method

    Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

    Declaration

    Swift

    static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Completable
        where Sequence.Element == Completable

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

    Declaration

    Swift

    static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Completable
        where Collection.Element == Completable

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • concat(_:) Extension method

    Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

    Declaration

    Swift

    static func concat(_ sources: Completable...) -> Completable

    Return Value

    An observable sequence that contains the elements of each given sequence, in sequential order.

  • zip(_:) Extension method

    Merges the completion of all Completables from a collection into a single Completable.

    Note

    For Completable, zip is an alias for merge.

    Declaration

    Swift

    static func zip<Collection: Swift.Collection>(_ sources: Collection) -> Completable
        where Collection.Element == Completable

    Parameters

    sources

    Collection of Completables to merge.

    Return Value

    A Completable that merges the completion of all Completables.

  • zip(_:) Extension method

    Merges the completion of all Completables from an array into a single Completable.

    Note

    For Completable, zip is an alias for merge.

    Declaration

    Swift

    static func zip(_ sources: [Completable]) -> Completable

    Parameters

    sources

    Array of observable sequences to merge.

    Return Value

    A Completable that merges the completion of all Completables.

  • zip(_:) Extension method

    Merges the completion of all Completables into a single Completable.

    Note

    For Completable, zip is an alias for merge.

    Declaration

    Swift

    static func zip(_ sources: Completable...) -> Completable

    Parameters

    sources

    Collection of observable sequences to merge.

    Return Value

    The observable sequence that merges the elements of the observable sequences.

Available where Trait == MaybeTrait

  • MaybeObserver Extension method

    Undocumented

    Declaration

    Swift

    typealias MaybeObserver = (MaybeEvent<Element>) -> Void
  • create(subscribe:) Extension method

    Creates an observable sequence from a specified subscribe method implementation.

    Declaration

    Swift

    static func create(subscribe: @escaping (@escaping MaybeObserver) -> Disposable) -> PrimitiveSequence<Trait, Element>

    Parameters

    subscribe

    Implementation of the resulting observable sequence’s subscribe method.

    Return Value

    The observable sequence with the specified implementation for the subscribe method.

  • subscribe(_:) Extension method

    Subscribes observer to receive events for this sequence.

    Declaration

    Swift

    func subscribe(_ observer: @escaping (MaybeEvent<Element>) -> Void) -> Disposable

    Return Value

    Subscription for observer that can be used to cancel production of sequence elements and free resources.

  • Subscribes a success handler, an error handler, and a completion handler for this sequence.

    Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.

    Note

    If object can’t be retained, none of the other closures will be invoked.

    Declaration

    Swift

    func subscribe<Object: AnyObject>(
        with object: Object,
        onSuccess: ((Object, Element) -> Void)? = nil,
        onError: ((Object, Swift.Error) -> Void)? = nil,
        onCompleted: ((Object) -> Void)? = nil,
        onDisposed: ((Object) -> Void)? = nil
    ) -> Disposable

    Parameters

    object

    The object to provide an unretained reference on.

    onSuccess

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes a success handler, an error handler, and a completion handler for this sequence.

    Declaration

    Swift

    func subscribe(
        onSuccess: ((Element) -> Void)? = nil,
        onError: ((Swift.Error) -> Void)? = nil,
        onCompleted: (() -> Void)? = nil,
        onDisposed: (() -> Void)? = nil
    ) -> Disposable

    Parameters

    onSuccess

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • just(_:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element) -> Maybe<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    Return Value

    An observable sequence containing the single specified element.

  • just(_:scheduler:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Maybe<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    scheduler

    Scheduler to send the single element on.

    Return Value

    An observable sequence containing the single specified element.

  • error(_:) Extension method

    Returns an observable sequence that terminates with an error.

    Declaration

    Swift

    static func error(_ error: Swift.Error) -> Maybe<Element>

    Return Value

    The observable sequence that terminates with specified error.

  • never() Extension method

    Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

    Declaration

    Swift

    static func never() -> Maybe<Element>

    Return Value

    An observable sequence whose observers will never get called.

  • empty() Extension method

    Returns an empty observable sequence, using the specified scheduler to send out the single Completed message.

    Declaration

    Swift

    static func empty() -> Maybe<Element>

    Return Value

    An observable sequence with no elements.

  • Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

    Declaration

    Swift

    func `do`(
        onNext: ((Element) throws -> Void)? = nil,
        afterNext: ((Element) throws -> Void)? = nil,
        onError: ((Swift.Error) throws -> Void)? = nil,
        afterError: ((Swift.Error) throws -> Void)? = nil,
        onCompleted: (() throws -> Void)? = nil,
        afterCompleted: (() throws -> Void)? = nil,
        onSubscribe: (() -> Void)? = nil,
        onSubscribed: (() -> Void)? = nil,
        onDispose: (() -> Void)? = nil
    )
        -> Maybe<Element>

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    afterNext

    Action to invoke for each element after the observable has passed an onNext event along to its downstream.

    onError

    Action to invoke upon errored termination of the observable sequence.

    afterError

    Action to invoke after errored termination of the observable sequence.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    afterCompleted

    Action to invoke after graceful termination of the observable sequence.

    onSubscribe

    Action to invoke before subscribing to source observable sequence.

    onSubscribed

    Action to invoke after subscribing to source observable sequence.

    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.

    Return Value

    The source sequence with the side-effecting behavior applied.

  • filter(_:) Extension method

    Filters the elements of an observable sequence based on a predicate.

    Declaration

    Swift

    func filter(_ predicate: @escaping (Element) throws -> Bool)
        -> Maybe<Element>

    Parameters

    predicate

    A function to test each source element for a condition.

    Return Value

    An observable sequence that contains elements from the input sequence that satisfy the condition.

  • map(_:) Extension method

    Projects each element of an observable sequence into a new form.

    Declaration

    Swift

    func map<Result>(_ transform: @escaping (Element) throws -> Result)
        -> Maybe<Result>

    Parameters

    transform

    A transform function to apply to each source element.

    Return Value

    An observable sequence whose elements are the result of invoking the transform function on each element of source.

  • compactMap(_:) Extension method

    Projects each element of an observable sequence into an optional form and filters all optional results.

    Declaration

    Swift

    func compactMap<Result>(_ transform: @escaping (Element) throws -> Result?)
        -> Maybe<Result>

    Parameters

    transform

    A transform function to apply to each source element.

    Return Value

    An observable sequence whose elements are the result of filtering the transform function for each element of the source.

  • flatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func flatMap<Result>(_ selector: @escaping (Element) throws -> Maybe<Result>)
        -> Maybe<Result>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

  • ifEmpty(default:) Extension method

    Emits elements from the source observable sequence, or a default element if the source observable sequence is empty.

    Declaration

    Swift

    func ifEmpty(default: Element) -> Single<Element>

    Parameters

    default

    Default element to be sent if the source does not emit any elements

    Return Value

    An observable sequence which emits default element end completes in case the original sequence is empty

  • ifEmpty(switchTo:) Extension method

    Returns the elements of the specified sequence or other sequence if the sequence is empty.

    Declaration

    Swift

    func ifEmpty(switchTo other: Maybe<Element>) -> Maybe<Element>

    Parameters

    other

    Observable sequence being returned when source sequence is empty.

    Return Value

    Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.

  • ifEmpty(switchTo:) Extension method

    Returns the elements of the specified sequence or other sequence if the sequence is empty.

    Declaration

    Swift

    func ifEmpty(switchTo other: Single<Element>) -> Single<Element>

    Parameters

    other

    Observable sequence being returned when source sequence is empty.

    Return Value

    Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.

  • catchAndReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    func catchAndReturn(_ element: Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

  • catchErrorJustReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catchAndReturn(_:﹚")
    func catchErrorJustReturn(_ element: Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

Available where Trait == SingleTrait

  • Creates a Single from the result of an asynchronous operation

    Declaration

    Swift

    @_disfavoredOverload
    static func create(
        detached: Bool = false,
        priority: TaskPriority? = nil,
        work: @Sendable @escaping () async throws -> Element
    ) -> PrimitiveSequence<Trait, Element>

    Parameters

    work

    An async closure expected to return an element of type Element

    Return Value

    A Single of the async closure’s element type

  • value Extension method, asynchronous

    Allows awaiting the success or failure of this Single asynchronously via Swift’s concurrency features (async/await)

    A sample usage would look like so:

    do {
        let value = try await single.value
    } catch {
        // Handle error
    }
    

    Declaration

    Swift

    var value: Element { get async throws }

Available where Trait == MaybeTrait

  • value Extension method, asynchronous

    Allows awaiting the success or failure of this Maybe asynchronously via Swift’s concurrency features (async/await)

    If the Maybe completes without emitting a value, it would return a nil value to indicate so.

    A sample usage would look like so:

    do {
        let value = try await maybe.value // Element?
    } catch {
        // Handle error
    }
    

    Declaration

    Swift

    var value: Element? { get async throws }

Available where Trait == CompletableTrait, Element == Never

  • value Extension method, asynchronous

    Allows awaiting the success or failure of this Completable asynchronously via Swift’s concurrency features (async/await)

    Upon completion, a Void will be returned

    A sample usage would look like so:

    do {
        let value = try await completable.value // Void
    } catch {
        // Handle error
    }
    

    Declaration

    Swift

    var value: Void { get async throws }

Available where Trait == SingleTrait

  • zip(_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

Available where Element == Any, Trait == SingleTrait

  • zip(_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>)
        -> PrimitiveSequence<Trait, (E1, E2)>

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

Available where Trait == MaybeTrait

  • zip(_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

Available where Element == Any, Trait == MaybeTrait

  • zip(_:_:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>)
        -> PrimitiveSequence<Trait, (E1, E2)>

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

Available where Trait == SingleTrait

  • zip(_:_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

Available where Element == Any, Trait == SingleTrait

Available where Trait == MaybeTrait

  • zip(_:_:_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

Available where Element == Any, Trait == MaybeTrait

Available where Trait == SingleTrait

Available where Element == Any, Trait == SingleTrait

Available where Trait == MaybeTrait

Available where Element == Any, Trait == MaybeTrait

Available where Trait == SingleTrait

Available where Element == Any, Trait == SingleTrait

Available where Trait == MaybeTrait

Available where Element == Any, Trait == MaybeTrait

Available where Trait == SingleTrait

Available where Element == Any, Trait == SingleTrait

Available where Trait == MaybeTrait

Available where Element == Any, Trait == MaybeTrait

Available where Trait == SingleTrait

Available where Element == Any, Trait == SingleTrait

Available where Trait == MaybeTrait

Available where Element == Any, Trait == MaybeTrait

Available where Trait == SingleTrait

Available where Element == Any, Trait == SingleTrait

Available where Trait == MaybeTrait

Available where Element == Any, Trait == MaybeTrait

Available where Element: RxAbstractInteger

  • timer(_:scheduler:) Extension method

    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.

    Declaration

    Swift

    static func timer(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    dueTime

    Relative time at which to produce the first value.

    scheduler

    Scheduler to run timers on.

    Return Value

    An observable sequence that produces a value after due time has elapsed and then each period.

Available where Trait == SingleTrait

  • SingleObserver Extension method

    Undocumented

    Declaration

    Swift

    typealias SingleObserver = (SingleEvent<Element>) -> Void
  • create(subscribe:) Extension method

    Creates an observable sequence from a specified subscribe method implementation.

    Declaration

    Swift

    static func create(subscribe: @escaping (@escaping SingleObserver) -> Disposable) -> Single<Element>

    Parameters

    subscribe

    Implementation of the resulting observable sequence’s subscribe method.

    Return Value

    The observable sequence with the specified implementation for the subscribe method.

  • subscribe(_:) Extension method

    Subscribes observer to receive events for this sequence.

    Declaration

    Swift

    func subscribe(_ observer: @escaping (SingleEvent<Element>) -> Void) -> Disposable

    Return Value

    Subscription for observer that can be used to cancel production of sequence elements and free resources.

  • Subscribes a success handler, and an error handler for this sequence.

    Declaration

    Swift

    @available(*, deprecated, renamed: "subscribe(onSuccess:onFailure:onDisposed:﹚")
    func subscribe(
        onSuccess: ((Element) -> Void)? = nil,
        onError: @escaping ((Swift.Error) -> Void),
        onDisposed: (() -> Void)? = nil
    ) -> Disposable

    Parameters

    onSuccess

    Action to invoke for each element in the observable sequence.

    onError

    Action to invoke upon errored termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes a success handler, and an error handler for this sequence.

    Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.

    Note

    If object can’t be retained, none of the other closures will be invoked.

    Declaration

    Swift

    func subscribe<Object: AnyObject>(
        with object: Object,
        onSuccess: ((Object, Element) -> Void)? = nil,
        onFailure: ((Object, Swift.Error) -> Void)? = nil,
        onDisposed: ((Object) -> Void)? = nil
    ) -> Disposable

    Parameters

    object

    The object to provide an unretained reference on.

    onSuccess

    Action to invoke for each element in the observable sequence.

    onFailure

    Action to invoke upon errored termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • Subscribes a success handler, and an error handler for this sequence.

    Declaration

    Swift

    func subscribe(
        onSuccess: ((Element) -> Void)? = nil,
        onFailure: ((Swift.Error) -> Void)? = nil,
        onDisposed: (() -> Void)? = nil
    ) -> Disposable

    Parameters

    onSuccess

    Action to invoke for each element in the observable sequence.

    onFailure

    Action to invoke upon errored termination of the observable sequence.

    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).

    Return Value

    Subscription object used to unsubscribe from the observable sequence.

  • just(_:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element) -> Single<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    Return Value

    An observable sequence containing the single specified element.

  • just(_:scheduler:) Extension method

    Returns an observable sequence that contains a single element.

    Declaration

    Swift

    static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Single<Element>

    Parameters

    element

    Single element in the resulting observable sequence.

    scheduler

    Scheduler to send the single element on.

    Return Value

    An observable sequence containing the single specified element.

  • error(_:) Extension method

    Returns an observable sequence that terminates with an error.

    Declaration

    Swift

    static func error(_ error: Swift.Error) -> Single<Element>

    Return Value

    The observable sequence that terminates with specified error.

  • never() Extension method

    Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

    Declaration

    Swift

    static func never() -> Single<Element>

    Return Value

    An observable sequence whose observers will never get called.

  • Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

    Declaration

    Swift

    func `do`(
        onSuccess: ((Element) throws -> Void)? = nil,
        afterSuccess: ((Element) throws -> Void)? = nil,
        onError: ((Swift.Error) throws -> Void)? = nil,
        afterError: ((Swift.Error) throws -> Void)? = nil,
        onSubscribe: (() -> Void)? = nil,
        onSubscribed: (() -> Void)? = nil,
        onDispose: (() -> Void)? = nil
    )
        -> Single<Element>

    Parameters

    onSuccess

    Action to invoke for each element in the observable sequence.

    afterSuccess

    Action to invoke for each element after the observable has passed an onNext event along to its downstream.

    onError

    Action to invoke upon errored termination of the observable sequence.

    afterError

    Action to invoke after errored termination of the observable sequence.

    onSubscribe

    Action to invoke before subscribing to source observable sequence.

    onSubscribed

    Action to invoke after subscribing to source observable sequence.

    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.

    Return Value

    The source sequence with the side-effecting behavior applied.

  • filter(_:) Extension method

    Filters the elements of an observable sequence based on a predicate.

    Declaration

    Swift

    func filter(_ predicate: @escaping (Element) throws -> Bool)
        -> Maybe<Element>

    Parameters

    predicate

    A function to test each source element for a condition.

    Return Value

    An observable sequence that contains elements from the input sequence that satisfy the condition.

  • map(_:) Extension method

    Projects each element of an observable sequence into a new form.

    Declaration

    Swift

    func map<Result>(_ transform: @escaping (Element) throws -> Result)
        -> Single<Result>

    Parameters

    transform

    A transform function to apply to each source element.

    Return Value

    An observable sequence whose elements are the result of invoking the transform function on each element of source.

  • compactMap(_:) Extension method

    Projects each element of an observable sequence into an optional form and filters all optional results.

    Declaration

    Swift

    func compactMap<Result>(_ transform: @escaping (Element) throws -> Result?)
        -> Maybe<Result>

    Parameters

    transform

    A transform function to apply to each source element.

    Return Value

    An observable sequence whose elements are the result of filtering the transform function for each element of the source.

  • flatMap(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func flatMap<Result>(_ selector: @escaping (Element) throws -> Single<Result>)
        -> Single<Result>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

  • flatMapMaybe(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func flatMapMaybe<Result>(_ selector: @escaping (Element) throws -> Maybe<Result>)
        -> Maybe<Result>

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

  • flatMapCompletable(_:) Extension method

    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

    Declaration

    Swift

    func flatMapCompletable(_ selector: @escaping (Element) throws -> Completable)
        -> Completable

    Parameters

    selector

    A transform function to apply to each element.

    Return Value

    An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

  • zip(_:resultSelector:) Extension method

    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.

    Declaration

    Swift

    static func zip<Collection, Result>(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> PrimitiveSequence<Trait, Result> where Collection : Collection, Collection.Element == PrimitiveSequence<SingleTrait, Self.Element>

    Parameters

    resultSelector

    Function to invoke for each series of elements at corresponding indexes in the sources.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • zip(_:) Extension method

    Merges the specified observable sequences into one observable sequence all of the observable sequences have produced an element at a corresponding index.

    Declaration

    Swift

    static func zip<Collection>(_ collection: Collection) -> PrimitiveSequence<Trait, [Element]> where Collection : Collection, Collection.Element == PrimitiveSequence<SingleTrait, Self.Element>

    Return Value

    An observable sequence containing the result of combining elements of the sources.

  • catchAndReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    func catchAndReturn(_ element: Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

  • catchErrorJustReturn(_:) Extension method

    Continues an observable sequence that is terminated by an error with a single element.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catchAndReturn(_:﹚")
    func catchErrorJustReturn(_ element: Element)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    element

    Last element in an observable sequence in case error occurs.

    Return Value

    An observable sequence containing the source sequence’s elements, followed by the element in case an error occurred.

  • asMaybe() Extension method

    Converts self to Maybe trait.

    Declaration

    Swift

    func asMaybe() -> Maybe<Element>

    Return Value

    Maybe trait that represents self.

  • asCompletable() Extension method

    Converts self to Completable trait, ignoring its emitted value if one exists.

    Declaration

    Swift

    func asCompletable() -> Completable

    Return Value

    Completable trait that represents self.

================================================ FILE: docs/Protocols/ReactiveCompatible.html ================================================ ReactiveCompatible Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

ReactiveCompatible

public protocol ReactiveCompatible

A type that has reactive extensions.

  • Extended type

    Declaration

    Swift

    associatedtype ReactiveBase
  • rx

    Reactive extensions.

    Declaration

    Swift

    static var rx: Reactive<ReactiveBase>.Type { get set }
  • rx

    Reactive extensions.

    Declaration

    Swift

    var rx: Reactive<ReactiveBase> { get set }
  • rx Extension method

    Reactive extensions.

    Declaration

    Swift

    static var rx: Reactive<Self>.Type { get set }
  • rx Extension method

    Reactive extensions.

    Declaration

    Swift

    var rx: Reactive<Self> { get set }
================================================ FILE: docs/Protocols/SchedulerType.html ================================================ SchedulerType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

SchedulerType

public protocol SchedulerType : ImmediateSchedulerType

Represents an object that schedules units of work.

  • now

    Declaration

    Swift

    var now: RxTime { get }

    Return Value

    Current time.

  • Schedules an action to be executed.

    Declaration

    Swift

    func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    dueTime

    Relative time after which to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules a periodic piece of work.

    Default Implementation

    Periodic task will be emulated using recursive scheduling.

    Declaration

    Swift

    func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    startAfter

    Period after which initial work should be run.

    period

    Period for running the work periodically.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

================================================ FILE: docs/Protocols/SubjectType.html ================================================ SubjectType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

SubjectType

public protocol SubjectType : ObservableType

Represents an object that is both an observable sequence as well as an observer.

  • The type of the observer that represents this subject.

    Usually this type is type of subject itself, but it doesn’t have to be.

    Declaration

    Swift

    associatedtype Observer : ObserverType
  • Returns observer interface for subject.

    Declaration

    Swift

    func asObserver() -> Observer

    Return Value

    Observer interface for subject.

================================================ FILE: docs/Protocols/VirtualTimeConverterType.html ================================================ VirtualTimeConverterType Protocol Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

VirtualTimeConverterType

public protocol VirtualTimeConverterType

Parametrization for virtual time used by VirtualTimeSchedulers.

  • Virtual time unit used that represents ticks of virtual clock.

    Declaration

    Swift

    associatedtype VirtualTimeUnit
  • Virtual time unit used to represent differences of virtual times.

    Declaration

    Swift

    associatedtype VirtualTimeIntervalUnit
  • Converts virtual time to real time.

    Declaration

    Swift

    func convertFromVirtualTime(_ virtualTime: VirtualTimeUnit) -> RxTime

    Parameters

    virtualTime

    Virtual time to convert to Date.

    Return Value

    Date corresponding to virtual time.

  • Converts real time to virtual time.

    Declaration

    Swift

    func convertToVirtualTime(_ time: RxTime) -> VirtualTimeUnit

    Parameters

    time

    Date to convert to virtual time.

    Return Value

    Virtual time corresponding to Date.

  • Converts from virtual time interval to TimeInterval.

    Declaration

    Swift

    func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> TimeInterval

    Parameters

    virtualTimeInterval

    Virtual time interval to convert to TimeInterval.

    Return Value

    TimeInterval corresponding to virtual time interval.

  • Converts from TimeInterval to virtual time interval.

    Declaration

    Swift

    func convertToVirtualTimeInterval(_ timeInterval: TimeInterval) -> VirtualTimeIntervalUnit

    Parameters

    timeInterval

    TimeInterval to convert to virtual time interval.

    Return Value

    Virtual time interval corresponding to time interval.

  • Offsets virtual time by virtual time interval.

    Declaration

    Swift

    func offsetVirtualTime(_ time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit

    Parameters

    time

    Virtual time.

    offset

    Virtual time interval.

    Return Value

    Time corresponding to time offsetted by virtual time interval.

  • This is additional abstraction because Date is unfortunately not comparable. Extending Date with Comparable would be too risky because of possible collisions with other libraries.

    Declaration

    Swift

    func compareVirtualTime(_ lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison
================================================ FILE: docs/RxSwift/Disposables.html ================================================ RxSwift/Disposables Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxSwift/Disposables

  • Represents a disposable resource that can be checked for disposal status.

    See more

    Declaration

    Swift

    public final class BooleanDisposable : Cancelable
  • Represents a group of disposable resources that are disposed together.

    See more

    Declaration

    Swift

    public final class CompositeDisposable : DisposeBase, Cancelable
  • A collection of utility methods for common disposable operations.

    See more

    Declaration

    Swift

    public struct Disposables
  • 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.

    See more

    Declaration

    Swift

    public final class DisposeBag : DisposeBase
  • Base class for all disposables.

    Declaration

    Swift

    public class DisposeBase
  • Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.

    See more

    Declaration

    Swift

    public final class RefCountDisposable : DisposeBase, Cancelable
  • Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler.

    See more

    Declaration

    Swift

    public final class ScheduledDisposable : Cancelable
  • Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.

    See more

    Declaration

    Swift

    public final class SerialDisposable : DisposeBase, Cancelable
  • 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.

    See more

    Declaration

    Swift

    public final class SingleAssignmentDisposable : DisposeBase, Cancelable
================================================ FILE: docs/RxSwift/Schedulers.html ================================================ RxSwift/Schedulers Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxSwift/Schedulers

  • 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.

    See more

    Declaration

    Swift

    public class ConcurrentDispatchQueueScheduler : SchedulerType
  • 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.

    See more

    Declaration

    Swift

    public final class ConcurrentMainScheduler : SchedulerType
  • 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.

    See more

    Declaration

    Swift

    public class CurrentThreadScheduler : ImmediateSchedulerType
  • Provides a virtual time scheduler that uses Date for absolute time and TimeInterval for relative time.

    See more

    Declaration

    Swift

    public class HistoricalScheduler : VirtualTimeScheduler<HistoricalSchedulerTimeConverter>
  • Converts historical virtual time into real time.

    Since historical virtual time is also measured in Date, this converter is identity function.

    See more

    Declaration

    Swift

    public struct HistoricalSchedulerTimeConverter : VirtualTimeConverterType
  • 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.

    See more

    Declaration

    Swift

    public final class MainScheduler : SerialDispatchQueueScheduler
  • 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.

    See more

    Declaration

    Swift

    public class OperationQueueScheduler : ImmediateSchedulerType
  • 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.

    See more

    Declaration

    Swift

    public class SerialDispatchQueueScheduler : SchedulerType
  • Parametrization for virtual time used by VirtualTimeSchedulers.

    See more

    Declaration

    Swift

    public protocol VirtualTimeConverterType
  • Base class for virtual time schedulers using a priority queue for scheduled items.

    See more

    Declaration

    Swift

    open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>:
        SchedulerType
    extension VirtualTimeScheduler: CustomDebugStringConvertible
================================================ FILE: docs/RxSwift/Subjects.html ================================================ RxSwift/Subjects Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxSwift/Subjects

  • An AsyncSubject emits the last value (and only the last value) emitted by the source Observable, and only after that source Observable completes.

    (If the source Observable does not emit any values, the AsyncSubject also completes without emitting any values.)

    See more

    Declaration

    Swift

    public final class AsyncSubject<Element>:
        Observable<Element>,
        SubjectType,
        ObserverType,
        SynchronizedUnsubscribeType
  • Represents a value that changes over time.

    Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.

    See more

    Declaration

    Swift

    public final class BehaviorSubject<Element>:
        Observable<Element>,
        SubjectType,
        ObserverType,
        SynchronizedUnsubscribeType,
        Cancelable
  • Represents an object that is both an observable sequence as well as an observer.

    Each notification is broadcasted to all subscribed observers.

    See more

    Declaration

    Swift

    public final class PublishSubject<Element>:
        Observable<Element>,
        SubjectType,
        Cancelable,
        ObserverType,
        SynchronizedUnsubscribeType
  • Represents an object that is both an observable sequence as well as an observer.

    Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.

    See more

    Declaration

    Swift

    public class ReplaySubject<Element>:
        Observable<Element>,
        SubjectType,
        ObserverType,
        Disposable
  • Represents an object that is both an observable sequence as well as an observer.

    See more

    Declaration

    Swift

    public protocol SubjectType : ObservableType
================================================ FILE: docs/RxSwift/Traits/Infallible.html ================================================ RxSwift/Traits/Infallible Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxSwift/Traits/Infallible

  • Infallible is an Observable-like push-style interface which is guaranteed to not emit error events.

    Unlike SharedSequence, it does not share its resources or replay its events, but acts as a standard Observable.

    See more

    Declaration

    Swift

    public struct Infallible<Element> : InfallibleType
================================================ FILE: docs/RxSwift/Traits/PrimitiveSequence.html ================================================ RxSwift/Traits/PrimitiveSequence Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxSwift/Traits/PrimitiveSequence

================================================ FILE: docs/RxSwift/Traits.html ================================================ RxSwift/Traits Reference

RxSwift 6.1.0-beta.1 Docs (95% documented)

View on GitHub

RxSwift/Traits

================================================ FILE: docs/RxSwift.html ================================================ RxSwift Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxSwift

  • A type-erased ObserverType.

    Forwards operations to an arbitrary underlying observer with the same Element type, hiding the specifics of the underlying observer type.

    See more

    Declaration

    Swift

    public struct AnyObserver<Element> : ObserverType
  • 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.

    See more

    Declaration

    Swift

    public struct Binder<Value> : ObserverType
  • Represents disposable resource with state tracking.

    See more

    Declaration

    Swift

    public protocol Cancelable : Disposable
  • Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence.

    See more

    Declaration

    Swift

    public protocol ConnectableObservableType : ObservableType
  • Represents a disposable resource.

    See more

    Declaration

    Swift

    public protocol Disposable
  • Represents a sequence event.

    Sequence grammar: next* (error | completed)

    See more

    Declaration

    Swift

    @frozen
    public enum Event<Element>
    extension Event: CustomDebugStringConvertible
    extension Event: EventConvertible
  • Represents an observable sequence of elements that share a common key. GroupedObservable is typically created by the groupBy operator. Each GroupedObservable instance represents a collection of elements that are grouped by a specific key.

    Example usage:

    let observable = Observable.of("Apple", "Banana", "Apricot", "Blueberry", "Avocado")
    
    let grouped = observable.groupBy { fruit in
        fruit.first! // Grouping by the first letter of each fruit
    }
    
    _ = grouped.subscribe { group in
        print("Group: \(group.key)")
        _ = group.subscribe { event in
            print(event)
        }
    }
    

    This will print:

    Group: A
    next(Apple)
    next(Apricot)
    next(Avocado)
    Group: B
    next(Banana)
    next(Blueberry)
    
    See more

    Declaration

    Swift

    public struct GroupedObservable<Key, Element> : ObservableType
  • Represents an object that immediately schedules units of work.

    See more

    Declaration

    Swift

    public protocol ImmediateSchedulerType
  • Undocumented

    See more

    Declaration

    Swift

    public class Observable<Element> : ObservableType
  • Type that can be converted to observable sequence (Observable<Element>).

    See more

    Declaration

    Swift

    public protocol ObservableConvertibleType
  • Represents a push style sequence.

    See more

    Declaration

    Swift

    public protocol ObservableType : ObservableConvertibleType
  • Supports push-style iteration over an observable sequence.

    See more

    Declaration

    Swift

    public protocol ObserverType
  • 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.

    Binders are also automatically synthesized using @dynamicMemberLookup for writable reference properties of the reactive base.

    See more

    Declaration

    Swift

    @dynamicMemberLookup
    public struct Reactive<Base>
  • Represents an object that schedules units of work.

    See more

    Declaration

    Swift

    public protocol SchedulerType : ImmediateSchedulerType
================================================ FILE: docs/Structs/AnyObserver.html ================================================ AnyObserver Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

AnyObserver

public struct AnyObserver<Element> : ObserverType

A type-erased ObserverType.

Forwards operations to an arbitrary underlying observer with the same Element type, hiding the specifics of the underlying observer type.

  • Anonymous event handler type.

    Declaration

    Swift

    public typealias EventHandler = (Event<Element>) -> Void
  • Construct an instance whose on(event) calls eventHandler(event)

    Declaration

    Swift

    public init(eventHandler: @escaping EventHandler)

    Parameters

    eventHandler

    Event handler that observes sequences events.

  • Construct an instance whose on(event) calls observer.on(event)

    Declaration

    Swift

    public init<Observer>(_ observer: Observer) where Element == Observer.Element, Observer : ObserverType

    Parameters

    observer

    Observer that receives sequence events.

  • Send event to this observer.

    Declaration

    Swift

    public func on(_ event: Event<Element>)

    Parameters

    event

    Event instance.

  • Erases type of observer and returns canonical observer.

    Declaration

    Swift

    public func asObserver() -> AnyObserver<Element>

    Return Value

    type erased observer.

================================================ FILE: docs/Structs/Binder.html ================================================ Binder Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Binder

public struct Binder<Value> : ObserverType

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.

  • Declaration

    Swift

    public typealias Element = Value
  • Initializes Binder

    Declaration

    Swift

    public init<Target>(_ target: Target, scheduler: ImmediateSchedulerType = MainScheduler(), binding: @escaping (Target, Value) -> Void) where Target : AnyObject

    Parameters

    target

    Target object.

    scheduler

    Scheduler used to bind the events.

    binding

    Binding logic.

  • Binds next element to owner view as described in binding.

    Declaration

    Swift

    public func on(_ event: Event<Value>)
  • Erases type of observer.

    Declaration

    Swift

    public func asObserver() -> AnyObserver<Value>

    Return Value

    type erased observer.

================================================ FILE: docs/Structs/Disposables.html ================================================ Disposables Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Disposables

public struct Disposables

A collection of utility methods for common disposable operations.

================================================ FILE: docs/Structs/GroupedObservable.html ================================================ GroupedObservable Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

GroupedObservable

public struct GroupedObservable<Key, Element> : ObservableType

Represents an observable sequence of elements that share a common key. GroupedObservable is typically created by the groupBy operator. Each GroupedObservable instance represents a collection of elements that are grouped by a specific key.

Example usage:

let observable = Observable.of("Apple", "Banana", "Apricot", "Blueberry", "Avocado")

let grouped = observable.groupBy { fruit in
    fruit.first! // Grouping by the first letter of each fruit
}

_ = grouped.subscribe { group in
    print("Group: \(group.key)")
    _ = group.subscribe { event in
        print(event)
    }
}

This will print:

Group: A
next(Apple)
next(Apricot)
next(Avocado)
Group: B
next(Banana)
next(Blueberry)
  • key

    The key associated with this grouped observable sequence. All elements emitted by this observable share this common key.

    Declaration

    Swift

    public let key: Key
  • Initializes a grouped observable sequence with a key and a source observable sequence.

    Example usage:

    let sourceObservable = Observable.of("Apple", "Apricot", "Avocado")
    let groupedObservable = GroupedObservable(key: "A", source: sourceObservable)
    
    _ = groupedObservable.subscribe { event in
        print(event)
    }
    

    This will print:

    next(Apple)
    next(Apricot)
    next(Avocado)
    

    Declaration

    Swift

    public init(key: Key, source: Observable<Element>)

    Parameters

    key

    The key associated with this grouped observable sequence.

    source

    The observable sequence of elements for the specified key.

  • Subscribes an observer to receive events emitted by the source observable sequence.

    Example usage:

    let fruitsObservable = Observable.of("Apple", "Banana", "Apricot", "Blueberry", "Avocado")
    let grouped = fruitsObservable.groupBy { $0.first! } // Group by first letter
    
    _ = grouped.subscribe { group in
        if group.key == "A" {
            _ = group.subscribe { event in
                print(event)
            }
        }
    }
    

    This will print:

    next(Apple)
    next(Apricot)
    next(Avocado)
    

    Declaration

    Swift

    public func subscribe<Observer>(_ observer: Observer) -> Disposable where Element == Observer.Element, Observer : ObserverType

    Parameters

    observer

    The observer that will receive the events of the source observable.

    Return Value

    A Disposable representing the subscription, which can be used to cancel the subscription.

  • Converts this GroupedObservable into a regular Observable sequence. This allows you to work with the sequence without directly interacting with the key.

    Example usage:

    let fruitsObservable = Observable.of("Apple", "Banana", "Apricot", "Blueberry", "Avocado")
    let grouped = fruitsObservable.groupBy { $0.first! } // Group by first letter
    
    _ = grouped.subscribe { group in
        if group.key == "A" {
            let regularObservable = group.asObservable()
            _ = regularObservable.subscribe { event in
                print(event)
            }
        }
    }
    

    This will print:

    next(Apple)
    next(Apricot)
    next(Avocado)
    

    Declaration

    Swift

    public func asObservable() -> Observable<Element>

    Return Value

    The underlying Observable sequence of elements for the specified key.

================================================ FILE: docs/Structs/HistoricalSchedulerTimeConverter.html ================================================ HistoricalSchedulerTimeConverter Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

HistoricalSchedulerTimeConverter

public struct HistoricalSchedulerTimeConverter : VirtualTimeConverterType

Converts historical virtual time into real time.

Since historical virtual time is also measured in Date, this converter is identity function.

================================================ FILE: docs/Structs/Infallible.html ================================================ Infallible Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Infallible

public struct Infallible<Element> : InfallibleType

Infallible is an Observable-like push-style interface which is guaranteed to not emit error events.

Unlike SharedSequence, it does not share its resources or replay its events, but acts as a standard Observable.

Combine Latest

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<I1: InfallibleType, I2: InfallibleType>
    (_ source1: I1, _ source2: I2, resultSelector: @escaping (I1.Element, I2.Element) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType>
    (_ source1: I1, _ source2: I2, _ source3: I3, resultSelector: @escaping (I1.Element, I2.Element, I3.Element) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType>
    (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType>
    (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType, I6: InfallibleType>
    (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, _ source6: I6, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element, I6.Element) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType, I6: InfallibleType, I7: InfallibleType>
    (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, _ source6: I6, _ source7: I7, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element, I6.Element, I7.Element) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

    Declaration

    Swift

    static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType, I6: InfallibleType, I7: InfallibleType, I8: InfallibleType>
    (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, _ source6: I6, _ source7: I7, _ source8: I8, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element, I6.Element, I7.Element, I8.Element) throws -> Element)
        -> Infallible<Element>

    Parameters

    resultSelector

    Function to invoke whenever any of the sources produces an element.

    Return Value

    An observable sequence containing the result of combining elements of the sources using the specified result selector function.

  • Undocumented

    Declaration

    Swift

    typealias InfallibleObserver = (InfallibleEvent<Element>) -> Void
  • Creates an observable sequence from a specified subscribe method implementation.

    Declaration

    Swift

    static func create(subscribe: @escaping (@escaping InfallibleObserver) -> Disposable) -> Infallible<Element>

    Parameters

    subscribe

    Implementation of the resulting observable sequence’s subscribe method.

    Return Value

    The observable sequence with the specified implementation for the subscribe method.

From & Of

Do

  • Invokes an action for each event in the infallible sequence, and propagates all observer messages through the result sequence.

    Declaration

    Swift

    func `do`(onNext: ((Element) throws -> Void)? = nil, afterNext: ((Element) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, afterCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil) -> Infallible<Element>

    Parameters

    onNext

    Action to invoke for each element in the observable sequence.

    afterNext

    Action to invoke for each element after the observable has passed an onNext event along to its downstream.

    onCompleted

    Action to invoke upon graceful termination of the observable sequence.

    afterCompleted

    Action to invoke after graceful termination of the observable sequence.

    onSubscribe

    Action to invoke before subscribing to source observable sequence.

    onSubscribed

    Action to invoke after subscribing to source observable sequence.

    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.

    Return Value

    The source sequence with the side-effecting behavior applied.

================================================ FILE: docs/Structs/PrimitiveSequence.html ================================================ PrimitiveSequence Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

PrimitiveSequence

public struct PrimitiveSequence<Trait, Element>
extension PrimitiveSequence: PrimitiveSequenceType
extension PrimitiveSequence: ObservableConvertibleType

Observable sequences containing 0 or 1 element.

  • Declaration

    Swift

    public var primitiveSequence: PrimitiveSequence<Trait, Element> { get }

    Return Value

    Observable sequence that represents self.

  • Converts self to Observable sequence.

    Declaration

    Swift

    public func asObservable() -> Observable<Element>

    Return Value

    Observable sequence that represents self.

  • Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.

    Declaration

    Swift

    static func deferred(_ observableFactory: @escaping () throws -> PrimitiveSequence<Trait, Element>)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    observableFactory

    Observable factory function to invoke for each observer that subscribes to the resulting sequence.

    Return Value

    An observable sequence whose observers trigger an invocation of the given observable factory function.

  • 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.

    Declaration

    Swift

    func delay(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    dueTime

    Relative time shift of the source by.

    scheduler

    Scheduler to run the subscription delay timer on.

    Return Value

    the source Observable shifted in time by the specified delay.

  • Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.

    Declaration

    Swift

    func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    dueTime

    Relative time shift of the subscription.

    scheduler

    Scheduler to run the subscription delay timer on.

    Return Value

    Time-shifted sequence.

  • 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.

    Declaration

    Swift

    func observe(on scheduler: ImmediateSchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    scheduler

    Scheduler to notify observers on.

    Return Value

    The source sequence whose observations happen on the specified scheduler.

  • 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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "observe(on:﹚")
    func observeOn(_ scheduler: ImmediateSchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    scheduler

    Scheduler to notify observers on.

    Return Value

    The source sequence whose observations happen on the specified scheduler.

  • 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.

    Declaration

    Swift

    func subscribe(on scheduler: ImmediateSchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    scheduler

    Scheduler to perform subscription and unsubscription actions on.

    Return Value

    The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.

  • 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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "subscribe(on:﹚")
    func subscribeOn(_ scheduler: ImmediateSchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    scheduler

    Scheduler to perform subscription and unsubscription actions on.

    Return Value

    The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.

  • Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

    Declaration

    Swift

    @available(*, deprecated, renamed: "catch(_:﹚")
    func catchError(_ handler: @escaping (Swift.Error) throws -> PrimitiveSequence<Trait, Element>)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    handler

    Error handler function, producing another observable sequence.

    Return Value

    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.

  • Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

    Declaration

    Swift

    func `catch`(_ handler: @escaping (Swift.Error) throws -> PrimitiveSequence<Trait, Element>)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    handler

    Error handler function, producing another observable sequence.

    Return Value

    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.

  • If the initial subscription to the observable sequence emits an error event, try repeating it up to the specified number of attempts (inclusive of the initial attempt) or until is succeeds. For example, if you want to retry a sequence once upon failure, you should use retry(2) (once for the initial attempt, and once for the retry).

    Declaration

    Swift

    func retry(_ maxAttemptCount: Int)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    maxAttemptCount

    Maximum number of times to attempt the sequence subscription.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.

  • 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.

    Declaration

    Swift

    func retry<Error: Swift.Error>(when notificationHandler: @escaping (Observable<Error>) -> some ObservableType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • 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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "retry(when:﹚")
    func retryWhen<Error: Swift.Error>(_ notificationHandler: @escaping (Observable<Error>) -> some ObservableType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • 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.

    Declaration

    Swift

    func retry(when notificationHandler: @escaping (Observable<Swift.Error>) -> some ObservableType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • 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.

    Declaration

    Swift

    @available(*, deprecated, renamed: "retry(when:﹚")
    func retryWhen(_ notificationHandler: @escaping (Observable<Swift.Error>) -> some ObservableType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    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.

    Return Value

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

  • Prints received events for all observers on standard output.

    Declaration

    Swift

    func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    identifier

    Identifier that is printed together with event description to standard output.

    trimOutput

    Should output be trimmed to max 40 characters.

    Return Value

    An observable sequence whose events are printed to standard output.

  • Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence’s lifetime.

    Declaration

    Swift

    static func using<Resource: Disposable>(_ resourceFactory: @escaping () throws -> Resource, primitiveSequenceFactory: @escaping (Resource) throws -> PrimitiveSequence<Trait, Element>)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    resourceFactory

    Factory function to obtain a resource object.

    primitiveSequenceFactory

    Factory function to obtain an observable sequence that depends on the obtained resource.

    Return Value

    An observable sequence whose lifetime controls the lifetime of the dependent resource object.

  • 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.

    Declaration

    Swift

    func timeout(_ dueTime: RxTimeInterval, scheduler: SchedulerType)
        -> PrimitiveSequence<Trait, Element>

    Parameters

    dueTime

    Maximum duration between values before a timeout occurs.

    scheduler

    Scheduler to run the timeout timer on.

    Return Value

    An observable sequence with a RxError.timeout in case of a timeout.

  • 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.

    Declaration

    Swift

    func timeout(
        _ dueTime: RxTimeInterval,
        other: PrimitiveSequence<Trait, Element>,
        scheduler: SchedulerType
    ) -> PrimitiveSequence<Trait, Element>

    Parameters

    dueTime

    Maximum duration between values before a timeout occurs.

    other

    Sequence to return in case of a timeout.

    scheduler

    Scheduler to run the timeout timer on.

    Return Value

    The source sequence switching to the other sequence in case of a timeout.

================================================ FILE: docs/Structs/Reactive.html ================================================ Reactive Structure Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

Reactive

@dynamicMemberLookup
public struct Reactive<Base>

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.

Binders are also automatically synthesized using @dynamicMemberLookup for writable reference properties of the reactive base.

  • Base object to extend.

    Declaration

    Swift

    public let base: Base
  • Creates extensions with base object.

    Declaration

    Swift

    public init(_ base: Base)

    Parameters

    base

    Base object.

  • Automatically synthesized binder for a key path between the reactive base and one of its properties

    Declaration

    Swift

    public subscript<Property>(dynamicMember keyPath: ReferenceWritableKeyPath<Base, Property>) -> Binder<Property> where Base : AnyObject { get }
================================================ FILE: docs/Structs/Resources.html ================================================ Resources Structure Reference

RxSwift 6.9.0 Docs (95% documented)

GitHub View on GitHub

================================================ FILE: docs/css/highlight.css ================================================ /*! Jazzy - https://github.com/realm/jazzy * Copyright Realm Inc. * SPDX-License-Identifier: MIT */ /* Credit to https://gist.github.com/wataru420/2048287 */ .highlight .c { color: #999988; font-style: italic; } .highlight .err { color: #a61717; background-color: #e3d2d2; } .highlight .k { color: #000000; font-weight: bold; } .highlight .o { color: #000000; font-weight: bold; } .highlight .cm { color: #999988; font-style: italic; } .highlight .cp { color: #999999; font-weight: bold; } .highlight .c1 { color: #999988; font-style: italic; } .highlight .cs { color: #999999; font-weight: bold; font-style: italic; } .highlight .gd { color: #000000; background-color: #ffdddd; } .highlight .gd .x { color: #000000; background-color: #ffaaaa; } .highlight .ge { color: #000000; font-style: italic; } .highlight .gr { color: #aa0000; } .highlight .gh { color: #999999; } .highlight .gi { color: #000000; background-color: #ddffdd; } .highlight .gi .x { color: #000000; background-color: #aaffaa; } .highlight .go { color: #888888; } .highlight .gp { color: #555555; } .highlight .gs { font-weight: bold; } .highlight .gu { color: #aaaaaa; } .highlight .gt { color: #aa0000; } .highlight .kc { color: #000000; font-weight: bold; } .highlight .kd { color: #000000; font-weight: bold; } .highlight .kp { color: #000000; font-weight: bold; } .highlight .kr { color: #000000; font-weight: bold; } .highlight .kt { color: #445588; } .highlight .m { color: #009999; } .highlight .s { color: #d14; } .highlight .na { color: #008080; } .highlight .nb { color: #0086B3; } .highlight .nc { color: #445588; font-weight: bold; } .highlight .no { color: #008080; } .highlight .ni { color: #800080; } .highlight .ne { color: #990000; font-weight: bold; } .highlight .nf { color: #990000; } .highlight .nn { color: #555555; } .highlight .nt { color: #000080; } .highlight .nv { color: #008080; } .highlight .ow { color: #000000; font-weight: bold; } .highlight .w { color: #bbbbbb; } .highlight .mf { color: #009999; } .highlight .mh { color: #009999; } .highlight .mi { color: #009999; } .highlight .mo { color: #009999; } .highlight .sb { color: #d14; } .highlight .sc { color: #d14; } .highlight .sd { color: #d14; } .highlight .s2 { color: #d14; } .highlight .se { color: #d14; } .highlight .sh { color: #d14; } .highlight .si { color: #d14; } .highlight .sx { color: #d14; } .highlight .sr { color: #009926; } .highlight .s1 { color: #d14; } .highlight .ss { color: #990073; } .highlight .bp { color: #999999; } .highlight .vc { color: #008080; } .highlight .vg { color: #008080; } .highlight .vi { color: #008080; } .highlight .il { color: #009999; } ================================================ FILE: docs/css/jazzy.css ================================================ /*! Jazzy - https://github.com/realm/jazzy * Copyright Realm Inc. * SPDX-License-Identifier: MIT */ *, *:before, *:after { box-sizing: inherit; } body { margin: 0; background: #fff; color: #333; font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: .2px; -webkit-font-smoothing: antialiased; box-sizing: border-box; } h1 { font-size: 2rem; font-weight: 700; margin: 1.275em 0 0.6em; } h2 { font-size: 1.75rem; font-weight: 700; margin: 1.275em 0 0.3em; } h3 { font-size: 1.5rem; font-weight: 700; margin: 1em 0 0.3em; } h4 { font-size: 1.25rem; font-weight: 700; margin: 1.275em 0 0.85em; } h5 { font-size: 1rem; font-weight: 700; margin: 1.275em 0 0.85em; } h6 { font-size: 1rem; font-weight: 700; margin: 1.275em 0 0.85em; color: #777; } p { margin: 0 0 1em; } ul, ol { padding: 0 0 0 2em; margin: 0 0 0.85em; } blockquote { margin: 0 0 0.85em; padding: 0 15px; color: #858585; border-left: 4px solid #e5e5e5; } img { max-width: 100%; } a { color: #4183c4; text-decoration: none; } a:hover, a:focus { outline: 0; text-decoration: underline; } a.discouraged { text-decoration: line-through; } a.discouraged:hover, a.discouraged:focus { text-decoration: underline line-through; } table { background: #fff; width: 100%; border-collapse: collapse; border-spacing: 0; overflow: auto; margin: 0 0 0.85em; } tr:nth-child(2n) { background-color: #fbfbfb; } th, td { padding: 6px 13px; border: 1px solid #ddd; } hr { height: 1px; border: none; background-color: #ddd; } pre { margin: 0 0 1.275em; padding: .85em 1em; overflow: auto; background: #f7f7f7; font-size: .85em; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; } code { font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; } .item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code { background: #f7f7f7; padding: .2em; } .item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after { letter-spacing: -.2em; content: "\00a0"; } pre code { padding: 0; white-space: pre; } .content-wrapper { display: flex; flex-direction: column; } @media (min-width: 768px) { .content-wrapper { flex-direction: row; } } .header { display: flex; padding: 8px; font-size: 0.875em; background: #444; color: #999; } .header-col { margin: 0; padding: 0 8px; } .header-col--primary { flex: 1; } .header-link { color: #fff; } .header-icon { padding-right: 2px; vertical-align: -3px; height: 16px; } .breadcrumbs { font-size: 0.875em; padding: 8px 16px; margin: 0; background: #fbfbfb; border-bottom: 1px solid #ddd; } .carat { height: 10px; margin: 0 5px; } .navigation { order: 2; } @media (min-width: 768px) { .navigation { order: 1; width: 25%; max-width: 300px; padding-bottom: 64px; overflow: hidden; word-wrap: normal; background: #fbfbfb; border-right: 1px solid #ddd; } } .nav-groups { list-style-type: none; padding-left: 0; } .nav-group-name { border-bottom: 1px solid #ddd; padding: 8px 0 8px 16px; } .nav-group-name-link { color: #333; } .nav-group-tasks { margin: 8px 0; padding: 0 0 0 8px; } .nav-group-task { font-size: 1em; list-style-type: none; white-space: nowrap; } .nav-group-task-link { color: #808080; } .main-content { order: 1; } @media (min-width: 768px) { .main-content { order: 2; flex: 1; padding-bottom: 60px; } } .section { padding: 0 32px; border-bottom: 1px solid #ddd; } .section-content { max-width: 834px; margin: 0 auto; padding: 16px 0; } .section-name { color: #666; display: block; } .section-name p { margin-bottom: inherit; } .declaration .highlight { overflow-x: initial; padding: 8px 0; margin: 0; background-color: transparent; border: none; } .task-group-section { border-top: 1px solid #ddd; } .task-group { padding-top: 0px; } .task-name-container a[name]:before { content: ""; display: block; } .section-name-container { position: relative; } .section-name-container .section-name-link { position: absolute; top: 0; left: 0; bottom: 0; right: 0; margin-bottom: 0; } .section-name-container .section-name { position: relative; pointer-events: none; z-index: 1; } .section-name-container .section-name a { pointer-events: auto; } .item-container { padding: 0; } .item { padding-top: 8px; width: 100%; list-style-type: none; } .item a[name]:before { content: ""; display: block; } .item .token, .item .direct-link { display: inline-block; text-indent: -20px; padding-left: 3px; margin-left: 20px; font-size: 1rem; } .declaration-note { font-size: .85em; color: #808080; font-style: italic; } .pointer-container { border-bottom: 1px solid #ddd; left: -23px; padding-bottom: 13px; position: relative; width: 110%; } .pointer { left: 21px; top: 7px; display: block; position: absolute; width: 12px; height: 12px; border-left: 1px solid #ddd; border-top: 1px solid #ddd; background: #fff; transform: rotate(45deg); } .height-container { display: none; position: relative; width: 100%; overflow: hidden; } .height-container .section { background: #fff; border: 1px solid #ddd; border-top-width: 0; padding-top: 10px; padding-bottom: 5px; padding: 8px 16px; } .aside, .language { padding: 6px 12px; margin: 12px 0; border-left: 5px solid #dddddd; overflow-y: hidden; } .aside .aside-title, .language .aside-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 0; margin: 0; color: #aaa; -webkit-user-select: none; } .aside p:last-child, .language p:last-child { margin-bottom: 0; } .language { border-left: 5px solid #cde9f4; } .language .aside-title { color: #4183c4; } .aside-warning, .aside-deprecated, .aside-unavailable { border-left: 5px solid #ff6666; } .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { color: #ff0000; } .graybox { border-collapse: collapse; width: 100%; } .graybox p { margin: 0; word-break: break-word; min-width: 50px; } .graybox td { border: 1px solid #ddd; padding: 5px 25px 5px 10px; vertical-align: middle; } .graybox tr td:first-of-type { text-align: right; padding: 7px; vertical-align: top; word-break: normal; width: 40px; } .slightly-smaller { font-size: 0.9em; } .footer { padding: 8px 16px; background: #444; color: #ddd; font-size: 0.8em; } .footer p { margin: 8px 0; } .footer a { color: #fff; } html.dash .header, html.dash .breadcrumbs, html.dash .navigation { display: none; } html.dash .height-container { display: block; } form[role=search] input { font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px; padding: 0 10px; margin: 0; border: none; border-radius: 1em; } .loading form[role=search] input { background: white url(../img/spinner.gif) center right 4px no-repeat; } form[role=search] .tt-menu { margin: 0; min-width: 300px; background: #fbfbfb; color: #333; border: 1px solid #ddd; } form[role=search] .tt-highlight { font-weight: bold; } form[role=search] .tt-suggestion { font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; padding: 0 8px; } form[role=search] .tt-suggestion span { display: table-cell; white-space: nowrap; } form[role=search] .tt-suggestion .doc-parent-name { width: 100%; text-align: right; font-weight: normal; font-size: 0.9em; padding-left: 16px; } form[role=search] .tt-suggestion:hover, form[role=search] .tt-suggestion.tt-cursor { cursor: pointer; background-color: #4183c4; color: #fff; } form[role=search] .tt-suggestion:hover .doc-parent-name, form[role=search] .tt-suggestion.tt-cursor .doc-parent-name { color: #fff; } ================================================ FILE: docs/index.html ================================================ RxSwift Reference

RxSwift 6.10.1 Docs (95% documented)

GitHub View on GitHub

RxSwift Logo
Build Status Supported Platforms: iOS, macOS, tvOS, watchOS & Linux

Rx is a generic abstraction of computation expressed through Observable<Element> interface, which lets you broadcast and subscribe to values and other events from an Observable stream.

RxSwift is the Swift-specific implementation of the Reactive Extensions standard.

RxSwift Observable Example of a price constantly changing and updating the app's UI

While this version aims to stay true to the original spirit and naming conventions of Rx, this project also aims to provide a true Swift-first API for Rx APIs.

Cross platform documentation can be found on ReactiveX.io.

Like other Rx implementations, RxSwift’s intention is to enable easy composition of asynchronous operations and streams of data in the form of Observable objects and a suite of methods to transform and compose these pieces of asynchronous work.

KVO observation, async operations, UI Events and other streams of data are all unified under abstraction of sequence. This is the reason why Rx is so simple, elegant and powerful.

I came here because I want to …

… understand
… install
… hack around
… interact
… compare
… understand the structure

RxSwift is as compositional as the asynchronous work it drives. The core unit is RxSwift itself, while other dependencies can be added for UI Work, testing, and more.

It comprises five separate components depending on each other in the following way:

┌──────────────┐    ┌──────────────┐
│   RxCocoa    ├────▶   RxRelay    │
└───────┬──────┘    └──────┬───────┘
        │                  │
┌───────▼──────────────────▼───────┐
│             RxSwift              │
└───────▲──────────────────▲───────┘
        │                  │
┌───────┴──────┐    ┌──────┴───────┐
│    RxTest    │    │  RxBlocking  │
└──────────────┘    └──────────────┘
  • RxSwift: The core of RxSwift, providing the Rx standard as (mostly) defined by ReactiveX. It has no other dependencies.
  • RxCocoa: Provides Cocoa-specific capabilities for general iOS/macOS/watchOS & tvOS app development, such as Shared Sequences, Traits, and much more. It depends on both RxSwift and RxRelay.
  • RxRelay: Provides PublishRelay, BehaviorRelay and ReplayRelay, three simple wrappers around Subjects. It depends on RxSwift.
  • RxTest and RxBlocking: Provides testing capabilities for Rx-based systems. It depends on RxSwift.

Usage

Here’s an example In Action
Define search for GitHub repositories …
let searchResults = searchBar.rx.text.orEmpty
    .throttle(.milliseconds(300), scheduler: MainScheduler.instance)
    .distinctUntilChanged()
    .flatMapLatest { query -> Observable<[Repository]> in
        if query.isEmpty {
            return .just([])
        }
        return searchGitHub(query)
            .catchAndReturn([])
    }
    .observe(on: 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)

Installation

RxSwift doesn’t contain any external dependencies.

These are currently the supported installation options:

Manual

Open Rx.xcworkspace, choose RxExample and hit run. This method will build everything and run the sample app

XCFrameworks

Each release starting with RxSwift 6 includes *.xcframework framework binaries.

Simply drag the needed framework binaries to your Frameworks, Libraries, and Embedded Content section under your target’s General tab.

XCFrameworks instructions

[!TIP] RxSwift’s xcframework(s) are signed with an Apple Developer account, and you can always verify the Team Name: Shai Mishali

XCFrameworks Signing Team Name Validation

Carthage

Add this to Cartfile

github "ReactiveX/RxSwift" "6.10.0"
$ carthage update

Carthage as a Static Library

Carthage defaults to building RxSwift as a Dynamic Library.

If you wish to build RxSwift as a Static Library using Carthage you may use the script below to manually modify the framework type before building with Carthage:

carthage update RxSwift --platform iOS --no-build
sed -i -e 's/MACH_O_TYPE = mh_dylib/MACH_O_TYPE = staticlib/g' Carthage/Checkouts/RxSwift/Rx.xcodeproj/project.pbxproj
carthage build RxSwift --platform iOS

Swift Package Manager

Note: There is a critical cross-dependency bug affecting many projects including RxSwift in Swift Package Manager. We’ve filed a bug (SR-12303) in early 2020 but have no answer yet. Your mileage may vary. A partial workaround can be found here.

Create a Package.swift file.

// swift-tools-version:5.0

import PackageDescription

let package = Package(
  name: "RxProject",
  dependencies: [
    .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0"))
  ],
  targets: [
    .target(name: "RxProject", dependencies: ["RxSwift", .product(name: "RxCocoa", package: "RxSwift")]),
  ]
)
$ swift build

To build or test a module with RxTest dependency, set TEST=1.

$ TEST=1 swift test

Manually using git submodules

  • Add RxSwift as a submodule
$ 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, RxCocoa and RxRelay targets

References

================================================ FILE: docs/js/jazzy.js ================================================ // Jazzy - https://github.com/realm/jazzy // Copyright Realm Inc. // SPDX-License-Identifier: MIT window.jazzy = {'docset': false} if (typeof window.dash != 'undefined') { document.documentElement.className += ' dash' window.jazzy.docset = true } if (navigator.userAgent.match(/xcode/i)) { document.documentElement.className += ' xcode' window.jazzy.docset = true } function toggleItem($link, $content) { var animationDuration = 300; $link.toggleClass('token-open'); $content.slideToggle(animationDuration); } function itemLinkToContent($link) { return $link.parent().parent().next(); } // On doc load + hash-change, open any targeted item function openCurrentItemIfClosed() { if (window.jazzy.docset) { return; } var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token'); $content = itemLinkToContent($link); if ($content.is(':hidden')) { toggleItem($link, $content); } } $(openCurrentItemIfClosed); $(window).on('hashchange', openCurrentItemIfClosed); // On item link ('token') click, toggle its discussion $('.token').on('click', function(event) { if (window.jazzy.docset) { return; } var $link = $(this); toggleItem($link, itemLinkToContent($link)); // Keeps the document from jumping to the hash. var href = $link.attr('href'); if (history.pushState) { history.pushState({}, '', href); } else { location.hash = href; } event.preventDefault(); }); // Clicks on links to the current, closed, item need to open the item $("a:not('.token')").on('click', function() { if (location == this.href) { openCurrentItemIfClosed(); } }); // KaTeX rendering if ("katex" in window) { $($('.math').each( (_, element) => { katex.render(element.textContent, element, { displayMode: $(element).hasClass('m-block'), throwOnError: false, trust: true }); })) } ================================================ FILE: docs/js/jazzy.search.js ================================================ // Jazzy - https://github.com/realm/jazzy // Copyright Realm Inc. // SPDX-License-Identifier: MIT $(function(){ var $typeahead = $('[data-typeahead]'); var $form = $typeahead.parents('form'); var searchURL = $form.attr('action'); function displayTemplate(result) { return result.name; } function suggestionTemplate(result) { var t = '
'; t += '' + result.name + ''; if (result.parent_name) { t += '' + result.parent_name + ''; } t += '
'; return t; } $typeahead.one('focus', function() { $form.addClass('loading'); $.getJSON(searchURL).then(function(searchData) { const searchIndex = lunr(function() { this.ref('url'); this.field('name'); this.field('abstract'); for (const [url, doc] of Object.entries(searchData)) { this.add({url: url, name: doc.name, abstract: doc.abstract}); } }); $typeahead.typeahead( { highlight: true, minLength: 3, autoselect: true }, { limit: 10, display: displayTemplate, templates: { suggestion: suggestionTemplate }, source: function(query, sync) { const lcSearch = query.toLowerCase(); const results = searchIndex.query(function(q) { q.term(lcSearch, { boost: 100 }); q.term(lcSearch, { boost: 10, wildcard: lunr.Query.wildcard.TRAILING }); }).map(function(result) { var doc = searchData[result.ref]; doc.url = result.ref; return doc; }); sync(results); } } ); $form.removeClass('loading'); $typeahead.trigger('focus'); }); }); var baseURL = searchURL.slice(0, -"search.json".length); $typeahead.on('typeahead:select', function(e, result) { window.location = baseURL + result.url; }); }); ================================================ FILE: docs/js/typeahead.jquery.js ================================================ /*! * typeahead.js 1.3.3 * https://github.com/corejavascript/typeahead.js * Copyright 2013-2024 Twitter, Inc. and other contributors; Licensed MIT */ (function(root, factory) { if (typeof define === "function" && define.amd) { define([ "jquery" ], function(a0) { return factory(a0); }); } else if (typeof module === "object" && module.exports) { module.exports = factory(require("jquery")); } else { factory(root["jQuery"]); } })(this, function($) { var _ = function() { "use strict"; return { isMsie: function() { return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false; }, isBlankString: function(str) { return !str || /^\s*$/.test(str); }, escapeRegExChars: function(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); }, isString: function(obj) { return typeof obj === "string"; }, isNumber: function(obj) { return typeof obj === "number"; }, isArray: $.isArray, isFunction: $.isFunction, isObject: $.isPlainObject, isUndefined: function(obj) { return typeof obj === "undefined"; }, isElement: function(obj) { return !!(obj && obj.nodeType === 1); }, isJQuery: function(obj) { return obj instanceof $; }, toStr: function toStr(s) { return _.isUndefined(s) || s === null ? "" : s + ""; }, bind: $.proxy, each: function(collection, cb) { $.each(collection, reverseArgs); function reverseArgs(index, value) { return cb(value, index); } }, map: $.map, filter: $.grep, every: function(obj, test) { var result = true; if (!obj) { return result; } $.each(obj, function(key, val) { if (!(result = test.call(null, val, key, obj))) { return false; } }); return !!result; }, some: function(obj, test) { var result = false; if (!obj) { return result; } $.each(obj, function(key, val) { if (result = test.call(null, val, key, obj)) { return false; } }); return !!result; }, mixin: $.extend, identity: function(x) { return x; }, clone: function(obj) { return $.extend(true, {}, obj); }, getIdGenerator: function() { var counter = 0; return function() { return counter++; }; }, templatify: function templatify(obj) { return $.isFunction(obj) ? obj : template; function template() { return String(obj); } }, defer: function(fn) { setTimeout(fn, 0); }, debounce: function(func, wait, immediate) { var timeout, result; return function() { var context = this, args = arguments, later, callNow; later = function() { timeout = null; if (!immediate) { result = func.apply(context, args); } }; callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) { result = func.apply(context, args); } return result; }; }, throttle: function(func, wait) { var context, args, timeout, result, previous, later; previous = 0; later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(), remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }, stringify: function(val) { return _.isString(val) ? val : JSON.stringify(val); }, guid: function() { function _p8(s) { var p = (Math.random().toString(16) + "000000000").substr(2, 8); return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p; } return "tt-" + _p8() + _p8(true) + _p8(true) + _p8(); }, noop: function() {} }; }(); var WWW = function() { "use strict"; var defaultClassNames = { wrapper: "twitter-typeahead", input: "tt-input", hint: "tt-hint", menu: "tt-menu", dataset: "tt-dataset", suggestion: "tt-suggestion", selectable: "tt-selectable", empty: "tt-empty", open: "tt-open", cursor: "tt-cursor", highlight: "tt-highlight" }; return build; function build(o) { var www, classes; classes = _.mixin({}, defaultClassNames, o); www = { css: buildCss(), classes: classes, html: buildHtml(classes), selectors: buildSelectors(classes) }; return { css: www.css, html: www.html, classes: www.classes, selectors: www.selectors, mixin: function(o) { _.mixin(o, www); } }; } function buildHtml(c) { return { wrapper: '', menu: '
' }; } function buildSelectors(classes) { var selectors = {}; _.each(classes, function(v, k) { selectors[k] = "." + v; }); return selectors; } function buildCss() { var css = { wrapper: { position: "relative", display: "inline-block" }, hint: { position: "absolute", top: "0", left: "0", borderColor: "transparent", boxShadow: "none", opacity: "1" }, input: { position: "relative", verticalAlign: "top", backgroundColor: "transparent" }, inputWithNoHint: { position: "relative", verticalAlign: "top" }, menu: { position: "absolute", top: "100%", left: "0", zIndex: "100", display: "none" }, ltr: { left: "0", right: "auto" }, rtl: { left: "auto", right: " 0" } }; if (_.isMsie()) { _.mixin(css.input, { backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)" }); } return css; } }(); var EventBus = function() { "use strict"; var namespace, deprecationMap; namespace = "typeahead:"; deprecationMap = { render: "rendered", cursorchange: "cursorchanged", select: "selected", autocomplete: "autocompleted" }; function EventBus(o) { if (!o || !o.el) { $.error("EventBus initialized without el"); } this.$el = $(o.el); } _.mixin(EventBus.prototype, { _trigger: function(type, args) { var $e = $.Event(namespace + type); this.$el.trigger.call(this.$el, $e, args || []); return $e; }, before: function(type) { var args, $e; args = [].slice.call(arguments, 1); $e = this._trigger("before" + type, args); return $e.isDefaultPrevented(); }, trigger: function(type) { var deprecatedType; this._trigger(type, [].slice.call(arguments, 1)); if (deprecatedType = deprecationMap[type]) { this._trigger(deprecatedType, [].slice.call(arguments, 1)); } } }); return EventBus; }(); var EventEmitter = function() { "use strict"; var splitter = /\s+/, nextTick = getNextTick(); return { onSync: onSync, onAsync: onAsync, off: off, trigger: trigger }; function on(method, types, cb, context) { var type; if (!cb) { return this; } types = types.split(splitter); cb = context ? bindContext(cb, context) : cb; this._callbacks = this._callbacks || {}; while (type = types.shift()) { this._callbacks[type] = this._callbacks[type] || { sync: [], async: [] }; this._callbacks[type][method].push(cb); } return this; } function onAsync(types, cb, context) { return on.call(this, "async", types, cb, context); } function onSync(types, cb, context) { return on.call(this, "sync", types, cb, context); } function off(types) { var type; if (!this._callbacks) { return this; } types = types.split(splitter); while (type = types.shift()) { delete this._callbacks[type]; } return this; } function trigger(types) { var type, callbacks, args, syncFlush, asyncFlush; if (!this._callbacks) { return this; } types = types.split(splitter); args = [].slice.call(arguments, 1); while ((type = types.shift()) && (callbacks = this._callbacks[type])) { syncFlush = getFlush(callbacks.sync, this, [ type ].concat(args)); asyncFlush = getFlush(callbacks.async, this, [ type ].concat(args)); syncFlush() && nextTick(asyncFlush); } return this; } function getFlush(callbacks, context, args) { return flush; function flush() { var cancelled; for (var i = 0, len = callbacks.length; !cancelled && i < len; i += 1) { cancelled = callbacks[i].apply(context, args) === false; } return !cancelled; } } function getNextTick() { var nextTickFn; if (window.setImmediate) { nextTickFn = function nextTickSetImmediate(fn) { setImmediate(function() { fn(); }); }; } else { nextTickFn = function nextTickSetTimeout(fn) { setTimeout(function() { fn(); }, 0); }; } return nextTickFn; } function bindContext(fn, context) { return fn.bind ? fn.bind(context) : function() { fn.apply(context, [].slice.call(arguments, 0)); }; } }(); var highlight = function(doc) { "use strict"; var defaults = { node: null, pattern: null, tagName: "strong", className: null, wordsOnly: false, caseSensitive: false, diacriticInsensitive: false }; var accented = { A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]", B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]", C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]", D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]", E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]", F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]", G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]", H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]", I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]", J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]", K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]", L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]", M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]", N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]", O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]", P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]", Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]", R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]", S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]", T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]", U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]", V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]", W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]", X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]", Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]", Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]" }; return function hightlight(o) { var regex; o = _.mixin({}, defaults, o); if (!o.node || !o.pattern) { return; } o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ]; regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive); traverse(o.node, hightlightTextNode); function hightlightTextNode(textNode) { var match, patternNode, wrapperNode; if (match = regex.exec(textNode.data)) { wrapperNode = doc.createElement(o.tagName); o.className && (wrapperNode.className = o.className); patternNode = textNode.splitText(match.index); patternNode.splitText(match[0].length); wrapperNode.appendChild(patternNode.cloneNode(true)); textNode.parentNode.replaceChild(wrapperNode, patternNode); } return !!match; } function traverse(el, hightlightTextNode) { var childNode, TEXT_NODE_TYPE = 3; for (var i = 0; i < el.childNodes.length; i++) { childNode = el.childNodes[i]; if (childNode.nodeType === TEXT_NODE_TYPE) { i += hightlightTextNode(childNode) ? 1 : 0; } else { traverse(childNode, hightlightTextNode); } } } }; function accent_replacer(chr) { return accented[chr.toUpperCase()] || chr; } function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) { var escapedPatterns = [], regexStr; for (var i = 0, len = patterns.length; i < len; i++) { var escapedWord = _.escapeRegExChars(patterns[i]); if (diacriticInsensitive) { escapedWord = escapedWord.replace(/\S/g, accent_replacer); } escapedPatterns.push(escapedWord); } regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")"; return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i"); } }(window.document); var Input = function() { "use strict"; var specialKeyCodeMap; specialKeyCodeMap = { 9: "tab", 27: "esc", 37: "left", 39: "right", 13: "enter", 38: "up", 40: "down" }; function Input(o, www) { var id; o = o || {}; if (!o.input) { $.error("input is missing"); } www.mixin(this); this.$hint = $(o.hint); this.$input = $(o.input); this.$menu = $(o.menu); id = this.$input.attr("id") || _.guid(); this.$menu.attr("id", id + "_listbox"); this.$hint.attr({ "aria-hidden": true }); this.$input.attr({ "aria-owns": id + "_listbox", "aria-controls": id + "_listbox", role: "combobox", "aria-autocomplete": "list", "aria-expanded": false }); this.query = this.$input.val(); this.queryWhenFocused = this.hasFocus() ? this.query : null; this.$overflowHelper = buildOverflowHelper(this.$input); this._checkLanguageDirection(); if (this.$hint.length === 0) { this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop; } this.onSync("cursorchange", this._updateDescendent); } Input.normalizeQuery = function(str) { return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " "); }; _.mixin(Input.prototype, EventEmitter, { _onBlur: function onBlur() { this.resetInputValue(); this.trigger("blurred"); }, _onFocus: function onFocus() { this.queryWhenFocused = this.query; this.trigger("focused"); }, _onKeydown: function onKeydown($e) { var keyName = specialKeyCodeMap[$e.which || $e.keyCode]; this._managePreventDefault(keyName, $e); if (keyName && this._shouldTrigger(keyName, $e)) { this.trigger(keyName + "Keyed", $e); } }, _onInput: function onInput() { this._setQuery(this.getInputValue()); this.clearHintIfInvalid(); this._checkLanguageDirection(); }, _managePreventDefault: function managePreventDefault(keyName, $e) { var preventDefault; switch (keyName) { case "up": case "down": preventDefault = !withModifier($e); break; default: preventDefault = false; } preventDefault && $e.preventDefault(); }, _shouldTrigger: function shouldTrigger(keyName, $e) { var trigger; switch (keyName) { case "tab": trigger = !withModifier($e); break; default: trigger = true; } return trigger; }, _checkLanguageDirection: function checkLanguageDirection() { var dir = (this.$input.css("direction") || "ltr").toLowerCase(); if (this.dir !== dir) { this.dir = dir; this.$hint.attr("dir", dir); this.trigger("langDirChanged", dir); } }, _setQuery: function setQuery(val, silent) { var areEquivalent, hasDifferentWhitespace; areEquivalent = areQueriesEquivalent(val, this.query); hasDifferentWhitespace = areEquivalent ? this.query.length !== val.length : false; this.query = val; if (!silent && !areEquivalent) { this.trigger("queryChanged", this.query); } else if (!silent && hasDifferentWhitespace) { this.trigger("whitespaceChanged", this.query); } }, _updateDescendent: function updateDescendent(event, id) { this.$input.attr("aria-activedescendant", id); }, bind: function() { var that = this, onBlur, onFocus, onKeydown, onInput; onBlur = _.bind(this._onBlur, this); onFocus = _.bind(this._onFocus, this); onKeydown = _.bind(this._onKeydown, this); onInput = _.bind(this._onInput, this); this.$input.on("blur.tt", onBlur).on("focus.tt", onFocus).on("keydown.tt", onKeydown); if (!_.isMsie() || _.isMsie() > 9) { this.$input.on("input.tt", onInput); } else { this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function($e) { if (specialKeyCodeMap[$e.which || $e.keyCode]) { return; } _.defer(_.bind(that._onInput, that, $e)); }); } return this; }, focus: function focus() { this.$input.focus(); }, blur: function blur() { this.$input.blur(); }, getLangDir: function getLangDir() { return this.dir; }, getQuery: function getQuery() { return this.query || ""; }, setQuery: function setQuery(val, silent) { this.setInputValue(val); this._setQuery(val, silent); }, hasQueryChangedSinceLastFocus: function hasQueryChangedSinceLastFocus() { return this.query !== this.queryWhenFocused; }, getInputValue: function getInputValue() { return this.$input.val(); }, setInputValue: function setInputValue(value) { this.$input.val(value); this.clearHintIfInvalid(); this._checkLanguageDirection(); }, resetInputValue: function resetInputValue() { this.setInputValue(this.query); }, getHint: function getHint() { return this.$hint.val(); }, setHint: function setHint(value) { this.$hint.val(value); }, clearHint: function clearHint() { this.setHint(""); }, clearHintIfInvalid: function clearHintIfInvalid() { var val, hint, valIsPrefixOfHint, isValid; val = this.getInputValue(); hint = this.getHint(); valIsPrefixOfHint = val !== hint && hint.indexOf(val) === 0; isValid = val !== "" && valIsPrefixOfHint && !this.hasOverflow(); !isValid && this.clearHint(); }, hasFocus: function hasFocus() { return this.$input.is(":focus"); }, hasOverflow: function hasOverflow() { var constraint = this.$input.width() - 2; this.$overflowHelper.text(this.getInputValue()); return this.$overflowHelper.width() >= constraint; }, isCursorAtEnd: function() { var valueLength, selectionStart, range; valueLength = this.$input.val().length; selectionStart = this.$input[0].selectionStart; if (_.isNumber(selectionStart)) { return selectionStart === valueLength; } else if (document.selection) { range = document.selection.createRange(); range.moveStart("character", -valueLength); return valueLength === range.text.length; } return true; }, destroy: function destroy() { this.$hint.off(".tt"); this.$input.off(".tt"); this.$overflowHelper.remove(); this.$hint = this.$input = this.$overflowHelper = $("
"); }, setAriaExpanded: function setAriaExpanded(value) { this.$input.attr("aria-expanded", value); } }); return Input; function buildOverflowHelper($input) { return $('').css({ position: "absolute", visibility: "hidden", whiteSpace: "pre", fontFamily: $input.css("font-family"), fontSize: $input.css("font-size"), fontStyle: $input.css("font-style"), fontVariant: $input.css("font-variant"), fontWeight: $input.css("font-weight"), wordSpacing: $input.css("word-spacing"), letterSpacing: $input.css("letter-spacing"), textIndent: $input.css("text-indent"), textRendering: $input.css("text-rendering"), textTransform: $input.css("text-transform") }).insertAfter($input); } function areQueriesEquivalent(a, b) { return Input.normalizeQuery(a) === Input.normalizeQuery(b); } function withModifier($e) { return $e.altKey || $e.ctrlKey || $e.metaKey || $e.shiftKey; } }(); var Dataset = function() { "use strict"; var keys, nameGenerator; keys = { dataset: "tt-selectable-dataset", val: "tt-selectable-display", obj: "tt-selectable-object" }; nameGenerator = _.getIdGenerator(); function Dataset(o, www) { o = o || {}; o.templates = o.templates || {}; o.templates.notFound = o.templates.notFound || o.templates.empty; if (!o.source) { $.error("missing source"); } if (!o.node) { $.error("missing node"); } if (o.name && !isValidName(o.name)) { $.error("invalid dataset name: " + o.name); } www.mixin(this); this.highlight = !!o.highlight; this.name = _.toStr(o.name || nameGenerator()); this.limit = o.limit || 5; this.displayFn = getDisplayFn(o.display || o.displayKey); this.templates = getTemplates(o.templates, this.displayFn); this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source; this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async; this._resetLastSuggestion(); this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name); } Dataset.extractData = function extractData(el) { var $el = $(el); if ($el.data(keys.obj)) { return { dataset: $el.data(keys.dataset) || "", val: $el.data(keys.val) || "", obj: $el.data(keys.obj) || null }; } return null; }; _.mixin(Dataset.prototype, EventEmitter, { _overwrite: function overwrite(query, suggestions) { suggestions = suggestions || []; if (suggestions.length) { this._renderSuggestions(query, suggestions); } else if (this.async && this.templates.pending) { this._renderPending(query); } else if (!this.async && this.templates.notFound) { this._renderNotFound(query); } else { this._empty(); } this.trigger("rendered", suggestions, false, this.name); }, _append: function append(query, suggestions) { suggestions = suggestions || []; if (suggestions.length && this.$lastSuggestion.length) { this._appendSuggestions(query, suggestions); } else if (suggestions.length) { this._renderSuggestions(query, suggestions); } else if (!this.$lastSuggestion.length && this.templates.notFound) { this._renderNotFound(query); } this.trigger("rendered", suggestions, true, this.name); }, _renderSuggestions: function renderSuggestions(query, suggestions) { var $fragment; $fragment = this._getSuggestionsFragment(query, suggestions); this.$lastSuggestion = $fragment.children().last(); this.$el.html($fragment).prepend(this._getHeader(query, suggestions)).append(this._getFooter(query, suggestions)); }, _appendSuggestions: function appendSuggestions(query, suggestions) { var $fragment, $lastSuggestion; $fragment = this._getSuggestionsFragment(query, suggestions); $lastSuggestion = $fragment.children().last(); this.$lastSuggestion.after($fragment); this.$lastSuggestion = $lastSuggestion; }, _renderPending: function renderPending(query) { var template = this.templates.pending; this._resetLastSuggestion(); template && this.$el.html(template({ query: query, dataset: this.name })); }, _renderNotFound: function renderNotFound(query) { var template = this.templates.notFound; this._resetLastSuggestion(); template && this.$el.html(template({ query: query, dataset: this.name })); }, _empty: function empty() { this.$el.empty(); this._resetLastSuggestion(); }, _getSuggestionsFragment: function getSuggestionsFragment(query, suggestions) { var that = this, fragment; fragment = document.createDocumentFragment(); _.each(suggestions, function getSuggestionNode(suggestion) { var $el, context; context = that._injectQuery(query, suggestion); $el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable); fragment.appendChild($el[0]); }); this.highlight && highlight({ className: this.classes.highlight, node: fragment, pattern: query }); return $(fragment); }, _getFooter: function getFooter(query, suggestions) { return this.templates.footer ? this.templates.footer({ query: query, suggestions: suggestions, dataset: this.name }) : null; }, _getHeader: function getHeader(query, suggestions) { return this.templates.header ? this.templates.header({ query: query, suggestions: suggestions, dataset: this.name }) : null; }, _resetLastSuggestion: function resetLastSuggestion() { this.$lastSuggestion = $(); }, _injectQuery: function injectQuery(query, obj) { return _.isObject(obj) ? _.mixin({ _query: query }, obj) : obj; }, update: function update(query) { var that = this, canceled = false, syncCalled = false, rendered = 0; this.cancel(); this.cancel = function cancel() { canceled = true; that.cancel = $.noop; that.async && that.trigger("asyncCanceled", query, that.name); }; this.source(query, sync, async); !syncCalled && sync([]); function sync(suggestions) { if (syncCalled) { return; } syncCalled = true; suggestions = (suggestions || []).slice(0, that.limit); rendered = suggestions.length; that._overwrite(query, suggestions); if (rendered < that.limit && that.async) { that.trigger("asyncRequested", query, that.name); } } function async(suggestions) { suggestions = suggestions || []; if (!canceled && rendered < that.limit) { that.cancel = $.noop; var idx = Math.abs(rendered - that.limit); rendered += idx; that._append(query, suggestions.slice(0, idx)); that.async && that.trigger("asyncReceived", query, that.name); } } }, cancel: $.noop, clear: function clear() { this._empty(); this.cancel(); this.trigger("cleared"); }, isEmpty: function isEmpty() { return this.$el.is(":empty"); }, destroy: function destroy() { this.$el = $("
"); } }); return Dataset; function getDisplayFn(display) { display = display || _.stringify; return _.isFunction(display) ? display : displayFn; function displayFn(obj) { return obj[display]; } } function getTemplates(templates, displayFn) { return { notFound: templates.notFound && _.templatify(templates.notFound), pending: templates.pending && _.templatify(templates.pending), header: templates.header && _.templatify(templates.header), footer: templates.footer && _.templatify(templates.footer), suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate }; function userSuggestionTemplate(context) { var template = templates.suggestion; return $(template(context)).attr("id", _.guid()); } function suggestionTemplate(context) { return $('
').attr("id", _.guid()).text(displayFn(context)); } } function isValidName(str) { return /^[_a-zA-Z0-9-]+$/.test(str); } }(); var Menu = function() { "use strict"; function Menu(o, www) { var that = this; o = o || {}; if (!o.node) { $.error("node is required"); } www.mixin(this); this.$node = $(o.node); this.query = null; this.datasets = _.map(o.datasets, initializeDataset); function initializeDataset(oDataset) { var node = that.$node.find(oDataset.node).first(); oDataset.node = node.length ? node : $("
").appendTo(that.$node); return new Dataset(oDataset, www); } } _.mixin(Menu.prototype, EventEmitter, { _onSelectableClick: function onSelectableClick($e) { this.trigger("selectableClicked", $($e.currentTarget)); }, _onRendered: function onRendered(type, dataset, suggestions, async) { this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); this.trigger("datasetRendered", dataset, suggestions, async); }, _onCleared: function onCleared() { this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); this.trigger("datasetCleared"); }, _propagate: function propagate() { this.trigger.apply(this, arguments); }, _allDatasetsEmpty: function allDatasetsEmpty() { return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) { var isEmpty = dataset.isEmpty(); this.$node.attr("aria-expanded", !isEmpty); return isEmpty; }, this)); }, _getSelectables: function getSelectables() { return this.$node.find(this.selectors.selectable); }, _removeCursor: function _removeCursor() { var $selectable = this.getActiveSelectable(); $selectable && $selectable.removeClass(this.classes.cursor); }, _ensureVisible: function ensureVisible($el) { var elTop, elBottom, nodeScrollTop, nodeHeight; elTop = $el.position().top; elBottom = elTop + $el.outerHeight(true); nodeScrollTop = this.$node.scrollTop(); nodeHeight = this.$node.height() + parseInt(this.$node.css("paddingTop"), 10) + parseInt(this.$node.css("paddingBottom"), 10); if (elTop < 0) { this.$node.scrollTop(nodeScrollTop + elTop); } else if (nodeHeight < elBottom) { this.$node.scrollTop(nodeScrollTop + (elBottom - nodeHeight)); } }, bind: function() { var that = this, onSelectableClick; onSelectableClick = _.bind(this._onSelectableClick, this); this.$node.on("click.tt", this.selectors.selectable, onSelectableClick); this.$node.on("mouseover", this.selectors.selectable, function() { that.setCursor($(this)); }); this.$node.on("mouseleave", function() { that._removeCursor(); }); _.each(this.datasets, function(dataset) { dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that); }); return this; }, isOpen: function isOpen() { return this.$node.hasClass(this.classes.open); }, open: function open() { this.$node.scrollTop(0); this.$node.addClass(this.classes.open); }, close: function close() { this.$node.attr("aria-expanded", false); this.$node.removeClass(this.classes.open); this._removeCursor(); }, setLanguageDirection: function setLanguageDirection(dir) { this.$node.attr("dir", dir); }, selectableRelativeToCursor: function selectableRelativeToCursor(delta) { var $selectables, $oldCursor, oldIndex, newIndex; $oldCursor = this.getActiveSelectable(); $selectables = this._getSelectables(); oldIndex = $oldCursor ? $selectables.index($oldCursor) : -1; newIndex = oldIndex + delta; newIndex = (newIndex + 1) % ($selectables.length + 1) - 1; newIndex = newIndex < -1 ? $selectables.length - 1 : newIndex; return newIndex === -1 ? null : $selectables.eq(newIndex); }, setCursor: function setCursor($selectable) { this._removeCursor(); if ($selectable = $selectable && $selectable.first()) { $selectable.addClass(this.classes.cursor); this._ensureVisible($selectable); } }, getSelectableData: function getSelectableData($el) { return $el && $el.length ? Dataset.extractData($el) : null; }, getActiveSelectable: function getActiveSelectable() { var $selectable = this._getSelectables().filter(this.selectors.cursor).first(); return $selectable.length ? $selectable : null; }, getTopSelectable: function getTopSelectable() { var $selectable = this._getSelectables().first(); return $selectable.length ? $selectable : null; }, update: function update(query) { var isValidUpdate = query !== this.query; if (isValidUpdate) { this.query = query; _.each(this.datasets, updateDataset); } return isValidUpdate; function updateDataset(dataset) { dataset.update(query); } }, empty: function empty() { _.each(this.datasets, clearDataset); this.query = null; this.$node.addClass(this.classes.empty); function clearDataset(dataset) { dataset.clear(); } }, destroy: function destroy() { this.$node.off(".tt"); this.$node = $("
"); _.each(this.datasets, destroyDataset); function destroyDataset(dataset) { dataset.destroy(); } } }); return Menu; }(); var Status = function() { "use strict"; function Status(options) { this.$el = $("", { role: "status", "aria-live": "polite" }).css({ position: "absolute", padding: "0", border: "0", height: "1px", width: "1px", "margin-bottom": "-1px", "margin-right": "-1px", overflow: "hidden", clip: "rect(0 0 0 0)", "white-space": "nowrap" }); options.$input.after(this.$el); _.each(options.menu.datasets, _.bind(function(dataset) { if (dataset.onSync) { dataset.onSync("rendered", _.bind(this.update, this)); dataset.onSync("cleared", _.bind(this.cleared, this)); } }, this)); } _.mixin(Status.prototype, { update: function update(event, suggestions) { var length = suggestions.length; var words; if (length === 1) { words = { result: "result", is: "is" }; } else { words = { result: "results", is: "are" }; } this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate."); }, cleared: function() { this.$el.text(""); } }); return Status; }(); var DefaultMenu = function() { "use strict"; var s = Menu.prototype; function DefaultMenu() { Menu.apply(this, [].slice.call(arguments, 0)); } _.mixin(DefaultMenu.prototype, Menu.prototype, { open: function open() { !this._allDatasetsEmpty() && this._show(); return s.open.apply(this, [].slice.call(arguments, 0)); }, close: function close() { this._hide(); return s.close.apply(this, [].slice.call(arguments, 0)); }, _onRendered: function onRendered() { if (this._allDatasetsEmpty()) { this._hide(); } else { this.isOpen() && this._show(); } return s._onRendered.apply(this, [].slice.call(arguments, 0)); }, _onCleared: function onCleared() { if (this._allDatasetsEmpty()) { this._hide(); } else { this.isOpen() && this._show(); } return s._onCleared.apply(this, [].slice.call(arguments, 0)); }, setLanguageDirection: function setLanguageDirection(dir) { this.$node.css(dir === "ltr" ? this.css.ltr : this.css.rtl); return s.setLanguageDirection.apply(this, [].slice.call(arguments, 0)); }, _hide: function hide() { this.$node.hide(); }, _show: function show() { this.$node.css("display", "block"); } }); return DefaultMenu; }(); var Typeahead = function() { "use strict"; function Typeahead(o, www) { var onFocused, onBlurred, onEnterKeyed, onTabKeyed, onEscKeyed, onUpKeyed, onDownKeyed, onLeftKeyed, onRightKeyed, onQueryChanged, onWhitespaceChanged; o = o || {}; if (!o.input) { $.error("missing input"); } if (!o.menu) { $.error("missing menu"); } if (!o.eventBus) { $.error("missing event bus"); } www.mixin(this); this.eventBus = o.eventBus; this.minLength = _.isNumber(o.minLength) ? o.minLength : 1; this.input = o.input; this.menu = o.menu; this.enabled = true; this.autoselect = !!o.autoselect; this.active = false; this.input.hasFocus() && this.activate(); this.dir = this.input.getLangDir(); this._hacks(); this.menu.bind().onSync("selectableClicked", this._onSelectableClicked, this).onSync("asyncRequested", this._onAsyncRequested, this).onSync("asyncCanceled", this._onAsyncCanceled, this).onSync("asyncReceived", this._onAsyncReceived, this).onSync("datasetRendered", this._onDatasetRendered, this).onSync("datasetCleared", this._onDatasetCleared, this); onFocused = c(this, "activate", "open", "_onFocused"); onBlurred = c(this, "deactivate", "_onBlurred"); onEnterKeyed = c(this, "isActive", "isOpen", "_onEnterKeyed"); onTabKeyed = c(this, "isActive", "isOpen", "_onTabKeyed"); onEscKeyed = c(this, "isActive", "_onEscKeyed"); onUpKeyed = c(this, "isActive", "open", "_onUpKeyed"); onDownKeyed = c(this, "isActive", "open", "_onDownKeyed"); onLeftKeyed = c(this, "isActive", "isOpen", "_onLeftKeyed"); onRightKeyed = c(this, "isActive", "isOpen", "_onRightKeyed"); onQueryChanged = c(this, "_openIfActive", "_onQueryChanged"); onWhitespaceChanged = c(this, "_openIfActive", "_onWhitespaceChanged"); this.input.bind().onSync("focused", onFocused, this).onSync("blurred", onBlurred, this).onSync("enterKeyed", onEnterKeyed, this).onSync("tabKeyed", onTabKeyed, this).onSync("escKeyed", onEscKeyed, this).onSync("upKeyed", onUpKeyed, this).onSync("downKeyed", onDownKeyed, this).onSync("leftKeyed", onLeftKeyed, this).onSync("rightKeyed", onRightKeyed, this).onSync("queryChanged", onQueryChanged, this).onSync("whitespaceChanged", onWhitespaceChanged, this).onSync("langDirChanged", this._onLangDirChanged, this); } _.mixin(Typeahead.prototype, { _hacks: function hacks() { var $input, $menu; $input = this.input.$input || $("
"); $menu = this.menu.$node || $("
"); $input.on("blur.tt", function($e) { var active, isActive, hasActive; active = document.activeElement; isActive = $menu.is(active); hasActive = $menu.has(active).length > 0; if (_.isMsie() && (isActive || hasActive)) { $e.preventDefault(); $e.stopImmediatePropagation(); _.defer(function() { $input.focus(); }); } }); $menu.on("mousedown.tt", function($e) { $e.preventDefault(); }); }, _onSelectableClicked: function onSelectableClicked(type, $el) { this.select($el); }, _onDatasetCleared: function onDatasetCleared() { this._updateHint(); }, _onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) { this._updateHint(); if (this.autoselect) { var cursorClass = this.selectors.cursor.substr(1); this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass); } this.eventBus.trigger("render", suggestions, async, dataset); }, _onAsyncRequested: function onAsyncRequested(type, dataset, query) { this.eventBus.trigger("asyncrequest", query, dataset); }, _onAsyncCanceled: function onAsyncCanceled(type, dataset, query) { this.eventBus.trigger("asynccancel", query, dataset); }, _onAsyncReceived: function onAsyncReceived(type, dataset, query) { this.eventBus.trigger("asyncreceive", query, dataset); }, _onFocused: function onFocused() { this._minLengthMet() && this.menu.update(this.input.getQuery()); }, _onBlurred: function onBlurred() { if (this.input.hasQueryChangedSinceLastFocus()) { this.eventBus.trigger("change", this.input.getQuery()); } }, _onEnterKeyed: function onEnterKeyed(type, $e) { var $selectable; if ($selectable = this.menu.getActiveSelectable()) { if (this.select($selectable)) { $e.preventDefault(); $e.stopPropagation(); } } else if (this.autoselect) { if (this.select(this.menu.getTopSelectable())) { $e.preventDefault(); $e.stopPropagation(); } } }, _onTabKeyed: function onTabKeyed(type, $e) { var $selectable; if ($selectable = this.menu.getActiveSelectable()) { this.select($selectable) && $e.preventDefault(); } else if (this.autoselect) { if ($selectable = this.menu.getTopSelectable()) { this.autocomplete($selectable) && $e.preventDefault(); } } }, _onEscKeyed: function onEscKeyed() { this.close(); }, _onUpKeyed: function onUpKeyed() { this.moveCursor(-1); }, _onDownKeyed: function onDownKeyed() { this.moveCursor(+1); }, _onLeftKeyed: function onLeftKeyed() { if (this.dir === "rtl" && this.input.isCursorAtEnd()) { this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable()); } }, _onRightKeyed: function onRightKeyed() { if (this.dir === "ltr" && this.input.isCursorAtEnd()) { this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable()); } }, _onQueryChanged: function onQueryChanged(e, query) { this._minLengthMet(query) ? this.menu.update(query) : this.menu.empty(); }, _onWhitespaceChanged: function onWhitespaceChanged() { this._updateHint(); }, _onLangDirChanged: function onLangDirChanged(e, dir) { if (this.dir !== dir) { this.dir = dir; this.menu.setLanguageDirection(dir); } }, _openIfActive: function openIfActive() { this.isActive() && this.open(); }, _minLengthMet: function minLengthMet(query) { query = _.isString(query) ? query : this.input.getQuery() || ""; return query.length >= this.minLength; }, _updateHint: function updateHint() { var $selectable, data, val, query, escapedQuery, frontMatchRegEx, match; $selectable = this.menu.getTopSelectable(); data = this.menu.getSelectableData($selectable); val = this.input.getInputValue(); if (data && !_.isBlankString(val) && !this.input.hasOverflow()) { query = Input.normalizeQuery(val); escapedQuery = _.escapeRegExChars(query); frontMatchRegEx = new RegExp("^(?:" + escapedQuery + ")(.+$)", "i"); match = frontMatchRegEx.exec(data.val); match && this.input.setHint(val + match[1]); } else { this.input.clearHint(); } }, isEnabled: function isEnabled() { return this.enabled; }, enable: function enable() { this.enabled = true; }, disable: function disable() { this.enabled = false; }, isActive: function isActive() { return this.active; }, activate: function activate() { if (this.isActive()) { return true; } else if (!this.isEnabled() || this.eventBus.before("active")) { return false; } else { this.active = true; this.eventBus.trigger("active"); return true; } }, deactivate: function deactivate() { if (!this.isActive()) { return true; } else if (this.eventBus.before("idle")) { return false; } else { this.active = false; this.close(); this.eventBus.trigger("idle"); return true; } }, isOpen: function isOpen() { return this.menu.isOpen(); }, open: function open() { if (!this.isOpen() && !this.eventBus.before("open")) { this.input.setAriaExpanded(true); this.menu.open(); this._updateHint(); this.eventBus.trigger("open"); } return this.isOpen(); }, close: function close() { if (this.isOpen() && !this.eventBus.before("close")) { this.input.setAriaExpanded(false); this.menu.close(); this.input.clearHint(); this.input.resetInputValue(); this.eventBus.trigger("close"); } return !this.isOpen(); }, setVal: function setVal(val) { this.input.setQuery(_.toStr(val)); }, getVal: function getVal() { return this.input.getQuery(); }, select: function select($selectable) { var data = this.menu.getSelectableData($selectable); if (data && !this.eventBus.before("select", data.obj, data.dataset)) { this.input.setQuery(data.val, true); this.eventBus.trigger("select", data.obj, data.dataset); this.close(); return true; } return false; }, autocomplete: function autocomplete($selectable) { var query, data, isValid; query = this.input.getQuery(); data = this.menu.getSelectableData($selectable); isValid = data && query !== data.val; if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) { this.input.setQuery(data.val); this.eventBus.trigger("autocomplete", data.obj, data.dataset); return true; } return false; }, moveCursor: function moveCursor(delta) { var query, $candidate, data, suggestion, datasetName, cancelMove, id; query = this.input.getQuery(); $candidate = this.menu.selectableRelativeToCursor(delta); data = this.menu.getSelectableData($candidate); suggestion = data ? data.obj : null; datasetName = data ? data.dataset : null; id = $candidate ? $candidate.attr("id") : null; this.input.trigger("cursorchange", id); cancelMove = this._minLengthMet() && this.menu.update(query); if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) { this.menu.setCursor($candidate); if (data) { if (typeof data.val === "string") { this.input.setInputValue(data.val); } } else { this.input.resetInputValue(); this._updateHint(); } this.eventBus.trigger("cursorchange", suggestion, datasetName); return true; } return false; }, destroy: function destroy() { this.input.destroy(); this.menu.destroy(); } }); return Typeahead; function c(ctx) { var methods = [].slice.call(arguments, 1); return function() { var args = [].slice.call(arguments); _.each(methods, function(method) { return ctx[method].apply(ctx, args); }); }; } }(); (function() { "use strict"; var old, keys, methods; old = $.fn.typeahead; keys = { www: "tt-www", attrs: "tt-attrs", typeahead: "tt-typeahead" }; methods = { initialize: function initialize(o, datasets) { var www; datasets = _.isArray(datasets) ? datasets : [].slice.call(arguments, 1); o = o || {}; www = WWW(o.classNames); return this.each(attach); function attach() { var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor; _.each(datasets, function(d) { d.highlight = !!o.highlight; }); $input = $(this); $wrapper = $(www.html.wrapper); $hint = $elOrNull(o.hint); $menu = $elOrNull(o.menu); defaultHint = o.hint !== false && !$hint; defaultMenu = o.menu !== false && !$menu; defaultHint && ($hint = buildHintFromInput($input, www)); defaultMenu && ($menu = $(www.html.menu).css(www.css.menu)); $hint && $hint.val(""); $input = prepInput($input, www); if (defaultHint || defaultMenu) { $wrapper.css(www.css.wrapper); $input.css(defaultHint ? www.css.input : www.css.inputWithNoHint); $input.wrap($wrapper).parent().prepend(defaultHint ? $hint : null).append(defaultMenu ? $menu : null); } MenuConstructor = defaultMenu ? DefaultMenu : Menu; eventBus = new EventBus({ el: $input }); input = new Input({ hint: $hint, input: $input, menu: $menu }, www); menu = new MenuConstructor({ node: $menu, datasets: datasets }, www); status = new Status({ $input: $input, menu: menu }); typeahead = new Typeahead({ input: input, menu: menu, eventBus: eventBus, minLength: o.minLength, autoselect: o.autoselect }, www); $input.data(keys.www, www); $input.data(keys.typeahead, typeahead); } }, isEnabled: function isEnabled() { var enabled; ttEach(this.first(), function(t) { enabled = t.isEnabled(); }); return enabled; }, enable: function enable() { ttEach(this, function(t) { t.enable(); }); return this; }, disable: function disable() { ttEach(this, function(t) { t.disable(); }); return this; }, isActive: function isActive() { var active; ttEach(this.first(), function(t) { active = t.isActive(); }); return active; }, activate: function activate() { ttEach(this, function(t) { t.activate(); }); return this; }, deactivate: function deactivate() { ttEach(this, function(t) { t.deactivate(); }); return this; }, isOpen: function isOpen() { var open; ttEach(this.first(), function(t) { open = t.isOpen(); }); return open; }, open: function open() { ttEach(this, function(t) { t.open(); }); return this; }, close: function close() { ttEach(this, function(t) { t.close(); }); return this; }, select: function select(el) { var success = false, $el = $(el); ttEach(this.first(), function(t) { success = t.select($el); }); return success; }, autocomplete: function autocomplete(el) { var success = false, $el = $(el); ttEach(this.first(), function(t) { success = t.autocomplete($el); }); return success; }, moveCursor: function moveCursoe(delta) { var success = false; ttEach(this.first(), function(t) { success = t.moveCursor(delta); }); return success; }, val: function val(newVal) { var query; if (!arguments.length) { ttEach(this.first(), function(t) { query = t.getVal(); }); return query; } else { ttEach(this, function(t) { t.setVal(_.toStr(newVal)); }); return this; } }, destroy: function destroy() { ttEach(this, function(typeahead, $input) { revert($input); typeahead.destroy(); }); return this; } }; $.fn.typeahead = function(method) { if (methods[method]) { return methods[method].apply(this, [].slice.call(arguments, 1)); } else { return methods.initialize.apply(this, arguments); } }; $.fn.typeahead.noConflict = function noConflict() { $.fn.typeahead = old; return this; }; function ttEach($els, fn) { $els.each(function() { var $input = $(this), typeahead; (typeahead = $input.data(keys.typeahead)) && fn(typeahead, $input); }); } function buildHintFromInput($input, www) { return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({ readonly: true, required: false }).removeAttr("id name placeholder").removeClass("required").attr({ spellcheck: "false", tabindex: -1 }); } function prepInput($input, www) { $input.data(keys.attrs, { dir: $input.attr("dir"), autocomplete: $input.attr("autocomplete"), spellcheck: $input.attr("spellcheck"), style: $input.attr("style") }); $input.addClass(www.classes.input).attr({ spellcheck: false }); try { !$input.attr("dir") && $input.attr("dir", "auto"); } catch (e) {} return $input; } function getBackgroundStyles($el) { return { backgroundAttachment: $el.css("background-attachment"), backgroundClip: $el.css("background-clip"), backgroundColor: $el.css("background-color"), backgroundImage: $el.css("background-image"), backgroundOrigin: $el.css("background-origin"), backgroundPosition: $el.css("background-position"), backgroundRepeat: $el.css("background-repeat"), backgroundSize: $el.css("background-size") }; } function revert($input) { var www, $wrapper; www = $input.data(keys.www); $wrapper = $input.parent().filter(www.selectors.wrapper); _.each($input.data(keys.attrs), function(val, key) { _.isUndefined(val) ? $input.removeAttr(key) : $input.attr(key, val); }); $input.removeData(keys.typeahead).removeData(keys.www).removeData(keys.attr).removeClass(www.classes.input); if ($wrapper.length) { $input.detach().insertAfter($wrapper); $wrapper.remove(); } } function $elOrNull(obj) { var isValid, $el; isValid = _.isJQuery(obj) || _.isElement(obj); $el = isValid ? $(obj).first() : []; return $el.length ? $el : null; } })(); }); ================================================ FILE: docs/search.json ================================================ {"Other%20Typealiases.html#/s:7RxSwift0A10Observablea":{"name":"RxObservable","abstract":"

A type-erased ObservableType.

"},"Other%20Typealiases.html#/s:7RxSwift0A12TimeIntervala":{"name":"RxTimeInterval","abstract":"

Undocumented

"},"Other%20Typealiases.html#/s:7RxSwift0A4Timea":{"name":"RxTime","abstract":"

Type that represents absolute time in the context of RxSwift.

"},"Other%20Typealiases.html#/s:7RxSwift0A15AbstractIntegera":{"name":"RxAbstractInteger","abstract":"

Undocumented

"},"Other%20Typealiases.html#/s:7RxSwift11SingleEventa":{"name":"SingleEvent","abstract":"

Undocumented

"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypeP5TraitQa":{"name":"Trait","abstract":"

Additional constraints

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypeP7ElementQa":{"name":"Element","abstract":"

Sequence element type

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypeP09primitiveD0AA0cD0Vy5TraitQz7ElementQzGvp":{"name":"primitiveSequence","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE7andThenyAA0cD0VyAA06SingleI0Oqd__GAQlF":{"name":"andThen(_:)","abstract":"

Concatenates the second observable sequence to self upon successful termination of self.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE7andThenyAA0cD0VyAA05MaybeI0Oqd__GAQlF":{"name":"andThen(_:)","abstract":"

Concatenates the second observable sequence to self upon successful termination of self.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE7andThenyAA0cD0VyAiEGAOF":{"name":"andThen(_:)","abstract":"

Concatenates the second observable sequence to self upon successful termination of self.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE7andThenyAA10ObservableCyqd__GAOlF":{"name":"andThen(_:)","abstract":"

Concatenates the second observable sequence to self upon successful termination of self.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE0H8Observera":{"name":"CompletableObserver","abstract":"

Undocumented

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE6create9subscribeAA0cD0VyAiEGAA10Disposable_pyAA0H5EventOcc_tFZ":{"name":"create(subscribe:)","abstract":"

Creates an observable sequence from a specified subscribe method implementation.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE9subscribeyAA10Disposable_pyAA0H5EventOcF":{"name":"subscribe(_:)","abstract":"

Subscribes observer to receive events for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE9subscribe4with11onCompleted0L5Error0L8DisposedAA10Disposable_pqd___yqd__cSgyqd___s0N0_ptcSgARtRld__ClF":{"name":"subscribe(with:onCompleted:onError:onDisposed:)","abstract":"

Subscribes a completion handler and an error handler for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE9subscribe11onCompleted0K5Error0K8DisposedAA10Disposable_pyycSg_ys0M0_pcSgAQtF":{"name":"subscribe(onCompleted:onError:onDisposed:)","abstract":"

Subscribes a completion handler and an error handler for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE5erroryAA0cD0VyAiEGs5Error_pFZ":{"name":"error(_:)","abstract":"

Returns an observable sequence that terminates with an error.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE5neverAA0cD0VyAiEGyFZ":{"name":"never()","abstract":"

Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE5emptyAA0cD0VyAiEGyFZ":{"name":"empty()","abstract":"

Returns an empty observable sequence, using the specified scheduler to send out the single Completed message.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE2do7onError05afterL00K9Completed0mN00K9Subscribe0K10Subscribed0K7DisposeAA0cD0VyAiEGys0L0_pKcSg_AXyyKcSgAYyycSgA2ZtF":{"name":"do(onError:afterError:onCompleted:afterCompleted:onSubscribe:onSubscribed:onDispose:)","abstract":"

Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE6concatyAA0cD0VyAiEGAOF":{"name":"concat(_:)","abstract":"

Concatenates the second observable sequence to self upon successful termination of self.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE6concatyAA0cD0VyAiEGqd__STRd__AoFRtd__lFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE6concatyAA0cD0VyAiEGqd__SlRd__AoFRtd__lFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE6concatyAA0cD0VyAiEGAOd_tFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE3zipyAA0cD0VyAiEGqd__SlRd__AoFRtd__lFZ":{"name":"zip(_:)","abstract":"

Merges the completion of all Completables from a collection into a single Completable.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE3zipyAA0cD0VyAiEGSayAOGFZ":{"name":"zip(_:)","abstract":"

Merges the completion of all Completables from an array into a single Completable.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE3zipyAA0cD0VyAiEGAOd_tFZ":{"name":"zip(_:)","abstract":"

Merges the completion of all Completables into a single Completable.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE0F8Observera":{"name":"MaybeObserver","abstract":"

Undocumented

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE6create9subscribeAA0cD0VyAE7ElementQzGAA10Disposable_pyAA0F5EventOyAMGcc_tFZ":{"name":"create(subscribe:)","abstract":"

Creates an observable sequence from a specified subscribe method implementation.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE9subscribeyAA10Disposable_pyAA0F5EventOy7ElementQzGcF":{"name":"subscribe(_:)","abstract":"

Subscribes observer to receive events for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE9subscribe4with9onSuccess0J5Error0J9Completed0J8DisposedAA10Disposable_pqd___yqd___7ElementQztcSgyqd___s0L0_ptcSgyqd__cSgATtRld__ClF":{"name":"subscribe(with:onSuccess:onError:onCompleted:onDisposed:)","abstract":"

Subscribes a success handler, an error handler, and a completion handler for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE9subscribe9onSuccess0I5Error0I9Completed0I8DisposedAA10Disposable_py7ElementQzcSg_ys0K0_pcSgyycSgAStF":{"name":"subscribe(onSuccess:onError:onCompleted:onDisposed:)","abstract":"

Subscribes a success handler, an error handler, and a completion handler for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE4justyAA0cD0VyAE7ElementQzGALFZ":{"name":"just(_:)","abstract":"

Returns an observable sequence that contains a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE4just_9schedulerAA0cD0VyAE7ElementQzGAM_AA018ImmediateSchedulerE0_ptFZ":{"name":"just(_:scheduler:)","abstract":"

Returns an observable sequence that contains a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE5erroryAA0cD0VyAE7ElementQzGs5Error_pFZ":{"name":"error(_:)","abstract":"

Returns an observable sequence that terminates with an error.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE5neverAA0cD0VyAE7ElementQzGyFZ":{"name":"never()","abstract":"

Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE5emptyAA0cD0VyAE7ElementQzGyFZ":{"name":"empty()","abstract":"

Returns an empty observable sequence, using the specified scheduler to send out the single Completed message.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE2do6onNext05afterJ00I5Error0kL00I9Completed0kM00I9Subscribe0I10Subscribed0I7DisposeAA0cD0VyAE7ElementQzGyAUKcSg_AWys0L0_pKcSgAYyyKcSgAZyycSgA_A_tF":{"name":"do(onNext:afterNext:onError:afterError:onCompleted:afterCompleted:onSubscribe:onSubscribed:onDispose:)","abstract":"

Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE6filteryAA0cD0VyAE7ElementQzGSbALKcF":{"name":"filter(_:)","abstract":"

Filters the elements of an observable sequence based on a predicate.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3mapyAA0cD0VyAEqd__Gqd__7ElementQzKclF":{"name":"map(_:)","abstract":"

Projects each element of an observable sequence into a new form.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE10compactMapyAA0cD0VyAEqd__Gqd__Sg7ElementQzKclF":{"name":"compactMap(_:)","abstract":"

Projects each element of an observable sequence into an optional form and filters all optional results.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE7flatMapyAA0cD0VyAEqd__GAK7ElementQzKclF":{"name":"flatMap(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE7ifEmpty7defaultAA0cD0VyAA06SingleG0O7ElementQzGAO_tF":{"name":"ifEmpty(default:)","abstract":"

Emits elements from the source observable sequence, or a default element if the source observable sequence is empty.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE7ifEmpty8switchToAA0cD0VyAE7ElementQzGAN_tF":{"name":"ifEmpty(switchTo:)","abstract":"

Returns the elements of the specified sequence or other sequence if the sequence is empty.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE7ifEmpty8switchToAA0cD0VyAA06SingleG0O7ElementQzGAP_tF":{"name":"ifEmpty(switchTo:)","abstract":"

Returns the elements of the specified sequence or other sequence if the sequence is empty.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE14catchAndReturnyAA0cD0VyAE7ElementQzGALF":{"name":"catchAndReturn(_:)","abstract":"

Continues an observable sequence that is terminated by an error with a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE20catchErrorJustReturnyAA0cD0VyAE7ElementQzGALF":{"name":"catchErrorJustReturn(_:)","abstract":"

Continues an observable sequence that is terminated by an error with a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE6create8detached8priority4workAA0cD0VyAE7ElementQzGSb_ScPSgAOyYaYbKctFZ":{"name":"create(detached:priority:work:)","abstract":"

Creates a Single from the result of an asynchronous operation

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE5value7ElementQzvp":{"name":"value","abstract":"

Allows awaiting the success or failure of this Single","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE5value7ElementQzSgvp":{"name":"value","abstract":"

Allows awaiting the success or failure of this Maybe","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs5NeverO7ElementRtzAA16CompletableTraitO0I0RtzrlE5valueytvp":{"name":"value","abstract":"

Allows awaiting the success or failure of this Completable","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip__14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAMqd___qd_0_tKctr0_lFZ":{"name":"zip(_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA11SingleTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_tGALyAGqd__G_ALyAGqd_0_Gtr0_lFZ":{"name":"zip(_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3zip__14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAMqd___qd_0_tKctr0_lFZ":{"name":"zip(_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA10MaybeTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_tGALyAGqd__G_ALyAGqd_0_Gtr0_lFZ":{"name":"zip(_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip___14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAMqd___qd_0_qd_1_tKctr1_lFZ":{"name":"zip(_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA11SingleTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_Gtr1_lFZ":{"name":"zip(_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3zip___14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAMqd___qd_0_qd_1_tKctr1_lFZ":{"name":"zip(_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA10MaybeTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_Gtr1_lFZ":{"name":"zip(_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip____14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAMqd___qd_0_qd_1_qd_2_tKctr2_lFZ":{"name":"zip(_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA11SingleTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_Gtr2_lFZ":{"name":"zip(_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3zip____14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAMqd___qd_0_qd_1_qd_2_tKctr2_lFZ":{"name":"zip(_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA10MaybeTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_Gtr2_lFZ":{"name":"zip(_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip_____14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAMqd___qd_0_qd_1_qd_2_qd_3_tKctr3_lFZ":{"name":"zip(_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA11SingleTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_Gtr3_lFZ":{"name":"zip(_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3zip_____14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAMqd___qd_0_qd_1_qd_2_qd_3_tKctr3_lFZ":{"name":"zip(_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA10MaybeTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_Gtr3_lFZ":{"name":"zip(_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip______14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAKyAEqd_4_GAMqd___qd_0_qd_1_qd_2_qd_3_qd_4_tKctr4_lFZ":{"name":"zip(_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA11SingleTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_qd_4_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_GALyAGqd_4_Gtr4_lFZ":{"name":"zip(_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3zip______14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAKyAEqd_4_GAMqd___qd_0_qd_1_qd_2_qd_3_qd_4_tKctr4_lFZ":{"name":"zip(_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA10MaybeTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_qd_4_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_GALyAGqd_4_Gtr4_lFZ":{"name":"zip(_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip_______14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAKyAEqd_4_GAKyAEqd_5_GAMqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tKctr5_lFZ":{"name":"zip(_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA11SingleTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_GALyAGqd_4_GALyAGqd_5_Gtr5_lFZ":{"name":"zip(_:_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3zip_______14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAKyAEqd_4_GAKyAEqd_5_GAMqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tKctr5_lFZ":{"name":"zip(_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA10MaybeTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_GALyAGqd_4_GALyAGqd_5_Gtr5_lFZ":{"name":"zip(_:_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip________14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAKyAEqd_4_GAKyAEqd_5_GAKyAEqd_6_GAMqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tKctr6_lFZ":{"name":"zip(_:_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA11SingleTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_GALyAGqd_4_GALyAGqd_5_GALyAGqd_6_Gtr6_lFZ":{"name":"zip(_:_:_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A10MaybeTraitO0G0RtzrlE3zip________14resultSelectorAA0cD0VyAE7ElementQzGAKyAEqd__G_AKyAEqd_0_GAKyAEqd_1_GAKyAEqd_2_GAKyAEqd_3_GAKyAEqd_4_GAKyAEqd_5_GAKyAEqd_6_GAMqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tKctr6_lFZ":{"name":"zip(_:_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAyp7ElementRtzAA10MaybeTraitO0H0RtzrlE3zipyAA0cD0VyAGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tGALyAGqd__G_ALyAGqd_0_GALyAGqd_1_GALyAGqd_2_GALyAGqd_3_GALyAGqd_4_GALyAGqd_5_GALyAGqd_6_Gtr6_lFZ":{"name":"zip(_:_:_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePAAs17FixedWidthInteger7ElementRpzrlE5timer_9schedulerAA0cD0Vy5TraitQzAFG8Dispatch0M12TimeIntervalO_AA09SchedulerE0_ptFZ":{"name":"timer(_:scheduler:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE0F8Observera":{"name":"SingleObserver","abstract":"

Undocumented

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE6create9subscribeAA0cD0VyAE7ElementQzGAA10Disposable_pys6ResultOyAMs5Error_pGcc_tFZ":{"name":"create(subscribe:)","abstract":"

Creates an observable sequence from a specified subscribe method implementation.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE9subscribeyAA10Disposable_pys6ResultOy7ElementQzs5Error_pGcF":{"name":"subscribe(_:)","abstract":"

Subscribes observer to receive events for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE9subscribe9onSuccess0I5Error0I8DisposedAA10Disposable_py7ElementQzcSg_ys0K0_pcyycSgtF":{"name":"subscribe(onSuccess:onError:onDisposed:)","abstract":"

Subscribes a success handler, and an error handler for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE9subscribe4with9onSuccess0J7Failure0J8DisposedAA10Disposable_pqd___yqd___7ElementQztcSgyqd___s5Error_ptcSgyqd__cSgtRld__ClF":{"name":"subscribe(with:onSuccess:onFailure:onDisposed:)","abstract":"

Subscribes a success handler, and an error handler for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE9subscribe9onSuccess0I7Failure0I8DisposedAA10Disposable_py7ElementQzcSg_ys5Error_pcSgyycSgtF":{"name":"subscribe(onSuccess:onFailure:onDisposed:)","abstract":"

Subscribes a success handler, and an error handler for this sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE4justyAA0cD0VyAE7ElementQzGALFZ":{"name":"just(_:)","abstract":"

Returns an observable sequence that contains a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE4just_9schedulerAA0cD0VyAE7ElementQzGAM_AA018ImmediateSchedulerE0_ptFZ":{"name":"just(_:scheduler:)","abstract":"

Returns an observable sequence that contains a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE5erroryAA0cD0VyAE7ElementQzGs5Error_pFZ":{"name":"error(_:)","abstract":"

Returns an observable sequence that terminates with an error.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE5neverAA0cD0VyAE7ElementQzGyFZ":{"name":"never()","abstract":"

Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE2do9onSuccess05afterJ00I5Error0kL00I9Subscribe0I10Subscribed0I7DisposeAA0cD0VyAE7ElementQzGyASKcSg_AUys0L0_pKcSgAWyycSgA2XtF":{"name":"do(onSuccess:afterSuccess:onError:afterError:onSubscribe:onSubscribed:onDispose:)","abstract":"

Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE6filteryAA0cD0VyAA05MaybeG0O7ElementQzGSbANKcF":{"name":"filter(_:)","abstract":"

Filters the elements of an observable sequence based on a predicate.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3mapyAA0cD0VyAEqd__Gqd__7ElementQzKclF":{"name":"map(_:)","abstract":"

Projects each element of an observable sequence into a new form.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE10compactMapyAA0cD0VyAA05MaybeG0Oqd__Gqd__Sg7ElementQzKclF":{"name":"compactMap(_:)","abstract":"

Projects each element of an observable sequence into an optional form and filters all optional results.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE7flatMapyAA0cD0VyAEqd__GAK7ElementQzKclF":{"name":"flatMap(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE12flatMapMaybeyAA0cD0VyAA0jG0Oqd__GAM7ElementQzKclF":{"name":"flatMapMaybe(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE18flatMapCompletableyAA0cD0VyAA0jG0Os5NeverOGAO7ElementQzKcF":{"name":"flatMapCompletable(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zip_14resultSelectorAA0cD0VyAEqd_0_Gqd___qd_0_Say7ElementQzGKctSlRd__AKyAeNGAMRtd__r0_lFZ":{"name":"zip(_:resultSelector:)","abstract":"

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.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE3zipyAA0cD0VyAESay7ElementQzGGqd__SlRd__AJyAeLGAKRtd__lFZ":{"name":"zip(_:)","abstract":"

Merges the specified observable sequences into one observable sequence all of the observable sequences have produced an element at a corresponding index.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE14catchAndReturnyAA0cD0VyAE7ElementQzGALF":{"name":"catchAndReturn(_:)","abstract":"

Continues an observable sequence that is terminated by an error with a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE20catchErrorJustReturnyAA0cD0VyAE7ElementQzGALF":{"name":"catchErrorJustReturn(_:)","abstract":"

Continues an observable sequence that is terminated by an error with a single element.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE7asMaybeAA0cD0VyAA0iG0O7ElementQzGyF":{"name":"asMaybe()","abstract":"

Converts self to Maybe trait.

","parent_name":"PrimitiveSequenceType"},"Protocols/PrimitiveSequenceType.html#/s:7RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0G0RtzrlE13asCompletableAA0cD0VyAA0iG0Os5NeverOGyF":{"name":"asCompletable()","abstract":"

Converts self to Completable trait, ignoring its emitted value if","parent_name":"PrimitiveSequenceType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE13combineLatest_14resultSelectorAA0C0Vy7ElementQzGqd___AISayAH_AHQYd__GKctSlRd__AabHRpd__lFZ":{"name":"combineLatest(_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE13combineLatestyAA0C0VySay7ElementQzGGqd__SlRd__AG_AGQYd__AHRSAabGRpd__lFZ":{"name":"combineLatest(_:)","abstract":"

Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE6valuesScSy7ElementQzGvp":{"name":"values","abstract":"

Allows iterating over the values of an Infallible","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4justyAA0C0Vy7ElementQzGAHFZ":{"name":"just(_:)","abstract":"

Returns an infallible sequence that contains a single element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4just_9schedulerAA0C0Vy7ElementQzGAI_AA018ImmediateSchedulerD0_ptFZ":{"name":"just(_:scheduler:)","abstract":"

Returns an infallible sequence that contains a single element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE5neverAA0C0Vy7ElementQzGyFZ":{"name":"never()","abstract":"

Returns a non-terminating infallible sequence, which can be used to denote an infinite duration.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE5emptyAA0C0Vy7ElementQzGyFZ":{"name":"empty()","abstract":"

Returns an empty infallible sequence, using the specified scheduler to send out the single Completed message.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE8deferredyAA0C0Vy7ElementQzGAIyKcFZ":{"name":"deferred(_:)","abstract":"

Returns an infallible sequence that invokes the specified factory function whenever a new observer subscribes.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE6filteryAA0C0Vy7ElementQzGSbAHcF":{"name":"filter(_:)","abstract":"

Filters the elements of an observable sequence based on a predicate.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3mapyAA0C0Vyqd__Gqd__7ElementQzclF":{"name":"map(_:)","abstract":"

Projects each element of an observable sequence into a new form.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE10compactMapyAA0C0Vyqd__Gqd__Sg7ElementQzclF":{"name":"compactMap(_:)","abstract":"

Projects each element of an observable sequence into an optional form and filters all optional results.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE20distinctUntilChangedyAA0C0Vy7ElementQzGqd__AHKcSQRd__lF":{"name":"distinctUntilChanged(_:)","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE20distinctUntilChangedyAA0C0Vy7ElementQzGSbAH_AHtKcF":{"name":"distinctUntilChanged(_:)","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to the comparer.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE20distinctUntilChanged_8comparerAA0C0Vy7ElementQzGqd__AIKc_Sbqd___qd__tKctlF":{"name":"distinctUntilChanged(_:comparer:)","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE20distinctUntilChanged2atAA0C0Vy7ElementQzGs7KeyPathCyAIqd__G_tSQRd__lF":{"name":"distinctUntilChanged(at:)","abstract":"

Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE8debounce_9schedulerAA0C0Vy7ElementQzG8Dispatch0H12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"debounce(_:scheduler:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE8throttle_6latest9schedulerAA0C0Vy7ElementQzG8Dispatch0I12TimeIntervalO_SbAA09SchedulerD0_ptF":{"name":"throttle(_:latest:scheduler:)","abstract":"

Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE7flatMapyAA0C0Vy7ElementQyd__Gqd__AGQzcAA021ObservableConvertibleD0Rd__lF":{"name":"flatMap(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE13flatMapLatestyAA0C0Vy7ElementQyd__Gqd__AGQzcAA021ObservableConvertibleD0Rd__lF":{"name":"flatMapLatest(_:)","abstract":"

Projects each element of an observable sequence into a new sequence of observable sequences and then","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE12flatMapFirstyAA0C0Vy7ElementQyd__Gqd__AGQzcAA021ObservableConvertibleD0Rd__lF":{"name":"flatMapFirst(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE6concatyAA0C0Vy7ElementQzGqd__AA021ObservableConvertibleD0Rd__AGQyd__AHRSlF":{"name":"concat(_:)","abstract":"

Concatenates the second observable sequence to self upon successful termination of self.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE6concatyAA0C0Vy7ElementQzGqd__STRd__AiGRtd__lFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE6concatyAA0C0Vy7ElementQzGqd__SlRd__AiGRtd__lFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE6concatyAA0C0Vy7ElementQzGAId_tFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE9concatMapyAA0C0Vy7ElementQyd__Gqd__AGQzcAA021ObservableConvertibleD0Rd__lF":{"name":"concatMap(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE5mergeyAA0C0Vy7ElementQzGqd__SlRd__AiGRtd__lFZ":{"name":"merge(_:)","abstract":"

Merges elements from all observable sequences from collection into a single observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE5mergeyAA0C0Vy7ElementQzGSayAIGFZ":{"name":"merge(_:)","abstract":"

Merges elements from all infallible sequences from array into a single infallible sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE5mergeyAA0C0Vy7ElementQzGAId_tFZ":{"name":"merge(_:)","abstract":"

Merges elements from all infallible sequences into a single infallible sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4scan4into11accumulatorAA0C0Vyqd__Gqd___yqd__z_7ElementQztctlF":{"name":"scan(into:accumulator:)","abstract":"

Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4scan_11accumulatorAA0C0Vyqd__Gqd___qd__qd___7ElementQztctlF":{"name":"scan(_:accumulator:)","abstract":"

Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE9startWithyAA0C0Vy7ElementQzGAHF":{"name":"startWith(_:)","abstract":"

Prepends a value to an observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4take5untilAA0C0Vy7ElementQzGqd___tAaBRd__lF":{"name":"take(until:)","abstract":"

Returns the elements from the source observable sequence until the other observable sequence produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4take5untilAA0C0Vy7ElementQzGqd___tAA010ObservableD0Rd__lF":{"name":"take(until:)","abstract":"

Returns the elements from the source observable sequence until the other observable sequence produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4take5until8behaviorAA0C0Vy7ElementQzGSbAJKc_AA12TakeBehaviorOtF":{"name":"take(until:behavior:)","abstract":"

Returns elements from an observable sequence until the specified condition is true.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4take5while8behaviorAA0C0Vy7ElementQzGSbAJKc_AA12TakeBehaviorOtF":{"name":"take(while:behavior:)","abstract":"

Returns elements from an observable sequence as long as a specified condition is true.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4takeyAA0C0Vy7ElementQzGSiF":{"name":"take(_:)","abstract":"

Returns a specified number of contiguous elements from the start of an observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4take3for9schedulerAA0C0Vy7ElementQzG8Dispatch0I12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"take(for:scheduler:)","abstract":"

Takes elements for the specified duration from the start of the infallible source sequence, using the specified scheduler to run timers.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4skip5whileAA0C0Vy7ElementQzGSbAIKc_tF":{"name":"skip(while:)","abstract":"

Bypasses elements in an infallible sequence as long as a specified condition is true and then returns the remaining elements.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE4skip5untilAA0C0Vy7ElementQzGqd___tAA010ObservableD0Rd__lF":{"name":"skip(until:)","abstract":"

Returns the elements from the source infallible sequence that are emitted after the other infallible sequence produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE5share6replay5scopeAA0C0Vy7ElementQzGSi_AA20SubjectLifetimeScopeOtF":{"name":"share(replay:scope:)","abstract":"

Returns an observable sequence that shares a single subscription to the underlying sequence, and immediately upon subscription replays elements in buffer.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE14withUnretained_14resultSelectorAA0C0Vyqd_0_Gqd___qd_0_qd___7ElementQztctRld__Cr0_lF":{"name":"withUnretained(_:resultSelector:)","abstract":"

Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE14withUnretainedyAA0C0Vyqd___7ElementQztGqd__Rld__ClF":{"name":"withUnretained(_:)","abstract":"

Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE14withLatestFrom_14resultSelectorAA0C0Vyqd_0_Gqd___qd_0_7ElementQz_AIQyd__tKctAaBRd__r0_lF":{"name":"withLatestFrom(_:resultSelector:)","abstract":"

Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE14withLatestFromyAA0C0Vy7ElementQyd__Gqd__AaBRd__lF":{"name":"withLatestFrom(_:)","abstract":"

Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when self emits an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3zip__14resultSelectorAA0C0Vy7ElementQzGAGyqd__G_AGyqd_0_GAIqd___qd_0_tKctr0_lFZ":{"name":"zip(_:_:resultSelector:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3zip___14resultSelectorAA0C0Vy7ElementQzGAGyqd__G_AGyqd_0_GAGyqd_1_GAIqd___qd_0_qd_1_tKctr1_lFZ":{"name":"zip(_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3zip____14resultSelectorAA0C0Vy7ElementQzGAGyqd__G_AGyqd_0_GAGyqd_1_GAGyqd_2_GAIqd___qd_0_qd_1_qd_2_tKctr2_lFZ":{"name":"zip(_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3zip_____14resultSelectorAA0C0Vy7ElementQzGAGyqd__G_AGyqd_0_GAGyqd_1_GAGyqd_2_GAGyqd_3_GAIqd___qd_0_qd_1_qd_2_qd_3_tKctr3_lFZ":{"name":"zip(_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3zip______14resultSelectorAA0C0Vy7ElementQzGAGyqd__G_AGyqd_0_GAGyqd_1_GAGyqd_2_GAGyqd_3_GAGyqd_4_GAIqd___qd_0_qd_1_qd_2_qd_3_qd_4_tKctr4_lFZ":{"name":"zip(_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3zip_______14resultSelectorAA0C0Vy7ElementQzGAGyqd__G_AGyqd_0_GAGyqd_1_GAGyqd_2_GAGyqd_3_GAGyqd_4_GAGyqd_5_GAIqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tKctr5_lFZ":{"name":"zip(_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE3zip________14resultSelectorAA0C0Vy7ElementQzGAGyqd__G_AGyqd_0_GAGyqd_1_GAGyqd_2_GAGyqd_3_GAGyqd_4_GAGyqd_5_GAGyqd_6_GAIqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tKctr6_lFZ":{"name":"zip(_:_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE9subscribe4with6onNext0G9Completed0G8DisposedAA10Disposable_pqd___yqd___7ElementQztcSgyqd__cSgAMtRld__ClF":{"name":"subscribe(with:onNext:onCompleted:onDisposed:)","abstract":"

Subscribes an element handler, a completion handler and disposed handler to an observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE9subscribe6onNext0F9Completed0F8DisposedAA10Disposable_py7ElementQzcSg_yycSgALtF":{"name":"subscribe(onNext:onCompleted:onDisposed:)","abstract":"

Subscribes an element handler, a completion handler and disposed handler to an observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAE9subscribeyAA10Disposable_pyAA0C5EventOy7ElementQzGcF":{"name":"subscribe(_:)","abstract":"

Subscribes an event handler to an observable sequence.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAyp7ElementRtzrlE13combineLatestyAA0C0VyADQyd___ADQyd_0_tGqd___qd_0_tAaBRd__AaBRd_0_r0_lFZ":{"name":"combineLatest(_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAyp7ElementRtzrlE13combineLatestyAA0C0VyADQyd___ADQyd_0_ADQyd_1_tGqd___qd_0_qd_1_tAaBRd__AaBRd_0_AaBRd_1_r1_lFZ":{"name":"combineLatest(_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAyp7ElementRtzrlE13combineLatestyAA0C0VyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_tGqd___qd_0_qd_1_qd_2_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_r2_lFZ":{"name":"combineLatest(_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAyp7ElementRtzrlE13combineLatestyAA0C0VyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_tGqd___qd_0_qd_1_qd_2_qd_3_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_r3_lFZ":{"name":"combineLatest(_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAyp7ElementRtzrlE13combineLatestyAA0C0VyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_r4_lFZ":{"name":"combineLatest(_:_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAyp7ElementRtzrlE13combineLatestyAA0C0VyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_ADQyd_5_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_r5_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAAyp7ElementRtzrlE13combineLatestyAA0C0VyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_ADQyd_5_ADQyd_6_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_AaBRd_6_r6_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"InfallibleType"},"Protocols/InfallibleType.html#/s:7RxSwift14InfallibleTypePAASQ7ElementRpzrlE20distinctUntilChangedAA0C0VyAEGyF":{"name":"distinctUntilChanged()","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to equality operator.

","parent_name":"InfallibleType"},"Protocols/ReactiveCompatible.html#/s:7RxSwift18ReactiveCompatibleP0C4BaseQa":{"name":"ReactiveBase","abstract":"

Extended type

","parent_name":"ReactiveCompatible"},"Protocols/ReactiveCompatible.html#/s:7RxSwift18ReactiveCompatibleP2rxAA0C0Vy0C4BaseQzGmvpZ":{"name":"rx","abstract":"

Reactive extensions.

","parent_name":"ReactiveCompatible"},"Protocols/ReactiveCompatible.html#/s:7RxSwift18ReactiveCompatibleP2rxAA0C0Vy0C4BaseQzGvp":{"name":"rx","abstract":"

Reactive extensions.

","parent_name":"ReactiveCompatible"},"Protocols/ReactiveCompatible.html#/s:7RxSwift18ReactiveCompatiblePAAE2rxAA0C0VyxGmvpZ":{"name":"rx","abstract":"

Reactive extensions.

","parent_name":"ReactiveCompatible"},"Protocols/ReactiveCompatible.html#/s:7RxSwift18ReactiveCompatiblePAAE2rxAA0C0VyxGvp":{"name":"rx","abstract":"

Reactive extensions.

","parent_name":"ReactiveCompatible"},"Protocols/DataDecoder.html#/s:7RxSwift11DataDecoderP6decode_4fromqd__qd__m_10Foundation0C0VtKSeRd__lF":{"name":"decode(_:from:)","abstract":"

Undocumented

","parent_name":"DataDecoder"},"Protocols/EventConvertible.html#/s:7RxSwift16EventConvertibleP7ElementQa":{"name":"Element","abstract":"

Type of element in event

","parent_name":"EventConvertible"},"Protocols/EventConvertible.html#/s:7RxSwift16EventConvertibleP5eventAA0C0Oy7ElementQzGvp":{"name":"event","abstract":"

Event representation of this instance

","parent_name":"EventConvertible"},"Protocols/EventConvertible.html":{"name":"EventConvertible","abstract":"

A type that can be converted to Event<Element>.

"},"Protocols/DataDecoder.html":{"name":"DataDecoder","abstract":"

Represents an entity capable of decoding raw Data"},"Protocols/ReactiveCompatible.html":{"name":"ReactiveCompatible","abstract":"

A type that has reactive extensions.

"},"Protocols/InfallibleType.html":{"name":"InfallibleType","abstract":"

Infallible is an Observable-like push-style interface"},"Protocols/PrimitiveSequenceType.html":{"name":"PrimitiveSequenceType","abstract":"

Observable sequences containing 0 or 1 element

"},"Extensions/AsyncSequence.html#/s:Sci7RxSwiftE12asObservable8priorityAA0D0Cy7ElementQzGScPSg_tF":{"name":"asObservable(priority:)","abstract":"

Convert an AsyncSequence to an Observable.

","parent_name":"AsyncSequence"},"Extensions/AsyncSequence.html":{"name":"AsyncSequence"},"Other%20Extensions.html#/s:10Foundation11JSONDecoderC":{"name":"JSONDecoder"},"Other%20Extensions.html#/s:10Foundation19PropertyListDecoderC":{"name":"PropertyListDecoder"},"Other%20Extensions.html#/c:objc(cs)NSObject":{"name":"NSObject","abstract":"

Extend NSObject with rx proxy.

"},"Enums/MaybeEvent.html#/s:7RxSwift10MaybeEventO7successyACyxGxcAEmlF":{"name":"success(_:)","abstract":"

One and only sequence element is produced. (underlying observable sequence emits: .next(Element), .completed)

","parent_name":"MaybeEvent"},"Enums/MaybeEvent.html#/s:7RxSwift10MaybeEventO5erroryACyxGs5Error_pcAEmlF":{"name":"error(_:)","abstract":"

Sequence terminated with an error. (underlying observable sequence emits: .error(Error))

","parent_name":"MaybeEvent"},"Enums/MaybeEvent.html#/s:7RxSwift10MaybeEventO9completedyACyxGAEmlF":{"name":"completed","abstract":"

Sequence completed successfully.

","parent_name":"MaybeEvent"},"Enums/CompletableEvent.html#/s:7RxSwift16CompletableEventO5erroryACs5Error_pcACmF":{"name":"error(_:)","abstract":"

Sequence terminated with an error. (underlying observable sequence emits: .error(Error))

","parent_name":"CompletableEvent"},"Enums/CompletableEvent.html#/s:7RxSwift16CompletableEventO9completedyA2CmF":{"name":"completed","abstract":"

Sequence completed successfully.

","parent_name":"CompletableEvent"},"Enums/InfallibleEvent.html#/s:7RxSwift15InfallibleEventO4nextyACyxGxcAEmlF":{"name":"next(_:)","abstract":"

Next element is produced.

","parent_name":"InfallibleEvent"},"Enums/InfallibleEvent.html#/s:7RxSwift15InfallibleEventO9completedyACyxGAEmlF":{"name":"completed","abstract":"

Sequence completed successfully.

","parent_name":"InfallibleEvent"},"Enums/InfallibleEvent.html#/s:7RxSwift16EventConvertibleP5eventAA0C0Oy7ElementQzGvp":{"name":"event","parent_name":"InfallibleEvent"},"Enums/VirtualTimeComparison.html#/s:7RxSwift21VirtualTimeComparisonO8lessThanyA2CmF":{"name":"lessThan","abstract":"

lhs < rhs.

","parent_name":"VirtualTimeComparison"},"Enums/VirtualTimeComparison.html#/s:7RxSwift21VirtualTimeComparisonO5equalyA2CmF":{"name":"equal","abstract":"

lhs == rhs.

","parent_name":"VirtualTimeComparison"},"Enums/VirtualTimeComparison.html#/s:7RxSwift21VirtualTimeComparisonO11greaterThanyA2CmF":{"name":"greaterThan","abstract":"

lhs > rhs.

","parent_name":"VirtualTimeComparison"},"Enums/TakeBehavior.html#/s:7RxSwift12TakeBehaviorO9inclusiveyA2CmF":{"name":"inclusive","abstract":"

Include the last element matching the predicate.

","parent_name":"TakeBehavior"},"Enums/TakeBehavior.html#/s:7RxSwift12TakeBehaviorO9exclusiveyA2CmF":{"name":"exclusive","abstract":"

Exclude the last element matching the predicate.

","parent_name":"TakeBehavior"},"Enums/SubjectLifetimeScope.html#/s:7RxSwift20SubjectLifetimeScopeO14whileConnectedyA2CmF":{"name":"whileConnected","abstract":"

Each connection will have it’s own subject instance to store replay events.","parent_name":"SubjectLifetimeScope"},"Enums/SubjectLifetimeScope.html#/s:7RxSwift20SubjectLifetimeScopeO7foreveryA2CmF":{"name":"forever","abstract":"

One subject will store replay events for all connections to source.","parent_name":"SubjectLifetimeScope"},"Enums/Resources.html#/total":{"name":"total","abstract":"

Counts internal Rx resource allocations (Observables, Observers, Disposables, etc.). This provides a simple way to detect leaks during development.

","parent_name":"Resources"},"Enums/Resources.html#/incrementTotal()":{"name":"incrementTotal()","abstract":"

Increments Resources.total resource count.

","parent_name":"Resources"},"Enums/Resources.html#/decrementTotal()":{"name":"decrementTotal()","abstract":"

Decrements Resources.total resource count

","parent_name":"Resources"},"Enums/Resources.html#/numberOfSerialDispatchQueueObservables":{"name":"numberOfSerialDispatchQueueObservables","abstract":"

Counts number of SerialDispatchQueueObservables.

","parent_name":"Resources"},"Enums/Hooks.html#/s:7RxSwift5HooksO22recordCallStackOnErrorSbvpZ":{"name":"recordCallStackOnError","abstract":"

Undocumented

","parent_name":"Hooks"},"Enums/Hooks.html#/s:7RxSwift5HooksO19DefaultErrorHandlera":{"name":"DefaultErrorHandler","abstract":"

Undocumented

","parent_name":"Hooks"},"Enums/Hooks.html#/s:7RxSwift5HooksO34CustomCaptureSubscriptionCallstacka":{"name":"CustomCaptureSubscriptionCallstack","abstract":"

Undocumented

","parent_name":"Hooks"},"Enums/Hooks.html#/s:7RxSwift5HooksO19defaultErrorHandleryySaySSG_s0E0_ptcvpZ":{"name":"defaultErrorHandler","abstract":"

Error handler called in case onError handler wasn’t provided.

","parent_name":"Hooks"},"Enums/Hooks.html#/s:7RxSwift5HooksO34customCaptureSubscriptionCallstackSaySSGycvpZ":{"name":"customCaptureSubscriptionCallstack","abstract":"

Subscription callstack block to fetch custom callstack information.

","parent_name":"Hooks"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO7unknownyA2CmF":{"name":"unknown","abstract":"

Unknown error occurred.

","parent_name":"RxError"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO8disposedyACyXl_tcACmF":{"name":"disposed(object:)","abstract":"

Performing an action on disposed object.

","parent_name":"RxError"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO8overflowyA2CmF":{"name":"overflow","abstract":"

Arithmetic overflow error.

","parent_name":"RxError"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO18argumentOutOfRangeyA2CmF":{"name":"argumentOutOfRange","abstract":"

Argument out of range error.

","parent_name":"RxError"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO10noElementsyA2CmF":{"name":"noElements","abstract":"

Sequence doesn’t contain any elements.

","parent_name":"RxError"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO18moreThanOneElementyA2CmF":{"name":"moreThanOneElement","abstract":"

Sequence contains more than one element.

","parent_name":"RxError"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO7timeoutyA2CmF":{"name":"timeout","abstract":"

Timeout error.

","parent_name":"RxError"},"Enums/RxError.html#/s:7RxSwift0A5ErrorO16debugDescriptionSSvp":{"name":"debugDescription","abstract":"

A textual representation of self, suitable for debugging.

","parent_name":"RxError"},"Enums/RxError.html":{"name":"RxError","abstract":"

Generic Rx error codes.

"},"Enums/Hooks.html":{"name":"Hooks","abstract":"

RxSwift global hooks

"},"Enums/Resources.html":{"name":"Resources","abstract":"

Resource utilization information

"},"Enums/SubjectLifetimeScope.html":{"name":"SubjectLifetimeScope","abstract":"

Subject lifetime scope

"},"Enums/TakeBehavior.html":{"name":"TakeBehavior","abstract":"

Behaviors for the take operator family.

"},"Enums/VirtualTimeComparison.html":{"name":"VirtualTimeComparison","abstract":"

Virtual time comparison result.

"},"Enums/InfallibleEvent.html":{"name":"InfallibleEvent","abstract":"

Undocumented

"},"Other%20Enums.html#/s:7RxSwift16CompletableTraitO":{"name":"CompletableTrait","abstract":"

Sequence containing 0 elements

"},"Enums/CompletableEvent.html":{"name":"CompletableEvent","abstract":"

Undocumented

"},"Other%20Enums.html#/s:7RxSwift10MaybeTraitO":{"name":"MaybeTrait","abstract":"

Sequence containing 0 or 1 elements

"},"Enums/MaybeEvent.html":{"name":"MaybeEvent","abstract":"

Undocumented

"},"Other%20Enums.html#/s:7RxSwift11SingleTraitO":{"name":"SingleTrait","abstract":"

Sequence containing exactly 1 element

"},"Other%20Global%20Variables.html#/s:7RxSwift29maxTailRecursiveSinkStackSizeSivp":{"name":"maxTailRecursiveSinkStackSize","abstract":"

Undocumented

"},"Classes/ConnectableObservable.html#/s:7RxSwift21ConnectableObservableC7connectAA10Disposable_pyF":{"name":"connect()","abstract":"

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.

","parent_name":"ConnectableObservable"},"Classes/ConnectableObservable.html":{"name":"ConnectableObservable","abstract":"

Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence.

"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV09primitiveD0ACyxq_Gvp":{"name":"primitiveSequence","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV12asObservableAA0F0Cyq_GyF":{"name":"asObservable()","abstract":"

Converts self to Observable sequence.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV8deferredyACyxq_GAEyKcFZ":{"name":"deferred(_:)","abstract":"

Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV5delay_9schedulerACyxq_G8Dispatch0G12TimeIntervalO_AA13SchedulerType_ptF":{"name":"delay(_:scheduler:)","abstract":"

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.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV17delaySubscription_9schedulerACyxq_G8Dispatch0H12TimeIntervalO_AA13SchedulerType_ptF":{"name":"delaySubscription(_:scheduler:)","abstract":"

Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV7observe2onACyxq_GAA22ImmediateSchedulerType_p_tF":{"name":"observe(on:)","abstract":"

Wraps the source sequence in order to run its observer callbacks on the specified scheduler.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV9observeOnyACyxq_GAA22ImmediateSchedulerType_pF":{"name":"observeOn(_:)","abstract":"

Wraps the source sequence in order to run its observer callbacks on the specified scheduler.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV9subscribe2onACyxq_GAA22ImmediateSchedulerType_p_tF":{"name":"subscribe(on:)","abstract":"

Wraps the source sequence in order to run its subscription and unsubscription logic on the specified","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV11subscribeOnyACyxq_GAA22ImmediateSchedulerType_pF":{"name":"subscribeOn(_:)","abstract":"

Wraps the source sequence in order to run its subscription and unsubscription logic on the specified","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV10catchErroryACyxq_GAEs0F0_pKcF":{"name":"catchError(_:)","abstract":"

Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV5catchyACyxq_GAEs5Error_pKcF":{"name":"catch(_:)","abstract":"

Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV5retryyACyxq_GSiF":{"name":"retry(_:)","abstract":"

If the initial subscription to the observable sequence emits an error event, try repeating it up to the specified number of attempts (inclusive of the initial attempt) or until is succeeds. For example, if you want to retry a sequence once upon failure, you should use retry(2) (once for the initial attempt, and once for the retry).

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV5retry4whenACyxq_Gqd_0_AA10ObservableCyqd__Gc_ts5ErrorRd__AA0G4TypeRd_0_r0_lF":{"name":"retry(when:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV9retryWhenyACyxq_Gqd_0_AA10ObservableCyqd__Gcs5ErrorRd__AA0G4TypeRd_0_r0_lF":{"name":"retryWhen(_:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV5retry4whenACyxq_Gqd__AA10ObservableCys5Error_pGc_tAA0G4TypeRd__lF":{"name":"retry(when:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV9retryWhenyACyxq_Gqd__AA10ObservableCys5Error_pGcAA0G4TypeRd__lF":{"name":"retryWhen(_:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV5debug_10trimOutput4file4line8functionACyxq_GSSSg_SbSSSuSStF":{"name":"debug(_:trimOutput:file:line:function:)","abstract":"

Prints received events for all observers on standard output.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV5using_09primitiveD7FactoryACyxq_Gqd__yKc_AFqd__KctAA10DisposableRd__lFZ":{"name":"using(_:primitiveSequenceFactory:)","abstract":"

Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence’s lifetime.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV7timeout_9schedulerACyxq_G8Dispatch0G12TimeIntervalO_AA13SchedulerType_ptF":{"name":"timeout(_:scheduler:)","abstract":"

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.

","parent_name":"PrimitiveSequence"},"Structs/PrimitiveSequence.html#/s:7RxSwift17PrimitiveSequenceV7timeout_5other9schedulerACyxq_G8Dispatch0H12TimeIntervalO_AgA13SchedulerType_ptF":{"name":"timeout(_:other:scheduler:)","abstract":"

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.

","parent_name":"PrimitiveSequence"},"RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift11Completablea":{"name":"Completable","abstract":"

Represents a push style sequence containing 0 elements.

"},"RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift5Maybea":{"name":"Maybe","abstract":"

Represents a push style sequence containing 0 or 1 element.

"},"Structs/PrimitiveSequence.html":{"name":"PrimitiveSequence","abstract":"

Observable sequences containing 0 or 1 element.

"},"RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift6Singlea":{"name":"Single","abstract":"

Represents a push style sequence containing 1 element.

"},"Structs/Infallible.html#/s:7RxSwift25ObservableConvertibleTypeP02asC0AA0C0Cy7ElementQzGyF":{"name":"asObservable()","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV13combineLatest__14resultSelectorACyxGqd___qd_0_x7ElementQyd___AGQyd_0_tKctAA0C4TypeRd__AaJRd_0_r0_lFZ":{"name":"combineLatest(_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV13combineLatest___14resultSelectorACyxGqd___qd_0_qd_1_x7ElementQyd___AGQyd_0_AGQyd_1_tKctAA0C4TypeRd__AaKRd_0_AaKRd_1_r1_lFZ":{"name":"combineLatest(_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV13combineLatest____14resultSelectorACyxGqd___qd_0_qd_1_qd_2_x7ElementQyd___AGQyd_0_AGQyd_1_AGQyd_2_tKctAA0C4TypeRd__AaLRd_0_AaLRd_1_AaLRd_2_r2_lFZ":{"name":"combineLatest(_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV13combineLatest_____14resultSelectorACyxGqd___qd_0_qd_1_qd_2_qd_3_x7ElementQyd___AGQyd_0_AGQyd_1_AGQyd_2_AGQyd_3_tKctAA0C4TypeRd__AaMRd_0_AaMRd_1_AaMRd_2_AaMRd_3_r3_lFZ":{"name":"combineLatest(_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV13combineLatest______14resultSelectorACyxGqd___qd_0_qd_1_qd_2_qd_3_qd_4_x7ElementQyd___AGQyd_0_AGQyd_1_AGQyd_2_AGQyd_3_AGQyd_4_tKctAA0C4TypeRd__AaNRd_0_AaNRd_1_AaNRd_2_AaNRd_3_AaNRd_4_r4_lFZ":{"name":"combineLatest(_:_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV13combineLatest_______14resultSelectorACyxGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_x7ElementQyd___AGQyd_0_AGQyd_1_AGQyd_2_AGQyd_3_AGQyd_4_AGQyd_5_tKctAA0C4TypeRd__AaORd_0_AaORd_1_AaORd_2_AaORd_3_AaORd_4_AaORd_5_r5_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV13combineLatest________14resultSelectorACyxGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_x7ElementQyd___AGQyd_0_AGQyd_1_AGQyd_2_AGQyd_3_AGQyd_4_AGQyd_5_AGQyd_6_tKctAA0C4TypeRd__AaPRd_0_AaPRd_1_AaPRd_2_AaPRd_3_AaPRd_4_AaPRd_5_AaPRd_6_r6_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV0C8Observera":{"name":"InfallibleObserver","abstract":"

Undocumented

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV6create9subscribeACyxGAA10Disposable_pyAA0C5EventOyxGcc_tFZ":{"name":"create(subscribe:)","abstract":"

Creates an observable sequence from a specified subscribe method implementation.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV2of_9schedulerACyxGxd_AA22ImmediateSchedulerType_ptFZ":{"name":"of(_:scheduler:)","abstract":"

This method creates a new Infallible instance with a variable number of elements.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV4from_9schedulerACyxGSayxG_AA22ImmediateSchedulerType_ptFZ":{"name":"from(_:scheduler:)","abstract":"

Converts an array to an Infallible sequence.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV4from_9schedulerACyxGqd___AA22ImmediateSchedulerType_pt7ElementQyd__RszSTRd__lFZ":{"name":"from(_:scheduler:)","abstract":"

Converts a sequence to an Infallible sequence.

","parent_name":"Infallible"},"Structs/Infallible.html#/s:7RxSwift10InfallibleV2do6onNext05afterF00E9Completed0gH00E9Subscribe0E10Subscribed0E7DisposeACyxGyxKcSg_AMyyKcSgANyycSgA2OtF":{"name":"do(onNext:afterNext:onCompleted:afterCompleted:onSubscribe:onSubscribed:onDispose:)","abstract":"

Invokes an action for each event in the infallible sequence, and propagates all observer messages through the result sequence.

","parent_name":"Infallible"},"Structs/Infallible.html":{"name":"Infallible","abstract":"

Infallible is an Observable-like push-style interface"},"Protocols/SubjectType.html#/s:7RxSwift11SubjectTypeP8ObserverQa":{"name":"Observer","abstract":"

The type of the observer that represents this subject.

","parent_name":"SubjectType"},"Protocols/SubjectType.html#/s:7RxSwift11SubjectTypeP10asObserver0F0QzyF":{"name":"asObserver()","abstract":"

Returns observer interface for subject.

","parent_name":"SubjectType"},"Classes/ReplaySubject.html#/s:7RxSwift13ReplaySubjectC0D12ObserverTypea":{"name":"SubjectObserverType","abstract":"

Undocumented

","parent_name":"ReplaySubject"},"Classes/ReplaySubject.html#/s:7RxSwift13ReplaySubjectC12hasObserversSbvp":{"name":"hasObservers","abstract":"

Indicates whether the subject has any observers

","parent_name":"ReplaySubject"},"Classes/ReplaySubject.html#/s:7RxSwift13ReplaySubjectC2onyyAA5EventOyxGF":{"name":"on(_:)","abstract":"

Notifies all subscribed observers about next event.

","parent_name":"ReplaySubject"},"Classes/ReplaySubject.html#/s:7RxSwift13ReplaySubjectC10asObserverACyxGyF":{"name":"asObserver()","abstract":"

Returns observer interface for subject.

","parent_name":"ReplaySubject"},"Classes/ReplaySubject.html#/s:7RxSwift13ReplaySubjectC7disposeyyF":{"name":"dispose()","abstract":"

Unsubscribe all observers and release resources.

","parent_name":"ReplaySubject"},"Classes/ReplaySubject.html#/s:7RxSwift13ReplaySubjectC6create10bufferSizeACyxGSi_tFZ":{"name":"create(bufferSize:)","abstract":"

Creates new instance of ReplaySubject that replays at most bufferSize last elements of sequence.

","parent_name":"ReplaySubject"},"Classes/ReplaySubject.html#/s:7RxSwift13ReplaySubjectC15createUnboundedACyxGyFZ":{"name":"createUnbounded()","abstract":"

Creates a new instance of ReplaySubject that buffers all the elements of a sequence.","parent_name":"ReplaySubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectC0D12ObserverTypea":{"name":"SubjectObserverType","abstract":"

Undocumented

","parent_name":"PublishSubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectC12hasObserversSbvp":{"name":"hasObservers","abstract":"

Indicates whether the subject has any observers

","parent_name":"PublishSubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectC10isDisposedSbvp":{"name":"isDisposed","abstract":"

Indicates whether the subject has been isDisposed.

","parent_name":"PublishSubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectCACyxGycfc":{"name":"init()","abstract":"

Creates a subject.

","parent_name":"PublishSubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectC2onyyAA5EventOyxGF":{"name":"on(_:)","abstract":"

Notifies all subscribed observers about next event.

","parent_name":"PublishSubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectC9subscribeyAA10Disposable_pqd__7ElementQyd__RszAA12ObserverTypeRd__lF":{"name":"subscribe(_:)","abstract":"

Subscribes an observer to the subject.

","parent_name":"PublishSubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectC10asObserverACyxGyF":{"name":"asObserver()","abstract":"

Returns observer interface for subject.

","parent_name":"PublishSubject"},"Classes/PublishSubject.html#/s:7RxSwift14PublishSubjectC7disposeyyF":{"name":"dispose()","abstract":"

Unsubscribe all observers and release resources.

","parent_name":"PublishSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC0D12ObserverTypea":{"name":"SubjectObserverType","abstract":"

Undocumented

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC12hasObserversSbvp":{"name":"hasObservers","abstract":"

Indicates whether the subject has any observers

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC10isDisposedSbvp":{"name":"isDisposed","abstract":"

Indicates whether the subject has been disposed.

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC5valueACyxGx_tcfc":{"name":"init(value:)","abstract":"

Initializes a new instance of the subject that caches its last value and starts with the specified value.

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC5valuexyKF":{"name":"value()","abstract":"

Gets the current value or throws an error.

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC2onyyAA5EventOyxGF":{"name":"on(_:)","abstract":"

Notifies all subscribed observers about next event.

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC9subscribeyAA10Disposable_pqd__7ElementQyd__RszAA12ObserverTypeRd__lF":{"name":"subscribe(_:)","abstract":"

Subscribes an observer to the subject.

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC10asObserverACyxGyF":{"name":"asObserver()","abstract":"

Returns observer interface for subject.

","parent_name":"BehaviorSubject"},"Classes/BehaviorSubject.html#/s:7RxSwift15BehaviorSubjectC7disposeyyF":{"name":"dispose()","abstract":"

Unsubscribe all observers and release resources.

","parent_name":"BehaviorSubject"},"Classes/AsyncSubject.html#/s:7RxSwift12AsyncSubjectC0D12ObserverTypea":{"name":"SubjectObserverType","abstract":"

Undocumented

","parent_name":"AsyncSubject"},"Classes/AsyncSubject.html#/s:7RxSwift12AsyncSubjectC12hasObserversSbvp":{"name":"hasObservers","abstract":"

Indicates whether the subject has any observers

","parent_name":"AsyncSubject"},"Classes/AsyncSubject.html#/s:7RxSwift12AsyncSubjectCACyxGycfc":{"name":"init()","abstract":"

Creates a subject.

","parent_name":"AsyncSubject"},"Classes/AsyncSubject.html#/s:7RxSwift12AsyncSubjectC2onyyAA5EventOyxGF":{"name":"on(_:)","abstract":"

Notifies all subscribed observers about next event.

","parent_name":"AsyncSubject"},"Classes/AsyncSubject.html#/s:7RxSwift12AsyncSubjectC9subscribeyAA10Disposable_pqd__7ElementQyd__RszAA12ObserverTypeRd__lF":{"name":"subscribe(_:)","abstract":"

Subscribes an observer to the subject.

","parent_name":"AsyncSubject"},"Classes/AsyncSubject.html#/s:7RxSwift12AsyncSubjectC10asObserverACyxGyF":{"name":"asObserver()","abstract":"

Returns observer interface for subject.

","parent_name":"AsyncSubject"},"Classes/AsyncSubject.html":{"name":"AsyncSubject","abstract":"

An AsyncSubject emits the last value (and only the last value) emitted by the source Observable,"},"Classes/BehaviorSubject.html":{"name":"BehaviorSubject","abstract":"

Represents a value that changes over time.

"},"Classes/PublishSubject.html":{"name":"PublishSubject","abstract":"

Represents an object that is both an observable sequence as well as an observer.

"},"Classes/ReplaySubject.html":{"name":"ReplaySubject","abstract":"

Represents an object that is both an observable sequence as well as an observer.

"},"Protocols/SubjectType.html":{"name":"SubjectType","abstract":"

Represents an object that is both an observable sequence as well as an observer.

"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC0cD0a":{"name":"VirtualTime","abstract":"

Undocumented

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC0cD8Intervala":{"name":"VirtualTimeInterval","abstract":"

Undocumented

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC3now10Foundation4DateVvp":{"name":"now","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC5clock0cD4UnitQzvp":{"name":"clock","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC12initialClock9converterACyxG0cD4UnitQz_xtcfc":{"name":"init(initialClock:converter:)","abstract":"

Creates a new virtual time scheduler.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC8schedule_6actionAA10Disposable_pqd___AaF_pqd__ctlF":{"name":"schedule(_:action:)","abstract":"

Schedules an action to be executed immediately.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC16scheduleRelative_03dueD06actionAA10Disposable_pqd___8Dispatch0kD8IntervalOAaG_pqd__ctlF":{"name":"scheduleRelative(_:dueTime:action:)","abstract":"

Schedules an action to be executed.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC016scheduleRelativeC0_03dueD06actionAA10Disposable_pqd___0cD12IntervalUnitQzAaG_pqd__ctlF":{"name":"scheduleRelativeVirtual(_:dueTime:action:)","abstract":"

Schedules an action to be executed after relative time has passed.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC016scheduleAbsoluteC0_4time6actionAA10Disposable_pqd___0cD4UnitQzAaG_pqd__ctlF":{"name":"scheduleAbsoluteVirtual(_:time:action:)","abstract":"

Schedules an action to be executed at absolute virtual time.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC015adjustScheduledD0y0cD4UnitQzAFF":{"name":"adjustScheduledTime(_:)","abstract":"

Adjusts time of scheduling before adding item to schedule queue.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC5startyyF":{"name":"start()","abstract":"

Starts the virtual time scheduler.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC9advanceToyy0cD4UnitQzF":{"name":"advanceTo(_:)","abstract":"

Advances the scheduler’s clock to the specified time, running all work till that point.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC5sleepyy0cD12IntervalUnitQzF":{"name":"sleep(_:)","abstract":"

Advances the scheduler’s clock by the specified relative time.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC4stopyyF":{"name":"stop()","abstract":"

Stops the virtual time scheduler.

","parent_name":"VirtualTimeScheduler"},"Classes/VirtualTimeScheduler.html#/s:7RxSwift20VirtualTimeSchedulerC16debugDescriptionSSvp":{"name":"debugDescription","abstract":"

A textual representation of self, suitable for debugging.

","parent_name":"VirtualTimeScheduler"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP0cD4UnitQa":{"name":"VirtualTimeUnit","abstract":"

Virtual time unit used that represents ticks of virtual clock.

","parent_name":"VirtualTimeConverterType"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP0cD12IntervalUnitQa":{"name":"VirtualTimeIntervalUnit","abstract":"

Virtual time unit used to represent differences of virtual times.

","parent_name":"VirtualTimeConverterType"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP011convertFromcD0y10Foundation4DateV0cD4UnitQzF":{"name":"convertFromVirtualTime(_:)","abstract":"

Converts virtual time to real time.

","parent_name":"VirtualTimeConverterType"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP09convertTocD0y0cD4UnitQz10Foundation4DateVF":{"name":"convertToVirtualTime(_:)","abstract":"

Converts real time to virtual time.

","parent_name":"VirtualTimeConverterType"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP011convertFromcD8IntervalySd0cdI4UnitQzF":{"name":"convertFromVirtualTimeInterval(_:)","abstract":"

Converts from virtual time interval to TimeInterval.

","parent_name":"VirtualTimeConverterType"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP09convertTocD8Intervaly0cdI4UnitQzSdF":{"name":"convertToVirtualTimeInterval(_:)","abstract":"

Converts from TimeInterval to virtual time interval.

","parent_name":"VirtualTimeConverterType"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP06offsetcD0_0G00cD4UnitQzAG_0cd8IntervalH0QztF":{"name":"offsetVirtualTime(_:offset:)","abstract":"

Offsets virtual time by virtual time interval.

","parent_name":"VirtualTimeConverterType"},"Protocols/VirtualTimeConverterType.html#/s:7RxSwift24VirtualTimeConverterTypeP07comparecD0yAA0cD10ComparisonO0cD4UnitQz_AHtF":{"name":"compareVirtualTime(_:_:)","abstract":"

This is additional abstraction because Date is unfortunately not comparable.","parent_name":"VirtualTimeConverterType"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC12TimeIntervala":{"name":"TimeInterval","abstract":"

Undocumented

","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC4Timea":{"name":"Time","abstract":"

Undocumented

","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC3now10Foundation4DateVvp":{"name":"now","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC08internalcE4Name06serialE13Configuration6leewayACSS_ySo17OS_dispatch_queueCcSg0D00D12TimeIntervalOtcfc":{"name":"init(internalSerialQueueName:serialQueueConfiguration:leeway:)","abstract":"

Constructs new SerialDispatchQueueScheduler with internal serial queue named internalSerialQueueName.

","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC5queue08internalcE4Name6leewayACSo012OS_dispatch_G0C_SS0D00D12TimeIntervalOtcfc":{"name":"init(queue:internalSerialQueueName:leeway:)","abstract":"

Constructs new SerialDispatchQueueScheduler named internalSerialQueueName that wraps queue.

","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC3qos08internalcE4Name6leewayAC0D00D3QoSV_SSAG0D12TimeIntervalOtcfc":{"name":"init(qos:internalSerialQueueName:leeway:)","abstract":"

Constructs new SerialDispatchQueueScheduler that wraps one of the global concurrent dispatch queues.

","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC8schedule_6actionAA10Disposable_px_AaF_pxctlF":{"name":"schedule(_:action:)","abstract":"

Schedules an action to be executed immediately.

","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC16scheduleRelative_7dueTime6actionAA10Disposable_px_0D00dJ8IntervalOAaG_pxctlF":{"name":"scheduleRelative(_:dueTime:action:)","abstract":"

Schedules an action to be executed.

","parent_name":"SerialDispatchQueueScheduler"},"Classes/SerialDispatchQueueScheduler.html#/s:7RxSwift28SerialDispatchQueueSchedulerC16schedulePeriodic_10startAfter6period6actionAA10Disposable_px_0D00D12TimeIntervalOAKxxctlF":{"name":"schedulePeriodic(_:startAfter:period:action:)","abstract":"

Schedules a periodic piece of work.

","parent_name":"SerialDispatchQueueScheduler"},"Classes/OperationQueueScheduler.html#/s:7RxSwift23OperationQueueSchedulerC09operationD0So011NSOperationD0Cvp":{"name":"operationQueue","abstract":"

Undocumented

","parent_name":"OperationQueueScheduler"},"Classes/OperationQueueScheduler.html#/s:7RxSwift23OperationQueueSchedulerC13queuePrioritySo011NSOperationdG0Vvp":{"name":"queuePriority","abstract":"

Undocumented

","parent_name":"OperationQueueScheduler"},"Classes/OperationQueueScheduler.html#/s:7RxSwift23OperationQueueSchedulerC09operationD013queuePriorityACSo011NSOperationD0C_So0idH0Vtcfc":{"name":"init(operationQueue:queuePriority:)","abstract":"

Constructs new instance of OperationQueueScheduler that performs work on operationQueue.

","parent_name":"OperationQueueScheduler"},"Classes/OperationQueueScheduler.html#/s:7RxSwift23OperationQueueSchedulerC8schedule_6actionAA10Disposable_px_AaF_pxctlF":{"name":"schedule(_:action:)","abstract":"

Schedules an action to be executed recursively.

","parent_name":"OperationQueueScheduler"},"Classes/MainScheduler.html#/s:7RxSwift13MainSchedulerCACycfc":{"name":"init()","abstract":"

Initializes new instance of MainScheduler.

","parent_name":"MainScheduler"},"Classes/MainScheduler.html#/s:7RxSwift13MainSchedulerC8instanceACvpZ":{"name":"instance","abstract":"

Singleton instance of MainScheduler

","parent_name":"MainScheduler"},"Classes/MainScheduler.html#/s:7RxSwift13MainSchedulerC13asyncInstanceAA019SerialDispatchQueueD0CvpZ":{"name":"asyncInstance","abstract":"

Singleton instance of MainScheduler that always schedules work asynchronously","parent_name":"MainScheduler"},"Classes/MainScheduler.html#/s:7RxSwift13MainSchedulerC017ensureExecutingOnD012errorMessageySSSg_tFZ":{"name":"ensureExecutingOnScheduler(errorMessage:)","abstract":"

In case this method is called on a background thread it will throw an exception.

","parent_name":"MainScheduler"},"Classes/MainScheduler.html#/s:7RxSwift13MainSchedulerC015ensureRunningOnC6Thread12errorMessageySSSg_tFZ":{"name":"ensureRunningOnMainThread(errorMessage:)","abstract":"

In case this method is running on a background thread it will throw an exception.

","parent_name":"MainScheduler"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV07VirtualE4Unita":{"name":"VirtualTimeUnit","abstract":"

Virtual time unit used that represents ticks of virtual clock.

","parent_name":"HistoricalSchedulerTimeConverter"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV07VirtualE12IntervalUnita":{"name":"VirtualTimeIntervalUnit","abstract":"

Virtual time unit used to represent differences of virtual times.

","parent_name":"HistoricalSchedulerTimeConverter"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV018convertFromVirtualE0y10Foundation4DateVAGF":{"name":"convertFromVirtualTime(_:)","abstract":"

Returns identical value of argument passed because historical virtual time is equal to real time, just","parent_name":"HistoricalSchedulerTimeConverter"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV016convertToVirtualE0y10Foundation4DateVAGF":{"name":"convertToVirtualTime(_:)","abstract":"

Returns identical value of argument passed because historical virtual time is equal to real time, just","parent_name":"HistoricalSchedulerTimeConverter"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV018convertFromVirtualE8IntervalyS2dF":{"name":"convertFromVirtualTimeInterval(_:)","abstract":"

Returns identical value of argument passed because historical virtual time is equal to real time, just","parent_name":"HistoricalSchedulerTimeConverter"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV016convertToVirtualE8IntervalyS2dF":{"name":"convertToVirtualTimeInterval(_:)","abstract":"

Returns identical value of argument passed because historical virtual time is equal to real time, just","parent_name":"HistoricalSchedulerTimeConverter"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV013offsetVirtualE0_0G010Foundation4DateVAH_SdtF":{"name":"offsetVirtualTime(_:offset:)","abstract":"

Offsets Date by time interval.

","parent_name":"HistoricalSchedulerTimeConverter"},"Structs/HistoricalSchedulerTimeConverter.html#/s:7RxSwift32HistoricalSchedulerTimeConverterV014compareVirtualE0yAA0hE10ComparisonO10Foundation4DateV_AItF":{"name":"compareVirtualTime(_:_:)","abstract":"

Compares two Dates.

","parent_name":"HistoricalSchedulerTimeConverter"},"Classes/HistoricalScheduler.html#/s:7RxSwift19HistoricalSchedulerC12initialClockAC10Foundation4DateV_tcfc":{"name":"init(initialClock:)","abstract":"

Creates a new historical scheduler with initial clock value.

","parent_name":"HistoricalScheduler"},"Classes/CurrentThreadScheduler.html#/s:7RxSwift22CurrentThreadSchedulerC8instanceACvpZ":{"name":"instance","abstract":"

The singleton instance of the current thread scheduler.

","parent_name":"CurrentThreadScheduler"},"Classes/CurrentThreadScheduler.html#/s:7RxSwift22CurrentThreadSchedulerC18isScheduleRequiredSbvpZ":{"name":"isScheduleRequired","abstract":"

Gets a value that indicates whether the caller must call a schedule method.

","parent_name":"CurrentThreadScheduler"},"Classes/CurrentThreadScheduler.html#/s:7RxSwift22CurrentThreadSchedulerC8schedule_6actionAA10Disposable_px_AaF_pxctlF":{"name":"schedule(_:action:)","abstract":"

Schedules an action to be executed as soon as possible on current thread.

","parent_name":"CurrentThreadScheduler"},"Classes/ConcurrentMainScheduler.html#/s:7RxSwift23ConcurrentMainSchedulerC12TimeIntervala":{"name":"TimeInterval","abstract":"

Undocumented

","parent_name":"ConcurrentMainScheduler"},"Classes/ConcurrentMainScheduler.html#/s:7RxSwift23ConcurrentMainSchedulerC4Timea":{"name":"Time","abstract":"

Undocumented

","parent_name":"ConcurrentMainScheduler"},"Classes/ConcurrentMainScheduler.html#/s:7RxSwift23ConcurrentMainSchedulerC3now10Foundation4DateVvp":{"name":"now","parent_name":"ConcurrentMainScheduler"},"Classes/ConcurrentMainScheduler.html#/s:7RxSwift23ConcurrentMainSchedulerC8instanceACvpZ":{"name":"instance","abstract":"

Singleton instance of ConcurrentMainScheduler

","parent_name":"ConcurrentMainScheduler"},"Classes/ConcurrentMainScheduler.html#/s:7RxSwift23ConcurrentMainSchedulerC8schedule_6actionAA10Disposable_px_AaF_pxctlF":{"name":"schedule(_:action:)","abstract":"

Schedules an action to be executed immediately.

","parent_name":"ConcurrentMainScheduler"},"Classes/ConcurrentMainScheduler.html#/s:7RxSwift23ConcurrentMainSchedulerC16scheduleRelative_7dueTime6actionAA10Disposable_px_8Dispatch0lI8IntervalOAaG_pxctlF":{"name":"scheduleRelative(_:dueTime:action:)","abstract":"

Schedules an action to be executed.

","parent_name":"ConcurrentMainScheduler"},"Classes/ConcurrentMainScheduler.html#/s:7RxSwift23ConcurrentMainSchedulerC16schedulePeriodic_10startAfter6period6actionAA10Disposable_px_8Dispatch0M12TimeIntervalOAKxxctlF":{"name":"schedulePeriodic(_:startAfter:period:action:)","abstract":"

Schedules a periodic piece of work.

","parent_name":"ConcurrentMainScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift32ConcurrentDispatchQueueSchedulerC12TimeIntervala":{"name":"TimeInterval","abstract":"

Undocumented

","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift32ConcurrentDispatchQueueSchedulerC4Timea":{"name":"Time","abstract":"

Undocumented

","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift13SchedulerTypeP3now10Foundation4DateVvp":{"name":"now","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift32ConcurrentDispatchQueueSchedulerC5queue6leewayACSo012OS_dispatch_G0C_0D00D12TimeIntervalOtcfc":{"name":"init(queue:leeway:)","abstract":"

Constructs new ConcurrentDispatchQueueScheduler that wraps queue.

","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift32ConcurrentDispatchQueueSchedulerC3qos6leewayAC0D00D3QoSV_AF0D12TimeIntervalOtcfc":{"name":"init(qos:leeway:)","abstract":"

Convenience init for scheduler that wraps one of the global concurrent dispatch queues.

","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift32ConcurrentDispatchQueueSchedulerC8schedule_6actionAA10Disposable_px_AaF_pxctlF":{"name":"schedule(_:action:)","abstract":"

Schedules an action to be executed immediately.

","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift32ConcurrentDispatchQueueSchedulerC16scheduleRelative_7dueTime6actionAA10Disposable_px_0D00dJ8IntervalOAaG_pxctlF":{"name":"scheduleRelative(_:dueTime:action:)","abstract":"

Schedules an action to be executed.

","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html#/s:7RxSwift32ConcurrentDispatchQueueSchedulerC16schedulePeriodic_10startAfter6period6actionAA10Disposable_px_0D00D12TimeIntervalOAKxxctlF":{"name":"schedulePeriodic(_:startAfter:period:action:)","abstract":"

Schedules a periodic piece of work.

","parent_name":"ConcurrentDispatchQueueScheduler"},"Classes/ConcurrentDispatchQueueScheduler.html":{"name":"ConcurrentDispatchQueueScheduler","abstract":"

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.

"},"Classes/ConcurrentMainScheduler.html":{"name":"ConcurrentMainScheduler","abstract":"

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.

"},"Classes/CurrentThreadScheduler.html":{"name":"CurrentThreadScheduler","abstract":"

Represents an object that schedules units of work on the current thread.

"},"Classes/HistoricalScheduler.html":{"name":"HistoricalScheduler","abstract":"

Provides a virtual time scheduler that uses Date for absolute time and TimeInterval for relative time.

"},"Structs/HistoricalSchedulerTimeConverter.html":{"name":"HistoricalSchedulerTimeConverter","abstract":"

Converts historical virtual time into real time.

"},"Classes/MainScheduler.html":{"name":"MainScheduler","abstract":"

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.

"},"Classes/OperationQueueScheduler.html":{"name":"OperationQueueScheduler","abstract":"

Abstracts the work that needs to be performed on a specific NSOperationQueue.

"},"Classes/SerialDispatchQueueScheduler.html":{"name":"SerialDispatchQueueScheduler","abstract":"

Abstracts the work that needs to be performed on a specific dispatch_queue_t. It will make sure"},"Protocols/VirtualTimeConverterType.html":{"name":"VirtualTimeConverterType","abstract":"

Parametrization for virtual time used by VirtualTimeSchedulers.

"},"Classes/VirtualTimeScheduler.html":{"name":"VirtualTimeScheduler","abstract":"

Base class for virtual time schedulers using a priority queue for scheduled items.

"},"Classes/SingleAssignmentDisposable.html#/s:7RxSwift26SingleAssignmentDisposableC10isDisposedSbvp":{"name":"isDisposed","parent_name":"SingleAssignmentDisposable"},"Classes/SingleAssignmentDisposable.html#/s:7RxSwift26SingleAssignmentDisposableCACycfc":{"name":"init()","abstract":"

Initializes a new instance of the SingleAssignmentDisposable.

","parent_name":"SingleAssignmentDisposable"},"Classes/SingleAssignmentDisposable.html#/s:7RxSwift26SingleAssignmentDisposableC03setE0yyAA0E0_pF":{"name":"setDisposable(_:)","abstract":"

Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined.

","parent_name":"SingleAssignmentDisposable"},"Classes/SingleAssignmentDisposable.html#/s:7RxSwift26SingleAssignmentDisposableC7disposeyyF":{"name":"dispose()","abstract":"

Disposes the underlying disposable.

","parent_name":"SingleAssignmentDisposable"},"Classes/SerialDisposable.html#/s:7RxSwift16SerialDisposableC10isDisposedSbvp":{"name":"isDisposed","parent_name":"SerialDisposable"},"Classes/SerialDisposable.html#/s:7RxSwift16SerialDisposableCACycfc":{"name":"init()","abstract":"

Initializes a new instance of the SerialDisposable.

","parent_name":"SerialDisposable"},"Classes/SerialDisposable.html#/s:7RxSwift16SerialDisposableC10disposableAA0D0_pvp":{"name":"disposable","abstract":"

Gets or sets the underlying disposable.

","parent_name":"SerialDisposable"},"Classes/SerialDisposable.html#/s:7RxSwift16SerialDisposableC7disposeyyF":{"name":"dispose()","abstract":"

Disposes the underlying disposable as well as all future replacements.

","parent_name":"SerialDisposable"},"Classes/ScheduledDisposable.html#/s:7RxSwift19ScheduledDisposableC9schedulerAA22ImmediateSchedulerType_pvp":{"name":"scheduler","abstract":"

Undocumented

","parent_name":"ScheduledDisposable"},"Classes/ScheduledDisposable.html#/s:7RxSwift19ScheduledDisposableC10isDisposedSbvp":{"name":"isDisposed","parent_name":"ScheduledDisposable"},"Classes/ScheduledDisposable.html#/s:7RxSwift19ScheduledDisposableC9scheduler10disposableAcA22ImmediateSchedulerType_p_AA0D0_ptcfc":{"name":"init(scheduler:disposable:)","abstract":"

Initializes a new instance of the ScheduledDisposable that uses a scheduler on which to dispose the disposable.

","parent_name":"ScheduledDisposable"},"Classes/ScheduledDisposable.html#/s:7RxSwift19ScheduledDisposableC7disposeyyF":{"name":"dispose()","abstract":"

Disposes the wrapped disposable on the provided scheduler.

","parent_name":"ScheduledDisposable"},"Classes/RefCountDisposable.html#/s:7RxSwift18RefCountDisposableC10isDisposedSbvp":{"name":"isDisposed","parent_name":"RefCountDisposable"},"Classes/RefCountDisposable.html#/s:7RxSwift18RefCountDisposableC10disposableAcA0E0_p_tcfc":{"name":"init(disposable:)","abstract":"

Initializes a new instance of the RefCountDisposable.

","parent_name":"RefCountDisposable"},"Classes/RefCountDisposable.html#/s:7RxSwift18RefCountDisposableC6retainAA0E0_pyF":{"name":"retain()","abstract":"

Holds a dependent disposable that when disposed decreases the refcount on the underlying disposable.

","parent_name":"RefCountDisposable"},"Classes/RefCountDisposable.html#/s:7RxSwift18RefCountDisposableC7disposeyyF":{"name":"dispose()","abstract":"

Disposes the underlying disposable only when all dependent disposables have been disposed.

","parent_name":"RefCountDisposable"},"Classes/DisposeBag/DisposableBuilder.html#/s:7RxSwift10DisposeBagC17DisposableBuilderV10buildBlockySayAA0E0_pGAaG_pd_tFZ":{"name":"buildBlock(_:)","abstract":"

Undocumented

","parent_name":"DisposableBuilder"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagCACycfc":{"name":"init()","abstract":"

Constructs new empty dispose bag.

","parent_name":"DisposeBag"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagC6insertyyAA10Disposable_pF":{"name":"insert(_:)","abstract":"

Adds disposable to be disposed when dispose bag is being deinited.

","parent_name":"DisposeBag"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagC9disposingAcA10Disposable_pd_tcfc":{"name":"init(disposing:)","abstract":"

Convenience init allows a list of disposables to be gathered for disposal.

","parent_name":"DisposeBag"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagC7builderACSayAA10Disposable_pGyXE_tcfc":{"name":"init(builder:)","abstract":"

Convenience init which utilizes a function builder to let you pass in a list of","parent_name":"DisposeBag"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagC9disposingACSayAA10Disposable_pG_tcfc":{"name":"init(disposing:)","abstract":"

Convenience init allows an array of disposables to be gathered for disposal.

","parent_name":"DisposeBag"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagC6insertyyAA10Disposable_pd_tF":{"name":"insert(_:)","abstract":"

Convenience function allows a list of disposables to be gathered for disposal.

","parent_name":"DisposeBag"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagC6insert7builderySayAA10Disposable_pGyXE_tF":{"name":"insert(builder:)","abstract":"

Convenience function allows a list of disposables to be gathered for disposal.

","parent_name":"DisposeBag"},"Classes/DisposeBag.html#/s:7RxSwift10DisposeBagC6insertyySayAA10Disposable_pGF":{"name":"insert(_:)","abstract":"

Convenience function allows an array of disposables to be gathered for disposal.

","parent_name":"DisposeBag"},"Classes/DisposeBag/DisposableBuilder.html":{"name":"DisposableBuilder","abstract":"

Undocumented

","parent_name":"DisposeBag"},"Structs/Disposables.html#/s:7RxSwift11DisposablesV6create4withAA10Cancelable_pyyc_tFZ":{"name":"create(with:)","abstract":"

Constructs a new disposable with the given action used for disposal.

","parent_name":"Disposables"},"Structs/Disposables.html#/s:7RxSwift11DisposablesV6createyAA10Cancelable_pAA10Disposable_p_AaF_ptFZ":{"name":"create(_:_:)","abstract":"

Creates a disposable with the given disposables.

","parent_name":"Disposables"},"Structs/Disposables.html#/s:7RxSwift11DisposablesV6createyAA10Cancelable_pAA10Disposable_p_AaF_pAaF_ptFZ":{"name":"create(_:_:_:)","abstract":"

Creates a disposable with the given disposables.

","parent_name":"Disposables"},"Structs/Disposables.html#/s:7RxSwift11DisposablesV6createyAA10Cancelable_pAA10Disposable_p_AaF_pAaF_pAaF_pdtFZ":{"name":"create(_:_:_:_:)","abstract":"

Creates a disposable with the given disposables.

","parent_name":"Disposables"},"Structs/Disposables.html#/s:7RxSwift11DisposablesV6createyAA10Cancelable_pSayAA10Disposable_pGFZ":{"name":"create(_:)","abstract":"

Creates a disposable with the given disposables.

","parent_name":"Disposables"},"Structs/Disposables.html#/s:7RxSwift11DisposablesV6createAA10Disposable_pyFZ":{"name":"create()","abstract":"

Creates a disposable that does nothing on disposal.

","parent_name":"Disposables"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableC10DisposeKeyV":{"name":"DisposeKey","abstract":"

Key used to remove disposable from composite disposable

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift10CancelableP10isDisposedSbvp":{"name":"isDisposed","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableCACycfc":{"name":"init()","abstract":"

Undocumented

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableCyAcA0D0_p_AaD_ptcfc":{"name":"init(_:_:)","abstract":"

Initializes a new instance of composite disposable with the specified number of disposables.

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableCyAcA0D0_p_AaD_pAaD_ptcfc":{"name":"init(_:_:_:)","abstract":"

Initializes a new instance of composite disposable with the specified number of disposables.

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableCyAcA0D0_p_AaD_pAaD_pAaD_pAaD_pdtcfc":{"name":"init(_:_:_:_:_:)","abstract":"

Initializes a new instance of composite disposable with the specified number of disposables.

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableC11disposablesACSayAA0D0_pG_tcfc":{"name":"init(disposables:)","abstract":"

Initializes a new instance of composite disposable with the specified number of disposables.

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableC6insertyAC10DisposeKeyVSgAA0D0_pF":{"name":"insert(_:)","abstract":"

Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableC5countSivp":{"name":"count","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableC6remove3foryAC10DisposeKeyV_tF":{"name":"remove(for:)","abstract":"

Removes and disposes the disposable identified by disposeKey from the CompositeDisposable.

","parent_name":"CompositeDisposable"},"Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableC7disposeyyF":{"name":"dispose()","abstract":"

Disposes all disposables in the group and removes them from the group.

","parent_name":"CompositeDisposable"},"Classes/BooleanDisposable.html#/s:7RxSwift17BooleanDisposableCACycfc":{"name":"init()","abstract":"

Initializes a new instance of the BooleanDisposable class

","parent_name":"BooleanDisposable"},"Classes/BooleanDisposable.html#/s:7RxSwift17BooleanDisposableC10isDisposedACSb_tcfc":{"name":"init(isDisposed:)","abstract":"

Initializes a new instance of the BooleanDisposable class with given value

","parent_name":"BooleanDisposable"},"Classes/BooleanDisposable.html#/s:7RxSwift17BooleanDisposableC10isDisposedSbvp":{"name":"isDisposed","parent_name":"BooleanDisposable"},"Classes/BooleanDisposable.html#/s:7RxSwift17BooleanDisposableC7disposeyyF":{"name":"dispose()","abstract":"

Sets the status to disposed, which can be observer through the isDisposed property.

","parent_name":"BooleanDisposable"},"Classes/BooleanDisposable.html":{"name":"BooleanDisposable","abstract":"

Represents a disposable resource that can be checked for disposal status.

"},"Classes/CompositeDisposable.html":{"name":"CompositeDisposable","abstract":"

Represents a group of disposable resources that are disposed together.

"},"Structs/Disposables.html":{"name":"Disposables","abstract":"

A collection of utility methods for common disposable operations.

"},"Classes/DisposeBag.html":{"name":"DisposeBag","abstract":"

Thread safe bag that disposes added disposables on deinit.

"},"RxSwift%2FDisposables.html#/s:7RxSwift11DisposeBaseC":{"name":"DisposeBase","abstract":"

Base class for all disposables.

"},"Classes/RefCountDisposable.html":{"name":"RefCountDisposable","abstract":"

Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.

"},"Classes/ScheduledDisposable.html":{"name":"ScheduledDisposable","abstract":"

Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler.

"},"Classes/SerialDisposable.html":{"name":"SerialDisposable","abstract":"

Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.

"},"Classes/SingleAssignmentDisposable.html":{"name":"SingleAssignmentDisposable","abstract":"

Represents a disposable resource which only allows a single assignment of its underlying disposable resource.

"},"Protocols/SchedulerType.html#/s:7RxSwift13SchedulerTypeP3now10Foundation4DateVvp":{"name":"now","parent_name":"SchedulerType"},"Protocols/SchedulerType.html#/s:7RxSwift13SchedulerTypeP16scheduleRelative_7dueTime6actionAA10Disposable_pqd___8Dispatch0kH8IntervalOAaG_pqd__ctlF":{"name":"scheduleRelative(_:dueTime:action:)","abstract":"

Schedules an action to be executed.

","parent_name":"SchedulerType"},"Protocols/SchedulerType.html#/s:7RxSwift13SchedulerTypeP16schedulePeriodic_10startAfter6period6actionAA10Disposable_pqd___8Dispatch0L12TimeIntervalOAKqd__qd__ctlF":{"name":"schedulePeriodic(_:startAfter:period:action:)","abstract":"

Schedules a periodic piece of work.

","parent_name":"SchedulerType"},"Structs/Reactive.html#/s:7RxSwift8ReactiveV4basexvp":{"name":"base","abstract":"

Base object to extend.

","parent_name":"Reactive"},"Structs/Reactive.html#/s:7RxSwift8ReactiveVyACyxGxcfc":{"name":"init(_:)","abstract":"

Creates extensions with base object.

","parent_name":"Reactive"},"Structs/Reactive.html#/s:7RxSwift8ReactiveV13dynamicMemberAA6BinderVyqd__Gs24ReferenceWritableKeyPathCyxqd__G_tcRlzCluip":{"name":"subscript(dynamicMember:)","abstract":"

Automatically synthesized binder for a key path between the reactive","parent_name":"Reactive"},"Protocols/ObserverType.html#/s:7RxSwift12ObserverTypeP7ElementQa":{"name":"Element","abstract":"

The type of elements in sequence that observer can observe.

","parent_name":"ObserverType"},"Protocols/ObserverType.html#/s:7RxSwift12ObserverTypeP2onyyAA5EventOy7ElementQzGF":{"name":"on(_:)","abstract":"

Notify observer about sequence event.

","parent_name":"ObserverType"},"Protocols/ObserverType.html#/s:7RxSwift12ObserverTypePAAE02asC0AA03AnyC0Vy7ElementQzGyF":{"name":"asObserver()","abstract":"

Erases type of observer and returns canonical observer.

","parent_name":"ObserverType"},"Protocols/ObserverType.html#/s:7RxSwift12ObserverTypePAAE03mapC0yAA03AnyC0Vyqd__G7ElementQzqd__KclF":{"name":"mapObserver(_:)","abstract":"

Transforms observer of type R to type E using custom transform method.","parent_name":"ObserverType"},"Protocols/ObserverType.html#/s:7RxSwift12ObserverTypePAAE6onNextyy7ElementQzF":{"name":"onNext(_:)","abstract":"

Convenience method equivalent to on(.next(element: Element))

","parent_name":"ObserverType"},"Protocols/ObserverType.html#/s:7RxSwift12ObserverTypePAAE11onCompletedyyF":{"name":"onCompleted()","abstract":"

Convenience method equivalent to on(.completed)

","parent_name":"ObserverType"},"Protocols/ObserverType.html#/s:7RxSwift12ObserverTypePAAE7onErroryys0F0_pF":{"name":"onError(_:)","abstract":"

Convenience method equivalent to on(.error(Swift.Error))

","parent_name":"ObserverType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypeP9subscribeyAA10Disposable_pqd__AA08ObserverD0Rd__7ElementQyd__AGRtzlF":{"name":"subscribe(_:)","abstract":"

Subscribes observer to receive events for this sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9subscribeyAA10Disposable_pyAA5EventOy7ElementQzGcF":{"name":"subscribe(_:)","abstract":"

Subscribes an event handler to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9subscribe4with6onNext0G5Error0G9Completed0G8DisposedAA10Disposable_pqd___yqd___7ElementQztcSgyqd___s0I0_ptcSgyqd__cSgAPtRld__ClF":{"name":"subscribe(with:onNext:onError:onCompleted:onDisposed:)","abstract":"

Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9subscribe6onNext0F5Error0F9Completed0F8DisposedAA10Disposable_py7ElementQzcSg_ys0H0_pcSgyycSgAOtF":{"name":"subscribe(onNext:onError:onCompleted:onDisposed:)","abstract":"

Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE02asC0AA0C0Cy7ElementQzGyF":{"name":"asObservable()","abstract":"

Default implementation of converting ObservableType to Observable.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3ambyAA0C0Cy7ElementQzGqd__STRd__AiGRtd__lFZ":{"name":"amb(_:)","abstract":"

Propagates the observable sequence that reacts first.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3ambyAA0C0Cy7ElementQzGqd__AaBRd__AGQyd__AHRSlF":{"name":"amb(_:)","abstract":"

Propagates the observable sequence that reacts first.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6buffer8timeSpan5count9schedulerAA0C0CySay7ElementQzGG8Dispatch0K12TimeIntervalO_SiAA09SchedulerD0_ptF":{"name":"buffer(timeSpan:count:scheduler:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5catchyAA0C0Cy7ElementQzGAIs5Error_pKcF":{"name":"catch(_:)","abstract":"

Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE10catchErroryAA0C0Cy7ElementQzGAIs0F0_pKcF":{"name":"catchError(_:)","abstract":"

Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE14catchAndReturnyAA0C0Cy7ElementQzGAHF":{"name":"catchAndReturn(_:)","abstract":"

Continues an observable sequence that is terminated by an error with a single element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE20catchErrorJustReturnyAA0C0Cy7ElementQzGAHF":{"name":"catchErrorJustReturn(_:)","abstract":"

Continues an observable sequence that is terminated by an error with a single element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE10catchErroryAA0C0Cy7ElementQzGqd__STRd__AiGRtd__lFZ":{"name":"catchError(_:)","abstract":"

Continues an observable sequence that is terminated by an error with the next observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5catch8sequenceAA0C0Cy7ElementQzGqd___tSTRd__AjHRtd__lFZ":{"name":"catch(sequence:)","abstract":"

Continues an observable sequence that is terminated by an error with the next observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5retryAA0C0Cy7ElementQzGyF":{"name":"retry()","abstract":"

Repeats the source observable sequence until it successfully terminates.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5retryyAA0C0Cy7ElementQzGSiF":{"name":"retry(_:)","abstract":"

Repeats the source observable sequence the specified number of times in case of an error or until it successfully terminates.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest_14resultSelectorAA0C0Cy7ElementQzGqd___AISayAH_AHQYd__GKctSlRd__AabHRpd__lFZ":{"name":"combineLatest(_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatestyAA0C0CySay7ElementQzGGqd__SlRd__AG_AGQYd__AHRSAabGRpd__lFZ":{"name":"combineLatest(_:)","abstract":"

Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest__14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_AiHQyd___AHQyd_0_tKctAaBRd__AaBRd_0_r0_lFZ":{"name":"combineLatest(_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest___14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_AiHQyd___AHQyd_0_AHQyd_1_tKctAaBRd__AaBRd_0_AaBRd_1_r1_lFZ":{"name":"combineLatest(_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest____14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_r2_lFZ":{"name":"combineLatest(_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest_____14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_r3_lFZ":{"name":"combineLatest(_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest______14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_qd_4_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_AHQyd_4_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_r4_lFZ":{"name":"combineLatest(_:_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest_______14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_AHQyd_4_AHQyd_5_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_r5_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13combineLatest________14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_AHQyd_4_AHQyd_5_AHQyd_6_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_AaBRd_6_r6_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:_:resultSelector:)","abstract":"

Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE10compactMapyAA0C0Cyqd__Gqd__Sg7ElementQzKclF":{"name":"compactMap(_:)","abstract":"

Projects each element of an observable sequence into an optional form and filters all optional results.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6concatyAA0C0Cy7ElementQzGqd__AA0c11ConvertibleD0Rd__AGQyd__AHRSlF":{"name":"concat(_:)","abstract":"

Concatenates the second observable sequence to self upon successful termination of self.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6concatyAA0C0Cy7ElementQzGqd__STRd__AiGRtd__lFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6concatyAA0C0Cy7ElementQzGqd__SlRd__AiGRtd__lFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6concatyAA0C0Cy7ElementQzGAId_tFZ":{"name":"concat(_:)","abstract":"

Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6createyAA0C0Cy7ElementQzGAA10Disposable_pAA11AnyObserverVyAHGcFZ":{"name":"create(_:)","abstract":"

Creates an observable sequence from a specified subscribe method implementation.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE8debounce_9schedulerAA0C0Cy7ElementQzG8Dispatch0H12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"debounce(_:scheduler:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5debug_10trimOutput4file4line8functionAA0C0Cy7ElementQzGSSSg_SbSSSuSStF":{"name":"debug(_:trimOutput:file:line:function:)","abstract":"

Prints received events for all observers on standard output.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7ifEmpty7defaultAA0C0Cy7ElementQzGAI_tF":{"name":"ifEmpty(default:)","abstract":"

Emits elements from the source observable sequence, or a default element if the source observable sequence is empty.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE8deferredyAA0C0Cy7ElementQzGAIyKcFZ":{"name":"deferred(_:)","abstract":"

Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5delay_9schedulerAA0C0Cy7ElementQzG8Dispatch0H12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"delay(_:scheduler:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE17delaySubscription_9schedulerAA0C0Cy7ElementQzG8Dispatch0I12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"delaySubscription(_:scheduler:)","abstract":"

Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE20distinctUntilChangedyAA0C0Cy7ElementQzGqd__AHKcSQRd__lF":{"name":"distinctUntilChanged(_:)","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE20distinctUntilChangedyAA0C0Cy7ElementQzGSbAH_AHtKcF":{"name":"distinctUntilChanged(_:)","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to the comparer.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE20distinctUntilChanged_8comparerAA0C0Cy7ElementQzGqd__AIKc_Sbqd___qd__tKctlF":{"name":"distinctUntilChanged(_:comparer:)","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE20distinctUntilChanged2atAA0C0Cy7ElementQzGs7KeyPathCyAIqd__G_tSQRd__lF":{"name":"distinctUntilChanged(at:)","abstract":"

Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE2do6onNext05afterG00F5Error0hI00F9Completed0hJ00F9Subscribe0F10Subscribed0F7DisposeAA0C0Cy7ElementQzGyAQKcSg_ASys0I0_pKcSgAUyyKcSgAVyycSgA2WtF":{"name":"do(onNext:afterNext:onError:afterError:onCompleted:afterCompleted:onSubscribe:onSubscribed:onDispose:)","abstract":"

Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9elementAtyAA0C0Cy7ElementQzGSiF":{"name":"elementAt(_:)","abstract":"

Returns a sequence emitting only element n emitted by an Observable

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7element2atAA0C0Cy7ElementQzGSi_tF":{"name":"element(at:)","abstract":"

Returns a sequence emitting only element n emitted by an Observable

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5emptyAA0C0Cy7ElementQzGyFZ":{"name":"empty()","abstract":"

Returns an empty observable sequence, using the specified scheduler to send out the single Completed message.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE10enumeratedAA0C0CySi5index_7ElementQz7elementtGyF":{"name":"enumerated()","abstract":"

Enumerates the elements of an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5erroryAA0C0Cy7ElementQzGs5Error_pFZ":{"name":"error(_:)","abstract":"

Returns an observable sequence that terminates with an error.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6filteryAA0C0Cy7ElementQzGSbAHKcF":{"name":"filter(_:)","abstract":"

Filters the elements of an observable sequence based on a predicate.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE14ignoreElementsAA0C0Cys5NeverOGyF":{"name":"ignoreElements()","abstract":"

Skips elements and completes (or errors) when the observable sequence completes (or errors). Equivalent to filter that always returns false.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE8generate12initialState9condition9scheduler7iterateAA0C0Cy7ElementQzGAL_SbALKcAA018ImmediateSchedulerD0_pA2LKctFZ":{"name":"generate(initialState:condition:scheduler:iterate:)","abstract":"

Generates an observable sequence by running a state-driven loop producing the sequence’s elements, using the specified scheduler","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7groupBy11keySelectorAA0C0CyAA07GroupedC0Vyqd__7ElementQzGGqd__AKKc_tSHRd__lF":{"name":"groupBy(keySelector:)","abstract":"

Undocumented

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4justyAA0C0Cy7ElementQzGAHFZ":{"name":"just(_:)","abstract":"

Returns an observable sequence that contains a single element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4just_9schedulerAA0C0Cy7ElementQzGAI_AA018ImmediateSchedulerD0_ptFZ":{"name":"just(_:scheduler:)","abstract":"

Returns an observable sequence that contains a single element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3mapyAA0C0Cyqd__Gqd__7ElementQzKclF":{"name":"map(_:)","abstract":"

Projects each element of an observable sequence into a new form.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE11materializeAA0C0CyAA5EventOy7ElementQzGGyF":{"name":"materialize()","abstract":"

Convert any Observable into an Observable of its events.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7flatMapyAA0C0Cy7ElementQyd__Gqd__AGQzKcAA0c11ConvertibleD0Rd__lF":{"name":"flatMap(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE12flatMapFirstyAA0C0Cy7ElementQyd__Gqd__AGQzKcAA0c11ConvertibleD0Rd__lF":{"name":"flatMapFirst(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5mergeyAA0C0Cy7ElementQzGqd__SlRd__AiGRtd__lFZ":{"name":"merge(_:)","abstract":"

Merges elements from all observable sequences from collection into a single observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5mergeyAA0C0Cy7ElementQzGSayAIGFZ":{"name":"merge(_:)","abstract":"

Merges elements from all observable sequences from array into a single observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5mergeyAA0C0Cy7ElementQzGAId_tFZ":{"name":"merge(_:)","abstract":"

Merges elements from all observable sequences into a single observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9concatMapyAA0C0Cy7ElementQyd__Gqd__AGQzKcAA0c11ConvertibleD0Rd__lF":{"name":"concatMap(_:)","abstract":"

Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9multicast_8selectorAA0C0Cyqd_0_Gqd__yKc_AhGy7ElementQyd__GKctAA07SubjectD0Rd__8Observer_AIQYd__AIRtzr0_lF":{"name":"multicast(_:selector:)","abstract":"

Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7publishAA011ConnectableC0Cy7ElementQzGyF":{"name":"publish()","abstract":"

Returns a connectable observable sequence that shares a single subscription to the underlying sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6replayyAA011ConnectableC0Cy7ElementQzGSiF":{"name":"replay(_:)","abstract":"

Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize elements.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9replayAllAA011ConnectableC0Cy7ElementQzGyF":{"name":"replayAll()","abstract":"

Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all elements.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9multicastyAA011ConnectableC0Cy7ElementQyd__Gqd__AA07SubjectD0Rd__8Observer_AGQYd__AGRtzlF":{"name":"multicast(_:)","abstract":"

Multicasts the source sequence notifications through the specified subject to the resulting connectable observable.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9multicast11makeSubjectAA011ConnectableC0Cy7ElementQyd__Gqd__yc_tAA0gD0Rd__8Observer_AHQYd__AHRtzlF":{"name":"multicast(makeSubject:)","abstract":"

Multicasts the source sequence notifications through an instantiated subject to the resulting connectable observable.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5neverAA0C0Cy7ElementQzGyFZ":{"name":"never()","abstract":"

Returns a non-terminating observable sequence, which can be used to denote an infinite duration.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7observe2onAA0C0Cy7ElementQzGAA018ImmediateSchedulerD0_p_tF":{"name":"observe(on:)","abstract":"

Wraps the source sequence in order to run its observer callbacks on the specified scheduler.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9observeOnyAA0C0Cy7ElementQzGAA018ImmediateSchedulerD0_pF":{"name":"observeOn(_:)","abstract":"

Wraps the source sequence in order to run its observer callbacks on the specified scheduler.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4from8optionalAA0C0Cy7ElementQzGAISg_tFZ":{"name":"from(optional:)","abstract":"

Converts a optional to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4from8optional9schedulerAA0C0Cy7ElementQzGAJSg_AA018ImmediateSchedulerD0_ptFZ":{"name":"from(optional:scheduler:)","abstract":"

Converts a optional to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6reduce_11accumulator9mapResultAA0C0Cyqd_0_Gqd___qd__qd___7ElementQztKcqd_0_qd__Kctr0_lF":{"name":"reduce(_:accumulator:mapResult:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6reduce_11accumulatorAA0C0Cyqd__Gqd___qd__qd___7ElementQztKctlF":{"name":"reduce(_:accumulator:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13repeatElement_9schedulerAA0C0Cy0F0QzGAI_AA018ImmediateSchedulerD0_ptFZ":{"name":"repeatElement(_:scheduler:)","abstract":"

Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5retry4whenAA0C0Cy7ElementQzGqd_0_AGyqd__Gc_ts5ErrorRd__AaBRd_0_r0_lF":{"name":"retry(when:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9retryWhenyAA0C0Cy7ElementQzGqd_0_AFyqd__Gcs5ErrorRd__AaBRd_0_r0_lF":{"name":"retryWhen(_:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5retry4whenAA0C0Cy7ElementQzGqd__AGys5Error_pGc_tAaBRd__lF":{"name":"retry(when:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9retryWhenyAA0C0Cy7ElementQzGqd__AFys5Error_pGcAaBRd__lF":{"name":"retryWhen(_:)","abstract":"

Repeats the source observable sequence on error when the notifier emits a next value.","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6sample_12defaultValueAA0C0Cy7ElementQzGqd___AISgtAaBRd__lF":{"name":"sample(_:defaultValue:)","abstract":"

Samples the source observable sequence using a sampler observable sequence producing sampling ticks.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4scan4into11accumulatorAA0C0Cyqd__Gqd___yqd__z_7ElementQztKctlF":{"name":"scan(into:accumulator:)","abstract":"

Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4scan_11accumulatorAA0C0Cyqd__Gqd___qd__qd___7ElementQztKctlF":{"name":"scan(_:accumulator:)","abstract":"

Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE2of_9schedulerAA0C0Cy7ElementQzGAId_AA018ImmediateSchedulerD0_ptFZ":{"name":"of(_:scheduler:)","abstract":"

This method creates a new Observable instance with a variable number of elements.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4from_9schedulerAA0C0Cy7ElementQzGSayAIG_AA018ImmediateSchedulerD0_ptFZ":{"name":"from(_:scheduler:)","abstract":"

Converts an array to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4from_9schedulerAA0C0Cy7ElementQzGqd___AA018ImmediateSchedulerD0_ptSTRd__AHQyd__AIRSlFZ":{"name":"from(_:scheduler:)","abstract":"

Converts a sequence to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5share6replay5scopeAA0C0Cy7ElementQzGSi_AA20SubjectLifetimeScopeOtF":{"name":"share(replay:scope:)","abstract":"

Returns an observable sequence that shares a single subscription to the underlying sequence, and immediately upon subscription replays elements in buffer.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6singleAA0C0Cy7ElementQzGyF":{"name":"single()","abstract":"

The single operator is similar to first, but throws a RxError.noElements or RxError.moreThanOneElement","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6singleyAA0C0Cy7ElementQzGSbAHKcF":{"name":"single(_:)","abstract":"

The single operator is similar to first, but throws a RxError.NoElements or RxError.MoreThanOneElement","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4skipyAA0C0Cy7ElementQzGSiF":{"name":"skip(_:)","abstract":"

Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4skip_9schedulerAA0C0Cy7ElementQzG8Dispatch0H12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"skip(_:scheduler:)","abstract":"

Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4skip5untilAA0C0Cy7ElementQzGqd___tAaBRd__lF":{"name":"skip(until:)","abstract":"

Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9skipUntilyAA0C0Cy7ElementQzGqd__AaBRd__lF":{"name":"skipUntil(_:)","abstract":"

Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4skip5whileAA0C0Cy7ElementQzGSbAIKc_tF":{"name":"skip(while:)","abstract":"

Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9skipWhileyAA0C0Cy7ElementQzGSbAHKcF":{"name":"skipWhile(_:)","abstract":"

Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9startWithyAA0C0Cy7ElementQzGAHd_tF":{"name":"startWith(_:)","abstract":"

Prepends a sequence of values to an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9subscribe2onAA0C0Cy7ElementQzGAA018ImmediateSchedulerD0_p_tF":{"name":"subscribe(on:)","abstract":"

Wraps the source sequence in order to run its subscription and unsubscription logic on the specified","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE11subscribeOnyAA0C0Cy7ElementQzGAA018ImmediateSchedulerD0_pF":{"name":"subscribeOn(_:)","abstract":"

Wraps the source sequence in order to run its subscription and unsubscription logic on the specified","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13flatMapLatestyAA0C0Cy7ElementQyd__Gqd__AGQzKcAA0c11ConvertibleD0Rd__lF":{"name":"flatMapLatest(_:)","abstract":"

Projects each element of an observable sequence into a new sequence of observable sequences and then","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE13flatMapLatestyAA10InfallibleVy7ElementQyd__Gqd__AGQzKcAA0hD0Rd__lF":{"name":"flatMapLatest(_:)","abstract":"

Projects each element of an observable sequence into a new sequence of observable sequences and then","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7ifEmpty8switchToAA0C0Cy7ElementQzGAJ_tF":{"name":"ifEmpty(switchTo:)","abstract":"

Returns the elements of the specified sequence or switchTo sequence if the sequence is empty.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4takeyAA0C0Cy7ElementQzGSiF":{"name":"take(_:)","abstract":"

Returns a specified number of contiguous elements from the start of an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4take3for9schedulerAA0C0Cy7ElementQzG8Dispatch0I12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"take(for:scheduler:)","abstract":"

Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4take_9schedulerAA0C0Cy7ElementQzG8Dispatch0H12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"take(_:scheduler:)","abstract":"

Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE8takeLastyAA0C0Cy7ElementQzGSiF":{"name":"takeLast(_:)","abstract":"

Returns a specified number of contiguous elements from the end of an observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4take5untilAA0C0Cy7ElementQzGqd___tAaBRd__lF":{"name":"take(until:)","abstract":"

Returns the elements from the source observable sequence until the other observable sequence produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4take5until8behaviorAA0C0Cy7ElementQzGSbAJKc_AA12TakeBehaviorOtF":{"name":"take(until:behavior:)","abstract":"

Returns elements from an observable sequence until the specified condition is true.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE4take5while8behaviorAA0C0Cy7ElementQzGSbAJKc_AA12TakeBehaviorOtF":{"name":"take(while:behavior:)","abstract":"

Returns elements from an observable sequence as long as a specified condition is true.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9takeUntilyAA0C0Cy7ElementQzGqd__AaBRd__lF":{"name":"takeUntil(_:)","abstract":"

Returns the elements from the source observable sequence until the other observable sequence produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9takeUntil_9predicateAA0C0Cy7ElementQzGAA12TakeBehaviorO_SbAIKctF":{"name":"takeUntil(_:predicate:)","abstract":"

Returns elements from an observable sequence until the specified condition is true.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE9takeWhileyAA0C0Cy7ElementQzGSbAHKcF":{"name":"takeWhile(_:)","abstract":"

Returns elements from an observable sequence as long as a specified condition is true.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE8throttle_6latest9schedulerAA0C0Cy7ElementQzG8Dispatch0I12TimeIntervalO_SbAA09SchedulerD0_ptF":{"name":"throttle(_:latest:scheduler:)","abstract":"

Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7timeout_9schedulerAA0C0Cy7ElementQzG8Dispatch0H12TimeIntervalO_AA09SchedulerD0_ptF":{"name":"timeout(_:scheduler:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7timeout_5other9schedulerAA0C0Cy7ElementQzG8Dispatch0I12TimeIntervalO_qd__AA09SchedulerD0_ptAA0c11ConvertibleD0Rd__AIQyd__AJRSlF":{"name":"timeout(_:other:scheduler:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7toArrayAA17PrimitiveSequenceVyAA11SingleTraitOSay7ElementQzGGyF":{"name":"toArray()","abstract":"

Converts an Observable into a Single that emits the whole sequence as a single array and then terminates.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5using_17observableFactoryAA0C0Cy7ElementQzGqd__yKc_AJqd__KctAA10DisposableRd__lFZ":{"name":"using(_:observableFactory:)","abstract":"

Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence’s lifetime.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE6window8timeSpan5count9schedulerAA0C0CyAIy7ElementQzGG8Dispatch0K12TimeIntervalO_SiAA09SchedulerD0_ptF":{"name":"window(timeSpan:count:scheduler:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE14withLatestFrom_14resultSelectorAA0C0Cyqd_0_Gqd___qd_0_7ElementQz_AIQyd__tKctAA0c11ConvertibleD0Rd__r0_lF":{"name":"withLatestFrom(_:resultSelector:)","abstract":"

Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE14withLatestFromyAA0C0Cy7ElementQyd__Gqd__AA0c11ConvertibleD0Rd__lF":{"name":"withLatestFrom(_:)","abstract":"

Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when self emits an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE14withUnretained_14resultSelectorAA0C0Cyqd_0_Gqd___qd_0_qd___7ElementQztctRld__Cr0_lF":{"name":"withUnretained(_:resultSelector:)","abstract":"

Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE14withUnretainedyAA0C0Cyqd___7ElementQztGqd__Rld__ClF":{"name":"withUnretained(_:)","abstract":"

Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip_14resultSelectorAA0C0Cy7ElementQzGqd___AISayAH_AHQYd__GKctSlRd__AabHRpd__lFZ":{"name":"zip(_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zipyAA0C0CySay7ElementQzGGqd__SlRd__AG_AGQYd__AHRSAabGRpd__lFZ":{"name":"zip(_:)","abstract":"

Merges the specified observable sequences into one observable sequence whenever all of the observable sequences have produced an element at a corresponding index.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip__14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_AiHQyd___AHQyd_0_tKctAaBRd__AaBRd_0_r0_lFZ":{"name":"zip(_:_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip___14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_AiHQyd___AHQyd_0_AHQyd_1_tKctAaBRd__AaBRd_0_AaBRd_1_r1_lFZ":{"name":"zip(_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip____14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_r2_lFZ":{"name":"zip(_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip_____14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_r3_lFZ":{"name":"zip(_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip______14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_qd_4_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_AHQyd_4_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_r4_lFZ":{"name":"zip(_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip_______14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_AHQyd_4_AHQyd_5_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_r5_lFZ":{"name":"zip(_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE3zip________14resultSelectorAA0C0Cy7ElementQzGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_AiHQyd___AHQyd_0_AHQyd_1_AHQyd_2_AHQyd_3_AHQyd_4_AHQyd_5_AHQyd_6_tKctAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_AaBRd_6_r6_lFZ":{"name":"zip(_:_:_:_:_:_:_:_:resultSelector:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE8asSingleAA17PrimitiveSequenceVyAA0F5TraitO7ElementQzGyF":{"name":"asSingle()","abstract":"

The asSingle operator throws a RxError.noElements or RxError.moreThanOneElement","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE5firstAA17PrimitiveSequenceVyAA11SingleTraitO7ElementQzSgGyF":{"name":"first()","abstract":"

The first operator emits only the very first item emitted by this Observable,","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAE7asMaybeAA17PrimitiveSequenceVyAA0F5TraitO7ElementQzGyF":{"name":"asMaybe()","abstract":"

The asMaybe operator throws a RxError.moreThanOneElement","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE13combineLatestyAA0C0CyADQyd___ADQyd_0_tGqd___qd_0_tAaBRd__AaBRd_0_r0_lFZ":{"name":"combineLatest(_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE13combineLatestyAA0C0CyADQyd___ADQyd_0_ADQyd_1_tGqd___qd_0_qd_1_tAaBRd__AaBRd_0_AaBRd_1_r1_lFZ":{"name":"combineLatest(_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE13combineLatestyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_tGqd___qd_0_qd_1_qd_2_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_r2_lFZ":{"name":"combineLatest(_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE13combineLatestyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_tGqd___qd_0_qd_1_qd_2_qd_3_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_r3_lFZ":{"name":"combineLatest(_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE13combineLatestyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_r4_lFZ":{"name":"combineLatest(_:_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE13combineLatestyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_ADQyd_5_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_r5_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE13combineLatestyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_ADQyd_5_ADQyd_6_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_AaBRd_6_r6_lFZ":{"name":"combineLatest(_:_:_:_:_:_:_:_:)","abstract":"

Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAA10Foundation4DataV7ElementRtzrlE6decode4type7decoderAA0C0Cyqd__Gqd__m_qd_0_tSeRd__AA0F7DecoderRd_0_r0_lF":{"name":"decode(type:decoder:)","abstract":"

Attempt to decode the emitted Data using a provided decoder.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePA2A16EventConvertible7ElementRpzrlE13dematerializeAA0C0CyAE_AEQZGyF":{"name":"dematerialize()","abstract":"

Convert any previously materialized Observable into it’s original form.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAASQ7ElementRpzrlE20distinctUntilChangedAA0C0CyAEGyF":{"name":"distinctUntilChanged()","abstract":"

Returns an observable sequence that contains only distinct contiguous elements according to equality operator.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePA2A0c11ConvertibleD07ElementRpzrlE5mergeAA0C0CyAE_AEQZGyF":{"name":"merge()","abstract":"

Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePA2A0c11ConvertibleD07ElementRpzrlE5merge13maxConcurrentAA0C0CyAE_AEQZGSi_tF":{"name":"merge(maxConcurrent:)","abstract":"

Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePA2A0c11ConvertibleD07ElementRpzrlE6concatAA0C0CyAE_AEQZGyF":{"name":"concat()","abstract":"

Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAs17FixedWidthInteger7ElementRpzrlE5range5start5count9schedulerAA0C0CyAFGAF_AfA018ImmediateSchedulerD0_ptFZ":{"name":"range(start:count:scheduler:)","abstract":"

Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to generate and send out observer messages.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePA2A0c11ConvertibleD07ElementRpzrlE12switchLatestAA0C0CyAE_AEQZGyF":{"name":"switchLatest()","abstract":"

Transforms an observable sequence of observable sequences into an observable sequence","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAs17FixedWidthInteger7ElementRpzrlE8interval_9schedulerAA0C0CyAFG8Dispatch0K12TimeIntervalO_AA09SchedulerD0_ptFZ":{"name":"interval(_:scheduler:)","abstract":"

Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAs17FixedWidthInteger7ElementRpzrlE5timer_6period9schedulerAA0C0CyAFG8Dispatch0L12TimeIntervalO_AOSgAA09SchedulerD0_ptFZ":{"name":"timer(_:period:scheduler:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE3zipyAA0C0CyADQyd___ADQyd_0_tGqd___qd_0_tAaBRd__AaBRd_0_r0_lFZ":{"name":"zip(_:_:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE3zipyAA0C0CyADQyd___ADQyd_0_ADQyd_1_tGqd___qd_0_qd_1_tAaBRd__AaBRd_0_AaBRd_1_r1_lFZ":{"name":"zip(_:_:_:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE3zipyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_tGqd___qd_0_qd_1_qd_2_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_r2_lFZ":{"name":"zip(_:_:_:_:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE3zipyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_tGqd___qd_0_qd_1_qd_2_qd_3_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_r3_lFZ":{"name":"zip(_:_:_:_:_:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE3zipyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_r4_lFZ":{"name":"zip(_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE3zipyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_ADQyd_5_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_r5_lFZ":{"name":"zip(_:_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAyp7ElementRtzrlE3zipyAA0C0CyADQyd___ADQyd_0_ADQyd_1_ADQyd_2_ADQyd_3_ADQyd_4_ADQyd_5_ADQyd_6_tGqd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_tAaBRd__AaBRd_0_AaBRd_1_AaBRd_2_AaBRd_3_AaBRd_4_AaBRd_5_AaBRd_6_r6_lFZ":{"name":"zip(_:_:_:_:_:_:_:_:)","abstract":"

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.

","parent_name":"ObservableType"},"Protocols/ObservableType.html#/s:7RxSwift14ObservableTypePAAs5NeverO7ElementRtzrlE13asCompletableAA17PrimitiveSequenceVyAA0H5TraitOAEGyF":{"name":"asCompletable()","parent_name":"ObservableType"},"Protocols/ObservableConvertibleType.html#/s:7RxSwift25ObservableConvertibleTypeP7ElementQa":{"name":"Element","abstract":"

Type of elements in sequence.

","parent_name":"ObservableConvertibleType"},"Protocols/ObservableConvertibleType.html#/s:7RxSwift25ObservableConvertibleTypeP02asC0AA0C0Cy7ElementQzGyF":{"name":"asObservable()","abstract":"

Converts self to Observable sequence.

","parent_name":"ObservableConvertibleType"},"Protocols/ObservableConvertibleType.html#/s:7RxSwift25ObservableConvertibleTypePAAE6valuesScsy7ElementQzs5Error_pGvp":{"name":"values","abstract":"

Allows iterating over the values of an Observable","parent_name":"ObservableConvertibleType"},"Protocols/ObservableConvertibleType.html#/s:7RxSwift25ObservableConvertibleTypePAAE12asInfallible17onErrorJustReturnAA0G0Vy7ElementQzGAI_tF":{"name":"asInfallible(onErrorJustReturn:)","abstract":"

Convert to an Infallible

","parent_name":"ObservableConvertibleType"},"Protocols/ObservableConvertibleType.html#/s:7RxSwift25ObservableConvertibleTypePAAE12asInfallible17onErrorFallbackToAA0G0Vy7ElementQzGAJ_tF":{"name":"asInfallible(onErrorFallbackTo:)","abstract":"

Convert to an Infallible

","parent_name":"ObservableConvertibleType"},"Protocols/ObservableConvertibleType.html#/s:7RxSwift25ObservableConvertibleTypePAAE12asInfallible14onErrorRecoverAA0G0Vy7ElementQzGAJs0I0_pc_tF":{"name":"asInfallible(onErrorRecover:)","abstract":"

Convert to an Infallible

","parent_name":"ObservableConvertibleType"},"Classes/Observable.html#/s:7RxSwift14ObservableTypeP9subscribeyAA10Disposable_pqd__AA08ObserverD0Rd__7ElementQyd__AGRtzlF":{"name":"subscribe(_:)","parent_name":"Observable"},"Classes/Observable.html#/s:7RxSwift25ObservableConvertibleTypeP02asC0AA0C0Cy7ElementQzGyF":{"name":"asObservable()","parent_name":"Observable"},"Protocols/ImmediateSchedulerType.html#/s:7RxSwift22ImmediateSchedulerTypeP8schedule_6actionAA10Disposable_pqd___AaF_pqd__ctlF":{"name":"schedule(_:action:)","abstract":"

Schedules an action to be executed immediately.

","parent_name":"ImmediateSchedulerType"},"Protocols/ImmediateSchedulerType.html#/s:7RxSwift22ImmediateSchedulerTypePAAE17scheduleRecursive_6actionAA10Disposable_pqd___yqd___yqd__XEtctlF":{"name":"scheduleRecursive(_:action:)","abstract":"

Schedules an action to be executed recursively.

","parent_name":"ImmediateSchedulerType"},"Structs/GroupedObservable.html#/s:7RxSwift17GroupedObservableV3keyxvp":{"name":"key","abstract":"

The key associated with this grouped observable sequence.","parent_name":"GroupedObservable"},"Structs/GroupedObservable.html#/s:7RxSwift17GroupedObservableV3key6sourceACyxq_Gx_AA0D0Cyq_Gtcfc":{"name":"init(key:source:)","abstract":"

Initializes a grouped observable sequence with a key and a source observable sequence.

","parent_name":"GroupedObservable"},"Structs/GroupedObservable.html#/s:7RxSwift17GroupedObservableV9subscribeyAA10Disposable_pqd__7ElementQyd__Rs_AA12ObserverTypeRd__lF":{"name":"subscribe(_:)","abstract":"

Subscribes an observer to receive events emitted by the source observable sequence.

","parent_name":"GroupedObservable"},"Structs/GroupedObservable.html#/s:7RxSwift17GroupedObservableV02asD0AA0D0Cyq_GyF":{"name":"asObservable()","abstract":"

Converts this GroupedObservable into a regular Observable sequence.","parent_name":"GroupedObservable"},"Enums/Event.html#/s:7RxSwift5EventO4nextyACyxGxcAEmlF":{"name":"next(_:)","abstract":"

Next element is produced.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO5erroryACyxGs5Error_pcAEmlF":{"name":"error(_:)","abstract":"

Sequence terminated with an error.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO9completedyACyxGAEmlF":{"name":"completed","abstract":"

Sequence completed successfully.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO16debugDescriptionSSvp":{"name":"debugDescription","abstract":"

Description of event.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO06isStopC0Sbvp":{"name":"isStopEvent","abstract":"

Is completed or error event.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO7elementxSgvp":{"name":"element","abstract":"

If next event, returns element value.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO5errors5Error_pSgvp":{"name":"error","abstract":"

If error event, returns error.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO11isCompletedSbvp":{"name":"isCompleted","abstract":"

If completed event, returns true.

","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO3mapyACyqd__Gqd__xKXElF":{"name":"map(_:)","abstract":"

Maps sequence elements using transform. If error happens during the transform, .error","parent_name":"Event"},"Enums/Event.html#/s:7RxSwift5EventO5eventACyxGvp":{"name":"event","abstract":"

Event representation of this instance

","parent_name":"Event"},"Protocols/Disposable.html#/s:7RxSwift10DisposableP7disposeyyF":{"name":"dispose()","abstract":"

Dispose resource.

","parent_name":"Disposable"},"Protocols/Disposable.html#/s:7RxSwift10DisposablePAAE8disposed2byyAA10DisposeBagC_tF":{"name":"disposed(by:)","abstract":"

Adds self to bag

","parent_name":"Disposable"},"Protocols/ConnectableObservableType.html#/s:7RxSwift25ConnectableObservableTypeP7connectAA10Disposable_pyF":{"name":"connect()","abstract":"

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.

","parent_name":"ConnectableObservableType"},"Protocols/ConnectableObservableType.html#/s:7RxSwift25ConnectableObservableTypePAAE8refCountAA0D0Cy7ElementQzGyF":{"name":"refCount()","abstract":"

Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

","parent_name":"ConnectableObservableType"},"Protocols/Cancelable.html#/s:7RxSwift10CancelableP10isDisposedSbvp":{"name":"isDisposed","abstract":"

Was resource disposed.

","parent_name":"Cancelable"},"Structs/Binder.html#/s:7RxSwift12ObserverTypeP7ElementQa":{"name":"Element","parent_name":"Binder"},"Structs/Binder.html#/s:7RxSwift6BinderV_9scheduler7bindingACyxGqd___AA22ImmediateSchedulerType_pyqd___xtctcRld__Clufc":{"name":"init(_:scheduler:binding:)","abstract":"

Initializes Binder

","parent_name":"Binder"},"Structs/Binder.html#/s:7RxSwift6BinderV2onyyAA5EventOyxGF":{"name":"on(_:)","abstract":"

Binds next element to owner view as described in binding.

","parent_name":"Binder"},"Structs/Binder.html#/s:7RxSwift6BinderV10asObserverAA03AnyE0VyxGyF":{"name":"asObserver()","abstract":"

Erases type of observer.

","parent_name":"Binder"},"Structs/AnyObserver.html#/s:7RxSwift11AnyObserverV12EventHandlera":{"name":"EventHandler","abstract":"

Anonymous event handler type.

","parent_name":"AnyObserver"},"Structs/AnyObserver.html#/s:7RxSwift11AnyObserverV12eventHandlerACyxGyAA5EventOyxGc_tcfc":{"name":"init(eventHandler:)","abstract":"

Construct an instance whose on(event) calls eventHandler(event)

","parent_name":"AnyObserver"},"Structs/AnyObserver.html#/s:7RxSwift11AnyObserverVyACyxGqd__c7ElementQyd__RszAA0D4TypeRd__lufc":{"name":"init(_:)","abstract":"

Construct an instance whose on(event) calls observer.on(event)

","parent_name":"AnyObserver"},"Structs/AnyObserver.html#/s:7RxSwift11AnyObserverV2onyyAA5EventOyxGF":{"name":"on(_:)","abstract":"

Send event to this observer.

","parent_name":"AnyObserver"},"Structs/AnyObserver.html#/s:7RxSwift11AnyObserverV02asD0ACyxGyF":{"name":"asObserver()","abstract":"

Erases type of observer and returns canonical observer.

","parent_name":"AnyObserver"},"Structs/AnyObserver.html":{"name":"AnyObserver","abstract":"

A type-erased ObserverType.

"},"Structs/Binder.html":{"name":"Binder","abstract":"

Observer that enforces interface binding rules:

"},"Protocols/Cancelable.html":{"name":"Cancelable","abstract":"

Represents disposable resource with state tracking.

"},"Protocols/ConnectableObservableType.html":{"name":"ConnectableObservableType","abstract":"

Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence.

"},"Protocols/Disposable.html":{"name":"Disposable","abstract":"

Represents a disposable resource.

"},"Enums/Event.html":{"name":"Event","abstract":"

Represents a sequence event.

"},"Structs/GroupedObservable.html":{"name":"GroupedObservable","abstract":"

Represents an observable sequence of elements that share a common key."},"Protocols/ImmediateSchedulerType.html":{"name":"ImmediateSchedulerType","abstract":"

Represents an object that immediately schedules units of work.

"},"Classes/Observable.html":{"name":"Observable","abstract":"

Undocumented

"},"Protocols/ObservableConvertibleType.html":{"name":"ObservableConvertibleType","abstract":"

Type that can be converted to observable sequence (Observable<Element>).

"},"Protocols/ObservableType.html":{"name":"ObservableType","abstract":"

Represents a push style sequence.

"},"Protocols/ObserverType.html":{"name":"ObserverType","abstract":"

Supports push-style iteration over an observable sequence.

"},"Structs/Reactive.html":{"name":"Reactive","abstract":"

Use Reactive proxy as customization point for constrained protocol extensions.

"},"Protocols/SchedulerType.html":{"name":"SchedulerType","abstract":"

Represents an object that schedules units of work.

"},"RxSwift.html":{"name":"RxSwift"},"RxSwift%2FDisposables.html":{"name":"RxSwift/Disposables"},"RxSwift%2FSchedulers.html":{"name":"RxSwift/Schedulers"},"RxSwift%2FSubjects.html":{"name":"RxSwift/Subjects"},"RxSwift%2FTraits%2FInfallible.html":{"name":"RxSwift/Traits/Infallible"},"RxSwift%2FTraits%2FPrimitiveSequence.html":{"name":"RxSwift/Traits/PrimitiveSequence"},"Other%20Classes.html":{"name":"Other Classes","abstract":"

The following classes are available globally.

"},"Other%20Global%20Variables.html":{"name":"Other Global Variables","abstract":"

The following global variables are available globally.

"},"Other%20Enums.html":{"name":"Other Enumerations","abstract":"

The following enumerations are available globally.

"},"Other%20Extensions.html":{"name":"Other Extensions","abstract":"

The following extensions are available globally.

"},"Other%20Protocols.html":{"name":"Other Protocols","abstract":"

The following protocols are available globally.

"},"Other%20Typealiases.html":{"name":"Other Type Aliases","abstract":"

The following type aliases are available globally.

"}} ================================================ FILE: docs/undocumented.json ================================================ { "warnings": [ { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Disposables/CompositeDisposable.swift", "line": 28, "symbol": "CompositeDisposable.init()", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Disposables/DisposeBag.swift", "line": 127, "symbol": "DisposeBag.DisposableBuilder", "symbol_kind": "source.lang.swift.decl.struct", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Disposables/DisposeBag.swift", "line": 128, "symbol": "DisposeBag.DisposableBuilder.buildBlock(_:)", "symbol_kind": "source.lang.swift.decl.function.method.static", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift", "line": 16, "symbol": "ScheduledDisposable.scheduler", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Observable.swift", "line": 15, "symbol": "Observable", "symbol_kind": "source.lang.swift.decl.class", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/ObservableType+Extensions.swift", "line": 128, "symbol": "Hooks.DefaultErrorHandler", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/ObservableType+Extensions.swift", "line": 129, "symbol": "Hooks.CustomCaptureSubscriptionCallstack", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Observables/Decode.swift", "line": 31, "symbol": "DataDecoder.decode(_:from:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Observables/GroupBy.swift", "line": 18, "symbol": "ObservableType.groupBy(keySelector:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Observers/TailRecursiveSink.swift", "line": 15, "symbol": "maxTailRecursiveSinkStackSize", "symbol_kind": "source.lang.swift.decl.var.global", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Rx.swift", "line": 140, "symbol": "Hooks.recordCallStackOnError", "symbol_kind": "source.lang.swift.decl.var.static", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/SchedulerType.swift", "line": 13, "symbol": "RxTimeInterval", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift", "line": 16, "symbol": "ConcurrentDispatchQueueScheduler.TimeInterval", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift", "line": 17, "symbol": "ConcurrentDispatchQueueScheduler.Time", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift", "line": 19, "symbol": "ConcurrentMainScheduler.TimeInterval", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift", "line": 20, "symbol": "ConcurrentMainScheduler.Time", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift", "line": 16, "symbol": "OperationQueueScheduler.operationQueue", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift", "line": 17, "symbol": "OperationQueueScheduler.queuePriority", "symbol_kind": "source.lang.swift.decl.var.instance", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift", "line": 30, "symbol": "SerialDispatchQueueScheduler.TimeInterval", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift", "line": 31, "symbol": "SerialDispatchQueueScheduler.Time", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift", "line": 15, "symbol": "VirtualTimeScheduler.VirtualTime", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift", "line": 16, "symbol": "VirtualTimeScheduler.VirtualTimeInterval", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Subjects/AsyncSubject.swift", "line": 19, "symbol": "AsyncSubject.SubjectObserverType", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Subjects/BehaviorSubject.swift", "line": 19, "symbol": "BehaviorSubject.SubjectObserverType", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Subjects/PublishSubject.swift", "line": 19, "symbol": "PublishSubject.SubjectObserverType", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Subjects/ReplaySubject.swift", "line": 18, "symbol": "ReplaySubject.SubjectObserverType", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/SwiftSupport/SwiftSupport.swift", "line": 12, "symbol": "RxAbstractInteger", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/Infallible/Infallible+Create.swift", "line": 11, "symbol": "InfallibleEvent", "symbol_kind": "source.lang.swift.decl.enum", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/Infallible/Infallible+Create.swift", "line": 20, "symbol": "Infallible.InfallibleObserver", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/Infallible/Infallible+Create.swift", "line": 46, "symbol": "InfallibleEvent", "symbol_kind": "source.lang.swift.decl.extension", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/PrimitiveSequence/Completable.swift", "line": 18, "symbol": "CompletableEvent", "symbol_kind": "source.lang.swift.decl.enum", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/PrimitiveSequence/Completable.swift", "line": 27, "symbol": "PrimitiveSequenceType.CompletableObserver", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/PrimitiveSequence/Maybe.swift", "line": 18, "symbol": "MaybeEvent", "symbol_kind": "source.lang.swift.decl.enum", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/PrimitiveSequence/Maybe.swift", "line": 30, "symbol": "PrimitiveSequenceType.MaybeObserver", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/PrimitiveSequence/Single.swift", "line": 17, "symbol": "SingleEvent", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" }, { "file": "/Users/freak4pc/Work/OSS/RxSwift/RxSwift/Traits/PrimitiveSequence/Single.swift", "line": 20, "symbol": "PrimitiveSequenceType.SingleObserver", "symbol_kind": "source.lang.swift.decl.typealias", "warning": "undocumented" } ], "source_directory": "/Users/freak4pc/Work/OSS/RxSwift" } ================================================ FILE: mise.toml ================================================ [tools] swiftformat = "0.58.7" xcbeautify = "latest" ================================================ FILE: scripts/all-tests.sh ================================================ . scripts/common.sh RELEASE_TEST=0 VALIDATE_IOS_EXAMPLE=1 VALIDATE_UNIX=1 VALIDATE_IOS=1 VALIDATE_TVOS=1 VALIDATE_WATCHOS=1 VALIDATE_MACCATALYST=0 TEST_SPM=1 UNIX_NAME=`uname` DARWIN="Darwin" LINUX="Linux" function unsuppported_os() { printf "${RED}Unsupported os: ${UNIX_NAME}${RESET}\n" exit -1 } function unsupported_target() { printf "${RED}Unsupported os: ${UNIX_NAME}${RESET}\n" exit -1 } if [ "$1" == "r" ]; then printf "${GREEN}Pre release tests on, hang on tight ...${RESET}\n" RELEASE_TEST=1 elif [ "$1" == "iOS-Example" ]; then VALIDATE_IOS_EXAMPLE=1 VALIDATE_UNIX=0 VALIDATE_IOS=0 VALIDATE_TVOS=0 VALIDATE_WATCHOS=0 TEST_SPM=0 elif [ "$1" == "Unix" ]; then VALIDATE_IOS_EXAMPLE=0 VALIDATE_UNIX=1 VALIDATE_IOS=0 VALIDATE_TVOS=0 VALIDATE_WATCHOS=0 TEST_SPM=0 elif [ "$1" == "iOS" ]; then VALIDATE_IOS_EXAMPLE=0 VALIDATE_UNIX=0 VALIDATE_IOS=1 VALIDATE_TVOS=0 VALIDATE_WATCHOS=0 TEST_SPM=0 elif [ "$1" == "tvOS" ]; then VALIDATE_IOS_EXAMPLE=0 VALIDATE_UNIX=0 VALIDATE_IOS=0 VALIDATE_TVOS=1 VALIDATE_WATCHOS=0 TEST_SPM=0 elif [ "$1" == "watchOS" ]; then VALIDATE_IOS_EXAMPLE=0 VALIDATE_UNIX=0 VALIDATE_IOS=0 VALIDATE_TVOS=0 VALIDATE_WATCHOS=1 TEST_SPM=0 elif [ "$1" == "macCatalyst" ]; then VALIDATE_IOS_EXAMPLE=0 VALIDATE_UNIX=0 VALIDATE_IOS=0 VALIDATE_TVOS=0 VALIDATE_WATCHOS=0 TEST_SPM=0 VALIDATE_MACCATALYST=1 elif [ "$1" == "SPM" ]; then VALIDATE_IOS_EXAMPLE=0 VALIDATE_UNIX=0 VALIDATE_IOS=0 VALIDATE_TVOS=0 VALIDATE_WATCHOS=0 TEST_SPM=1 fi RUN_DEVICE_TESTS=${RUN_DEVICE_TESTS:-1} function ensureVersionEqual() { if [[ "$1" != "$2" ]]; then echo "Version $1 and $2 are not equal ($3)" exit -1 fi } function ensureNoGitChanges() { if [ `(git add . && git diff HEAD && git reset) | wc -l` -gt 0 ]; then echo $1 exit -1 fi } function checkPlistVersions() { RXSWIFT_VERSION=`grep "^RX_VERSION" Version.xcconfig | cut -d '=' -f 2 | tr -d ' '` echo "RxSwift version: ${RXSWIFT_VERSION}" PROJECTS=(RxSwift RxCocoa RxRelay RxBlocking RxTest) for project in ${PROJECTS[@]} do echo "Checking version for ${project}" PLIST_VERSION=`defaults read "\`pwd\`/${project}/Info.plist" CFBundleShortVersionString` # Check that Info.plist uses the RX_VERSION variable reference if [[ "${PLIST_VERSION}" != '$(RX_VERSION)' ]]; then echo "Invalid version for `pwd`/${project}/Info.plist: ${PLIST_VERSION} (expected \$(RX_VERSION))" exit -1 fi done } ensureNoGitChanges "Please make sure the working tree is clean. Use \`git status\` to check." if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then checkPlistVersions ./scripts/update-jazzy-config.rb ensureNoGitChanges "Please run ./scripts/update-jazzy-config.rb" ./scripts/validate-headers.swift ./scripts/package-spm.swift > /dev/null ensureNoGitChanges "Package for Swift package manager isn't updated, please run ./scripts/package-spm.swift and commit the changes" fi CONFIGURATIONS=(Debug) if [ "${RELEASE_TEST}" -eq 1 ]; then CONFIGURATIONS=(Debug Release Release-Tests) fi if [ "${VALIDATE_IOS_EXAMPLE}" -eq 1 ]; then if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then for scheme in "RxExample-iOS" do for configuration in "Debug" do rx ${scheme} ${configuration} "${DEFAULT_IOS_SIMULATOR}" build done done elif [[ "${UNIX_NAME}" == "${LINUX}" ]]; then unsupported_target else unsupported_os fi else printf "${RED}Skipping iOS-Example tests ...${RESET}\n" fi if [ "${VALIDATE_IOS}" -eq 1 ]; then if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then #make sure all iOS tests pass for configuration in ${CONFIGURATIONS[@]} do rx "AllTests-iOS" ${configuration} "${DEFAULT_IOS_SIMULATOR}" test done elif [[ "${UNIX_NAME}" == "${LINUX}" ]]; then unsupported_target else unsupported_os fi else printf "${RED}Skipping iOS tests ...${RESET}\n" fi if [ "${VALIDATE_UNIX}" -eq 1 ]; then if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then if [[ "${CI}" == "" ]]; then ./scripts/test-linux.sh fi # compile and run playgrounds . scripts/validate-playgrounds.sh # make sure macOS builds for scheme in "RxExample-macOS" do for configuration in ${CONFIGURATIONS[@]} do rx ${scheme} ${configuration} "" build done done #make sure all macOS tests pass for configuration in ${CONFIGURATIONS[@]} do rx "AllTests-macOS" ${configuration} "" test done elif [[ "${UNIX_NAME}" == "${LINUX}" ]]; then CONFIGURATIONS=(debug release) for configuration in ${CONFIGURATIONS[@]} do echo "Linux Configuration ${configuration}" git checkout Package.swift if [[ $configuration == "debug" ]]; then cat Package.swift | sed "s/let buildTests = false/let buildTests = true/" > Package.tests.swift mv Package.tests.swift Package.swift fi swift build -c ${configuration} if [[ $configuration == "debug" ]]; then ./.build/debug/AllTestz fi done else unsupported_os fi else printf "${RED}Skipping Unix (macOS, Linux) tests ...${RESET}\n" fi if [ "${VALIDATE_TVOS}" -eq 1 ]; then if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then for configuration in ${CONFIGURATIONS[@]} do rx "AllTests-tvOS" ${configuration} "${DEFAULT_TVOS_SIMULATOR}" test done elif [[ "${UNIX_NAME}" == "${LINUX}" ]]; then printf "${RED}Skipping tvOS tests ...${RESET}\n" else unsupported_os fi else printf "${RED}Skipping tvOS tests ...${RESET}\n" fi if [ "${VALIDATE_WATCHOS}" -eq 1 ]; then if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then # make sure watchos builds # temporary solution WATCH_OS_BUILD_TARGETS=(RxSwift RxCocoa RxRelay RxBlocking) for scheme in ${WATCH_OS_BUILD_TARGETS[@]} do for configuration in ${CONFIGURATIONS[@]} do rx "${scheme}" "${configuration}" "${DEFAULT_WATCHOS_SIMULATOR}" build done done #make sure all watchOS tests pass #tests for Watch OS are not available rdar://21760513 # for configuration in ${CONFIGURATIONS[@]} # do # rx "RxTests-watchOS" ${configuration} $DEFAULT_WATCHOS_SIMULATOR test # done elif [[ "${UNIX_NAME}" == "${LINUX}" ]]; then printf "${RED}Skipping watchOS tests ...${RESET}\n" else unsupported_os fi else printf "${RED}Skipping watchOS tests ...${RESET}\n" fi if [ "${VALIDATE_MACCATALYST}" -eq 1 ]; then if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then MAC_CATALYST_BUILD_TARGETS=(RxSwift RxCocoa RxRelay RxBlocking) for scheme in ${MAC_CATALYST_BUILD_TARGETS[@]} do for configuration in ${CONFIGURATIONS[@]} do rx "${scheme}" "${configuration}" "macCatalyst" build done done else unsupported_os fi else printf "${RED}Skipping macCatalyst tests ...${RESET}\n" fi if [ "${TEST_SPM}" -eq 1 ]; then rm -rf .build || true swift build -c release --disable-sandbox # until compiler is fixed swift build -c debug --disable-sandbox # until compiler is fixed else printf "${RED}Skipping SPM tests ...${RESET}\n" fi ================================================ FILE: scripts/common.sh ================================================ #!/bin/bash set -e RESET="\033[0m" BLACK="\033[30m" RED="\033[31m" GREEN="\033[32m" YELLOW="\033[33m" BLUE="\033[34m" MAGENTA="\033[35m" CYAN="\033[36m" WHITE="\033[37m" BOLDBLACK="\033[1m\033[30m" BOLDRED="\033[1m\033[31m" BOLDGREEN="\033[1m\033[32m" BOLDYELLOW="\033[1m\033[33m" BOLDBLUE="\033[1m\033[34m" BOLDMAGENTA="\033[1m\033[35m" BOLDCYAN="\033[1m\033[36m" BOLDWHITE="\033[1m\033[37m" # make sure all tests are passing if [[ `uname` == "Darwin" ]]; then # Detect Xcode version to determine which simulators to use XCODE_VERSION=$(xcodebuild -version | head -1 | sed 's/Xcode //') XCODE_MAJOR=$(echo $XCODE_VERSION | cut -d. -f1) if [ "$XCODE_MAJOR" -ge 26 ]; then echo "Running Xcode $XCODE_VERSION (iOS 26 / watchOS 26 / tvOS 26)" DEFAULT_IOS_SIMULATOR=RxSwiftTest/iPhone-17/iOS/26.2 DEFAULT_WATCHOS_SIMULATOR=RxSwiftTest/Apple-Watch-Series-11-46mm/watchOS/26.2 DEFAULT_TVOS_SIMULATOR=RxSwiftTest/Apple-TV-1080p/tvOS/26.2 elif [ "$XCODE_MAJOR" -ge 16 ]; then echo "Running Xcode $XCODE_VERSION (iOS 18.5 / watchOS 11.5 / tvOS 18.5)" DEFAULT_IOS_SIMULATOR=RxSwiftTest/iPhone-16/iOS/18.5 DEFAULT_WATCHOS_SIMULATOR=RxSwiftTest/Apple-Watch-Series-10-46mm/watchOS/11.5 DEFAULT_TVOS_SIMULATOR=RxSwiftTest/Apple-TV-1080p/tvOS/18.5 else echo "Unsupported Xcode version: $XCODE_VERSION" exit -1 fi fi RUN_SIMULATOR_BY_NAME=0 function runtime_available() { if [ `xcrun simctl list runtimes | grep "${1}" | wc -l` -eq 1 ]; then return 0 else return 1 fi } # used to check simulator name function contains() { string="$1" substring="$2" if [[ $string == *"$substring"* ]] then return 0 # $substring is in $string else return 1 # $substring is not in $string fi } function simulator_ids() { SIMULATOR=$1 xcrun simctl list | grep "${SIMULATOR}" | cut -d "(" -f 2 | cut -d ")" -f 1 | sort | uniq } function simulator_available() { SIMULATOR=$1 if [ `simulator_ids "${SIMULATOR}" | wc -l` -eq 0 ]; then return -1 elif [ `simulator_ids "${SIMULATOR}" | wc -l` -gt 1 ]; then echo "Multiple simulators ${SIMULATOR} found" xcrun simctl list | grep "${SIMULATOR}" exit -1 elif [ `xcrun simctl list | grep "${SIMULATOR}" | grep "unavailable" | wc -l` -gt 0 ]; then xcrun simctl list | grep "${SIMULATOR}" | grep "unavailable" exit -1 else return 0 fi } function is_real_device() { contains "$1" "’s " } function ensure_simulator_available() { SIMULATOR=$1 if simulator_available "${SIMULATOR}"; then echo "${SIMULATOR} exists" return fi DEVICE=`echo "${SIMULATOR}" | cut -d "/" -f 2` OS=`echo "${SIMULATOR}" | cut -d "/" -f 3` VERSION_SUFFIX=`echo "${SIMULATOR}" | cut -d "/" -f 4 | sed -e "s/\./-/"` RUNTIME="com.apple.CoreSimulator.SimRuntime.${OS}-${VERSION_SUFFIX}" echo "Creating new simulator with runtime=${RUNTIME}" if ! xcrun simctl create "${SIMULATOR}" "com.apple.CoreSimulator.SimDeviceType.${DEVICE}" "${RUNTIME}"; then echo "" echo "Failed to create simulator. Available runtimes:" xcrun simctl list runtimes echo "" echo "Available device types:" xcrun simctl list devicetypes exit 1 fi SIMULATOR_ID=`simulator_ids "${SIMULATOR}"` echo "Warming up ${SIMULATOR_ID} ..." xcrun simctl boot "${SIMULATOR_ID}" open -a "Simulator" --args -CurrentDeviceUDID "${SIMULATOR_ID}" || true sleep 120 } BUILD_DIRECTORY=build function rx() { action Rx.xcworkspace "$1" "$2" "$3" "$4" } function action() { WORKSPACE=$1 SCHEME=$2 CONFIGURATION=$3 SIMULATOR=$4 ACTION=$5 echo printf "${GREEN}${ACTION} ${BOLDCYAN}$SCHEME - $CONFIGURATION ($SIMULATOR)${RESET}\n" echo DESTINATION="" if [ "${SIMULATOR}" == "macCatalyst" ]; then DESTINATION='platform=macOS,variant=Mac Catalyst' elif [ "${SIMULATOR}" != "" ]; then #if it's a real device if is_real_device "${SIMULATOR}"; then DESTINATION='name='${SIMULATOR} #else it's just a simulator else OS=`echo $SIMULATOR | cut -d '/' -f 3` if [ "${RUN_SIMULATOR_BY_NAME}" -eq 1 ]; then SIMULATOR_NAME=`echo $SIMULATOR | cut -d '/' -f 1` DESTINATION='platform='$OS' Simulator,name='$SIMULATOR_NAME'' else ensure_simulator_available "${SIMULATOR}" SIMULATOR_GUID=`simulator_ids "${SIMULATOR}"` DESTINATION='platform='$OS' Simulator,OS='$OS',id='$SIMULATOR_GUID'' fi echo "Running on ${DESTINATION}" fi else DESTINATION='platform=macOS' fi set -x mkdir -p build killall Simulator || true LINT=1 xcodebuild -workspace "${WORKSPACE}" \ -scheme "${SCHEME}" \ -configuration "${CONFIGURATION}" \ -derivedDataPath "${BUILD_DIRECTORY}" \ -destination "$DESTINATION" \ $ACTION | tee build/last-build-output.txt | xcbeautify exitIfLastStatusWasUnsuccessful set +x } function exitIfLastStatusWasUnsuccessful() { STATUS=${PIPESTATUS[0]} if [ $STATUS -ne 0 ]; then echo $STATUS exit $STATUS fi } ================================================ FILE: scripts/make-xcframeworks.sh ================================================ rm -rf .build mkdir .build products=(RxSwift RxRelay RxCocoa RxTest RxBlocking) BUILD_PATH=`realpath .build` for product in ${products[@]}; do PROJECT_NAME="$product" # Generate iOS framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-iphoneos.xcarchive" -destination "generic/platform=iOS" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate iOS Simulator framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-iossimulator.xcarchive" -destination "generic/platform=iOS Simulator" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate macOS framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-macosx.xcarchive" -destination "generic/platform=macOS,name=Any Mac" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate maccatalyst framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-maccatalyst.xcarchive" -destination "generic/platform=macOS,variant=Mac Catalyst" SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate tvOS framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-appletvos.xcarchive" -destination "generic/platform=tvOS" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate tvOS Simulator framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive" -destination "generic/platform=tvOS Simulator" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate visionOS framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive" -destination "generic/platform=visionOS" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate visionOS simulator framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-visionossimulator.xcarchive" -destination "generic/platform=visionOS Simulator" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # RxTest doesn't work on watchOS if [[ "$product" != "RxTest" ]]; then # Generate watchOS framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-watchos.xcarchive" -destination "generic/platform=watchOS" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate watchOS Simulator framework xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-watchsimulator.xcarchive" -destination "generic/platform=watchOS Simulator" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify # Generate XCFramework xcodebuild -create-xcframework \ -framework "${BUILD_PATH}/${PROJECT_NAME}-iphoneos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-iphoneos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-iossimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-iossimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-macosx.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-macosx.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-maccatalyst.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-maccatalyst.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-watchos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-watchos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-watchsimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-watchsimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-appletvos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-visionossimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-visionossimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -output "./${PROJECT_NAME}.xcframework" | xcbeautify else # Generate XCFramework xcodebuild -create-xcframework \ -framework "${BUILD_PATH}/${PROJECT_NAME}-iphoneos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-iphoneos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-iossimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-iossimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-macosx.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-macosx.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-maccatalyst.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-maccatalyst.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-appletvos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -framework "${BUILD_PATH}/${PROJECT_NAME}-visionossimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \ -debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-visionossimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \ -output "./${PROJECT_NAME}.xcframework" | xcbeautify fi # Code sign the binary codesign --timestamp -v --sign "Apple Distribution: Shai Mishali (272EB7D3H3)" "./${PROJECT_NAME}.xcframework" done # Zip all frameworks to a single ZIP # This is (unfortunately) required by Carthage to work: https://bit.ly/3LVm0Y9 zip -r ./RxSwift.xcframework.zip *.xcframework ================================================ FILE: scripts/package-spm.swift ================================================ #!/usr/bin/swift // // package-spm.swift // scripts // // Created by Krunoslav Zaher on 12/26/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation /** This script packages normal Rx* structure into `Sources` directory. * creates and updates links to normal project structure * builds unit tests `main.swift` Unfortunately, Swift support for Linux, libdispatch and package manager are still quite unstable, so certain class of unit tests is excluded for now. */ // It is kind of ironic that we need to additionally package for package manager :/ let fileManager = FileManager.default let allowedExtensions = [ ".swift", ".h", ".m", ".c" ] // Those tests are dependent on conditional compilation logic and it's hard to handle them automatically // They usually test some internal state, so it should be ok to exclude them for now. let excludedTests: [String] = [ "testConcat_TailRecursionCollection", "testConcat_TailRecursionSequence", "testMapCompose_OptimizationIsPerformed", "testMapCompose_OptimizationIsNotPerformed", "testObserveOn_EnsureCorrectImplementationIsChosen", "testObserveOnDispatchQueue_EnsureCorrectImplementationIsChosen", "testResourceLeaksDetectionIsTurnedOn", "testAnonymousObservable_disposeReferenceDoesntRetainObservable", "testObserveOnDispatchQueue_DispatchQueueSchedulerIsSerial", "ReleasesResourcesOn", "testShareReplayLatestWhileConnectedDisposableDoesntRetainAnything", "testSingle_DecrementCountsFirst", "testSinglePredicate_DecrementCountsFirst", "testLockUnlockCountsResources", "testDisposeWithEnqueuedElement", "testDisposeWithEnqueuedError", "testDisposeWithEnqueuedCompleted" ] func excludeTest(_ name: String) -> Bool { for exclusion in excludedTests { if name.contains(exclusion) { return true } } return false } let excludedTestClasses: [String] = [ /* "ObservableConcurrentSchedulerConcurrencyTest", "SubjectConcurrencyTest", "VirtualSchedulerTest", "HistoricalSchedulerTest" */ "BagTest", "SharedSequenceConcurrencyTests", "InfallibleConcurrencyTests", "ObservableConcurrencyTests", "PrimitiveSequenceConcurrencyTests" ] let throwingWordsInTests: [String] = [ /* "error", "fail", "throw", "retrycount", "retrywhen", */ ] func isExtensionAllowed(_ path: String) -> Bool { (allowedExtensions.map { path.hasSuffix($0) }).reduce(false) { $0 || $1 } } func checkExtension(_ path: String) throws { if !isExtensionAllowed(path) { throw NSError(domain: "Security", code: -1, userInfo: ["path": path]) } } func packageRelativePath(_ paths: [String], targetDirName: String, excluded: [String] = []) throws { let targetPath = "Sources/\(targetDirName)" print("Checking " + targetPath) for file in try fileManager.contentsOfDirectory(atPath: targetPath).sorted(by: { $0 < $1 }) { if file != "include", file != ".DS_Store", file != "PrivacyInfo.xcprivacy" { print("Checking extension \(file)") try checkExtension(file) print("Cleaning \(file)") try fileManager.removeItem(atPath: "\(targetPath)/\(file)") } } for sourcePath in paths { var isDirectory: ObjCBool = false fileManager.fileExists(atPath: sourcePath, isDirectory: &isDirectory) let files: [String] = isDirectory.boolValue ? fileManager.subpaths(atPath: sourcePath)! : [sourcePath] for file in files { if !isExtensionAllowed(file) { print("Skipping \(file)") continue } if excluded.contains(file) { print("Skipping \(file)") continue } let fileRelativePath = isDirectory.boolValue ? "\(sourcePath)/\(file)" : file let destinationURL = NSURL(string: "../../\(fileRelativePath)")! let fileName = (file as NSString).lastPathComponent let atURL = NSURL(string: "file:///\(fileManager.currentDirectoryPath)/\(targetPath)/\(fileName)")! if fileName.hasSuffix(".h") { let sourcePath = NSURL(string: "file:///" + fileManager.currentDirectoryPath + "/" + sourcePath + "/" + file)! // throw NSError(domain: sourcePath.description, code: -1, userInfo: nil) try fileManager.copyItem(at: sourcePath as URL, to: atURL as URL) } else { print("Linking \(fileName) [\(atURL)] -> \(destinationURL)") try fileManager.createSymbolicLink(at: atURL as URL, withDestinationURL: destinationURL as URL) } } } } func buildAllTestsTarget(_ testsPath: String) throws { let splitClasses = "(?:class|extension)\\s+(\\w+)" let testMethods = "\\s+func\\s+(test\\w+)" let splitClassesRegularExpression = try! NSRegularExpression(pattern: splitClasses, options: []) let testMethodsExpression = try! NSRegularExpression(pattern: testMethods, options: []) var reducedMethods: [String: [String]] = [:] for file in try fileManager.contentsOfDirectory(atPath: testsPath).sorted(by: { $0 < $1 }) { if !file.hasSuffix(".swift") || file == "main.swift" { continue } let fileRelativePath = "\(testsPath)/\(file)" let testContent = try String(contentsOfFile: fileRelativePath, encoding: String.Encoding.utf8) print(fileRelativePath) let classMatches = splitClassesRegularExpression.matches(in: testContent as String, options: [], range: NSRange(location: 0, length: testContent.count)) let matchIndexes = classMatches .map(\.range.location) let classNames = classMatches.map { (testContent as NSString).substring(with: $0.range(at: 1)) as NSString } let ranges = zip([0] + matchIndexes, matchIndexes + [testContent.count]).map { NSRange(location: $0, length: $1 - $0) } let classRanges = ranges[1 ..< ranges.count] let classes = zip(classNames, classRanges.map { (testContent as NSString).substring(with: $0) as NSString }) for (name, classCode) in classes { if excludedTestClasses.contains(name as String) { print("Skipping \(name)") continue } let methodMatches = testMethodsExpression.matches(in: classCode as String, options: [], range: NSRange(location: 0, length: classCode.length)) let methodNameRanges = methodMatches.map { $0.range(at: 1) } let testMethodNames = methodNameRanges .map { classCode.substring(with: $0) } .filter { !excludeTest($0) } if testMethodNames.count == 0 { continue } let existingMethods = reducedMethods[name as String] ?? [] reducedMethods[name as String] = existingMethods + testMethodNames } } var mainContent = [String]() mainContent.append("// this file is autogenerated using `./scripts/package-spm.swift`") mainContent.append("import XCTest") mainContent.append("import RxSwift") mainContent.append("") mainContent.append("protocol RxTestCase {") mainContent.append("#if os(macOS)") mainContent.append(" init()") mainContent.append(" static var allTests: [(String, (Self) -> () -> Void)] { get }") mainContent.append("#endif") mainContent.append(" func setUp()") mainContent.append(" func tearDown()") mainContent.append("}") mainContent.append("") for name in reducedMethods.keys.sorted() { let methods = reducedMethods[name]! mainContent.append("") mainContent.append("final class \(name)_ : \(name), RxTestCase {") mainContent.append(" #if os(macOS)") mainContent.append(" required override init() {") mainContent.append(" super.init()") mainContent.append(" }") mainContent.append(" #endif") mainContent.append("") mainContent.append(" static var allTests: [(String, (\(name)_) -> () -> Void)] { return [") for method in methods { // throwing error on Linux, you will crash let isTestCaseHandlingError = throwingWordsInTests.map { (method as String).lowercased().contains($0) }.reduce(false) { $0 || $1 } mainContent.append(" \(isTestCaseHandlingError ? "//" : "")(\"\(method)\", \(name).\(method)),") } mainContent.append(" ] }") mainContent.append("}") } mainContent.append("#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)") mainContent.append("") mainContent.append("func testCase(_ tests: [(String, (T) -> () -> Void)]) -> () -> Void {") mainContent.append(" return {") mainContent.append(" for testCase in tests {") mainContent.append(" print(\"Test \\(testCase)\")") mainContent.append(" for test in T.allTests {") mainContent.append(" let testInstance = T()") mainContent.append(" testInstance.setUp()") mainContent.append(" print(\" testing \\(test.0)\")") mainContent.append(" test.1(testInstance)()") mainContent.append(" testInstance.tearDown()") mainContent.append(" }") mainContent.append(" }") mainContent.append(" }") mainContent.append("}") mainContent.append("") mainContent.append("func XCTMain(_ tests: [() -> Void]) {") mainContent.append(" for testCase in tests {") mainContent.append(" testCase()") mainContent.append(" }") mainContent.append("}") mainContent.append("") mainContent.append("#endif") mainContent.append("") mainContent.append(" XCTMain([") for testCase in reducedMethods.keys.sorted() { mainContent.append(" testCase(\(testCase)_.allTests),") } mainContent.append(" ])") mainContent.append("//}") mainContent.append("") let serializedMainContent = mainContent.joined(separator: "\n") try serializedMainContent.write(toFile: "\(testsPath)/main.swift", atomically: true, encoding: String.Encoding.utf8) } try packageRelativePath(["RxSwift"], targetDirName: "RxSwift") try packageRelativePath(["RxRelay"], targetDirName: "RxRelay") try packageRelativePath([ "RxCocoa/RxCocoa.swift", "RxCocoa/Traits", "RxCocoa/Common", "RxCocoa/Foundation", "RxCocoa/iOS", "RxCocoa/macOS", "RxCocoa/Platform" ], targetDirName: "RxCocoa") try packageRelativePath([ "RxCocoa/Runtime/include" ], targetDirName: "RxCocoaRuntime/include") try packageRelativePath([ "RxCocoa/Runtime/_RX.m", "RxCocoa/Runtime/_RXDelegateProxy.m", "RxCocoa/Runtime/_RXKVOObserver.m", "RxCocoa/Runtime/_RXObjCRuntime.m" ], targetDirName: "RxCocoaRuntime") try packageRelativePath(["RxBlocking"], targetDirName: "RxBlocking") try packageRelativePath(["RxTest"], targetDirName: "RxTest") // It doesn't work under `Tests` subpath ¯\_(ツ)_/¯ try packageRelativePath( [ "Tests/RxSwiftTests", "Tests/RxRelayTests", "Tests/RxBlockingTests", "RxSwift/RxMutableBox.swift", "Tests/RxTest.swift", "Tests/Recorded+Timeless.swift", "Tests/TestErrors.swift", "Tests/XCTest+AllTests.swift", "Platform", "Tests/RxCocoaTests/Driver+Test.swift", "Tests/RxCocoaTests/Signal+Test.swift", "Tests/RxCocoaTests/SharedSequence+Extensions.swift", "Tests/RxCocoaTests/SharedSequence+Test.swift", "Tests/RxCocoaTests/SharedSequence+OperatorTest.swift", "Tests/RxCocoaTests/NotificationCenterTests.swift" ], targetDirName: "AllTestz", excluded: [ "Tests/VirtualSchedulerTest.swift", "Tests/HistoricalSchedulerTest.swift", // @testable import doesn't work well in Linux :/ "QueueTests.swift", // @testable import doesn't work well in Linux :/ "SubjectConcurrencyTest.swift", // @testable import doesn't work well in Linux :/ "BagTest.swift" ] ) try buildAllTestsTarget("Sources/AllTestz") ================================================ FILE: scripts/profile-build-times.sh ================================================ set -oe pipefail mkdir -p build xcodebuild -workspace Rx.xcworkspace -scheme RxSwift-iOS -configuration Debug -destination "name=iPhone 17" clean test \ | tee build/output \ | grep .[0-9]ms \ | grep -v ^0.[0-9]ms \ | sort -nr > build/build-times.txt \ && cat build/build-times.txt | less ================================================ FILE: scripts/swiftlint.sh ================================================ if [[ "${TRAVIS}" != "" ]] || [[ "${LINT}" != "" ]]; then if which swiftlint >/dev/null; then swiftlint else echo "warning: SwiftLint is not installed" fi else echo "To run swiftlint please set TRAVIS or LINT environmental variable." fi ================================================ FILE: scripts/test-linux.sh ================================================ set -e function cleanup { git checkout Package.swift } if [[ `uname` == "Darwin" ]]; then if [[ `git diff HEAD Package.swift | wc -l` > 0 ]]; then echo "Package.swift has uncommitted changes" exit -1 fi trap cleanup EXIT echo "Running linux" eval $(docker-machine env default) docker run --rm -it -v `pwd`:/RxSwift swift:latest bash -c "cd /RxSwift; scripts/test-linux.sh" || (echo "You maybe need to pull the docker image: 'docker pull swift'" && exit -1) elif [[ `uname` == "Linux" ]]; then CONFIGURATIONS=(debug release) rm -rf .build || true echo "Using `swift -version`" ./scripts/all-tests.sh Unix else echo "Unknown os (`uname`)" exit -1 fi ================================================ FILE: scripts/update-jazzy-config.rb ================================================ #!/usr/bin/env ruby require 'yaml' included_directories = %w(RxSwift RxCocoa RxRelay) files_and_directories = included_directories.collect do |directory| Dir.glob("#{directory}/**/*") end.flatten.sort_by { |file| file } swift_files = files_and_directories.select { |file| file =~ /.*\.swift$/ } directory_and_name = swift_files.map do |file| { File.dirname(file) => File.basename(file, '.swift') } end categories = directory_and_name.flat_map(&:entries) .group_by(&:first) .map { |k,v| { 'name' => k, 'children' => v.map(&:last) } } config = { 'custom_categories' => categories } File.open('.jazzy.yml','w') do |h| h.write config.to_yaml end ================================================ FILE: scripts/update-jazzy-docs.sh ================================================ . scripts/common.sh VERSION=$(grep 'RX_VERSION' Version.xcconfig | cut -d'=' -f2 | tr -d ' ') function updateDocs() { WORKSPACE=$1 SCHEME=$2 CONFIGURATION=$3 SIMULATOR=$4 MODULE=$5 SIMULATOR_GUID=$(xcrun simctl list devices available | grep "$SIMULATOR" | head -1 | grep -oE '[A-F0-9-]{36}') DESTINATION='id='$SIMULATOR_GUID'' set -x killall Simulator || true jazzy --config .jazzy.yml --module-version "${VERSION}" --theme fullwidth --github_url https://github.com/ReactiveX/RxSwift -m "${MODULE}" -x -workspace,"${WORKSPACE}",-scheme,"${SCHEME}",-configuration,"${CONFIGURATION}",-derivedDataPath,"${BUILD_DIRECTORY}",-destination,"$DESTINATION",CODE_SIGN_IDENTITY=,CODE_SIGNING_REQUIRED=NO,CODE_SIGNING_ALLOWED=NO set +x } ./scripts/update-jazzy-config.rb updateDocs Rx.xcworkspace "RxExample-iOS" "Release" "iPhone 17 Pro" "RxSwift" ================================================ FILE: scripts/validate-headers.swift ================================================ #!/usr/bin/swift // // validate-headers.swift // scripts // // Created by Krunoslav Zaher on 12/26/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import Foundation /** Validates that all headers are in this standard form. // // {file}.swift // Project // // Created by {Author} on 2/14/15. // Copyright (c) 2015 Krunoslav Zaher. All rights reserved. // Only Project is not checked yet, but it will be soon. */ let fileManager = FileManager.default let allowedExtensions = [ ".swift", ".h", ".m" ] let excludedRootPaths = [ "Carthage", ".git", "build", "Rx.playground", "vendor", "Sources", "Carthage" ] let excludePaths = [ "AllTestz/main.swift", "Platform/AtomicInt.swift", "Platform/Platform.Linux.swift", "Platform/Platform.Darwin.swift", "Platform/RecursiveLock.swift", "Platform/DataStructures/Bag.swift", "Platform/DataStructures/InfiniteSequence.swift", "Platform/DataStructures/PriorityQueue.swift", "Platform/DataStructures/Queue.swift", "Platform/DispatchQueue+Extensions.swift", "Platform/DeprecationWarner.swift", "RxExample/Services/Reachability.swift", "RxDataSources" ] func isExtensionIncluded(path: String) -> Bool { (allowedExtensions.map { path.hasSuffix($0) }).reduce(false) { $0 || $1 } } let whitespace = NSCharacterSet.whitespacesAndNewlines let identifier = "(?:\\w|\\+|\\_|\\.|-)+" let fileLine = try NSRegularExpression(pattern: "// (\(identifier))", options: []) let projectLine = try NSRegularExpression(pattern: "// (\(identifier))", options: []) let createdBy = try NSRegularExpression(pattern: "// Created by .* on \\d+/\\d+/\\d+\\.", options: []) let copyrightLine = try NSRegularExpression(pattern: "// Copyright © (\\d+) (.*?). All rights reserved.", options: []) func validateRegexMatches(regularExpression: NSRegularExpression, content: String) -> ([String], Bool) { let range = NSRange(location: 0, length: content.count) let matches = regularExpression.matches(in: content, options: [], range: range) if matches.count == 0 { print("ERROR: line `\(content)` is invalid: \(regularExpression.pattern)") return ([], false) } for m in matches { if m.numberOfRanges == 0 || !NSEqualRanges(m.range, range) { print("ERROR: line `\(content)` is invalid: \(regularExpression.pattern)") return ([], false) } } return (matches[0 ..< matches.count].flatMap { m -> [String] in return (1 ..< m.numberOfRanges).map { index in let range = m.range(at: index) return (content as NSString).substring(with: range) } }, true) } func validateHeader(path: String) throws -> Bool { let contents = try String(contentsOfFile: path, encoding: String.Encoding.utf8) let rawLines = contents.components(separatedBy: "\n") var lines = rawLines.map { $0.trimmingCharacters(in: whitespace) } if (lines.first ?? "").hasPrefix("#") || (lines.first ?? "").hasPrefix("// This file is autogenerated.") { lines.remove(at: 0) } if lines.count < 8 { print("ERROR: Number of lines is less then 8, so the header can't be correct") return false } for i in 0 ..< 7 { if !lines[i].hasPrefix("//") { print("ERROR: Line [\(i + 1)] (\(lines[i])) isn't prefixed with //") return false } } if lines[0] != "//" { print("ERROR: Line[1] First line should be `//`") return false } let (parsedFileLine, isValidFilename) = validateRegexMatches(regularExpression: fileLine, content: lines[1]) if !isValidFilename { print("ERROR: Line[2] Filename line should match `\(fileLine.pattern)`") return false } let fileNameInFile = parsedFileLine.first ?? "" if fileNameInFile != (path as NSString).lastPathComponent { print("ERROR: Line[2] invalid file name `\(fileNameInFile)`, correct content is `\((path as NSString).lastPathComponent)`") return false } let (parsedProject, isValidProject) = validateRegexMatches(regularExpression: projectLine, content: lines[2]) let targetProject = path.components(separatedBy: "/")[0] if !isValidProject || parsedProject.first != targetProject { print("ERROR: Line[3] Line not equal to `// \(targetProject)`") return false } if lines[3] != "//" { print("ERROR: Line[4] Line should be `//`") return false } let (_, isValidCreatedBy) = validateRegexMatches(regularExpression: createdBy, content: lines[4]) if !isValidCreatedBy { print("ERROR: Line[5] Line not matching \(createdBy.pattern)") return false } let (year, isValidCopyright) = validateRegexMatches(regularExpression: copyrightLine, content: lines[5]) if !isValidCopyright { print("ERROR: Line[6] Line not matching \(copyrightLine.pattern)") return false } let currentYear = Calendar.current.component(.year, from: Date()) if year.first == nil || !(2015 ... currentYear).contains(Int(year.first!) ?? 0) { print("ERROR: Line[6] Wrong copyright year \(year.first ?? "?") instead of 2015...\(currentYear)") return false } if lines[6] != "//" { print("ERROR: Line[7] Line not matching \(copyrightLine.pattern)") return false } if lines[7] != "" { print("ERROR: Line[8] Should be blank and not `\(lines[7])`") return false } return true } func verifyAll(root: String) throws -> Bool { try fileManager.subpathsOfDirectory(atPath: root).map { file -> Bool in let excluded = excludePaths.map { file.hasPrefix($0) }.reduce(false) { $0 || $1 } if excluded { return true } if !isExtensionIncluded(path: file) { return true } let isValid = try validateHeader(path: "\(root)/\(file)") if !isValid { print(" while Validating '\(root)/\(file)'") } return isValid }.reduce(true) { $0 && $1 } } let allValid = try fileManager.contentsOfDirectory(atPath: ".").map { rootDir -> Bool in if excludedRootPaths.contains(rootDir) { print("Skipping \(rootDir)") return true } return try verifyAll(root: rootDir) }.reduce(true) { $0 && $1 } if !allValid { exit(-1) } ================================================ FILE: scripts/validate-markdown.sh ================================================ ROOT=`pwd` pushd `npm root -g` remark -u remark-slug -u remark-validate-links "${ROOT}/*.md" "${ROOT}/**/*.md" "${ROOT}/.github/ISSUE_TEMPLATE.md" "${ROOT}/RxExample/" "${ROOT}/RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift" "${ROOT}/Rx.playground" popd ================================================ FILE: scripts/validate-playgrounds.sh ================================================ . scripts/common.sh PLAYGROUND_CONFIGURATIONS=(Release) # make sure macOS builds for scheme in "RxSwift" do for configuration in ${PLAYGROUND_CONFIGURATIONS[@]} do PAGES_PATH=${BUILD_DIRECTORY}/Build/Products/${configuration}/all-playground-pages.swift rx ${scheme} ${configuration} "" build cat Rx.playground/Sources/*.swift Rx.playground/Pages/**/*.swift > ${PAGES_PATH} swift -v -D NOT_IN_PLAYGROUND -F ${BUILD_DIRECTORY}/Build/Products/${configuration} ${PAGES_PATH} done done