Full Code of ReactiveX/RxSwift for AI

main 132aea4f236c cached
825 files
7.8 MB
2.1M tokens
53 symbols
1 requests
Download .txt
Showing preview only (8,371K chars total). Download the full file or copy to clipboard to get everything.
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<Element>  {
    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<String, E1>` and `Observable<String, E2>`

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<E>
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<Int>*/ = BehaviorRelay(value: 1)   // a = 1
let b /*: Observable<Int>*/ = 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<String>
            .map { WolframAlphaIsPrime(Int($0) ?? 0) }             // type is Observable<Observable<Prime>>
            .concat()                                              // type is Observable<Prime>
            .map { "number \($0.n) is prime? \($0.isPrime)" }      // type is Observable<String>
            .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<Availability> 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<Bool>`
        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<Observable<Availability>>`
// we need to somehow return to a simple `Observable<Availability>`.
// 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<Element>` 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<Element>  {
    case next(Element)      // next element of a sequence
    case error(Swift.Error) // sequence failed with error
    case completed          // sequence terminated successfully
}

class Observable<Element> {
    func subscribe(_ observer: Observer<Element>) -> Disposable
}

protocol ObserverType {
    func on(_ event: Event<Element>)
}
```

**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<Int>.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<Int>.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<Int>.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<Element>) 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<Results> {}
```

```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<E>(_ element: E) -> Observable<E> {
    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<E>(_ sequence: [E]) -> Observable<E> {
    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<Int> {
    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<R>(transform: @escaping (Element) -> R) -> Observable<R> {
        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<MagicBeing> = 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<JSON> in
        return self.api.loadFlickrFeed("karate")
            .catchError { error -> Observable<JSON> 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<JSON> in
        return self.api.loadFlickrFeed("karate")
            .catchError { (error: Error) -> Observable<JSON> 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<Self.E> {
        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<Int>.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<E>(type: E.Type, _ keyPath: String, options: KeyValueObservingOptions, retainSelf: Bool = true) -> Observable<E?> {}
}

#if !DISABLE_SWIZZLING
// KVO
extension Reactive where Base: NSObject {
    public func observeWeakly<E>(type: E.Type, _ keyPath: String, options: KeyValueObservingOptions) -> Observable<E?> {}
}
#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<String> 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<StateType>(state: StateType, action: (/*ImmediateScheduler,*/ StateType) -> RxResult<Disposable>) -> RxResult<Disposable>
}
```

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<StateType>(state: StateType, dueTime: TimeInterval, action: (StateType) -> RxResult<Disposable>) -> RxResult<Disposable>
}
```

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<StateType>(state: StateType, startAfter: TimeInterval, period: TimeInterval, action: (StateType) -> StateType) -> RxResult<Disposable>
}
```

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<AmazingResponse>
```


================================================
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<E> {
            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<Element> {
    let source: Observable<Element>
}

struct Driver<Element> {
    let source: Observable<Element>
}
...
```

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<Void>` 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<String> {
    return Maybe<String>.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<String?> {
        let source: Observable<String?> = Observable.deferred { [weak searchBar = self.base as UISearchBar] () -> Observable<String?> 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<Int> {
        value
    }
    
    /// Reactive wrapper for `selectedSegmentIndex` property.
    public var value: ControlProperty<Int> {
        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<Void> {
        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<IndexPath> {
        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
========

### <a name="unused-disposable"></a>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<E> ....

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

_ = xs // <-- note the underscore
  .filter { ... }
  .map { ... }
  .switchLatest()
  .subscribe(onNext: {
    ...
  }, onError: {
    ...
  })
```

### <a name="unused-observable"></a>Unused observable sequence (unused-observable)

You will receive a warning for doing something such as this:

```Swift
let xs: Observable<E> ....

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

let ys = xs // <--- names definition as `ys`
  .filter { ... }
  .map { ... }
```

... or start computation based on that definition

