Initialization

Here is how to initialize the Wepin widget iOS SDK.

Then, use the App ID and App Key assigned after app registration to initialize the instance.

Initialize

Before using the created instance, initialize it using the App ID and App Key.

import wepin

let appId = "app_id_eg12sf3491azgs520"
let appKey = "ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313", 
let attributes = Wepin.WidgetAttributes(type: Wepin.WidgetType.show)

let attributes = Wepin.WidgetAttributes(type: Wepin.WidgetType.show)
let wepin = Wepin.instance()
wepin.initialize(appId: appId, appKey: appKey, attributes: attributes){ (result, error) -> Void in
    print(result)
}

WidgetAttributes, WidgetType

The WidgetAttributes and WidgetType, which are used as parameters for initialization, are as follows.

  • appId: String App ID assigned during registration

  • appKey: String App Key assigned during registration

  • attributes: Object (optional) Properties of the Wepin Widget

    • type: WidgetType It determines how the app widget window will be displayed on initial loading. The default value is hide. show: Show the widget window immediately after loading for the first time. hide: Hide the widget window initially when loading and show it later using openWidget().

    • defaultLanguage: String The language to be displayed on the widget. The default value is ko. The currently supported languages are en and ko.

    • defaultCurrency: String The currency to be displayed on the widget. The default value is KRW. The currently supported currencies are USD and KRW.

You need to handle the URL schemes added in the app's Info file in the AppDelegate or SceneDelegate. If your app has SceneDelegate, handle it there. Otherwise, add the following code to handle it int the AppDelegate.

isInitialized

You can use the isInitialized method to check if the Wepin instance has been initialized successfully.

The returned value is as follows.

  • boolean init result; true if Wepin SDK is already initialized, otherwise false.

Last updated

Was this helpful?