FREObject

public extension FREObject

FREObject: Extends FREObject with Swift syntax.

  • hasOwnProperty: Indicates whether an object has a specified property defined.

    if argv[0].hasOwnProperty("name") {
    
    }
    

    Declaration

    Swift

    func hasOwnProperty(name: String) -> Bool

    Parameters

    name

    The property of the FREObject.

    Return Value

    Bool

  • toString: Calls toString() on a FREObject

    Declaration

    Swift

    func toString(_ suppressStrings: Bool = false) -> String

    Parameters

    suppressStrings

    If calling toString on a String pass true to prevent infinite conversion loop.

    Return Value

    String

  • init: Creates a new FREObject.

    let newPerson = FREObject(className: "com.tuarua.Person", args: 1, true, "Free")
    

    Declaration

    Swift

    init?(className: String, args: Any?...)

    Parameters

    className

    name of AS3 class to create

    args

    arguments to use. These are automatically converted to FREObjects

    Return Value

    FREObject?

  • init: Creates a new FREObject.

    let newPerson = FREObject(className: "com.tuarua.Person")
    

    Declaration

    Swift

    init?(className: String)

    Parameters

    className

    name of AS3 class to create

    Return Value

    FREObject?

  • call: Calls a method on a FREObject.

    person.call(method: "add", args: 100, 31)
    

    Declaration

    Swift

    @discardableResult
    func call(method: String, args: Any?...) -> FREObject?

    Parameters

    method

    name of AS3 method to call

    args

    arguments to pass to the method

    Return Value

    FREObject?

  • returns the type of the FREObject

    Declaration

    Swift

    var type: FreObjectTypeSwift { get }
  • returns the className of the FREObject

    Declaration

    Swift

    var className: String? { get }
  • accessor: sets/gets the Property of a FREObject.

    let myName = argv[0]["name"]
    argv[0]["name"] = "New Name".toFREObject()
    

    Declaration

    Swift

    subscript(name: String) -> FREObject? { get set }

    Parameters

    name

    name of the property to return

    Return Value

    FREObject?

  • value: returns the Swift value of a FREObject.

    Declaration

    Swift

    var value: Any? { get }

    Return Value

    Any?