FreSwiftMainController

public protocol FreSwiftMainController

FreSwiftMainController: Our SwiftController extends this Protocol.

  • Map of functions to connect Objective C to Swift

    Declaration

    Swift

    var functionsToSet: FREFunctionMap { get set }
  • FREContext

    Declaration

    Swift

    var context: FreContextSwift! { get set }
  • TAG

    Tag used when tracing logs

    Declaration

    Swift

    static var TAG: String { get set }
  • Returns functions which connect Objective C to Swift

    Declaration

    Swift

    func getFunctions(prefix: String) -> [String]
  • Allows Objective C to call our Swift Controller

    Declaration

    Swift

    func callSwiftFunction(name: String, ctx: FREContext, argc: FREArgc, argv: FREArgv) -> FREObject?

    Parameters

    name

    name of the function

    ctx

    context

    argc

    number of arguments

    argv

    array of FREObject arguments

  • Called by Objective C when ANE is loaded into memory

    @objc func applicationDidFinishLaunching(_ notification: Notification) {
        appDidFinishLaunchingNotif = notification
    }
    
    public func onLoad() {
       NotificationCenter.default.addObserver(self, selector: #selector(applicationDidFinishLaunching),
       name: UIApplication.didFinishLaunchingNotification, object: nil)
    }
    

    Declaration

    Swift

    func onLoad()
  • trace(_:) Extension method

    trace: sends StatusEvent to our swc with a level of “TRACE”

    trace("Hello")
    

    Declaration

    Swift

    func trace(_ value: Any...)

    Parameters

    value

    value to trace to console

    Return Value

    Void

  • info(_:) Extension method

    info: sends StatusEvent to our swc with a level of “TRACE” The output string is prefixed with ℹ️ INFO:

    info("Hello")
    

    Declaration

    Swift

    func info(_ value: Any...)

    Parameters

    value

    value to trace to console

    Return Value

    Void

  • warning(_:) Extension method

    warning: sends StatusEvent to our swc with a level of “TRACE” The output string is prefixed with ⚠️ WARNING:

    warning("Hello")
    

    Declaration

    Swift

    func warning(_ value: Any...)

    Parameters

    value

    value to trace to console

    Return Value

    Void

  • dispatchEvent(name:value:) Extension method

    dispatchEvent: sends StatusEvent to our swc with a level of name and code of value replaces DispatchStatusEventAsync

    dispatchEvent("MY_EVENT", "ok")
    

    Declaration

    Swift

    func dispatchEvent(name: String, value: String)

    Parameters

    name

    name of event

    value

    value passed with event

    Return Value

    Void