Documentation Archive Developer
Search

GameController Changes for Swift

GameController

Removed GCControllerPlayerIndexUnset
Modified GCController
Declaration
From
class GCController : NSObject {
    var controllerPausedHandler: ((GCController!) -> Void)!
    var vendorName: String! { get }
    var attachedToDevice: Bool { get }
    var playerIndex: Int
    var gamepad: GCGamepad! { get }
    var extendedGamepad: GCExtendedGamepad! { get }
    var motion: GCMotion! { get }
    class func controllers() -> [AnyObject]!
    class func startWirelessControllerDiscoveryWithCompletionHandler(_ completionHandler: (() -> Void)!)
    class func stopWirelessControllerDiscovery()
}
To
class GCController : NSObject {
    var controllerPausedHandler: ((GCController) -> Void)?
    var handlerQueue: dispatch_queue_t
    var vendorName: String? { get }
    var attachedToDevice: Bool { get }
    var playerIndex: GCControllerPlayerIndex
    var gamepad: GCGamepad? { get }
    var extendedGamepad: GCExtendedGamepad? { get }
    var motion: GCMotion? { get }
    class func controllers() -> [GCController]
    class func startWirelessControllerDiscoveryWithCompletionHandler(_ completionHandler: (() -> Void)?)
    class func stopWirelessControllerDiscovery()
}

Declaration
From
var controllerPausedHandler: ((GCController!) -> Void)!
To
var controllerPausedHandler: ((GCController) -> Void)?

Declaration
From
class func controllers() -> [AnyObject]!
To
class func controllers() -> [GCController]

Declaration
From
var extendedGamepad: GCExtendedGamepad! { get }
To
var extendedGamepad: GCExtendedGamepad? { get }

Declaration
From
var gamepad: GCGamepad! { get }
To
var gamepad: GCGamepad? { get }

Declaration
From
var motion: GCMotion! { get }
To
var motion: GCMotion? { get }

Declaration
From
var playerIndex: Int
To
var playerIndex: GCControllerPlayerIndex

Declaration
From
class func startWirelessControllerDiscoveryWithCompletionHandler(_ completionHandler: (() -> Void)!)
To
class func startWirelessControllerDiscoveryWithCompletionHandler(_ completionHandler: (() -> Void)?)

Declaration
From
var vendorName: String! { get }
To
var vendorName: String? { get }

Declaration
From
class GCControllerAxisInput : GCControllerElement {
    var valueChangedHandler: GCControllerAxisValueChangedHandler!
    var value: Float { get }
}
To
class GCControllerAxisInput : GCControllerElement {
    var valueChangedHandler: GCControllerAxisValueChangedHandler?
    var value: Float { get }
}

Declaration
From
var valueChangedHandler: GCControllerAxisValueChangedHandler!
To
var valueChangedHandler: GCControllerAxisValueChangedHandler?

Declaration
From
class GCControllerButtonInput : GCControllerElement {
    var valueChangedHandler: GCControllerButtonValueChangedHandler!
    var pressedChangedHandler: GCControllerButtonValueChangedHandler!
    var value: Float { get }
    var pressed: Bool { get }
}
To
class GCControllerButtonInput : GCControllerElement {
    var valueChangedHandler: GCControllerButtonValueChangedHandler?
    var pressedChangedHandler: GCControllerButtonValueChangedHandler?
    var value: Float { get }
    var pressed: Bool { get }
}

Declaration
From
var pressedChangedHandler: GCControllerButtonValueChangedHandler!
To
var pressedChangedHandler: GCControllerButtonValueChangedHandler?

Declaration
From
var valueChangedHandler: GCControllerButtonValueChangedHandler!
To
var valueChangedHandler: GCControllerButtonValueChangedHandler?

Declaration
From
class GCControllerDirectionPad : GCControllerElement {
    var valueChangedHandler: GCControllerDirectionPadValueChangedHandler!
    var xAxis: GCControllerAxisInput! { get }
    var yAxis: GCControllerAxisInput! { get }
    var up: GCControllerButtonInput! { get }
    var down: GCControllerButtonInput! { get }
    var left: GCControllerButtonInput! { get }
    var right: GCControllerButtonInput! { get }
}
To
class GCControllerDirectionPad : GCControllerElement {
    var valueChangedHandler: GCControllerDirectionPadValueChangedHandler?
    var xAxis: GCControllerAxisInput { get }
    var yAxis: GCControllerAxisInput { get }
    var up: GCControllerButtonInput { get }
    var down: GCControllerButtonInput { get }
    var left: GCControllerButtonInput { get }
    var right: GCControllerButtonInput { get }
}

