Skip to content
Reactive extension for the EnumKit framework to enable easy working with observables streams of events as enum cases
Swift Ruby Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
RxEnumKit.xcodeproj
RxEnumKit.xcworkspace
RxEnumKit
RxEnumKitTests
Sources/RxEnumKit
Tests
.gitignore
.travis.yml
LICENSE
Package.swift
Podfile
Podfile.lock
README.md
RxEnumKit.png
RxEnumKit.podspec
codecov.yml

README.md

RxEnumKit

Build Status Swift Package Manager cocoapods

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
        ...
    })

Requirements

  • Xcode 10.2
  • Swift 5.0

Installation

RxEnumKit offers cocoapods and swiftPM

Via Cocoapods

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'RxEnumKit', '~> 1.0.1'
end

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

via Swift Package Manager

Create a Package.swift file.

// swift-tools-version:5.0

import PackageDescription

let package = Package(
  name: "YourProjectName",
  dependencies: [
    .package(url: "https://github.com/gringoireDM/RxEnumKit.git", from: "1.0.1")
  ],
  targets: [
    .target(name: "YourProjectName", dependencies: ["RxEnumKit"])
  ]
)
$ swift build
You can’t perform that action at this time.