Propertied

public protocol Propertied

Any TiledKit object that can have user defined properties, that supports writing of properties

  • The Properties of the object

    Declaration

    Swift

    var properties: Properties { get }
  • is(a:) Extension method

    Determines if the type of the propertied object matches the type supplied

    Declaration

    Swift

    func `is`(a type: TiledType) -> Bool

    Parameters

    type

    The type(s) to be tested

    Return Value

    true if it matches, false otherwise

  • tiledType Extension method

    The type of the Propertied object

    Declaration

    Swift

    var tiledType: TiledType { get }
  • hasProperty(in:) Extension method

    Determines if the properties of the object include at least one of the properties in the supplied array

    Declaration

    Swift

    func hasProperty<EngineProperty>(in properties: [EngineProperty]) -> Bool where EngineProperty : BridgableProperty

    Parameters

    properties

    The properties to check for

    Return Value

    true if at least one of the properties exists

  • subscript(dynamicMember:) Extension method

    Retreives a Color from an object that can have user properties dynamically.

            let fillColor : Color = layer.fillColor ?? Color.white
    

    Declaration

    Swift

    subscript(dynamicMember member: String) -> Color? { get }

    Parameters

    member

    The name of the property

    Return Value

    The Color value or nil if the property does not exist, or is not of the right type

  • subscript(dynamicMember:) Extension method

    Retreives a URL from an object that can have user properties dynamically.

            let levelTheme : URL? = layer.levelMP3
    

    Declaration

    Swift

    subscript(dynamicMember member: String) -> URL? { get }

    Parameters

    member

    The name of the property

    Return Value

    The URL value or nil if the property does not exist, or is not of the right type

  • subscript(dynamicMember:) Extension method

    Retreives a Double from an object that can have user properties dynamically.

            let weight : Double = object.weight ?? 100.0
    

    Declaration

    Swift

    subscript(dynamicMember member: String) -> Double? { get }

    Parameters

    member

    The name of the property

    Return Value

    The Double value or nil if the property does not exist, or is not of the right type

  • subscript(dynamicMember:) Extension method

    Retreives a Int from an object that can have user properties dynamically.

            let extraLives : Int = layer.bonusLives ?? 0
    

    Declaration

    Swift

    subscript(dynamicMember member: String) -> Int? { get }

    Parameters

    member

    The name of the property

    Return Value

    The Int value or nil if the property does not exist, or is not of the right type

  • subscript(dynamicMember:) Extension method

    Retreives a Bool from an object that can have user properties dynamically.

            let pausable : Bool = layer.pausable ?? true
    

    Declaration

    Swift

    subscript(dynamicMember member: String) -> Bool? { get }

    Parameters

    member

    The name of the property

    Return Value

    The Bool value or nil if the property does not exist, or is not of the right type

  • subscript(dynamicMember:) Extension method

    Retreives a String from an object that can have user properties dynamically.

            let gameOverText : String = layer.gameOverText ?? "Game Over"
    

    Declaration

    Swift

    subscript(dynamicMember member: String) -> String? { get }

    Parameters

    member

    The name of the property

    Return Value

    The String value or nil if the property does not exist, or is not of the right type