#Methods

#init

init(_ appId: String)

Creates a new Engage instance (required to display elements) using your app ID.
The engage object should be retained, so you'll have to instanciate it at class level or store it in a controller that stays alive for the time you're using it.

#createElement

func createElement(_ slug: String, _ target: UIView)

Presents the desired Engage element in the targeted UIView.
⚠️ This doesn't take display conditions into account. It will print the element no matter what.

#autoCreate

func autoCreate()

Presents multiple elements depending on target condition.
EngageIOS SDK provides a UIView extension for you to add a target value to your views, just do the following:
⚠️ If multiple views have the same target value, the element will only be printed in the first view matching the value.

#config

func config(_ config: [String: Any], _ readOnly: Bool = false)

Allows to set some configuration options. See the configuration options documentation.

#texts

func texts(_ texts: [String: String], locale: String = "en", _ readOnly: Bool = false)

Allows to set custom texts all over your elements for the desired locale. See the texts documentation.
ℹ️ You can set several times the same text value with different locales.

#variables

func variables(_ variables: [String: Any]) -> Void

Allows to set custom variables to be replaced inside some text keys. See the variables documentation.

#on

func on(_ event: EngageEvent, once: Bool = false)

Allows to listen to a specific event in Engage lifecycle (ex: onReady). See the events documentation.

#off

func off(_ event: EngageEvent)

Allows to remove a listener previously set with the .on method.

#setDebug

static func setDebug(_ enabled: Bool)

Enables/Disables debugging for all Engage instances.