Coder Social home page Coder Social logo

rxbibinding's Introduction

RxBiBinding

Build Status Carthage compatible Version License Platform

Example

Binding between two ControlProperty

let disposeBag = DisposeBag()

var textFieldFirst = UITextField()
var textFieldSecond = UITextField()

(textFieldFirst.rx.text <-> textFieldSecond.rx.text).disposed(by: disposeBag)

Binding between two BehaviorRelay

let disposeBag = DisposeBag()

var textFirst = BehaviorRelay<String?>(value: "")
var textSecond = BehaviorRelay<String?>(value: "")

(textFirst <-> textSecond).disposed(by: disposeBag)

Binding between ControlProperty and BehaviorRelay

let disposeBag = DisposeBag()

var text = BehaviorRelay<String?>(value: "")
var textField = UITextField()

(textField.rx.text <-> text).disposed(by: disposeBag)

Requirements

iOS >= 10

Installation

RxBiBinding is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'RxBiBinding'

Carthage

carthage update --platform ios

Thanks

This solution is based on ReactiveCocoa (Obj-C version)

License

RxBiBinding is available under the MIT license. See the LICENSE file for more info. Copyright (c) RxSwiftCommunity

rxbibinding's People

Contributors

cukingpro avatar d2vydov avatar davarg avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

rxbibinding's Issues

macOS support

I got really enthusiastic reading about RxBiBinding. Until I found out it is yet another ios-only project. Would you please consider (also) making RxBiBinding available for macOS?

Swift package manager resolution failing

When trying to include RxBiBinding via swift package manager in Xcode 11 I am getting an error saying

"The package dependency graph can not be resolved; unable find any available tag for the following requirements:"

Screen Shot 2019-09-03 at 10 24 07 AM

Reentrancy anomaly was detected

I'm using it with BehaviorRelay<->BehaviorRelay

Reentrancy anomaly was detected.

Debugging: To debug this issue you can set a breakpoint in /Users/antonioscardigno/Documents/Sogetel/repository-forward/SOGETEL-RUMORS/DEV/iOSProjects/branches/newUI/Pods/RxSwift/RxSwift/Rx.swift:97 and observe the call stack.
Problem: This behavior is breaking the observable sequence grammar. next (error | completed)?
This behavior breaks the grammar because there is overlapping between sequence events.
Observable sequence is trying to send an event before sending of previous event has finished.
Interpretation: This could mean that there is some kind of unexpected cyclic dependency in your code,
or that the system is not behaving in the expected way.
Remedy: If this is the expected behavior this message can be suppressed by adding .observeOn(MainScheduler.asyncInstance)
or by enqueing sequence events in some other way.

UISwitch

UISwitch skip first value when toggle

@IBOutlet weak var testSwitch: UISwitch!

let isOn = BehaviorRelay<Bool>(value: true)

let db = DisposeBag()

override func viewDidLoad() {
    super.viewDidLoad()

    (testSwitch.rx.isOn <-> isOn).disposed(by: db)        
    
    isOn.subscribe(onNext: { (value) in
        print(value)
    }).disposed(by: db)
}

But if add another property and bind after UISwitch it is works good

@IBOutlet weak var testTextField: UITextField!
@IBOutlet weak var testSwitch: UISwitch!    

let isOn = BehaviorRelay<Bool>(value: true)
let text = BehaviorRelay<String>(value: "")
let db = DisposeBag()

override func viewDidLoad() {
    super.viewDidLoad()

    (testSwitch.rx.isOn <-> isOn).disposed(by: db)
    (testTextField.rx.textInput <-> text).disposed(by: db)
    
    isOn.subscribe(onNext: { (value) in
        print(value)
    }).disposed(by: db)
}

CocoaPods could not find compatible versions for pod "RxBiBinding"

Hello guys, good morning.

Recently I needed to do the two way data binding with RxSwift and searching in the github community, I've found this pod..

But when I run pod install I face this issue:
Specs satisfying the RxBiBinding dependency were found, but they required a higher minimum deployment target.

Can anyone help me?
The minimum iOS version for my app is 11.0 so and in the readme it says that this pod requires at least ios 10.
Anyone faced this problem before?