Declaration
From
var down: GCControllerButtonInput! { get }
To
var down: GCControllerButtonInput { get }

Declaration
From
var left: GCControllerButtonInput! { get }
To
var left: GCControllerButtonInput { get }

Declaration
From
var right: GCControllerButtonInput! { get }
To
var right: GCControllerButtonInput { get }

Declaration
From
var up: GCControllerButtonInput! { get }
To
var up: GCControllerButtonInput { get }

Declaration
From
var valueChangedHandler: GCControllerDirectionPadValueChangedHandler!
To
var valueChangedHandler: GCControllerDirectionPadValueChangedHandler?

Declaration
From
var xAxis: GCControllerAxisInput! { get }
To
var xAxis: GCControllerAxisInput { get }

Declaration
From
var yAxis: GCControllerAxisInput! { get }
To
var yAxis: GCControllerAxisInput { get }

Declaration
From
class GCControllerElement : NSObject {
    weak var collection: GCControllerElement! { get }
    var analog: Bool { get }
}
To
class GCControllerElement : NSObject {
    weak var collection: GCControllerElement? { get }
    var analog: Bool { get }
}

Declaration
From
weak var collection: GCControllerElement! { get }
To
weak var collection: GCControllerElement? { get }

Declaration
From
class GCExtendedGamepad : NSObject {
    weak var controller: GCController! { get }
    var valueChangedHandler: GCExtendedGamepadValueChangedHandler!
    func saveSnapshot() -> GCExtendedGamepadSnapshot!
    var dpad: GCControllerDirectionPad! { get }
    var buttonA: GCControllerButtonInput! { get }
    var buttonB: GCControllerButtonInput! { get }
    var buttonX: GCControllerButtonInput! { get }
    var buttonY: GCControllerButtonInput! { get }
    var leftThumbstick: GCControllerDirectionPad! { get }
    var rightThumbstick: GCControllerDirectionPad! { get }
    var leftShoulder: GCControllerButtonInput! { get }
    var rightShoulder: GCControllerButtonInput! { get }
    var leftTrigger: GCControllerButtonInput! { get }
    var rightTrigger: GCControllerButtonInput! { get }
}
To
class GCExtendedGamepad : NSObject {
    weak var controller: GCController? { get }
    var valueChangedHandler: GCExtendedGamepadValueChangedHandler?
    func saveSnapshot() -> GCExtendedGamepadSnapshot
    var dpad: GCControllerDirectionPad { get }
    var buttonA: GCControllerButtonInput { get }
    var buttonB: GCControllerButtonInput { get }
    var buttonX: GCControllerButtonInput { get }
    var buttonY: GCControllerButtonInput { get }
    var leftThumbstick: GCControllerDirectionPad { get }
    var rightThumbstick: GCControllerDirectionPad { get }
    var leftShoulder: GCControllerButtonInput { get }
    var rightShoulder: GCControllerButtonInput { get }
    var leftTrigger: GCControllerButtonInput { get }
    var rightTrigger: GCControllerButtonInput { get }
}

Declaration
From
var buttonA: GCControllerButtonInput! { get }
To
var buttonA: GCControllerButtonInput { get }

Declaration
From
var buttonB: GCControllerButtonInput! { get }
To
var buttonB: GCControllerButtonInput { get }

Declaration
From
var buttonX: GCControllerButtonInput! { get }
To
var buttonX: GCControllerButtonInput { get }

Declaration
From
var buttonY: GCControllerButtonInput! { get }
To
var buttonY: GCControllerButtonInput { get }

Declaration
From
weak var controller: GCController! { get }
To
weak var controller: GCController? { get }

Declaration
From
var dpad: GCControllerDirectionPad! { get }
To
var dpad: GCControllerDirectionPad { get }

Declaration
From
var leftShoulder: GCControllerButtonInput! { get }
To
var leftShoulder: GCControllerButtonInput { get }

