GCOverseer

0.1.0

Observe and manage game controllers using Combine.
backslash-f/gcoverseer

What's New

v0.1.0

2020-10-13T20:59:09Z

In the very first release, listen to game controller connect / disconnect events as follows:

let gcOverseer = GCOverseer()

gcOverseer.$isGameControllerConnected
  .sink { isConnected in
    // Do something
  }
  .store(in: &cancellables)
}

swift-version swift-package-manager platform build-status license

GCOverseer

Combine wrapper around Apple's Game Controller Framework.

Tested platforms

  • iOS 14+
  • macOS 11+ (BigSur+)
  • Mac Catalyst 14+
  • tvOS 14+
  • Xcode 12+
  • Swift 5.3+

Usage

Handle connected / disconnected events

import SpriteKit
import Combine
import GCOverseer

class GameScene: SKScene {

    let gcOverseer = GCOverseer()

    var cancellables = Set<AnyCancellable>()

    override init(size: CGSize) {
        super.init(size: size)

        // 🎮
        gcOverseer.$isGameControllerConnected
            .sink { isConnected in
                // Do something
            }
            .store(in: &cancellables)
    }
}

Integration

Xcode

Use Xcode's built-in support for SPM.

or...

Package.swift

In your Package.swift, add GCOverseer as a dependency:

dependencies: [
  .package(url: "https://github.com/backslash-f/gcoverseer", from: "0.1.0")
],

Associate the dependency with your target:

targets: [
  .target(name: "App", dependencies: ["GCOverseer"])
]

Run: swift build

Description

  • Swift Tools 5.3.0

Dependencies

Last updated: Fri Oct 30 2020 21:42:19 GMT-0500 (GMT-05:00)