RxEnumKit is the reactive extension of EnumKit. It extends ObservableType and SharedSequenceConvertibleType to add flexibility while working with stream of enum cases.
With RxEnumKit you’ll be able to extract associated values from each CaseAccessible enum element of the stream, map, compactMap, flatMap, filter and exclude cases.
Having a CaseAccessible enum, and an Observable
enum MyEvent: CaseAccessible {
case eventA(String)
case eventB(foo: Int)
}
let observable: Observable<MyEvent>
With RxEnumKit the following patterns will be possible:
observable.capture(case: MyEvent.eventA)
.subscribe(onNext: { value in //String
...
})
observable.map(case: MyEvent.eventB, String.init)
.subscribe(onNext: { value in // String
...
})
RxEnumKit is the reactive extension of EnumKit. It extends
ObservableType
andSharedSequenceConvertibleType
to add flexibility while working with stream of enum cases.With RxEnumKit you’ll be able to extract associated values from each
CaseAccessible
enum element of the stream, map, compactMap, flatMap, filter and exclude cases.Having a
CaseAccessible
enum, and an ObservableWith RxEnumKit the following patterns will be possible:
Requirements
Installation
RxEnumKit offers cocoapods and swiftPM
Via Cocoapods
Replace
YOUR_TARGET_NAME
and then, in thePodfile
directory, type:via Swift Package Manager
Create a
Package.swift
file.