Set of useful extensions for ReactiveSwift & ReactiveCocoa

Overview

ackee|ACKReactiveExtensions

Build Version License Platform

ACKReactiveExtensions

ACKReactiveExtensions is set of useful extensions for ReactiveCocoa you could use in your apps.

Currently we have extensions for

If you'd love to have more extensions available just open an issue or even better create a pull request!

Installation

ACKReactiveExtensions is available through CocoaPods. Simply add the following line to your Podfile:

pod "ACKReactiveExtensions"

Requirements

  • Xcode 8.x
  • Swift 3.x
  • iOS 8.3 and newer

For Swift 2.x compatible version use ACKReactiveExtensions in 1.2.x version.

Subspecs

By using pod "ACKReactiveExtensions" you will get only general and UIKit extensions but there are also subspecs you can like/need.

pod 'ACKReactiveExtensions/AlamofireImage'
pod 'ACKReactiveExtensions/Argo'
pod 'ACKReactiveExtensions/Marshal'
pod 'ACKReactiveExtensions/Reachability'
pod 'ACKReactiveExtensions/Realm'
pod 'ACKReactiveExtensions/SDWebImage'
pod 'ACKReactiveExtensions/WebKit'

These subspecs mostly require aditional dependencies (as Argo or Reachability) and you could not need it for your project. That's why it is separated to subspecs.

Usage

Usage is really simple, ACKReactiveExtensions contains just more extensions for ReactiveSwift's Reactive struct so it can be used on more objects.

let imageURL: Property<URL> = ...
let imageView = UIImageView()

imageView.reactive.imageURL <~ imageURL

Mapping extensions

ACKReactiveExtensions contains reactive mapping extensions for following libraries. See their page for more information.

Mapping configuration

In general we are against mapping objects on main thread (and you should be too), but you know, you only live once so we still give you the opportunity to do so. By default our mapping extensions allow this behavior but if you want to restrict that, you can do that by setting a configuration variable.

ACKReactiveExtensionsConfiguration.allowMappingOnMainThread = false

From now on the mapping extensions will expect to be called on background thread, but don't worry, we use asserts so your production users are safe from crashing if somehow things don't go as good as expected.

UITextField/UITextView two way binding

ACKReactiveExtensions contains special <~> two way binding operator which will create binding between MutableProperty and your UITextField/UITextView.

Until now all those bindings looked like this

let textProperty: MutableProperty<String?> ...
let textField: UITextField ...

textField.reactive.text <~ textProperty
textProperty <~ textField.reactive.continousTextValues

From now on you can use the <~> operator

textProperty <~> textField

The <~> operator is commutative so the order of operands doesn't matter.

Author

Ackee team

License

ACKategories is available under the MIT license. See the LICENSE file for more info.

