{"id":15034150,"url":"https://github.com/combinecommunity/rxcombine","last_synced_at":"2025-02-24T15:30:56.789Z","repository":{"id":34931271,"uuid":"191436499","full_name":"CombineCommunity/RxCombine","owner":"CombineCommunity","description":"Bi-directional type bridging between RxSwift and Apple's Combine framework","archived":false,"fork":false,"pushed_at":"2024-04-21T15:21:37.000Z","size":936,"stargazers_count":1040,"open_issues_count":10,"forks_count":92,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-02-17T16:03:29.819Z","etag":null,"topics":["applecombine","combine","frp","ios","linux","macos","reactive","reactive-programming","reactive-streams","rxswift","swift","watchos"],"latest_commit_sha":null,"homepage":null,"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/CombineCommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-11T19:25:48.000Z","updated_at":"2025-02-13T20:44:39.000Z","dependencies_parsed_at":"2024-06-18T22:35:27.752Z","dependency_job_id":"cde7538b-f65b-4e80-a5a1-7394dc9d17b9","html_url":"https://github.com/CombineCommunity/RxCombine","commit_stats":{"total_commits":43,"total_committers":7,"mean_commits":6.142857142857143,"dds":0.2325581395348837,"last_synced_commit":"010ef6fcca69cbbabe8ed7f52b31485b70c3a22d"},"previous_names":["freak4pc/rxcombine"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CombineCommunity%2FRxCombine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CombineCommunity%2FRxCombine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CombineCommunity%2FRxCombine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CombineCommunity%2FRxCombine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CombineCommunity","download_url":"https://codeload.github.com/CombineCommunity/RxCombine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240503537,"owners_count":19812015,"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","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":["applecombine","combine","frp","ios","linux","macos","reactive","reactive-programming","reactive-streams","rxswift","swift","watchos"],"created_at":"2024-09-24T20:24:05.557Z","updated_at":"2025-02-24T15:30:56.332Z","avatar_url":"https://github.com/CombineCommunity.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RxCombine\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/freak4pc/RxCombine/raw/main/Resources/logo.png\" width=\"220\"\u003e\n\u003cbr /\u003e\u003cbr /\u003e\n\u003ca href=\"https://actions-badge.atrox.dev/CombineCommunity/RxCombine/goto\" target=\"_blank\" alt=\"Build Status\" title=\"Build Status\"\u003e\u003cimg src=\"https://github.com/CombineCommunity/RxCombine/workflows/RxCombine/badge.svg?branch=main\" alt=\"Build Status\" title=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/CombineCommunity/RxCombine\" target=\"_blank\" alt=\"Code Coverage for RxCombine on codecov\" title=\"Code Coverage for RxCombine on codecov\"\u003e\u003cimg src=\"https://codecov.io/gh/CombineCommunity/RxCombine/branch/main/graph/badge.svg\" alt=\"Code Coverage for RxCombine on codecov\" title=\"Code Coverage for RxCombine on codecov\"/\u003e\u003c/a\u003e\n\u003cbr /\u003e\n\u003ca href=\"https://cocoapods.org/pods/RxCombine\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/RxCombine.svg?1\" alt=\"RxCombine supports CocoaPods\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/apple/swift-package-manager\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg\" alt=\"RxCombine supports Swift Package Manager (SPM)\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Carthage/Carthage\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\" alt=\"RxCombine supports Carthage\"\u003e\u003c/a\u003e\n\u003cbr /\u003e\n\u003cimg src=\"https://img.shields.io/badge/platforms-iOS%2013.0%20%7C%20macOS%2010.15%20%7C%20tvOS%2013.0%20%7C%20watchOS%206%20%7C%20Linux-333333.svg\" /\u003e\n\u003c/p\u003e\n\nRxCombine provides bi-directional type bridging between [RxSwift](https://github.com/ReactiveX/RxSwift.git) and Apple's [Combine](https://developer.apple.com/documentation/combine) framework.\n\n**Note**: This is highly experimental, and basically just a quickly-put-together PoC. I gladly accept PRs, ideas, opinions, or improvements. Thank you ! :)\n\n## Basic Examples\n\nCheck out the Example App in the **ExampleApp** folder. Run `pod install` before opening the project.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/freak4pc/RxCombine/raw/main/Resources/example.gif\" width=\"400\"\u003e\u003c/p\u003e\n\n## Installation\n\n### CocoaPods\n\nAdd the following line to your **Podfile**:\n\n```rb\npod 'RxCombine'\n```\n\n### Swift Package Manager\n\nAdd the following dependency to your **Package.swift** file:\n\n```swift\n.package(url: \"https://github.com/CombineCommunity/RxCombine.git\", from: \"1.6.0\")\n```\n\n### Carthage\n\nCarthage support is offered as a prebuilt binary.\n\nAdd the following to your **Cartfile**:\n\n```\ngithub \"CombineCommunity/RxCombine\"\n```\n\n## I want to ...\n\n### Use RxSwift in my Combine code\n\nRxCombine provides several helpers and conversions to help you bridge your existing RxSwift types to Combine.\n\n**Note**: If you want to learn more about the parallel operators in Combine from RxSwift, check out my [RxSwift to Combine Cheat Sheet](https://medium.com/gett-engineering/rxswift-to-apples-combine-cheat-sheet-e9ce32b14c5b) *(or on [GitHub](https://github.com/freak4pc/rxswift-to-combine-cheatsheet))*.\n\n* `Observable` (and other `ObservableConvertibleType`s) have a  `publisher` property which returns a `AnyPublisher\u003cElement, Swift.Error\u003e` mirroring the underlying `Observable`.\n\n```swift\nlet observable = Observable.just(\"Hello, Combine!\")\n\nobservable\n    .publisher // AnyPublisher\u003cString, Swift.Error\u003e\n    .sink(receiveValue: { value in ... })\n```\n\n* `Relays` and `Subjects` can be converted to their Combine-counterparts using the `toCombine()` method, so you can use them as if they are regular Combine Subjects, and have them connected to your existing subjects.\n\n```swift\nlet relay = BehaviorRelay\u003cInt\u003e(value: 0)\n\n// Use `sink` on RxSwift relay\nlet combineSubject = relay.toCombine()\n\ncombineSubject.sink(receiveValue: { value in ... })\n\n// Use `send(value:)` on RxSwift relay\ncombineSubject.send(1)\ncombineSubject.send(2)\ncombineSubject.send(3)\n```\n\n### Use Combine in my RxSwift code\n\nRxCombine provides several helpers and conversions to help you bridge Combine code and types into your existing RxSwift codebase.\n\n* `Publisher`s have a `asObservable()` method, providing an `Observable\u003cOutput\u003e` mirroring the underlying `Publisher`.\n```swift\n// A publisher publishing numbers from 0 to 100.\nlet publisher = AnyPublisher\u003cInt, Swift.Error\u003e { subscriber in\n    (0...100).forEach { _ = subscriber.receive($0) }\n    subscriber.receive(completion: .finished)\n}\n\npublisher\n    .asObservable() // Observable\u003cInt\u003e\n    .subscribe(onNext: { num in ... })\n```\n\n* `PassthroughSubject` and `CurrentValueSubject` both have a `asAnyObserver()` method which returns a `AnyObserver\u003cOutput\u003e`. Binding to it from your RxSwift code pushes the events to the underlying Combine Subject.\n\n```swift\n// Combine Subject\nlet subject = PassthroughSubject\u003cInt, Swift.Error\u003e()\n\n// A publisher publishing numbers from 0 to 100.\nlet publisher = AnyPublisher\u003cInt, Swift.Error\u003e { subscriber in\n    (0...100).forEach { _ = subscriber.receive($0) }\n    subscriber.receive(completion: .finished)\n}\n\n// Convert a Publisher to an Observable and bind it\n// back to a Combine Subject 🤯🤯🤯\npublisher.asObservable()\n         .bind(to: subject)\n\nObservable.of(10, 5, 7, 4, 1,  6)\n          .subscribe(subject.asAnyObserver())\n```\n\n## Future ideas \n\n* ~~Add CI / Tests~~\n* ~~Carthage Support~~\n* Bridge SwiftUI with RxCocoa/RxSwift\n* ~~Partial Backpressure support, perhaps?~~\n* ... your ideas? :)\n\n## License\n\nMIT, of course ;-) See the [LICENSE](LICENSE) file. \n\nThe Apple logo and the Combine framework are property of Apple Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcombinecommunity%2Frxcombine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcombinecommunity%2Frxcombine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcombinecommunity%2Frxcombine/lists"}