Button
class Button : NSObject
The main interface to the Button SDK.
-
@returns The current SDK version (e.g. @“6.33.0”).
-
Configures Button with your
applicationId
.@note Get your application Id from from the Button Dashboard.
@params applicationId Your applicationId (required).
Declaration
Swift
class func configure(applicationId: String) async throws
Parameters
completionHandler
A block to be executed upon completion (optional).
-
Button Purchase Path takes regular Merchant URLs to products, categories or just the homepage and replaces them with a fully attributed Button Purchase Path, optimized for both conversion and user experience. https://developer.usebutton.com/docs/publishers-ios-app-setup#handle-link-routing-when-a-user-taps
Example usage:
BTNPurchasePathRequest *request = [BTNPurchasePathRequest requestWithURL:merchantURL]; [Button.purchasePath fetchWithRequest:request purchasePathHandler:^(BTNPurchasePath *purchasePath, NSError *error) { [purchasePath start]; }];
Declaration
Swift
class var purchasePath: any PurchasePathInterface { get }
-
Associate your user with a Button session.
@discussion You can associate all Button activity with one of your users by setting their User Identifier. This can be your user ID or a stable hash of one. You can use this later to look up orders in Webhooks.
Button.user.setIdentifier(myLoggedInUser.identifier);
Declaration
Swift
class var user: any User { get }
-
Button SDK feature configuration.
Declaration
Swift
class var configuration: any ConfigurationInterface { get }
-
Offer impressions
Declaration
Swift
class var offers: any OffersInterface { get }
-
Debug the Button SDK.
@discussion Enable debug logging during integration for more visibility.
Button.debug.loggingEnabled = YES;
Declaration
Swift
class var debug: any DebugInterface { get }
-
Discards the current session and all persisted data.
@discussion Call this method in your log out handler if/when your user logs out of your app.
Declaration
Swift
class func clearAllData()