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 enand ko.
defaultCurrency:String
The currency to be displayed on the widget. The default value is KRW. The currently supported currencies are USDand KRW.
Handle Universal Link
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.
public enum WidgetType: String {
case show
case hide
}
public struct WidgetAttributes {
var type: WidgetType
var defaultLanguage: String
var defaultCurrency: String
}
// If you are adding it to AppDelegate, handle it here:
// func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool{ }
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else { return }
let bundleId = Bundle.main.infoDictionary?[“CFBundleIdentifier”] as! String
print(“bundleId ” + bundleId)
let checkScheme = bundleId + “.wepin”
// Check url scheme
guard url.scheme == checkScheme else {
print(“invalid url scheme : ” + url.scheme!)
return
}
// Pass the received URL to Wepin.
Wepin.instance().handleUniversalLink(paramUrl: url)
//
}
if(Wepin.isInitialized()) {
// Success to initialize wepin
}