Comments
  • Add Codable extensions

    Add Codable extensions

    Adds extensions for Codable in the same manner the we already have extensions for Marshal

    And as Realm 5.3 requires iOS 9.0+, I've also bumped deployment targets of our Realm extensions.

    opened by olejnjak 3
  • Update dependencies

    Update dependencies

    • uses ReactiveSwift from version 7.0
    • uses ReactiveCocoa from version 12.0
    • uses AlamofireImage from version 4.0
    • changes iOS deployment target to 10.0
    dependencies 
    opened by vendulasvastal 1
  • Bump addressable from 2.7.0 to 2.8.0

    Bump addressable from 2.7.0 to 2.8.0

    Bumps addressable from 2.7.0 to 2.8.0.

    Changelog

    Sourced from addressable's changelog.

    Addressable 2.8.0

    • fixes ReDoS vulnerability in Addressable::Template#match
    • no longer replaces + with spaces in queries for non-http(s) schemes
    • fixed encoding ipv6 literals
    • the :compacted flag for normalized_query now dedupes parameters
    • fix broken escape_component alias
    • dropping support for Ruby 2.0 and 2.1
    • adding Ruby 3.0 compatibility for development tasks
    • drop support for rack-mount and remove Addressable::Template#generate
    • performance improvements
    • switch CI/CD to GitHub Actions
    Commits
    • 6469a23 Updating gemspec again
    • 2433638 Merge branch 'main' of github.com:sporkmonger/addressable into main
    • e9c76b8 Merge pull request #378 from ashmaroli/flat-map
    • 56c5cf7 Update the gemspec
    • c1fed1c Require a non-vulnerable rake
    • 0d8a312 Adding note about ReDoS vulnerability
    • 89c7613 Merge branch 'template-regexp' into main
    • cf8884f Note about alias fix
    • bb03f71 Merge pull request #371 from charleystran/add_missing_encode_component_doc_entry
    • 6d1d809 Adding note about :compacted normalization
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Fix threading for `RealmCollection` observing

    Fix threading for `RealmCollection` observing

    Using completely custom queue was not really correct as RealmCollection changes were propagated on incorrect thread. This solution tries to use current queue, instead of nil queue, so it should probably fix issue from #56 and also preserve correct thread.

    Please @LukasHromadnik run it on your Mac and if it is fine, then we can merge it.

    opened by olejnjak 0
  • Use custom queue for RealmCollection observing

    Use custom queue for RealmCollection observing

    Lately, we have experienced several crashes after updating Realm dependency in project which also uses ACKReactiveExtensions. Given PR should resolve the issue.

    opened by IgorRosocha 0
  • Update Xcode and dependencies

    Update Xcode and dependencies

    • build using Xcode 12.4
    • update workflow to use XCFrameworks - uses custom action that uses Carthage workaround script as Realm currently doesn't contain M1 archs when building (https://github.com/realm/realm-cocoa/pull/7095)
    • update dependencies
    opened by olejnjak 0
  • Update Realm dependency

    Update Realm dependency

    Right now we depend on ancient Realm version ~> 3.14 as current version is 4.3.2 and 5.0.0 is in its third beta, it might be time to update our dependency to at least ~> 4.0 so everyone who uses this version can still use our lib and later on to release version with ~> 5.0 support.

    opened by olejnjak 0
  • Fix RealmCollection bug

    Fix RealmCollection bug

    Ocassionally if Realm receives new data before sending initial change notification, it just sends initial notification with modified content (e.g. if data is saved on other thread). So the skip(first: 1) would actually skip a change.

    Checklist

    • [ ] Updated CHANGELOG.md.
    opened by olejnjak 0
  • Deprecate extensions which are available through keypaths

    Deprecate extensions which are available through keypaths

    This PR addresses #40. It adds deprecations to extensions which are available through keypaths so they can be removed in later releases.

    Right now I am not sure about the deprecation style - maybe this way would be better?

    @available(*, deprecated, message: "Use [\.tableHeaderView] instead")
    

    Checklist

    • [x] Updated CHANGELOG.md.
    opened by olejnjak 0
  • Use `MappingError` in Marshal extensions

    Use `MappingError` in Marshal extensions

    As we do not like the force cast of error, we should use generic MappingError also for Marshal extensions (in the same way we do it for Codable)

    https://github.com/AckeeCZ/ACKReactiveExtensions/blob/d7ced4c5e685a56099187d31542a302f9109a0fa/ACKReactiveExtensions/Marshal/MarshalMapping.swift#L61

    enhancement 
    opened by olejnjak 0
  • Update AlamofireImage dependency

    Update AlamofireImage dependency

    Do we want to update the AlamofireImage dependency to ~> 4.0? The point is that it already depends on Alamofire ~> 5.0 but we haven't updated it in our projects which might be a bit annoying as it means some effort.

    Updating it in ACKReactiveExtensions would mean that we will not be able to update it until we update Alamofire in project.

    update 
    opened by olejnjak 1
  • Deprecate and later remove extensions which are available using keypaths

    Deprecate and later remove extensions which are available using keypaths

    ReactiveSwift allows accessing allows accessing reactive properties using KVC

    tableView.reactive[\.tableViewHeader] <~ tableViewHeaderSignal
    

    We can compact ACKReactiveExtensions by removing such extensions

    enhancement 
    opened by olejnjak 0
  • Make `reactive.imageURL` optional

    Make `reactive.imageURL` optional

    Use case

    When adding images to UIImageView using AlamofireImage, the binding target extension should be of type BindingTarget<URL?> for simple reason. If new imageURL is set AlamofireImage automatically cancels running request for previous URL (if any). But if new model has no imageURL, then imageView.af_cancelImageRequest() should be called to cancel current image request (if any).

    Possible solution

    There are two possible solutions:

    1. Add imageView.reactive.cancelImageRequest: BindingTarget<Void> and call it if nil is assigned
    2. make imageView.reactive.imageURL of type BindingTarget<URL?> and if nil then imageView.af_cancelImageRequest() will be called

    I'd prefer the 2nd solution as it fits our needs best.

    https://github.com/AckeeCZ/ACKReactiveExtensions/blob/145af295341226f41202450314129a08c8d80f2a/ACKReactiveExtensions/AlamofireImage/AlamofireImageExtensions.swift#L14

    enhancement 
    opened by olejnjak 0
Releases(6.1.0)
Owner
Ackee
Software development enthusiasts from the ❤️ of Europe.
Ackee
Core Data with ReactiveCocoa

ReactiveCoreData ReactiveCoreData (RCD) is an attempt to bring Core Data into the ReactiveCocoa (RAC) world. Currently has several files with the sour

