Skip to content
A collection of useful extensions for Combine and CombineX
Swift Ruby
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.
CXExtensions.xcodeproj
Sources/CXExtensions
Tests
.gitignore
CXExtensions.podspec
Cartfile
LICENSE
Package.resolved
Package.swift
README.md

README.md

CXExtensions

release install platform license dicord

A collection of useful extensions for Combine and CombineX.

API

Publisher

IgnoreError

Ignore error from upstream and complete.

// Output: (data: Data, response: URLResponse), Failure: URLError
let upstream = URLSession.shared.cx.dataTaskPublisher(for: url)

// Output: (data: Data, response: URLResponse), Failure: Never
let pub = upstream.ignoreError()

Cancellable

DelayedAutoCancellable

Auto cancel after delay.

let delayedCancel = upstream
    .sink { o in
    }
    .cancel(after .second(1), scheduler: mainScheduler)

Install

Swift Package Manager

dependencies.append(
    .package(url: "https://github.com/cx-org/CXExtensions", .branch("master"))
)

CocoaPods

pod 'CXExtensions', :git => 'https://github.com/cx-org/CXExtensions.git', :branch => 'master'

Carthage

github "cx-org/CXExtensions" "master"

Use with Combine

You can change the underlying dependency to Combine by passing USE_COMBINE to the target's build configurations. For example, if you are using CocoaPods, you can modify your podfile like below:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'CXExtensions'
            target.build_configurations.each do |config|
                config.build_settings['OTHER_SWIFT_FLAGS'] = '-DUSE_COMBINE'
            end
        end
    end
end

If you are using Carthage, you should be able to use XCODE_XCCONFIG_FILE to do that.

You can’t perform that action at this time.