Coder Social home page Coder Social logo

ackreactiveextensions's Introduction

ackee|ACKReactiveExtensions

Build

ACKReactiveExtensions

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

Currently we have extensions for

  • UIKit
  • WebKit

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

Installation

You can use Carthage by adding it to your Cartfile:

github "AckeeCZ/ACKReactiveExtensions

Or you can use SPM by adding it to you Package.swift.

Usage

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

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.

ackreactiveextensions's People

Contributors

igorrosocha avatar janmisar avatar josefdolezal avatar leinhauplk avatar lukasackee avatar lukashromadnik avatar michal-klein avatar olejnjak avatar tkohout avatar tommhol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ackreactiveextensions's Issues

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.

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.

Remove backgroundColor extension on UIView

backgroundColor extension on Reactive<UIView> is now redundant as it is already contained in ReactiveCocoa. It also makes use of binding operator ambigous as one property is optional and the other isn't.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.