CXExtensions 0.0.1-beta.4

CXExtensions 0.0.1-beta.4

Maintained by luoxiu.



 
Depends on:
CXFoundation~> 0.0.1-beta.5
CXCompatible~> 0.0.1-beta.4
 

CXExtensions 0.0.1-beta.4

  • By
  • Quentin Jin

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.