Jacob Gorban 258 Aug 6, 2022
An array class implemented in Swift that can be observed using ReactiveCocoa's Signals

ReactiveArray An array class implemented in Swift that can be observed using ReactiveCocoa's Signals. Installation Carthage Add the following to your

Wolox 53 Jan 29, 2022
ReactiveCocoa wrapper for CLLocationManager.

ReactiveSwift wrapper to observe location Our wrapper automatically asks for permission. It determines what kind of permission your app requires by ch

Ackee 24 Sep 6, 2022
Handy RxSwift extensions on NSObject, including rx.disposeBag.

NSObject+Rx If you're using RxSwift, you've probably encountered the following code more than a few times. class MyObject: Whatever { let disposeBag

RxSwift Community 625 Dec 12, 2022
RxSwift extensions for Core Data

RxCoreData Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Xcode 9.0 Swift 4.0

RxSwift Community 164 Oct 14, 2022
Reflection based (Dictionary, CKRecord, NSManagedObject, Realm, JSON and XML) object mapping with extensions for Alamofire and Moya with RxSwift or ReactiveSwift

EVReflection General information At this moment the master branch is tested with Swift 4.2 and 5.0 beta If you want to continue using EVReflection in

Edwin Vermeer 964 Dec 14, 2022
Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift.

ReactiveSwift offers composable, declarative and flexible primitives that are built around the grand concept of streams of values over time. These primitives can be used to uniformly represent common Cocoa and generic programming patterns that are fundamentally an act of observation.

null 20k Jan 3, 2023
Reflection based (Dictionary, CKRecord, NSManagedObject, Realm, JSON and XML) object mapping with extensions for Alamofire and Moya with RxSwift or ReactiveSwift

EVReflection General information At this moment the master branch is tested with Swift 4.2 and 5.0 beta If you want to continue using EVReflection in

Edwin Vermeer 964 Dec 14, 2022
Extendy - A set of useful string extensions.

Extendy A set of useful string extensions. Requirements iOS 11.0+ Swift 5+ Installation CocoaPods Extendy is available through CocoaPods. To install i

Anton Novichenko 3 Sep 23, 2021
Spin aims to provide a versatile Feedback Loop implementation working with the three main reactive frameworks available in the Swift community (RxSwift, ReactiveSwift and Combine)

With the introduction of Combine and SwiftUI, we will face some transition periods in our code base. Our applications will use both Combine and a thir

Spinners 119 Dec 29, 2022
Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift. ⚠️ Looking for the Objective-C API? ?? Migrating from RAC 4.x? ?? Release Road

null 20k Jan 8, 2023
Core Data with ReactiveCocoa

ReactiveCoreData ReactiveCoreData (RCD) is an attempt to bring Core Data into the ReactiveCocoa (RAC) world. Currently has several files with the sour

Jacob Gorban 258 Aug 6, 2022
An array class implemented in Swift that can be observed using ReactiveCocoa's Signals

ReactiveArray An array class implemented in Swift that can be observed using ReactiveCocoa's Signals. Installation Carthage Add the following to your

Wolox 53 Jan 29, 2022
ReactiveCocoa wrapper for CLLocationManager.

ReactiveSwift wrapper to observe location Our wrapper automatically asks for permission. It determines what kind of permission your app requires by ch

Ackee 24 Sep 6, 2022
A Swift implementation of a Flickr-search application that uses MVVM and ReactiveCocoa

ReactiveCocoa, Swift and MVVM This application is a Swift-port of an MVVM / ReactiveCocoa example application I wrote a few months ago. Instructions T

Colin Eberhardt 377 Sep 26, 2022
iOS client for Giphy written in Swift with ReactiveCocoa

Giraffe iOS client for Giphy written in Swift with ReactiveCocoa Requirements iOS 10.0 Beta Xcode 8 Beta 2 Swift 2.3 Carthage Why S

Yevhen Dubinin 43 Feb 10, 2022
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.

Features • Classes and Extensions Compatibility • Requirements • Communication • Contributing • Installing and Usage • Documentation • Changelog • Exa

Fabrizio Brancati 992 Dec 2, 2022
Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects

SwiftyPick ?? ?? Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects. Purpose The idea behind t

Manu Herrera 19 May 12, 2022
Useful extensions for my Swift code

UIViewController extensions presentAlert(withTitle title: String, message : String) presentAlertDialog(withTitle title: String, message : String, acti

Bogdan Grafonsky 1 Oct 17, 2021
Personally useful Swift Extensions for iOS Development

Useful-Swift-Extensions Personally useful Swift Extensions for iOS Development; cobbled together from a variety of development projects and StackOverf

Nick Arner 5 Dec 13, 2021