Swiftpack.co - cx-org/CXBridge as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by cx-org.
cx-org/CXBridge v0.0.1
Bidirectional bridge between Combine and CombineX
⭐️ 1
🕓 3 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/cx-org/CXBridge.git", from: "v0.0.1")

CXBridge

Bidirectional bridge between Combine and CombineX.

Though CombineX is available whenever Combine is needed, Apple's Combine is still required for SwiftUI integration. For example, SwiftUI.EnvironmentObject only accept Combine.ObservableObject, you can't use CombineX.ObservableObject. With CXBridge, you can easily convert between them.

screenshot1

The data source of application above is powered by CombineX and used by SwiftUI.

Usage

  • Use .ac to convert CombineX type to Combine type.
let pub = CombineX.Just(1)
let bridged: Combine.AnyPublisher<Int, Never> = pub.ac
  • Use .cx to convert Combine type to CombineX type.
let pub = Combine.Just(1)
let bridged: CombineX.AnyPublisher<Int, Never> = pub.cx

Bridgeable Types

Bridgeable Type Bridged Combine Type Bridged CombineX Type
CombineIdentifier CombineIdentifier CombineIdentifier
Subscribers.Demand Subscribers.Demand Subscribers.Demand
Subscribers.Completion Subscribers.Completion Subscribers.Completion
Cancellable AnyCancellable AnyCancellable
Subscription ACWrappers.AnySubscription CXWrappers.AnySubscription
Subscriber AnySubscriber AnySubscriber
Publisher AnyPublisher AnyPublisher
Subject ACWrappers.AnySubject CXWrappers.AnySubject
Scheduler ACWrappers.AnyScheduler CXWrappers.AnyScheduler
ObservableObject ACWrappers.AnyObservableObject CXWrappers.AnyObservableObject
TopLevelEncoder ACWrappers.AnyTopLevelEncoder CXWrappers.AnyTopLevelEncoder
TopLevelDecoder ACWrappers.AnyTopLevelDecoder CXWrappers.AnyTopLevelDecoder

GitHub

link
Stars: 1
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics