Latest 1.0.0
Homepage https://github.com/giginet/RxSpriteKit
License MIT
Platforms ios 11.0, osx 10.13, watchos 4.0, tvos 11.0
Dependencies RxSwift, RxCocoa
Authors

Build Status
Language
Carthage compatible
CocoaPods Compatible
Platform
License

React extensions for SpriteKit :space_invader:

Installation

Carthage

github "giginet/RxSpriteKit"

CocoaPods

use_framework!

pod "RxSpriteKit"

Usage

See RxSpriteKitDemo for detail.

import SpriteKit
import RxSpriteKit
import RxSwift
import RxCocoa

class GameScene: SKScene {
    private let disposeBag = DisposeBag()
    private var label: SKLabelNode!
    private let frameRelay = PublishRelay<Int>()

    override func sceneDidLoad() {
        super.sceneDidLoad()

        guard let label = childNode(withName: "//helloLabel") as? SKLabelNode else {
            fatalError("Label is not defined")
        }
        self.label = label
        rx.update
            .scan(0, accumulator: { frameCount, _ in frameCount + 1 })
            .bind(to: frameRelay)
            .disposed(by: disposeBag)
        frameRelay
            .map { CGFloat($0) * 0.01 }
            .bind(to: label.rx.zRotation)
            .disposed(by: disposeBag)
        frameRelay
            .map { CGPoint(x: 0, y: $0) }
            .bind(to: label.rx.position)
            .disposed(by: disposeBag)
        frameRelay
            .map { String(describing: $0) }
            .bind(to: label.rx.text)
            .disposed(by: disposeBag)
    }
}

Latest podspec

{
    "name": "RxSpriteKit",
    "version": "1.0.0",
    "summary": "Reactive Extension for SpriteKit :space_invader:",
    "homepage": "https://github.com/giginet/RxSpriteKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "giginet": "[email protected]"
    },
    "social_media_url": "http://twitter.com/giginet",
    "platforms": {
        "ios": "11.0",
        "osx": "10.13",
        "watchos": "4.0",
        "tvos": "11.0"
    },
    "source": {
        "git": "https://github.com/giginet/RxSpriteKit.git",
        "tag": "1.0.0"
    },
    "source_files": "RxSpriteKit/**/*.{h,swift}",
    "ios": {
        "exclude_files": "RxSpriteKit/**/macOS/*.swift",
        "frameworks": [
            "UIKit",
            "SpriteKit"
        ]
    },
    "osx": {
        "exclude_files": "RxSpriteKit/**/iOS/*.swift",
        "frameworks": [
            "Cocoa",
            "SpriteKit"
        ]
    },
    "watchos": {
        "exclude_files": [
            "RxSpriteKit/Input/**/*.swift",
            "RxSpriteKit/**/SKView+Binder.swift"
        ],
        "frameworks": [
            "UIKit",
            "SpriteKit"
        ]
    },
    "tvos": {
        "exclude_files": "RxSpriteKit/**/macOS/*.swift",
        "frameworks": [
            "UIKit",
            "SpriteKit"
        ]
    },
    "dependencies": {
        "RxSwift": [
            "~> 4.1"
        ],
        "RxCocoa": [
            "~> 4.1"
        ]
    },
    "swift_version": "4.0"
}

Pin It on Pinterest

Share This