Declaration
From
var leftThumbstick: GCControllerDirectionPad! { get }
To
var leftThumbstick: GCControllerDirectionPad { get }

Declaration
From
var leftTrigger: GCControllerButtonInput! { get }
To
var leftTrigger: GCControllerButtonInput { get }

Declaration
From
var rightShoulder: GCControllerButtonInput! { get }
To
var rightShoulder: GCControllerButtonInput { get }

Declaration
From
var rightThumbstick: GCControllerDirectionPad! { get }
To
var rightThumbstick: GCControllerDirectionPad { get }

Declaration
From
var rightTrigger: GCControllerButtonInput! { get }
To
var rightTrigger: GCControllerButtonInput { get }

Declaration
From
func saveSnapshot() -> GCExtendedGamepadSnapshot!
To
func saveSnapshot() -> GCExtendedGamepadSnapshot

Declaration
From
var valueChangedHandler: GCExtendedGamepadValueChangedHandler!
To
var valueChangedHandler: GCExtendedGamepadValueChangedHandler?

Declaration
From
class GCExtendedGamepadSnapshot : GCExtendedGamepad {
    @NSCopying var snapshotData: NSData!
    init!(snapshotData data: NSData!)
    init!(controller controller: GCController!, snapshotData data: NSData!)
}
To
class GCExtendedGamepadSnapshot : GCExtendedGamepad {
    @NSCopying var snapshotData: NSData
    init(snapshotData data: NSData)
    init(controller controller: GCController, snapshotData data: NSData)
}

Declaration
From
init!(controller controller: GCController!, snapshotData data: NSData!)
To
init(controller controller: GCController, snapshotData data: NSData)

Declaration
From
init!(snapshotData data: NSData!)
To
init(snapshotData data: NSData)

Declaration
From
@NSCopying var snapshotData: NSData!
To
@NSCopying var snapshotData: NSData

Declaration
From
struct GCExtendedGamepadSnapShotDataV100 {
    var version: UInt16
    var size: UInt16
    var dpadX: float_t
    var dpadY: float_t
    var buttonA: float_t
    var buttonB: float_t
    var buttonX: float_t
    var buttonY: float_t
    var leftShoulder: float_t
    var rightShoulder: float_t
    var leftThumbstickX: float_t
    var leftThumbstickY: float_t
    var rightThumbstickX: float_t
    var rightThumbstickY: float_t
    var leftTrigger: float_t
    var rightTrigger: float_t
    init()
    init(version version: UInt16, size size: UInt16, dpadX dpadX: float_t, dpadY dpadY: float_t, buttonA buttonA: float_t, buttonB buttonB: float_t, buttonX buttonX: float_t, buttonY buttonY: float_t, leftShoulder leftShoulder: float_t, rightShoulder rightShoulder: float_t, leftThumbstickX leftThumbstickX: float_t, leftThumbstickY leftThumbstickY: float_t, rightThumbstickX rightThumbstickX: float_t, rightThumbstickY rightThumbstickY: float_t, leftTrigger leftTrigger: float_t, rightTrigger rightTrigger: float_t)
}
To
struct GCExtendedGamepadSnapShotDataV100 {
    var version: UInt16
    var size: UInt16
    var dpadX: Float
    var dpadY: Float
    var buttonA: Float
    var buttonB: Float
    var buttonX: Float
    var buttonY: Float
    var leftShoulder: Float
    var rightShoulder: Float
    var leftThumbstickX: Float
    var leftThumbstickY: Float
    var rightThumbstickX: Float
    var rightThumbstickY: Float
    var leftTrigger: Float
    var rightTrigger: Float
    init()
    init(version version: UInt16, size size: UInt16, dpadX dpadX: Float, dpadY dpadY: Float, buttonA buttonA: Float, buttonB buttonB: Float, buttonX buttonX: Float, buttonY buttonY: Float, leftShoulder leftShoulder: Float, rightShoulder rightShoulder: Float, leftThumbstickX leftThumbstickX: Float, leftThumbstickY leftThumbstickY: Float, rightThumbstickX rightThumbstickX: Float, rightThumbstickY rightThumbstickY: Float, leftTrigger leftTrigger: Float, rightTrigger rightTrigger: Float)
}

Declaration
From
var buttonA: float_t
To
var buttonA: Float

