Initialize SDK object and use it anywhere in your application.
Remember to initialize SDK only once on application launch. Don't forget to replace the %YOUR_STORE_KEY% text with the current store key from your PersonaClick account.
import PersonaClick
sdk = createPersonalizationSDK(
shopId: "%YOUR_STORE_KEY%",
apiDomain: "api.personaclick.com",
enableLogs: false,
parentViewController: (window?.rootViewController)!,
needReInitialization: true, // Optional: Allows reinitialization of the SDK and clears the local storage.
{ error in
// Assign the SDK instance to a global variable for reuse across the application.
globalSDK = self.sdk
// Notify other parts of the application about the successful initialization of the SDK.
NotificationCenter.default.post(name: globalSDKNotificationNameMainInit, object: nil)
}
)
Parameters
Name
Type
Requirement
Description
shopId
string
required
The current store key from the PersonaClick account.
apiDomain
string
required
The API domain for server communication.
enableLogs
boolean
optionally
Enable logs for debugging purposes during development.
parentViewController
controller
optionally
The view controller to display in-app notifications.
needReInitialization
boolean
optionally
Allows reinitialization of the SDK and clears the local storage.
userEmail
string
optionally
User Email.
userPhone
string
optionally
User Phone.
userLoyaltyId
string
optionally
The Loyalty Program user ID (loyalty card).
autoSendPushToken
boolean
optionally
Thetruevalue (the default) allows the token to be requested, andfalsedisallows it.