```Swift
let xs: Observable<E> ....
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<User> = 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<User> = 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<T>: 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<Entry>()

    // 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<Element>: Sequence {
    typealias Iterator = AnyIterator<Element>

    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<Element> {
    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<T>: Sequence {
    /// Type of generator.
    typealias Generator = AnyIterator<T>

    private let resizeFactor = 2

    private var storage: ContiguousArray<T?>
    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<T?>(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<T?>(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<T> {
        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<Void> = {
        let key = DispatchSpecificKey<Void>()
        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<T>(_ 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<T: AnyObject>(_ 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 <source-files-root> <derived-data> ")
    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 = "<group>"; 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 = "<group>";
		};
		C81108781AF5114D001C13E4 /* Products */ = {
			isa = PBXGroup;
			children = (
				C81108771AF5114D001C13E4 /* Preprocessor */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		C81108791AF5114D001C13E4 /* Preprocessor */ = {
			isa = PBXGroup;
			children = (
				C811087A1AF5114D001C13E4 /* main.swift */,
			);
			path = Preprocessor;
			sourceTree = "<group>";
		};
/* 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
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:Preprocessor.xcodeproj">
   </FileRef>
</Workspace>


================================================
FILE: Preprocessor/Preprocessor.xcodeproj/xcshareddata/xcschemes/Preprocessor.xcscheme
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "1250"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
      buildImplicitDependencies = "YES">
      <BuildActionEntries>
         <BuildActionEntry
            buildForTesting = "YES"
            buildForRunning = "YES"
            buildForProfiling = "YES"
            buildForArchiving = "YES"
            buildForAnalyzing = "YES">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "C81108761AF5114D001C13E4"
               BuildableName = "Preprocessor"
               BlueprintName = "Preprocessor"
               ReferencedContainer = "container:Preprocessor.xcodeproj">
            </BuildableReference>
         </BuildActionEntry>
      </BuildActionEntries>
   </BuildAction>
   <TestAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      shouldUseLaunchSchemeArgsEnv = "YES">
      <Testables>
      </Testables>
   </TestAction>
   <LaunchAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      ignoresPersistentStateOnLaunch = "NO"
      debugDocumentVersioning = "YES"
      debugServiceExtension = "internal"
      allowLocationSimulation = "YES">
      <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "C81108761AF5114D001C13E4"
            BuildableName = "Preprocessor"
            BlueprintName = "Preprocessor"
            ReferencedContainer = "container:Preprocessor.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>
      <CommandLineArguments>
         <CommandLineArgument
            argument = "$(SRCROOT)/.. $(BUILT_PRODUCTS_DIR)"
            isEnabled = "YES">
         </CommandLineArgument>
      </CommandLineArguments>
   </LaunchAction>
   <ProfileAction
      buildConfiguration = "Release"
      shouldUseLaunchSchemeArgsEnv = "YES"
      savedToolIdentifier = ""
      useCustomWorkingDirectory = "NO"
      debugDocumentVersioning = "YES">
      <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "C81108761AF5114D001C13E4"
            BuildableName = "Preprocessor"
            BlueprintName = "Preprocessor"
            ReferencedContainer = "container:Preprocessor.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>
   </ProfileAction>
   <AnalyzeAction
      buildConfiguration = "Debug">
   </AnalyzeAction>
   <ArchiveAction
      buildConfiguration = "Release"
      revealArchiveInOrganizer = "YES">
   </ArchiveAction>
</Scheme>


================================================
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<E\($0)>" }) %>, resultSelector: (<%= ", ".join(map(1...i) { "E\($0)" }) %>) -> Result<R>)
        -> Observable<R> {
    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<E\($0)>" }) %>, resultSelector: (<%= ", ".join(map(1...i) { "E\($0)" }) %>) -> R)
        -> Observable<R> {
    return CombineLatest<%= i %>(
        <%= ", ".join(map(1...i) { "source\($0): source\($0)" }) %>,
        resultSelector: { success(resultSelector(<%= ", ".join(map(0..<i) { "$\($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<E1, E2, R>
    (source1: Observable<E1>, source2: Observable<E2>, resultSelector: (E1, E2) -> Result<R>)
        -> Observable<R> {
    return CombineLatest2(
        source1: source1, source2: source2,
        resultSelector: resultSelector
    )
}

public func combineLatest<E1, E2, R>
    (source1: Observable<E1>, source2: Observable<E2>, resultSelector: (E1, E2) -> R)
        -> Observable<R> {
    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
================================================
<p align="center">
<img src="https://github.com/ReactiveX/RxSwift/blob/main/assets/RxSwift_Logo.png?raw=true" width="35%" alt="RxSwift Logo" />
<br />
<a href="https://github.com/ReactiveX/RxSwift/actions/workflows/tests.yml" target="_blank"><img src="https://github.com/ReactiveX/RxSwift/actions/workflows/tests.yml/badge.svg" alt="Build Status" /></a>
<img src="https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg" alt="Supported Platforms: iOS, macOS, tvOS, watchOS & Linux" />
<br />
<a href="https://github.com/Carthage/Carthage" alt="RxSwift on Carthage" title="RxSwift on Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" /></a>
<a href="https://github.com/swiftlang/swift-package-manager" alt="RxSwift on Swift Package Manager" title="RxSwift on Swift Package Manager"><img src="https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg" /></a>
</p>

Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) 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](http://reactivex.io) standard.

<p align="center"><img src="https://github.com/ReactiveX/RxSwift/blob/main/assets/example.png?raw=true" width="55%" alt="RxSwift Observable Example of a price constantly changing and updating the app's UI" /></p>

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. <br />[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

<table>
  <tr>
    <th width="30%">Here's an example</th>
    <th width="30%">In Action</th>
  </tr>
  <tr>
    <td>Define search for GitHub repositories ...</td>
    <th rowspan="9"><img src="https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/GithubSearch.gif"></th>
  </tr>
  <tr>
    <td><div class="highlight highlight-source-swift"><pre>
let searchResults = searchBar.rx.text.orEmpty
    .throttle(.milliseconds(300), scheduler: MainScheduler.instance)
    .distinctUntilChanged()
    .flatMapLatest { query -> Observable&lt;[Repository]&gt; in
        if query.isEmpty {
            return .just([])
        }
        return searchGitHub(query)
            .catchAndReturn([])
    }
    .observe(on: MainScheduler.instance)</pre></div></td>
  </tr>
  <tr>
    <td>... then bind the results to your tableview</td>
  </tr>
  <tr>
    <td width="30%"><div class="highlight highlight-source-swift"><pre>
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)</pre></div></td>
  </tr>
</table>

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

<img src="https://raw.githubusercontent.com/ReactiveX/RxSwift/main/assets/xcframeworks.png" alt="XCFrameworks instructions" width="65%">

> [!TIP]
> RxSwift's xcframework(s) are signed with an Apple Developer account, and you can always verify the Team Name: Shai Mishali
>
> <img src="https://raw.githubusercontent.com/ReactiveX/RxSwift/main/assets/xcframeworks_signing.png" alt="XCFrameworks Signing Team Name Validation" width="65%">

### [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<String>()
    let subject2 = PublishSubject<String>()

    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<String>()
    let intSubject = PublishSubject<Int>()

    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<String>()
    let intSubject = PublishSubject<Int>()

    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<String>()
    let drinksSubject = PublishSubject<String>()

    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<Int>.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<Int>.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 = Obse
Download .txt
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
Download .txt
SYMBOL INDEX (53 symbols across 6 files)

FILE: RxCocoa/Runtime/include/_RXObjCRuntime.h
  type objc_method_description (line 96) | struct objc_method_description

FILE: Sources/RxCocoaRuntime/include/_RXObjCRuntime.h
  type objc_method_description (line 96) | struct objc_method_description

FILE: Tests/RxCocoaTests/RXObjCRuntime+Testing.h
  type some_insanely_large_struct (line 45) | struct some_insanely_large_struct {

FILE: docs/js/jazzy.js
  function toggleItem (line 15) | function toggleItem($link, $content) {
  function itemLinkToContent (line 21) | function itemLinkToContent($link) {
  function openCurrentItemIfClosed (line 26) | function openCurrentItemIfClosed() {

FILE: docs/js/jazzy.search.js
  function displayTemplate (line 10) | function displayTemplate(result) {
  function suggestionTemplate (line 14) | function suggestionTemplate(result) {

FILE: docs/js/typeahead.jquery.js
  function reverseArgs (line 55) | function reverseArgs(index, value) {
  function template (line 100) | function template() {
  function _p8 (line 153) | function _p8(s) {
  function build (line 178) | function build(o) {
  function buildHtml (line 197) | function buildHtml(c) {
  function buildSelectors (line 203) | function buildSelectors(classes) {
  function buildCss (line 210) | function buildCss() {
  function EventBus (line 267) | function EventBus(o) {
  function on (line 304) | function on(method, types, cb, context) {
  function onAsync (line 321) | function onAsync(types, cb, context) {
  function onSync (line 324) | function onSync(types, cb, context) {
  function off (line 327) | function off(types) {
  function trigger (line 338) | function trigger(types) {
  function getFlush (line 352) | function getFlush(callbacks, context, args) {
  function getNextTick (line 362) | function getNextTick() {
  function bindContext (line 379) | function bindContext(fn, context) {
  function hightlightTextNode (line 433) | function hightlightTextNode(textNode) {
  function traverse (line 445) | function traverse(el, hightlightTextNode) {
  function accent_replacer (line 457) | function accent_replacer(chr) {
  function getRegex (line 460) | function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensiti...
  function Input (line 485) | function Input(o, www) {
  function buildOverflowHelper (line 685) | function buildOverflowHelper($input) {
  function areQueriesEquivalent (line 702) | function areQueriesEquivalent(a, b) {
  function withModifier (line 705) | function withModifier($e) {
  function Dataset (line 718) | function Dataset(o, www) {
  function sync (line 859) | function sync(suggestions) {
  function async (line 871) | function async(suggestions) {
  function getDisplayFn (line 896) | function getDisplayFn(display) {
  function getTemplates (line 903) | function getTemplates(templates, displayFn) {
  function isValidName (line 919) | function isValidName(str) {
  function Menu (line 925) | function Menu(o, www) {
  function updateDataset (line 1047) | function updateDataset(dataset) {
  function clearDataset (line 1055) | function clearDataset(dataset) {
  function destroyDataset (line 1063) | function destroyDataset(dataset) {
  function Status (line 1072) | function Status(options) {
  function DefaultMenu (line 1122) | function DefaultMenu() {
  function Typeahead (line 1165) | function Typeahead(o, www) {
  function c (line 1448) | function c(ctx) {
  function attach (line 1474) | function attach() {
  function ttEach (line 1633) | function ttEach($els, fn) {
  function buildHintFromInput (line 1639) | function buildHintFromInput($input, www) {
  function prepInput (line 1648) | function prepInput($input, www) {
  function getBackgroundStyles (line 1663) | function getBackgroundStyles($el) {
  function revert (line 1675) | function revert($input) {
  function $elOrNull (line 1688) | function $elOrNull(obj) {
Condensed preview — 825 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (8,635K chars).
[
  {
    "path": ".editorConfig",
    "chars": 135,
    "preview": "# editorconfig.org\n\nroot = true\n\n[*]\nindent_style = space\nindent_size = 4\ntrim_trailing_whitespace = true\ninsert_final_n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 2285,
    "preview": "\n:warning: If you don't have something to report in the following format, it will probably be easier and faster to ask i"
  },
  {
    "path": ".github/workflows/tests.yml",
    "chars": 1834,
    "preview": "name: RxSwift\n\non:\n  push:\n    branches:\n      - \"main\"\n  pull_request:\n  workflow_dispatch:\n\njobs:\n  xcode26:\n    name:"
  },
  {
    "path": ".gitignore",
    "chars": 548,
    "preview": "# Xcode\n#\nbuild/\nBuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3"
  },
  {
    "path": ".jazzy.yml",
    "chars": 6568,
    "preview": "---\ncustom_categories:\n- name: RxCocoa/Common\n  children:\n  - ControlTarget\n  - DelegateProxy\n  - DelegateProxyType\n  - "
  },
  {
    "path": ".ruby-version",
    "chars": 6,
    "preview": "3.3.0\n"
  },
  {
    "path": ".swift-version",
    "chars": 4,
    "preview": "6.1\n"
  },
  {
    "path": ".swiftformat",
    "chars": 186,
    "preview": "--ifdef no-indent\n--wrap-arguments before-first\n--commas inline\n--doc-comments preserve\n--exclude Sources/AllTestz/main."
  },
  {
    "path": ".swiftlint.yml",
    "chars": 773,
    "preview": "included:\n  - RxSwift\n  - RxCocoa\n  - RxTest\n  - RxBlocking\nopt_in_rules:\n  - overridden_super_call\n  - private_outlet\n "
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3275,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 8225,
    "preview": "## Contributing to RxSwift\n\nThank you for your interest in RxSwift! There are multiple ways you can contribute to this p"
  },
  {
    "path": "Dangerfile",
    "chars": 1060,
    "preview": "# Warn about develop branch\nwarn(\"Please target PRs to `develop` branch\") if github.branch_for_base != \"develop\"\n\n# Some"
  },
  {
    "path": "Documentation/ComparisonWithOtherLibraries.md",
    "chars": 4053,
    "preview": "# Comparison with other libraries\n\nThis section attempts to compare RxSwift with other known and popular alternatives.\n\n"
  },
  {
    "path": "Documentation/DesignRationale.md",
    "chars": 3299,
    "preview": "Design Rationale\n================\n\n## Why error type isn't generic\n\n```Swift\nenum Event<Element>  {\n    case next(Elemen"
  },
  {
    "path": "Documentation/ExampleApp.md",
    "chars": 145,
    "preview": "\n## RxExamples\n\nTo run the example app:\n\n* Open `Rx.xcworkspace`\n* Choose one of example schemes (RxExample-iOS, RxExamp"
  },
  {
    "path": "Documentation/Examples.md",
    "chars": 7444,
    "preview": "Examples\n========\n\n1. [Reactive values](#reactive-values)\n1. [Simple UI bindings](#simple-ui-bindings)\n1. [Automatic inp"
  },
  {
    "path": "Documentation/GettingStarted.md",
    "chars": 35059,
    "preview": "Getting Started\n===============\n\nThis project tries to be consistent with [ReactiveX.io](http://reactivex.io/). The gene"
  },
  {
    "path": "Documentation/HotAndColdObservables.md",
    "chars": 2458,
    "preview": "Hot and Cold Observables\n========================\n\nIMHO, I would suggest to more think of this as property of sequences "
  },
  {
    "path": "Documentation/MathBehindRx.md",
    "chars": 1159,
    "preview": "Math Behind Rx\n==============\n\n## Duality between Observer and Iterator / Enumerator / Generator / Sequences\n\nThere is a"
  },
  {
    "path": "Documentation/NewFeatureRequestTemplate.md",
    "chars": 531,
    "preview": "**Please copy the following template [here](https://github.com/ReactiveX/RxSwift/issues/new) and fill in the missing fie"
  },
  {
    "path": "Documentation/Playgrounds.md",
    "chars": 208,
    "preview": "## Playgrounds\n\nTo use playgrounds:\n\n* Open `Rx.xcworkspace`\n* Build the `RxSwift` scheme on `My Mac`.\n* Open `Rx` playg"
  },
  {
    "path": "Documentation/Schedulers.md",
    "chars": 5944,
    "preview": "# Schedulers\n\n1. [Serial vs Concurrent Schedulers](#serial-vs-concurrent-schedulers)\n1. [Custom schedulers](#custom-sche"
  },
  {
    "path": "Documentation/Subjects.md",
    "chars": 408,
    "preview": "# Subjects\n\nAll of behave exactly the same like described [here](http://reactivex.io/documentation/subject.html)\n\n## Rel"
  },
  {
    "path": "Documentation/SwiftConcurrency.md",
    "chars": 2877,
    "preview": "## Swift Concurrency\n\nSwift 5.5 introduced a new long-awaited concurrency model for Swift, using the new `async`/`await`"
  },
  {
    "path": "Documentation/Tips.md",
    "chars": 1585,
    "preview": "Tips\n====\n\n* Always strive to model your systems or their parts as pure functions. Those pure functions can be tested ea"
  },
  {
    "path": "Documentation/Traits.md",
    "chars": 19031,
    "preview": "Traits (formerly Units)\n=====\n\nThis document will try to describe what traits are, why they are a useful concept, and ho"
  },
  {
    "path": "Documentation/UnitTests.md",
    "chars": 5651,
    "preview": "Unit Tests\n==========\n\n## Testing custom operators\n\nRxSwift uses `RxTest` for all operator tests, located in the AllTest"
  },
  {
    "path": "Documentation/Warnings.md",
    "chars": 3349,
    "preview": "Warnings\n========\n\n### <a name=\"unused-disposable\"></a>Unused disposable (unused-disposable)\n\nThe following is valid for"
  },
  {
    "path": "Documentation/Why.md",
    "chars": 11008,
    "preview": "## Why\n\n**Rx enables building apps in a declarative way.**\n\n### Bindings\n\n```swift\nObservable.combineLatest(firstName.rx"
  },
  {
    "path": "Gemfile",
    "chars": 43,
    "preview": "source 'https://rubygems.org'\n\ngem 'danger'"
  },
  {
    "path": "LICENSE.md",
    "chars": 1120,
    "preview": "**The MIT License**\n**Copyright © 2015 Shai Mishali, Krunoslav Zaher**\n**All rights reserved.**\n\nPermission is hereby gr"
  },
  {
    "path": "Makefile",
    "chars": 45,
    "preview": "format:\n\tmise x swiftformat -- swiftformat .\n"
  },
  {
    "path": "Package.swift",
    "chars": 3707,
    "preview": "// swift-tools-version:5.5\n\nimport Foundation\nimport PackageDescription\n\nfunc isTargetingDarwin() -> Bool {\n    // Check"
  },
  {
    "path": "Package@swift-5.9.swift",
    "chars": 3748,
    "preview": "// swift-tools-version:5.9\n\nimport Foundation\nimport PackageDescription\n\nfunc isTargetingDarwin() -> Bool {\n    // Check"
  },
  {
    "path": "Platform/AtomicInt.swift",
    "chars": 1551,
    "preview": "//\n//  AtomicInt.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 10/28/18.\n//  Copyright © 2018 Krunoslav Zaher."
  },
  {
    "path": "Platform/DataStructures/Bag.swift",
    "chars": 4233,
    "preview": "//\n//  Bag.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 2/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All ri"
  },
  {
    "path": "Platform/DataStructures/InfiniteSequence.swift",
    "chars": 570,
    "preview": "//\n//  InfiniteSequence.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 6/13/15.\n//  Copyright © 2015 Krunoslav "
  },
  {
    "path": "Platform/DataStructures/PriorityQueue.swift",
    "chars": 3274,
    "preview": "//\n//  PriorityQueue.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/27/15.\n//  Copyright © 2015 Krunoslav Za"
  },
  {
    "path": "Platform/DataStructures/Queue.swift",
    "chars": 3902,
    "preview": "//\n//  Queue.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 3/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All "
  },
  {
    "path": "Platform/DispatchQueue+Extensions.swift",
    "chars": 489,
    "preview": "//\n//  DispatchQueue+Extensions.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 10/22/16.\n//  Copyright © 2016 K"
  },
  {
    "path": "Platform/Platform.Darwin.swift",
    "chars": 824,
    "preview": "//\n//  Platform.Darwin.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/29/15.\n//  Copyright © 2015 Krunoslav "
  },
  {
    "path": "Platform/Platform.Linux.swift",
    "chars": 740,
    "preview": "//\n//  Platform.Linux.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/29/15.\n//  Copyright © 2015 Krunoslav Z"
  },
  {
    "path": "Platform/RecursiveLock.swift",
    "chars": 645,
    "preview": "//\n//  RecursiveLock.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/18/16.\n//  Copyright © 2016 Krunoslav Za"
  },
  {
    "path": "Preprocessor/Preprocessor/main.swift",
    "chars": 3512,
    "preview": "//\n//  main.swift\n//  Preprocessor\n//\n//  Created by Krunoslav Zaher on 4/22/15.\n//  Copyright © 2015 Krunoslav Zaher. A"
  },
  {
    "path": "Preprocessor/Preprocessor.xcodeproj/project.pbxproj",
    "chars": 9067,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "Preprocessor/Preprocessor.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 157,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:Preprocessor.xc"
  },
  {
    "path": "Preprocessor/Preprocessor.xcodeproj/xcshareddata/xcschemes/Preprocessor.xcscheme",
    "chars": 3086,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Preprocessor/README.md",
    "chars": 2354,
    "preview": "## RxSwift KISS code generator.\n\nRxSwift code is partially machine generated. \nIt converts *.tt files into generated *.s"
  },
  {
    "path": "README.md",
    "chars": 10668,
    "preview": "<p align=\"center\">\n<img src=\"https://github.com/ReactiveX/RxSwift/blob/main/assets/RxSwift_Logo.png?raw=true\" width=\"35%"
  },
  {
    "path": "Rx.playground/Pages/Combining_Operators.xcplaygroundpage/Contents.swift",
    "chars": 6864,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Connectable_Operators.xcplaygroundpage/Contents.swift",
    "chars": 4923,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Creating_and_Subscribing_to_Observables.xcplaygroundpage/Contents.swift",
    "chars": 7117,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Debugging_Operators.xcplaygroundpage/Contents.swift",
    "chars": 2190,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Enable_RxSwift.Resources.total.xcplaygroundpage/Contents.swift",
    "chars": 791,
    "preview": "//: [Back](@previous)\n/*:\n Follow these instructions to enable `RxSwift.Resources.total` in your project:\n #\n **CocoaPod"
  },
  {
    "path": "Rx.playground/Pages/Error_Handling_Operators.xcplaygroundpage/Contents.swift",
    "chars": 4093,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Filtering_and_Conditional_Operators.xcplaygroundpage/Contents.swift",
    "chars": 7767,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Introduction.xcplaygroundpage/Contents.swift",
    "chars": 4412,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Mathematical_and_Aggregate_Operators.xcplaygroundpage/Contents.swift",
    "chars": 2593,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Table_of_Contents.xcplaygroundpage/Contents.swift",
    "chars": 939,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Transforming_Operators.xcplaygroundpage/Contents.swift",
    "chars": 3750,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/TryYourself.xcplaygroundpage/Contents.swift",
    "chars": 679,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Pages/Working_with_Subjects.xcplaygroundpage/Contents.swift",
    "chars": 3706,
    "preview": "/*:\n > # IMPORTANT: To use **Rx.playground**:\n 1. Open **Rx.xcworkspace**.\n 1. Build the **RxExample-macOS** scheme (**P"
  },
  {
    "path": "Rx.playground/Sources/SupportCode.swift",
    "chars": 1063,
    "preview": "import Dispatch\n\n/**\n Encloses each code example in its own scope. Prints a `description` header and then executes the `"
  },
  {
    "path": "Rx.playground/SupportCode.remap",
    "chars": 3,
    "preview": "[\n]"
  },
  {
    "path": "Rx.playground/contents.xcplayground",
    "chars": 831,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<playground version='6.0' target-platform='macos' display-mode='"
  },
  {
    "path": "Rx.playground/playground.xcworkspace/contents.xcworkspacedata",
    "chars": 135,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef"
  },
  {
    "path": "Rx.xcodeproj/project.pbxproj",
    "chars": 401688,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 55;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "Rx.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 147,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:Rx.xcodeproj\">\n"
  },
  {
    "path": "Rx.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/91761072-433E-43DC-A058-545FB88C59EC.plist",
    "chars": 3803,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/996C445D-86F0-429E-92A9-44EBD3769290.plist",
    "chars": 3789,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/B553A9F9-C6F1-4009-9BDC-AC42F9D31E38.plist",
    "chars": 3789,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcbaselines/C8E8BA541E2C181A00A4AC2C.xcbaseline/Info.plist",
    "chars": 1969,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/AllTests-iOS.xcscheme",
    "chars": 1912,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/AllTests-macOS.xcscheme",
    "chars": 1996,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/AllTests-tvOS.xcscheme",
    "chars": 1958,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/RxBlocking.xcscheme",
    "chars": 2747,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/RxCocoa.xcscheme",
    "chars": 2729,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/RxRelay.xcscheme",
    "chars": 2729,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/RxSwift.xcscheme",
    "chars": 2729,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcodeproj/xcshareddata/xcschemes/RxTest.xcscheme",
    "chars": 2723,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "Rx.xcworkspace/contents.xcworkspacedata",
    "chars": 2595,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:Package.swift\""
  },
  {
    "path": "Rx.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "RxBlocking/BlockingObservable+Operators.swift",
    "chars": 5808,
    "preview": "//\n//  BlockingObservable+Operators.swift\n//  RxBlocking\n//\n//  Created by Krunoslav Zaher on 10/19/15.\n//  Copyright © "
  },
  {
    "path": "RxBlocking/BlockingObservable.swift",
    "chars": 622,
    "preview": "//\n//  BlockingObservable.swift\n//  RxBlocking\n//\n//  Created by Krunoslav Zaher on 10/19/15.\n//  Copyright © 2015 Kruno"
  },
  {
    "path": "RxBlocking/Info.plist",
    "chars": 816,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "RxBlocking/ObservableConvertibleType+Blocking.swift",
    "chars": 693,
    "preview": "//\n//  ObservableConvertibleType+Blocking.swift\n//  RxBlocking\n//\n//  Created by Krunoslav Zaher on 7/12/15.\n//  Copyrig"
  },
  {
    "path": "RxBlocking/README.md",
    "chars": 753,
    "preview": "RxBlocking \n============================================================\n\nSet of blocking operators for easy unit testin"
  },
  {
    "path": "RxBlocking/Resources.swift",
    "chars": 600,
    "preview": "//\n//  Resources.swift\n//  RxBlocking\n//\n//  Created by Krunoslav Zaher on 1/21/17.\n//  Copyright © 2017 Krunoslav Zaher"
  },
  {
    "path": "RxBlocking/RunLoopLock.swift",
    "chars": 2257,
    "preview": "//\n//  RunLoopLock.swift\n//  RxBlocking\n//\n//  Created by Krunoslav Zaher on 11/5/15.\n//  Copyright © 2015 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/Common/ControlTarget.swift",
    "chars": 2133,
    "preview": "//\n//  ControlTarget.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zahe"
  },
  {
    "path": "RxCocoa/Common/DelegateProxy.swift",
    "chars": 11572,
    "preview": "//\n//  DelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/14/15.\n//  Copyright © 2015 Krunoslav Zahe"
  },
  {
    "path": "RxCocoa/Common/DelegateProxyType.swift",
    "chars": 17643,
    "preview": "//\n//  DelegateProxyType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/15/15.\n//  Copyright © 2015 Krunoslav "
  },
  {
    "path": "RxCocoa/Common/Infallible+Bind.swift",
    "chars": 5319,
    "preview": "//\n//  Infallible+Bind.swift\n//  RxCocoa\n//\n//  Created by Shai Mishali on 27/08/2020.\n//  Copyright © 2020 Krunoslav Za"
  },
  {
    "path": "RxCocoa/Common/Observable+Bind.swift",
    "chars": 3952,
    "preview": "//\n//  Observable+Bind.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/29/15.\n//  Copyright © 2015 Krunoslav Za"
  },
  {
    "path": "RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift",
    "chars": 8185,
    "preview": "//\n//  RxCocoaObjCRuntimeError+Extensions.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 10/9/16.\n//  Copyright "
  },
  {
    "path": "RxCocoa/Common/RxTarget.swift",
    "chars": 734,
    "preview": "//\n//  RxTarget.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/12/15.\n//  Copyright © 2015 Krunoslav Zaher. Al"
  },
  {
    "path": "RxCocoa/Common/SectionedViewDataSourceType.swift",
    "chars": 624,
    "preview": "//\n//  SectionedViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 1/10/16.\n//  Copyright © 2016 "
  },
  {
    "path": "RxCocoa/Common/TextInput.swift",
    "chars": 1810,
    "preview": "//\n//  TextInput.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/12/16.\n//  Copyright © 2016 Krunoslav Zaher. A"
  },
  {
    "path": "RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift",
    "chars": 1681,
    "preview": "//\n//  KVORepresentable+CoreGraphics.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 20"
  },
  {
    "path": "RxCocoa/Foundation/KVORepresentable+Swift.swift",
    "chars": 1985,
    "preview": "//\n//  KVORepresentable+Swift.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 2015 Krun"
  },
  {
    "path": "RxCocoa/Foundation/KVORepresentable.swift",
    "chars": 632,
    "preview": "//\n//  KVORepresentable.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 2015 Krunoslav "
  },
  {
    "path": "RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift",
    "chars": 1932,
    "preview": "//\n//  NSObject+Rx+KVORepresentable.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 201"
  },
  {
    "path": "RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift",
    "chars": 1689,
    "preview": "//\n//  NSObject+Rx+RawRepresentable.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/9/15.\n//  Copyright © 2015"
  },
  {
    "path": "RxCocoa/Foundation/NSObject+Rx.swift",
    "chars": 18403,
    "preview": "//\n//  NSObject+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher."
  },
  {
    "path": "RxCocoa/Foundation/NotificationCenter+Rx.swift",
    "chars": 1026,
    "preview": "//\n//  NotificationCenter+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/2/15.\n//  Copyright © 2015 Krunosl"
  },
  {
    "path": "RxCocoa/Foundation/URLSession+Rx.swift",
    "chars": 8188,
    "preview": "//\n//  URLSession+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 3/23/15.\n//  Copyright © 2015 Krunoslav Zahe"
  },
  {
    "path": "RxCocoa/Info.plist",
    "chars": 816,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "RxCocoa/Runtime/_RX.m",
    "chars": 159,
    "preview": "//\n//  _RX.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights "
  },
  {
    "path": "RxCocoa/Runtime/_RXDelegateProxy.m",
    "chars": 4690,
    "preview": "//\n//  _RXDelegateProxy.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/4/15.\n//  Copyright © 2015 Krunoslav Zaher."
  },
  {
    "path": "RxCocoa/Runtime/_RXKVOObserver.m",
    "chars": 1468,
    "preview": "//\n//  _RXKVOObserver.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. "
  },
  {
    "path": "RxCocoa/Runtime/_RXObjCRuntime.m",
    "chars": 48935,
    "preview": "//\n//  _RXObjCRuntime.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. "
  },
  {
    "path": "RxCocoa/Runtime/include/RxCocoaRuntime.h",
    "chars": 469,
    "preview": "//\n//  RxCocoaRuntime.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. "
  },
  {
    "path": "RxCocoa/Runtime/include/_RX.h",
    "chars": 3956,
    "preview": "//\n//  _RX.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights "
  },
  {
    "path": "RxCocoa/Runtime/include/_RXDelegateProxy.h",
    "chars": 740,
    "preview": "//\n//  _RXDelegateProxy.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/4/15.\n//  Copyright © 2015 Krunoslav Zaher."
  },
  {
    "path": "RxCocoa/Runtime/include/_RXKVOObserver.h",
    "chars": 800,
    "preview": "//\n//  _RXKVOObserver.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. "
  },
  {
    "path": "RxCocoa/Runtime/include/_RXObjCRuntime.h",
    "chars": 4071,
    "preview": "//\n//  _RXObjCRuntime.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. "
  },
  {
    "path": "RxCocoa/RxCocoa.h",
    "chars": 494,
    "preview": "//\n//  RxCocoa.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rig"
  },
  {
    "path": "RxCocoa/RxCocoa.swift",
    "chars": 4746,
    "preview": "//\n//  RxCocoa.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All"
  },
  {
    "path": "RxCocoa/Traits/ControlEvent.swift",
    "chars": 2560,
    "preview": "//\n//  ControlEvent.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/28/15.\n//  Copyright © 2015 Krunoslav Zaher"
  },
  {
    "path": "RxCocoa/Traits/ControlProperty.swift",
    "chars": 4897,
    "preview": "//\n//  ControlProperty.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/28/15.\n//  Copyright © 2015 Krunoslav Za"
  },
  {
    "path": "RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift",
    "chars": 494,
    "preview": "//\n//  BehaviorRelay+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 10/7/17.\n//  Copyright © 2017 Krunosl"
  },
  {
    "path": "RxCocoa/Traits/Driver/ControlEvent+Driver.swift",
    "chars": 632,
    "preview": "//\n//  ControlEvent+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunosla"
  },
  {
    "path": "RxCocoa/Traits/Driver/ControlProperty+Driver.swift",
    "chars": 644,
    "preview": "//\n//  ControlProperty+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Kruno"
  },
  {
    "path": "RxCocoa/Traits/Driver/Driver+Subscription.swift",
    "chars": 8674,
    "preview": "//\n//  Driver+Subscription.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunosla"
  },
  {
    "path": "RxCocoa/Traits/Driver/Driver.swift",
    "chars": 2136,
    "preview": "//\n//  Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/26/16.\n//  Copyright © 2016 Krunoslav Zaher. All "
  },
  {
    "path": "RxCocoa/Traits/Driver/Infallible+Driver.swift",
    "chars": 430,
    "preview": "//\n//  Infallible+Driver.swift\n//  RxCocoa\n//\n//  Created by Anton Siliuk on 14/02/2022.\n//  Copyright © 2022 Krunoslav "
  },
  {
    "path": "RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift",
    "chars": 1715,
    "preview": "//\n//  ObservableConvertibleType+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © "
  },
  {
    "path": "RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift",
    "chars": 2010,
    "preview": "//\n//  ObservableConvertibleType+SharedSequence.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/1/17.\n//  Copy"
  },
  {
    "path": "RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift",
    "chars": 1800,
    "preview": "//\n//  SchedulerType+SharedSequence.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/27/17.\n//  Copyright © 2017"
  },
  {
    "path": "RxCocoa/Traits/SharedSequence/SharedSequence+Concurrency.swift",
    "chars": 1295,
    "preview": "//\n//  SharedSequence+Concurrency.swift\n//  RxCocoa\n//\n//  Created by Shai Mishali on 22/09/2021.\n//  Copyright © 2021 K"
  },
  {
    "path": "RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift",
    "chars": 41652,
    "preview": "// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project\n//\n//  SharedSequence+Operators+a"
  },
  {
    "path": "RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.tt",
    "chars": 5001,
    "preview": "//\n//  SharedSequence+Operators+arity.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 10/14/15.\n//  Copyright © 2"
  },
  {
    "path": "RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift",
    "chars": 28236,
    "preview": "//\n//  SharedSequence+Operators.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Kru"
  },
  {
    "path": "RxCocoa/Traits/SharedSequence/SharedSequence.swift",
    "chars": 8720,
    "preview": "//\n//  SharedSequence.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/27/15.\n//  Copyright © 2015 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/Traits/Signal/ControlEvent+Signal.swift",
    "chars": 632,
    "preview": "//\n//  ControlEvent+Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/1/17.\n//  Copyright © 2017 Krunosla"
  },
  {
    "path": "RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift",
    "chars": 1716,
    "preview": "//\n//  ObservableConvertibleType+Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © "
  },
  {
    "path": "RxCocoa/Traits/Signal/PublishRelay+Signal.swift",
    "chars": 492,
    "preview": "//\n//  PublishRelay+Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 12/28/15.\n//  Copyright © 2017 Krunosl"
  },
  {
    "path": "RxCocoa/Traits/Signal/Signal+Subscription.swift",
    "chars": 6933,
    "preview": "//\n//  Signal+Subscription.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunosla"
  },
  {
    "path": "RxCocoa/Traits/Signal/Signal.swift",
    "chars": 1608,
    "preview": "//\n//  Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/26/16.\n//  Copyright © 2016 Krunoslav Zaher. All "
  },
  {
    "path": "RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift",
    "chars": 3349,
    "preview": "//\n//  RxCollectionViewReactiveArrayDataSource.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyr"
  },
  {
    "path": "RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift",
    "chars": 2832,
    "preview": "//\n//  RxPickerViewAdapter.swift\n//  RxCocoa\n//\n//  Created by Sergey Shulga on 12/07/2017.\n//  Copyright © 2017 Krunosl"
  },
  {
    "path": "RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift",
    "chars": 2836,
    "preview": "//\n//  RxTableViewReactiveArrayDataSource.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/26/15.\n//  Copyright "
  },
  {
    "path": "RxCocoa/iOS/Events/ItemEvents.swift",
    "chars": 471,
    "preview": "//\n//  ItemEvents.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/20/15.\n//  Copyright © 2015 Krunoslav Zaher. "
  },
  {
    "path": "RxCocoa/iOS/NSTextStorage+Rx.swift",
    "chars": 1210,
    "preview": "//\n//  NSTextStorage+Rx.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 12/30/15.\n//  Copyright © 2015 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift",
    "chars": 788,
    "preview": "//\n//  RxCollectionViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyright © 20"
  },
  {
    "path": "RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift",
    "chars": 707,
    "preview": "//\n//  RxPickerViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Sergey Shulga on 05/07/2017.\n//  Copyright © 2017 "
  },
  {
    "path": "RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift",
    "chars": 738,
    "preview": "//\n//  RxTableViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/26/15.\n//  Copyright © 2015 Kr"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxCollectionViewDataSourcePrefetchingProxy.swift",
    "chars": 3191,
    "preview": "//\n//  RxCollectionViewDataSourcePrefetchingProxy.swift\n//  RxCocoa\n//\n//  Created by Rowan Livingstone on 2/15/18.\n//  "
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift",
    "chars": 2817,
    "preview": "//\n//  RxCollectionViewDataSourceProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyright © 2"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift",
    "chars": 836,
    "preview": "//\n//  RxCollectionViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyright © 201"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift",
    "chars": 1242,
    "preview": "//\n//  RxNavigationControllerDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Diogo on 13/04/17.\n//  Copyright © 2017 K"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift",
    "chars": 2420,
    "preview": "//\n//  RxPickerViewDataSourceProxy.swift\n//  RxCocoa\n//\n//  Created by Sergey Shulga on 05/07/2017.\n//  Copyright © 2017"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift",
    "chars": 995,
    "preview": "//\n//  RxPickerViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 5/12/16.\n//  Copyright © 2016 Kruno"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift",
    "chars": 2802,
    "preview": "//\n//  RxScrollViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/19/15.\n//  Copyright © 2015 Kr"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift",
    "chars": 1053,
    "preview": "//\n//  RxSearchBarDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/4/15.\n//  Copyright © 2015 Krun"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift",
    "chars": 1171,
    "preview": "//\n//  RxSearchControllerDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 3/17/16.\n//  Copyright © 2016"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift",
    "chars": 1093,
    "preview": "//\n//  RxTabBarControllerDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Yusuke Kita on 2016/12/07.\n//  Copyright © 20"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift",
    "chars": 1367,
    "preview": "//\n//  RxTabBarDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Jesse Farless on 5/14/16.\n//  Copyright © 2016 Krunosla"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxTableViewDataSourcePrefetchingProxy.swift",
    "chars": 3011,
    "preview": "//\n//  RxTableViewDataSourcePrefetchingProxy.swift\n//  RxCocoa\n//\n//  Created by Rowan Livingstone on 2/15/18.\n//  Copyr"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift",
    "chars": 2470,
    "preview": "//\n//  RxTableViewDataSourceProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/15/15.\n//  Copyright © 2015 K"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift",
    "chars": 706,
    "preview": "//\n//  RxTableViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/15/15.\n//  Copyright © 2015 Kru"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift",
    "chars": 1027,
    "preview": "//\n//  RxTextStorageDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 12/30/15.\n//  Copyright © 2015 Kru"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift",
    "chars": 1334,
    "preview": "//\n//  RxTextViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Yuta ToKoRo on 7/19/15.\n//  Copyright © 2015 Krunosla"
  },
  {
    "path": "RxCocoa/iOS/Proxies/RxWKNavigationDelegateProxy.swift",
    "chars": 1309,
    "preview": "//\n//  RxWKNavigationDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Giuseppe Lanza on 14/02/2020.\n//  Copyright © 202"
  },
  {
    "path": "RxCocoa/iOS/UIActivityIndicatorView+Rx.swift",
    "chars": 643,
    "preview": "//\n//  UIActivityIndicatorView+Rx.swift\n//  RxCocoa\n//\n//  Created by Ivan Persidskiy on 02/12/15.\n//  Copyright © 2015 "
  },
  {
    "path": "RxCocoa/iOS/UIApplication+Rx.swift",
    "chars": 4450,
    "preview": "//\n//  UIApplication+Rx.swift\n//  RxCocoa\n//\n//  Created by Mads Bøgeskov on 18/01/16.\n//  Copyright © 2016 Krunoslav Za"
  },
  {
    "path": "RxCocoa/iOS/UIBarButtonItem+Rx.swift",
    "chars": 1789,
    "preview": "//\n//  UIBarButtonItem+Rx.swift\n//  RxCocoa\n//\n//  Created by Daniel Tartaglia on 5/31/15.\n//  Copyright © 2015 Krunosla"
  },
  {
    "path": "RxCocoa/iOS/UIButton+Rx.swift",
    "chars": 1966,
    "preview": "//\n//  UIButton+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 3/28/15.\n//  Copyright © 2015 Krunoslav Zaher."
  },
  {
    "path": "RxCocoa/iOS/UICollectionView+Rx.swift",
    "chars": 16155,
    "preview": "//\n//  UICollectionView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 4/2/15.\n//  Copyright © 2015 Krunoslav"
  },
  {
    "path": "RxCocoa/iOS/UIControl+Rx.swift",
    "chars": 2894,
    "preview": "//\n//  UIControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Daniel Tartaglia on 5/23/15.\n//  Copyright © 2015 Krunoslav Zahe"
  },
  {
    "path": "RxCocoa/iOS/UIDatePicker+Rx.swift",
    "chars": 1075,
    "preview": "//\n//  UIDatePicker+Rx.swift\n//  RxCocoa\n//\n//  Created by Daniel Tartaglia on 5/31/15.\n//  Copyright © 2015 Krunoslav Z"
  },
  {
    "path": "RxCocoa/iOS/UIGestureRecognizer+Rx.swift",
    "chars": 1898,
    "preview": "//\n//  UIGestureRecognizer+Rx.swift\n//  RxCocoa\n//\n//  Created by Carlos García on 10/6/15.\n//  Copyright © 2015 Krunosl"
  },
  {
    "path": "RxCocoa/iOS/UINavigationController+Rx.swift",
    "chars": 1845,
    "preview": "//\n//  UINavigationController+Rx.swift\n//  RxCocoa\n//\n//  Created by Diogo on 13/04/17.\n//  Copyright © 2017 Krunoslav Z"
  },
  {
    "path": "RxCocoa/iOS/UIPickerView+Rx.swift",
    "chars": 8126,
    "preview": "//\n//  UIPickerView+Rx.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 5/12/16.\n//  Copyright © 2016 Krunoslav Zaher"
  },
  {
    "path": "RxCocoa/iOS/UIRefreshControl+Rx.swift",
    "chars": 612,
    "preview": "//\n//  UIRefreshControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Yosuke Ishikawa on 1/31/16.\n//  Copyright © 2016 Krunosla"
  },
  {
    "path": "RxCocoa/iOS/UIScrollView+Rx.swift",
    "chars": 5814,
    "preview": "//\n//  UIScrollView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 4/3/15.\n//  Copyright © 2015 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/iOS/UISearchBar+Rx.swift",
    "chars": 5179,
    "preview": "//\n//  UISearchBar+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 3/28/15.\n//  Copyright © 2015 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/iOS/UISearchController+Rx.swift",
    "chars": 1727,
    "preview": "//\n//  UISearchController+Rx.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 3/17/16.\n//  Copyright © 2016 Krunoslav"
  },
  {
    "path": "RxCocoa/iOS/UISegmentedControl+Rx.swift",
    "chars": 1593,
    "preview": "//\n//  UISegmentedControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Carlos García on 8/7/15.\n//  Copyright © 2015 Krunoslav"
  },
  {
    "path": "RxCocoa/iOS/UISlider+Rx.swift",
    "chars": 579,
    "preview": "//\n//  UISlider+Rx.swift\n//  RxCocoa\n//\n//  Created by Alexander van der Werff on 28/05/15.\n//  Copyright © 2015 Krunosl"
  },
  {
    "path": "RxCocoa/iOS/UIStepper+Rx.swift",
    "chars": 572,
    "preview": "//\n//  UIStepper+Rx.swift\n//  RxCocoa\n//\n//  Created by Yuta ToKoRo on 9/1/15.\n//  Copyright © 2015 Krunoslav Zaher. All"
  },
  {
    "path": "RxCocoa/iOS/UISwitch+Rx.swift",
    "chars": 885,
    "preview": "//\n//  UISwitch+Rx.swift\n//  RxCocoa\n//\n//  Created by Carlos García on 8/7/15.\n//  Copyright © 2015 Krunoslav Zaher. Al"
  },
  {
    "path": "RxCocoa/iOS/UITabBar+Rx.swift",
    "chars": 2911,
    "preview": "//\n//  UITabBar+Rx.swift\n//  RxCocoa\n//\n//  Created by Jesse Farless on 5/13/16.\n//  Copyright © 2016 Krunoslav Zaher. A"
  },
  {
    "path": "RxCocoa/iOS/UITabBarController+Rx.swift",
    "chars": 2861,
    "preview": "//\n//  UITabBarController+Rx.swift\n//  RxCocoa\n//\n//  Created by Yusuke Kita on 2016/12/07.\n//  Copyright © 2016 Krunosl"
  },
  {
    "path": "RxCocoa/iOS/UITableView+Rx.swift",
    "chars": 16273,
    "preview": "//\n//  UITableView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 4/2/15.\n//  Copyright © 2015 Krunoslav Zahe"
  },
  {
    "path": "RxCocoa/iOS/UITextField+Rx.swift",
    "chars": 1712,
    "preview": "//\n//  UITextField+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/iOS/UITextView+Rx.swift",
    "chars": 4647,
    "preview": "//\n//  UITextView+Rx.swift\n//  RxCocoa\n//\n//  Created by Yuta ToKoRo on 7/19/15.\n//  Copyright © 2015 Krunoslav Zaher. A"
  },
  {
    "path": "RxCocoa/iOS/WKWebView+Rx.swift",
    "chars": 1926,
    "preview": "//\n//  WKWebView+Rx.swift\n//  RxCocoa\n//\n//  Created by Giuseppe Lanza on 14/02/2020.\n//  Copyright © 2020 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/macOS/NSButton+Rx.swift",
    "chars": 699,
    "preview": "//\n//  NSButton+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/17/15.\n//  Copyright © 2015 Krunoslav Zaher."
  },
  {
    "path": "RxCocoa/macOS/NSControl+Rx.swift",
    "chars": 2639,
    "preview": "//\n//  NSControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/31/15.\n//  Copyright © 2015 Krunoslav Zaher"
  },
  {
    "path": "RxCocoa/macOS/NSSlider+Rx.swift",
    "chars": 580,
    "preview": "//\n//  NSSlider+Rx.swift\n//  RxCocoa\n//\n//  Created by Junior B. on 24/05/15.\n//  Copyright © 2015 Krunoslav Zaher. All "
  },
  {
    "path": "RxCocoa/macOS/NSTextField+Rx.swift",
    "chars": 2621,
    "preview": "//\n//  NSTextField+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/17/15.\n//  Copyright © 2015 Krunoslav Zah"
  },
  {
    "path": "RxCocoa/macOS/NSTextView+Rx.swift",
    "chars": 2861,
    "preview": "//\n//  NSTextView+Rx.swift\n//  RxCocoa\n//\n//  Created by Cee on 8/5/18.\n//  Copyright © 2018 Krunoslav Zaher. All rights"
  },
  {
    "path": "RxCocoa/macOS/NSView+Rx.swift",
    "chars": 415,
    "preview": "//\n//  NSView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 12/6/15.\n//  Copyright © 2015 Krunoslav Zaher. A"
  },
  {
    "path": "RxExample/Extensions/CLLocationManager+Rx.swift",
    "chars": 7125,
    "preview": "//\n//  CLLocationManager+Rx.swift\n//  RxExample\n//\n//  Created by Carlos García on 8/7/15.\n//  Copyright © 2015 Krunosla"
  },
  {
    "path": "RxExample/Extensions/RxCLLocationManagerDelegateProxy.swift",
    "chars": 1546,
    "preview": "//\n//  RxCLLocationManagerDelegateProxy.swift\n//  RxExample\n//\n//  Created by Carlos García on 8/7/15.\n//  Copyright © 2"
  },
  {
    "path": "RxExample/Extensions/RxImagePickerDelegateProxy.swift",
    "chars": 456,
    "preview": "//\n//  RxImagePickerDelegateProxy.swift\n//  RxExample\n//\n//  Created by Segii Shulga on 1/4/16.\n//  Copyright © 2016 Kru"
  },
  {
    "path": "RxExample/Extensions/UIImagePickerController+Rx.swift",
    "chars": 1226,
    "preview": "//\n//  UIImagePickerController+Rx.swift\n//  RxExample\n//\n//  Created by Segii Shulga on 1/4/16.\n//  Copyright © 2016 Kru"
  },
  {
    "path": "RxExample/Playgrounds/Info.plist",
    "chars": 836,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  }
]

// ... and 625 more files (download for full content)

About this extraction

This page contains the full source code of the ReactiveX/RxSwift GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 825 files (7.8 MB), approximately 2.1M tokens, and a symbol index with 53 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!