Skip to main content

iOS Framework API References

Initialization Method

GlamAr.initialize(
accessKey: String, // Required - Pass your unique access key for the GlamAR service
debug: Bool? = false, // false by default
bundleIdentifier: String? = Bundle.main.bundleIdentifier, // Bundle.main.bundleIdentifier by default
overrides: GlamAROverrides? = nil,
webView:WKWebView? = nil) //
ParametersTypeDescriptionOptions
accessKeystringYour unique access key for the GlamAR serviceRequired
debugbooleanA flag to switch between debug and production environments

true: Uses debug/staging environment
false: Uses production environment Default - false

bundleIdentifierstringIdentifier is used for parent domain white listing

Default - Bundle.main.bundleIdentifier

overridesGlamAROverrides

Category configurations. Check GlamAROverrides inside GlamAR package

Default - nil

webViewWKWebViewPass a pre-configured WKWebView

Default - nil

Post-Initialization Methods

open

GlamAr.skinAnalysis(options:"start");

Opens the Skin Analysis flow.
Return Value: None

ParametersDescriptionTypeOptions
optionsPass start (Required)stringstart

addEventListener

GlamAr.addEventListener(event: String, callback: @escaping (Any?) -> Void);

Adds the listener to the given event name.
Return Value: None

ParametersTypeDescription
eventNamestring

A Name of specific event or "*" To listen to the all the events.

handlerFunctionfunction Your handler function that will listen to callback.

removeEventListener

GlamAr.removeEventListener(event:String);

Removes the given listener for the event name.
Return Value: None

ParametersTypeDescription
eventNamestring

A Name of specific event or "*" To remove all the events.

isLoaded

GlamAr.isLoaded();

Returns the status of module loading.
Return Bool: true if loaded, otherwise false

ParametersDescription

None

No parameters required.

reset

GlamAr.reset();

Removes all the current effects from the canvas.
Return Value: None

ParametersDescription

None

No parameters required.

close

GlamAr.close();

Closes canvas and returns to the main widget page.
Return Value: None

ParametersDescription

None

No parameters required.

snapshot

GlamAr.snapshot();

After a successfully scan, client can be get a PDF of his scan from share event
Return Value: none

ParametersDescription

None

No parameters required.

back

GlamAR.back();

To simulate back button without using UI
Return Value: None

ParametersDescription
None No parameters required.

Events

The GlamAR SDK emits various events throughout its lifecycle to help you monitor state, respond to user actions, and handle success or failure cases.

GlamAr.addEventListener(event: "loaded") { (callbackValue) in
print("loaded: \(callbackValue ?? "")")
}

GlamAr.addEventListener(event: "skin-analysis") { (callbackValue) in
print("skin-analysis: \(callbackValue ?? "")")
}

Check Events Page for event details.