Latest 2.3.0
Homepage https://github.com/RxSwiftCommunity/RxCocoa-Texture
License MIT
Platforms ios 9.3
Dependencies RxSwift, RxCocoa, Texture
Authors

alt text

CI Status
Version
License
Platform

Notice

  • ASBinder support directly binder for behaviorRelay
  • GTTexture+RxExtension is deprecated
  • ASButtonNode url image downloader no more support, try to use ASNetworkImageNode with ASTextNode
  • Texture 2.7 doesn’t support cocoapods, but 2.7.1 hotfix version will coming soon.

Your Contributions always welcome welcome!.

Concept

RxCocoa provides extensions to the Cocoa and Cocoa Touch frameworks to take advantage of RxSwift.
Texture provides various basic UI components such as ASTableNode, ASControlNode, ASButtonNode and so on.
ref: Node Subclasses

So, This Library provides extensions to the Texture frameworks to take advantage of RxSwift like a RxCocoa

ref: Texture + RxSwift Interactive Wrapper

Example

Extension

ASBinder

: Subscribed Observer operates asynchronously.

Expectation Flow Expectation UI
RxCocoa-Texture RxCocoa-Texture

But, Node dosen’t know that event value applied on UI before draw.

Unexpectation Flow Unexpectation UI
RxCocoa-Texture RxCocoa-Texture

In this case, Node should use setNeedsLayout. but, [bind:_] doesn’t call setNeedsLayout automatically.

Normally, you can use like this code

// Profile NetworkImage Node is default
// username, description is Optional

// *** self is usernameNode supernode
viewModel.username
         .subscribe(onNext: { [weak self] text in 
            self?.usernameNode.rx.text(Node.usernameAttributes).onNext(text)
            self?.setNeedsLayout() // Here
         })
         .disposed(by: disposeBag)

If you use ASBinder then you don’t need call setNeedsLayout. ASBinder will operates it automatically.

// Profile NetworkImage Node is default
// username, description is Optional

// *** self is usernameNode supernode
viewModel.username
         .bind(to: usernameNode.rx.text(Node.usernameAttributes),
               setNeedsLayout: self) 
         .disposed(by: disposeBag)

// *** self is descriptionNode supernode
viewModel.desc
         .bind(to: descriptionNode.rx.text(Node.descAttributes),
               setNeedsLayout: self) 
         .disposed(by: disposeBag)

If you don’t need setNeedsLayout then just write code like this.

// setNeedsLayout default is nil!
viewModel.username
         .bind(to: usernameNode.rx.text(Node.usernameAttributes) 
         .disposed(by: disposeBag)

viewModel.desc
         .bind(to: descriptionNode.rx.text(Node.descAttributes)) 
         .disposed(by: disposeBag)
ASBinder Flow Output UI
RxCocoa-Texture RxCocoa-Texture

Installation

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

swift 4.x

pod 'RxCocoa-Texture'

Caution

This library has been migrated to Texture 2.7.
When Rx subscribe logic moves from initialization to didLoad method. I no longer faced this problem.
When using RxSwift / RxCocoa, it is safe to subscribe from the didLoad method.
https://github.com/TextureGroup/Texture/issues/977

Author

Geektree0101, [email protected]

License

This library belongs to RxSwiftCommunity.
RxCocoa-Texture is available under the MIT license. See the LICENSE file for more info

Latest podspec

{
    "name": "RxCocoa-Texture",
    "version": "2.3.0",
    "summary": "RxCocoa Extension Library for Texture",
    "description": "This library is built on Texture with RxCocoa, RxCocoa is a framework that helps make Cocoa APIs used in iOS and OS X easier to use with reactive techniques.",
    "homepage": "https://github.com/RxSwiftCommunity/RxCocoa-Texture",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Geektree0101": "[email protected]"
    },
    "source": {
        "git": "https://github.com/RxSwiftCommunity/RxCocoa-Texture.git",
        "tag": "2.3.0"
    },
    "platforms": {
        "ios": "9.3"
    },
    "source_files": "RxCocoa-Texture/Classes/**/*",
    "dependencies": {
        "RxSwift": [
            "~> 4.0"
        ],
        "RxCocoa": [
            "~> 4.0"
        ],
        "Texture": [
            "2.8"
        ]
    }
}

Pin It on Pinterest

Share This