Declaration
From
var buttonB: float_t
To
var buttonB: Float

Declaration
From
var buttonX: float_t
To
var buttonX: Float

Declaration
From
var buttonY: float_t
To
var buttonY: Float

Declaration
From
var dpadX: float_t
To
var dpadX: Float

Declaration
From
var dpadY: float_t
To
var dpadY: Float

Modified GCExtendedGamepadSnapShotDataV100.init(version: UInt16, size: UInt16, dpadX: Float, dpadY: Float, buttonA: Float, buttonB: Float, buttonX: Float, buttonY: Float, leftShoulder: Float, rightShoulder: Float, leftThumbstickX: Float, leftThumbstickY: Float, rightThumbstickX: Float, rightThumbstickY: Float, leftTrigger: Float, rightTrigger: Float)
Declaration
From
init(version version: UInt16, size size: UInt16, dpadX dpadX: float_t, dpadY dpadY: float_t, buttonA buttonA: float_t, buttonB buttonB: float_t, buttonX buttonX: float_t, buttonY buttonY: float_t, leftShoulder leftShoulder: float_t, rightShoulder rightShoulder: float_t, leftThumbstickX leftThumbstickX: float_t, leftThumbstickY leftThumbstickY: float_t, rightThumbstickX rightThumbstickX: float_t, rightThumbstickY rightThumbstickY: float_t, leftTrigger leftTrigger: float_t, rightTrigger rightTrigger: float_t)
To
init(version version: UInt16, size size: UInt16, dpadX dpadX: Float, dpadY dpadY: Float, buttonA buttonA: Float, buttonB buttonB: Float, buttonX buttonX: Float, buttonY buttonY: Float, leftShoulder leftShoulder: Float, rightShoulder rightShoulder: Float, leftThumbstickX leftThumbstickX: Float, leftThumbstickY leftThumbstickY: Float, rightThumbstickX rightThumbstickX: Float, rightThumbstickY rightThumbstickY: Float, leftTrigger leftTrigger: Float, rightTrigger rightTrigger: Float)

Declaration
From
var leftShoulder: float_t
To
var leftShoulder: Float

Declaration
From
var leftThumbstickX: float_t
To
var leftThumbstickX: Float

Declaration
From
var leftThumbstickY: float_t
To
var leftThumbstickY: Float

Declaration
From
var leftTrigger: float_t
To
var leftTrigger: Float

Declaration
From
var rightShoulder: float_t
To
var rightShoulder: Float

Declaration
From
var rightThumbstickX: float_t
To
var rightThumbstickX: Float

Declaration
From
var rightThumbstickY: float_t
To
var rightThumbstickY: Float

Declaration
From
var rightTrigger: float_t
To
var rightTrigger: Float

Modified GCGamepad
Declaration
From
class GCGamepad : NSObject {
    weak var controller: GCController! { get }
    var valueChangedHandler: GCGamepadValueChangedHandler!
    func saveSnapshot() -> GCGamepadSnapshot!
    var dpad: GCControllerDirectionPad! { get }
    var buttonA: GCControllerButtonInput! { get }
    var buttonB: GCControllerButtonInput! { get }
    var buttonX: GCControllerButtonInput! { get }
    var buttonY: GCControllerButtonInput! { get }
    var leftShoulder: GCControllerButtonInput! { get }
    var rightShoulder: GCControllerButtonInput! { get }
}
To
class GCGamepad : NSObject {
    weak var controller: GCController? { get }
    var valueChangedHandler: GCGamepadValueChangedHandler?
    func saveSnapshot() -> GCGamepadSnapshot
    var dpad: GCControllerDirectionPad { get }
    var buttonA: GCControllerButtonInput { get }
    var buttonB: GCControllerButtonInput { get }
    var buttonX: GCControllerButtonInput { get }
    var buttonY: GCControllerButtonInput { get }
    var leftShoulder: GCControllerButtonInput { get }
    var rightShoulder: GCControllerButtonInput { get }
}

Declaration
From
var buttonA: GCControllerButtonInput! { get }
To
var buttonA: GCControllerButtonInput { get }

Declaration
From
var buttonB: GCControllerButtonInput! { get }
To
var buttonB: GCControllerButtonInput { get }

