Skip to content

Bidirectional bridge between Combine and CombineX

Notifications You must be signed in to change notification settings

cx-org/CXBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Bidirectional bridge between Combine and CombineX

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages