Latest 0.0.1
Homepage https://github.com/shintarogit/wcsession_rx
License MIT
Platforms watchos 2.2
Dependencies RxSwift, RxCocoa
Authors

WCSession Reactive Extension

Inspired by RxSwft’s CLLocationManager+Rx
https://github.com/ReactiveX/RxSwift/tree/master/RxExample/Extensions

Useage

import WatchKit
import WatchConnectivity
import RxSwift
import WCSessionRx

class InterfaceController: WKInterfaceController {

    private var disposer: Disposable?

    override func awake(withContext context: Any?) {
        super.awake(withContext: context)

        disposer = WCSession.default()
            .rx.activationState
            .subscribe(onNext: {

                print("Activation State is ($0)")

            }, onError: {

                print("Error ($0)")

            }, onCompleted: {

            }) {

                print("Canceled ($0)")

        }
    }

    override func willActivate() {
        super.willActivate()
        WCSession.default().activate()
    }

    deinit {
        disposer?.dispose()
    }

}

Requirements

  • watchOS 2.2

Installation

CocoaPods

# Podfile
use_frameworks!

target 'YOUR_WATCH_EXTENSION_TARGET_NAME' do
  pod 'RxSwift',    '~> 3.0.0'
  pod 'RxCocoa',    '~> 3.0.0'
  pod 'WCSessionRx'
end

Replace YOUR_WATCH_EXTENSION_TARGET_NAME and then, in the Podfile directory, type:

pod install

Latest podspec

{
    "name": "WCSessionRx",
    "version": "0.0.1",
    "summary": "WCSession Reactive Extension with RxSwift.",
    "description": "Inspired bynhttps://github.com/ReactiveX/RxSwift/tree/master/RxExample/Extensions",
    "homepage": "https://github.com/shintarogit/wcsession_rx",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "shintarogit": "[email protected]"
    },
    "social_media_url": "https://twitter.com/Shintaro_In",
    "platforms": {
        "watchos": "2.2"
    },
    "source": {
        "git": "https://github.com/shintarogit/wcsession_rx.git",
        "tag": "0.0.1"
    },
    "source_files": "WCSession+Rx/**/*.swift",
    "dependencies": {
        "RxSwift": [
            "~> 3.0.0"
        ],
        "RxCocoa": [
            "~> 3.0.0"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This