Thanks in advance!

best regards

Update RxSwift & RxCocoa version

Can you update podspec so that it can be installed with newer version of RxSwift and RxCocoa ?
In my fork repo, I changed the version to 4.3.1 and it's working properly.

Carthage build problem for platform macOS

Happy to see that RxBiBinding now supports macOS!!

I encounter a problem building for the macOS platform using carthage though:

*** Skipped building RxBiBinding due to the error:
Dependency "RxBiBinding" has no shared framework schemes for any of the platforms: Mac

If you believe this to be an error, please file an issue with the maintainers at https://github.com/RxSwiftCommunity/RxBiBinding/issues/new

FWIW, I used carthage update --platform macOS with cartfile set to:

github "ReactiveX/RxSwift" ~> 5.0.1
github "RxSwiftCommunity/RxBiBinding.git"

Eager to start using RxBiBinding, I hope anyone can provide a fix for this. Thanks!

Tests

Need to create tests.

Binding with different initial values

let a: BehaviorRelay<String?> = BehaviorRelay(value: "1")
let b: BehaviorRelay<String?> = BehaviorRelay(value: "2")
a.subscribe(onNext:{ print("a \($0)") }).disposed(by: disposeBag)
b.subscribe(onNext:{ print("b \($0)") }).disposed(by: disposeBag)

(a <-> b).disposed(by: disposeBag)

Result:

a 1
b 2
a 2
b 1

If I don't emit any new values, they end up switching their values. Is there any way to make b get the initial value of a?

Update podspec to Swift 4.2

This warning makes my teeth itch. :)
image

Thanks, I love what this little library does for my code's readability!

Carthage build problem

Hi, I encounter a problem building for the iOS platform using Carthage :

    /bin/sh -c /Users/alexandreraulin/Library/Caches/org.carthage.CarthageKit/DerivedData/12.5.1_12E507/RxBiBinding/0.3.5/Build/Intermediates.noindex/ArchiveIntermediates/RxBiBinding/IntermediateBuildFilesPath/RxBiBinding.build/Release-iphoneos/RxBiBinding.build/Script-30A70933216E15A80056D6A8.sh
Failed to read file or folder at /Users/alexandreraulin/workspace/app/Carthage/Checkouts/RxBiBinding/Carthage/Build/iOS/RxSwift.framework: Error Domain=NSCocoaErrorDomain Code=259 "Cannot retrive binary file from bundle at file:///Users/alexandreraulin/workspace/app/Carthage/Checkouts/RxBiBinding/Carthage/Build/iOS/RxSwift.framework/" UserInfo={NSLocalizedDescription=Cannot retrive binary file from bundle at file:///Users/alexandreraulin/workspace/app/Carthage/Checkouts/RxBiBinding/Carthage/Build/iOS/RxSwift.framework/, NSLocalizedRecoverySuggestion=Does the bundle contain an Info.plist?}
Command PhaseScriptExecution failed with a nonzero exit code

** ARCHIVE FAILED **


The following build commands failed:
	PhaseScriptExecution Run\ Script /Users/alexandreraulin/Library/Caches/org.carthage.CarthageKit/DerivedData/12.5.1_12E507/RxBiBinding/0.3.5/Build/Intermediates.noindex/ArchiveIntermediates/RxBiBinding/IntermediateBuildFilesPath/RxBiBinding.build/Release-iphoneos/RxBiBinding.build/Script-30A70933216E15A80056D6A8.sh
(1 failure)

(Full build log at the end)

I'm not familiar with Carthage, is anyone know how to fix the problem ? Thanks

Carthage command used :
carthage update --platform iOS --use-xcframeworks --cache-builds

Cartfile

github "ReactiveX/RxSwift" "6.2.0"
github "RxSwiftCommunity/RxSwiftExt"
github "RxSwiftCommunity/RxOptional"
github "RxSwiftCommunity/RxDataSources"
github "pixeldock/RxAppState"
github "RxSwiftCommunity/RxFlow"

github "RxSwiftCommunity/RxBiBinding"

RxBiBinding.log

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.