Documentation Archive Developer
Search

GameplayKit Changes for Swift

GameplayKit

Modified GKBehavior
Declaration
From
class GKBehavior : NSObject, NSFastEnumeration {
    var goalCount: Int { get }
    convenience init(goal goal: GKGoal, weight weight: Float)
    class func behaviorWithGoal(_ goal: GKGoal, weight weight: Float) -> Self
    convenience init(goals goals: [GKGoal])
    class func behaviorWithGoals(_ goals: [GKGoal]) -> Self
    convenience init(goals goals: [GKGoal], andWeights weights: [NSNumber])
    class func behaviorWithGoals(_ goals: [GKGoal], andWeights weights: [NSNumber]) -> Self
    convenience init(weightedGoals weightedGoals: [GKGoal : NSNumber])
    class func behaviorWithWeightedGoals(_ weightedGoals: [GKGoal : NSNumber]) -> Self
    func setWeight(_ weight: Float, forGoal goal: GKGoal)
    func weightForGoal(_ goal: GKGoal) -> Float
    func removeGoal(_ goal: GKGoal)
    func removeAllGoals()
    subscript (_ idx: Int) -> GKGoal { get }
    func objectAtIndexedSubscript(_ idx: Int) -> GKGoal
    subscript (_ goal: GKGoal) -> NSNumber
    func setObject(_ weight: NSNumber, forKeyedSubscript goal: GKGoal)
    func objectForKeyedSubscript(_ goal: GKGoal) -> NSNumber
}
To
class GKBehavior : NSObject, NSFastEnumeration {
    var goalCount: Int { get }
    convenience init(goal goal: GKGoal, weight weight: Float)
    class func behaviorWithGoal(_ goal: GKGoal, weight weight: Float) -> Self
    convenience init(goals goals: [GKGoal])
    class func behaviorWithGoals(_ goals: [GKGoal]) -> Self
    convenience init(goals goals: [GKGoal], andWeights weights: [NSNumber])
    class func behaviorWithGoals(_ goals: [GKGoal], andWeights weights: [NSNumber]) -> Self
    convenience init(weightedGoals weightedGoals: [GKGoal : NSNumber])
    class func behaviorWithWeightedGoals(_ weightedGoals: [GKGoal : NSNumber]) -> Self
    func setWeight(_ weight: Float, forGoal goal: GKGoal)
    func weightForGoal(_ goal: GKGoal) -> Float
    func removeGoal(_ goal: GKGoal)
    func removeAllGoals()
    subscript (_ idx: Int) -> GKGoal { get }
    func objectAtIndexedSubscript(_ idx: Int) -> GKGoal
    func setObject(_ weight: NSNumber, forKeyedSubscript goal: GKGoal)
    subscript (_ goal: GKGoal) -> NSNumber
    func objectForKeyedSubscript(_ goal: GKGoal) -> NSNumber
}