Declaration
From
var buttonX: GCControllerButtonInput! { get }
To
var buttonX: GCControllerButtonInput { get }

Declaration
From
var buttonY: GCControllerButtonInput! { get }
To
var buttonY: GCControllerButtonInput { get }

Declaration
From
weak var controller: GCController! { get }
To
weak var controller: GCController? { get }

Declaration
From
var dpad: GCControllerDirectionPad! { get }
To
var dpad: GCControllerDirectionPad { get }

Declaration
From
var leftShoulder: GCControllerButtonInput! { get }
To
var leftShoulder: GCControllerButtonInput { get }

Declaration
From
var rightShoulder: GCControllerButtonInput! { get }
To
var rightShoulder: GCControllerButtonInput { get }

Declaration
From
func saveSnapshot() -> GCGamepadSnapshot!
To
func saveSnapshot() -> GCGamepadSnapshot

Declaration
From
var valueChangedHandler: GCGamepadValueChangedHandler!
To
var valueChangedHandler: GCGamepadValueChangedHandler?

Declaration
From
class GCGamepadSnapshot : GCGamepad {
    @NSCopying var snapshotData: NSData!
    init!(snapshotData data: NSData!)
    init!(controller controller: GCController!, snapshotData data: NSData!)
}
To
class GCGamepadSnapshot : GCGamepad {
    @NSCopying var snapshotData: NSData
    init(snapshotData data: NSData)
    init(controller controller: GCController, snapshotData data: NSData)
}

Declaration
From
init!(controller controller: GCController!, snapshotData data: NSData!)
To
init(controller controller: GCController, snapshotData data: NSData)

Declaration
From
init!(snapshotData data: NSData!)
To
init(snapshotData data: NSData)

Declaration
From
@NSCopying var snapshotData: NSData!
To
@NSCopying var snapshotData: NSData

Declaration
From
struct GCGamepadSnapShotDataV100 {
    var version: UInt16
    var size: UInt16
    var dpadX: float_t
    var dpadY: float_t
    var buttonA: float_t
    var buttonB: float_t
    var buttonX: float_t
    var buttonY: float_t
    var leftShoulder: float_t
    var rightShoulder: float_t
    init()
    init(version version: UInt16, size size: UInt16, dpadX dpadX: float_t, dpadY dpadY: float_t, buttonA buttonA: float_t, buttonB buttonB: float_t, buttonX buttonX: float_t, buttonY buttonY: float_t, leftShoulder leftShoulder: float_t, rightShoulder rightShoulder: float_t)
}
To
struct GCGamepadSnapShotDataV100 {
    var version: UInt16
    var size: UInt16
    var dpadX: Float
    var dpadY: Float
    var buttonA: Float
    var buttonB: Float
    var buttonX: Float
    var buttonY: Float
    var leftShoulder: Float
    var rightShoulder: Float
    init()
    init(version version: UInt16, size size: UInt16, dpadX dpadX: Float, dpadY dpadY: Float, buttonA buttonA: Float, buttonB buttonB: Float, buttonX buttonX: Float, buttonY buttonY: Float, leftShoulder leftShoulder: Float, rightShoulder rightShoulder: Float)
}

Declaration
From
var buttonA: float_t
To
var buttonA: Float

Declaration
From
var buttonB: float_t
To
var buttonB: Float

Declaration
From
var buttonX: float_t
To
var buttonX: Float

Declaration
From
var buttonY: float_t
To
var buttonY: Float

Declaration
From
var dpadX: float_t
To
var dpadX: Float

Declaration
From
var dpadY: float_t
To
var dpadY: Float

Modified GCGamepadSnapShotDataV100.init(version: UInt16, size: UInt16, dpadX: Float, dpadY: Float, buttonA: Float, buttonB: Float, buttonX: Float, buttonY: Float, leftShoulder: Float, rightShoulder: Float)
Declaration
From
init(version version: UInt16, size size: UInt16, dpadX dpadX: float_t, dpadY dpadY: float_t, buttonA buttonA: float_t, buttonB buttonB: float_t, buttonX buttonX: float_t, buttonY buttonY: float_t, leftShoulder leftShoulder: float_t, rightShoulder rightShoulder: float_t)
To
init(version version: UInt16, size size: UInt16, dpadX dpadX: Float, dpadY dpadY: Float, buttonA buttonA: Float, buttonB buttonB: Float, buttonX buttonX: Float, buttonY buttonY: Float, leftShoulder leftShoulder: Float, rightShoulder rightShoulder: Float)

