{"id":1835,"url":"https://github.com/STDevTM/STDevRxExt","last_synced_at":"2025-08-02T04:32:40.980Z","repository":{"id":53520757,"uuid":"127521531","full_name":"STDevTM/STDevRxExt","owner":"STDevTM","description":"STDevRxExt contains some extension functions for RxSwift and RxCocoa which makes our live easy.","archived":false,"fork":false,"pushed_at":"2021-03-26T10:18:21.000Z","size":73,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-10T09:18:03.102Z","etag":null,"topics":["cast-extensions","extensions","filter-extensions","reactivex","rxcocoa","rxswift","swift4"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/STDevTM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-31T10:14:36.000Z","updated_at":"2023-08-02T09:15:34.000Z","dependencies_parsed_at":"2022-09-03T12:00:31.227Z","dependency_job_id":null,"html_url":"https://github.com/STDevTM/STDevRxExt","commit_stats":null,"previous_names":["stdevteam/stdevrxext"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/STDevTM/STDevRxExt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STDevTM%2FSTDevRxExt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STDevTM%2FSTDevRxExt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STDevTM%2FSTDevRxExt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STDevTM%2FSTDevRxExt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/STDevTM","download_url":"https://codeload.github.com/STDevTM/STDevRxExt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STDevTM%2FSTDevRxExt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334618,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cast-extensions","extensions","filter-extensions","reactivex","rxcocoa","rxswift","swift4"],"created_at":"2024-01-05T20:15:56.931Z","updated_at":"2025-08-02T04:32:40.649Z","avatar_url":"https://github.com/STDevTM.png","language":"Swift","readme":"# STDevRxExt\n\n[![CI Status](https://github.com/STDevTM/STDevRxExt/workflows/STDevRxExt/badge.svg?branch=master)](https://github.com/STDevTM/STDevRxExt/actions)\n[![Platform](https://img.shields.io/cocoapods/p/STDevRxExt.svg?style=flat)](http://cocoapods.org/pods/STDevRxExt)\n[![Cocoapods](https://img.shields.io/cocoapods/v/STDevRxExt.svg?style=flat)](http://cocoapods.org/pods/STDevRxExt)\n[![SPM compatible](https://img.shields.io/badge/SPM-Compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)\n[![codecov](https://codecov.io/gh/STDevTM/STDevRxExt/branch/master/graph/badge.svg)](https://codecov.io/gh/STDevTM/STDevRxExt)\n[![License](https://img.shields.io/cocoapods/l/STDevRxExt.svg?style=flat)](http://cocoapods.org/pods/STDevRxExt)\n\n## Example\n\nTo run the [Example.playground](Example/Example.playground), clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n* iOS 9.0+\n* tvOS 9.0+\n* macOS 10.10+\n* watchOS 3.0+\n* Swift 5.0+\n* Xcode 11+\n\n## Installation\n\n\u003cdetails\u003e\n\u003csummary\u003eCocoaPods\u003c/summary\u003e\n\u003c/br\u003e\n\u003cp\u003eSTDevRxExt is available through \u003ca href=\"http://cocoapods.org\"\u003eCocoaPods\u003c/a\u003e. To install it, simply add the following line to your \u003ccode\u003ePodfile\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode class=\"ruby language-ruby\"\u003epod 'STDevRxExt'\u003c/code\u003e\u003c/pre\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSwift Package Manager\u003c/summary\u003e\n\u003c/br\u003e\n\u003cp\u003eYou can use \u003ca href=\"https://swift.org/package-manager\"\u003eThe Swift Package Manager\u003c/a\u003e to install \u003ccode\u003eSTDevRxExt\u003c/code\u003e by adding the proper description to your \u003ccode\u003ePackage.swift\u003c/code\u003e file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode class=\"swift language-swift\"\u003eimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    targets: [],\n    dependencies: [\n        .package(url: \"https://github.com/STDevTM/STDevRxExt.git\", from: \"1.0.0\")\n    ]\n)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNext, add \u003ccode\u003eSTDevRxExt\u003c/code\u003e to your targets dependencies like so:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"swift language-swift\"\u003e.target(\n    name: \"YOUR_TARGET_NAME\",\n    dependencies: [\n        \"STDevRxExt\",\n    ]\n),\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThen run \u003ccode\u003eswift package update\u003c/code\u003e.\u003c/p\u003e\n\n\u003c/details\u003e\n\n\n## List of All Extensions\n\n* [Filter Extensions](#filter-extensions)\n* [Map Extensions](#map-extensions)\n* [Cast Extensions](#cast_extensions)\n* [Other Extensions](#other_extensions)\n* _more coming soon_\n\n### Filter Extensions\n\nAllow only `true` elements from `Observable\u003cBool\u003e`:\n\n```swift\nlet disposeBag = DisposeBag()\n\nObservable.of(true, false, false, true, true)\n    .allowTrue()\n    .subscribe(onNext: { print($0) })\n    .disposed(by: disposeBag)\n```\n\nOutput will be:\n\n```text\ntrue\ntrue\ntrue\n```\n\nYou can use `allowTrue` on `Bool?` as well. In this case `nil` elements will be ignored:\n\n```swift\nlet disposeBag = DisposeBag()\n\nObservable.of(true, false, nil, true, nil, true)\n    .allowTrue()\n    .subscribe(onNext: { print($0) })\n    .disposed(by: disposeBag)\n```\n\nOutput will be:\n\n```text\ntrue\ntrue\ntrue\n```\n\nIf you prefer to allow `nil` elements as well then you can use `allowTrueOrNil` like this:\n\n```swift\nlet disposeBag = DisposeBag()\n\nObservable.of(true, false, nil, true, nil, true, false)\n    .allowTrueOrNil()\n    .subscribe(onNext: { print($0) })\n    .disposed(by: disposeBag)\n```\n\nOutput will be:\n\n```text\ntrue\ntrue\ntrue\ntrue\ntrue\n```\n\n### Map Extensions\n\nYou can map every element in sequence with provided value.\n\n```swift\nlet disposeBag = DisposeBag()\n\nObservable.of(1, 5, 7, 8)\n    .map(to: \"ping\")\n    .subscribe(onNext: { print($0) })\n    .disposed(by: disposeBag)\n```\n\nOutput will be:\n\n```text\nping\nping\nping\nping\n```\n\nYou can map every element in sequence by procided Key Path.\n\n```swift\nlet disposeBag = DisposeBag()\n\n   let observable = Observable.of(\n            Book(title: \"Twenty Thousand Leagues Under the Sea\", author: Author(\"Jules\", \"Verne\")),\n            Book(title: \"Hamlet\", author: Author(\"William\", \"Shakespeare\")),\n            Book(title: \"Hearts of Three\", author: Author(\"Jack\", \"London\"))\n        )\n\n    observable\n        .map(at: \\.title)\n        .subscribe(onNext: { print($0) })\n        .disposed(by: disposeBag)\n\n    observable\n        .map(at: \\.author.firstName)\n        .subscribe(onNext: { print($0) })\n        .disposed(by: disposeBag)\n```\n\nOutput will be:\n\n```text\nTwenty Thousand Leagues Under the Sea\nHamlet\nHearts of Three\n\nJules\nWilliam\nJack\n```\n\n### Cast Extensions\n\nYou can do downcast elements in sequence using `cast(to:)`.\n\n```swift\nlet disposeBag = DisposeBag()\n\nObservable\u003cCustomStringConvertible\u003e.of(\"1\", \"5\", \"7\", \"8\")\n    .cast(to: String.self)\n    .subscribe(onNext: { print($0) })\n    .disposed(by: disposeBag)\n```\n\nOutput will be:\n\n```text\nOptional(\"1\")\nOptional(\"5\")\nOptional(\"7\")\nOptional(\"8\")\n```\n\nIn order to do force downcast use `forceCast(to:)` liek this:\n\n```swift\nlet disposeBag = DisposeBag()\n\nObservable\u003cCustomStringConvertible\u003e.of(\"1\", \"5\", \"7\", \"8\")\n    .forceCast(to: String.self)\n    .subscribe(onNext: { print($0) })\n    .disposed(by: disposeBag)\n```\n\nOutput will be:\n\n```text\n1\n5\n7\n8\n```\n\nIn case of downcast exception it will return `Observable.error(RxCastError.castFailed)`.\n\nAllow extension functions can be used on `Driver` as well, except `forceCast(to:)`.\n\n### Other Extensions\n\nSometimes we need to update some subject or observer on each `next` event of `Observable` or `Driver`. For example:\n\n```swift\nrequest\n    .do(onNext: { [weak self] _ in\n        self?.inProgress.onNext(true)\n    })\n    .flatMap {\n        service.doRequest($0)\n    }\n    .do(onNext: { [weak self] _ in\n        self?.inProgress.onNext(false)\n    })\n    .subscribe(onNext: { response in\n        dump(response)\n    })\n    .disposed(by: disposeBag)\n```\n\nYou can use `update(_:with:)` method for shorting code like this:\n\n```swift\nrequest\n    .update(inProgress, with: true)\n    .flatMap {\n        service.doRequest($0)\n    }\n    .update(inProgress, with: false)\n    .subscribe(onNext: { response in\n        dump(response)\n    })\n    .disposed(by: disposeBag)\n```\n\n## Author\n\nTigran Hambardzumyan, tigran@stdevmail.com\n\n## Support\n\nFeel free to [open issues](https://github.com/STDevTM/STDevRxExt/issues/new) with any suggestions, bug reports, feature requests, questions.\n\n## Let us know!\n\nWe’d be really happy if you sent us links to your projects where you use our component. Just send an email to developer@stdevmail.com And do let us know if you have any questions or suggestion.\n\n## License\n\nSTDevRxExt is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["Reactive Programming"],"sub_categories":["Other Parsing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSTDevTM%2FSTDevRxExt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSTDevTM%2FSTDevRxExt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSTDevTM%2FSTDevRxExt/lists"}