cx-org / CXCocoa

Combine & CombineX extensions for Cocoa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CombineX.Cocoa(中文)

release install platform license dicord

Notice

This library is still in beta, so do not use it in production!

🐱

What is CXCocoa

Like ReactiveCocoa and ReaciveSwift, RxCocoa and RxSwift, CXCocoa is a derivative of CombineX. It provides Combine extensions to Cocoa Framework, making it easier to write Cocoa-related asynchronous code.

It includes but is not limited to:

  • MethodPublisher/DeallocatePublisher, intercepting method calls with method swizzle
  • KVOPublisher, observing property changes through the KVO mechanism
  • DelegateProxy, forwarding delegate message
  • UIKit extensions(binder & property), subscribing control event and binding values
  • UIScheduler
  • ...

You can freely switch the underlying dependency between CombineX and Combine.

Demo

Install

CocoaPods

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

Carthage

github "cx-org/CXCocoa" "master"

What is Combine/CombineX

Check here.

Contribution

Welcome! Any kind of contribution is welcome at any time!!!

You can:

  1. Add more control extensions, especially for macOS controls.
  2. Add documentation.
  3. Make your suggestions.
  4. Star! Then tell your friends!

Because the upstream CombineX is still in beta, if you encounter a strange problem in this library - then it may drift from upstream. 🤣

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.

Acknowledgement

The implementation of the library references both ReactiveCocoa and RxCocoa, especially ReactiveCocoa, the ObjC part is almost completely modified from its source code, really appreciate to their great work!

About

Combine & CombineX extensions for Cocoa

License:MIT License


Languages

Language:Swift 96.4%Language:Ruby 2.3%Language:Objective-C 1.2%