Declaration
From
var leftShoulder: float_t
To
var leftShoulder: Float

Declaration
From
var rightShoulder: float_t
To
var rightShoulder: Float

Modified GCMotion
Declaration
From
class GCMotion : NSObject {
    weak var controller: GCController! { get }
    var valueChangedHandler: GCMotionValueChangedHandler!
    var gravity: GCAcceleration { get }
    var userAcceleration: GCAcceleration { get }
    var attitude: GCQuaternion { get }
    var rotationRate: GCRotationRate { get }
}
To
class GCMotion : NSObject {
    weak var controller: GCController? { get }
    var valueChangedHandler: GCMotionValueChangedHandler?
    var gravity: GCAcceleration { get }
    var userAcceleration: GCAcceleration { get }
    var attitude: GCQuaternion { get }
    var rotationRate: GCRotationRate { get }
}

Declaration
From
weak var controller: GCController! { get }
To
weak var controller: GCController? { get }

Declaration
From
var valueChangedHandler: GCMotionValueChangedHandler!
To
var valueChangedHandler: GCMotionValueChangedHandler?

Declaration
From
typealias GCControllerAxisValueChangedHandler = (GCControllerAxisInput!, Float) -> Void
To
typealias GCControllerAxisValueChangedHandler = (GCControllerAxisInput, Float) -> Void

Declaration
From
typealias GCControllerButtonValueChangedHandler = (GCControllerButtonInput!, Float, Bool) -> Void
To
typealias GCControllerButtonValueChangedHandler = (GCControllerButtonInput, Float, Bool) -> Void

Declaration
From
typealias GCControllerDirectionPadValueChangedHandler = (GCControllerDirectionPad!, Float, Float) -> Void
To
typealias GCControllerDirectionPadValueChangedHandler = (GCControllerDirectionPad, Float, Float) -> Void

Declaration
From
func GCExtendedGamepadSnapShotDataV100FromNSData(_ snapshotData: UnsafeMutablePointer<GCExtendedGamepadSnapShotDataV100>, _ data: NSData!) -> Bool
To
func GCExtendedGamepadSnapShotDataV100FromNSData(_ snapshotData: UnsafeMutablePointer<GCExtendedGamepadSnapShotDataV100>, _ data: NSData?) -> Bool

Declaration
From
typealias GCExtendedGamepadValueChangedHandler = (GCExtendedGamepad!, GCControllerElement!) -> Void
To
typealias GCExtendedGamepadValueChangedHandler = (GCExtendedGamepad, GCControllerElement) -> Void

Declaration
From
func GCGamepadSnapShotDataV100FromNSData(_ snapshotData: UnsafeMutablePointer<GCGamepadSnapShotDataV100>, _ data: NSData!) -> Bool
To
func GCGamepadSnapShotDataV100FromNSData(_ snapshotData: UnsafeMutablePointer<GCGamepadSnapShotDataV100>, _ data: NSData?) -> Bool

Declaration
From
typealias GCGamepadValueChangedHandler = (GCGamepad!, GCControllerElement!) -> Void
To
typealias GCGamepadValueChangedHandler = (GCGamepad, GCControllerElement) -> Void

Declaration
From
typealias GCMotionValueChangedHandler = (GCMotion!) -> Void
To
typealias GCMotionValueChangedHandler = (GCMotion) -> Void

Declaration
From
func NSDataFromGCExtendedGamepadSnapShotDataV100(_ snapshotData: UnsafeMutablePointer<GCExtendedGamepadSnapShotDataV100>) -> NSData!
To
func NSDataFromGCExtendedGamepadSnapShotDataV100(_ snapshotData: UnsafeMutablePointer<GCExtendedGamepadSnapShotDataV100>) -> NSData?

Declaration
From
func NSDataFromGCGamepadSnapShotDataV100(_ snapshotData: UnsafeMutablePointer<GCGamepadSnapShotDataV100>) -> NSData!
To
func NSDataFromGCGamepadSnapShotDataV100(_ snapshotData: UnsafeMutablePointer<GCGamepadSnapShotDataV100>) -> NSData?