SteamControllerManager

Objective-C

@interface SteamControllerManager : NSObject

Swift

class SteamControllerManager : NSObject

SteamControllerManager handles the connection and disconnection of Steam Controllers, and inserts connected Steam Controllers into the array of controllers returned by [GCController controllers].

  • Returns the shared instance of SteamControllerManager.

    Declaration

    Objective-C

    + (nonnull instancetype)sharedManager;

    Swift

    class func shared() -> Self
  • Returns the currently connected Steam Controllers. Unless you only want to support Steam Controllers, you should use [GCController controllers] instead of this property.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<SteamController *> *_Nonnull controllers;

    Swift

    var controllers: [SteamController] { get }
  • Detects connected and pairing Steam Controllers. If a controller is in pairing mode, this will initiate the pairing process. If it is already paired and connected, it will configure it and post a GCControllerDidConnectNotification notification when it’s ready.

    Declaration

    Objective-C

    - (void)scanForControllers;

    Swift

    func scanForControllers()

Listening

  • Starts listening for controller connections.

    You should call this method in your app delegate’s application:didFinishLaunchingWithOptions: method.

    This enables controllers to be detected automatically when they connect/reconnect, without having to call scanForControllers. This feature calls IOKit functions dynamically, which is private API on iOS/tvOS, it can be excluded from the build by passing -DSTEAMCONTROLLER_NO_PRIVATE_API to the compiler, or using the SteamController/no-private-api subspec in your Podfile.

    Declaration

    Objective-C

    + (BOOL)listenForConnections;

    Swift

    class func listenForConnections() -> Bool