Latest 0.2.1
Homepage https://github.com/kjisoo/RxObserve
License MIT
Platforms ios 8.0
Dependencies RxSwift, RxCocoa
Authors

CI Status
Version
License
Platform

RxObserve is an extension that allows you to use observe with keypath.

Getting Started

class SomeObject: NSObject {
  @objc dynamic var text: String = ""
}

let object = SomeObject()
// in RxCocoa observe, Optional type and must be typed and is a string keypath.
let textObservable = object.rx.observe(String.self, "text") // observe in RxCocoa, It's type is Observable<String?>

// RxObserve
let textObservable = object.rx.asObservable(keyPath: .text) // It's type is Observable<String>
let textObservable = object.rx.asObservable(keyPath: .text, options: [.new]) // default value for options is [.initial, .new]

let textObserver = object.rx.asObserver(keyPath: .text) // It's type is AnyObserver<String>

let view = UIView()
let backgroundColorObservable = view.rx.asObservable(keyPath: .backgroundColor) // It's type is Observable<UIColor?>

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

pod 'RxObserve'

Author

kjisoo, [email protected]

License

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

Latest podspec

{
    "name": "RxObserve",
    "version": "0.2.1",
    "summary": "RxSwift Extension for easier use of observe.",
    "description": "RxSwift Extension for easier use of observe.nRxObserve is an extension that allows you to use observe with keypath.",
    "homepage": "https://github.com/kjisoo/RxObserve",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "kjisoo": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kjisoo/RxObserve.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.2",
    "source_files": "Sources/**/*.swift",
    "dependencies": {
        "RxSwift": [
            "~> 4.0"
        ],
        "RxCocoa": [
            "~> 4.0"
        ]
    }
}

Pin It on Pinterest

Share This