API Reference
Complete iOS SDK properties and methods reference
Properties
delegate
Grovs.delegate: GrovsDelegate?The delegate that receives deep link callbacks from the SDK.
userIdentifier
Grovs.userIdentifier: String?Get or set the user identifier. This value appears in the Grovs dashboard and reports. Typically set to your app's user_id.
userAttributes
Grovs.userAttributes: [String: Any]?Get or set user attributes. These appear in the Grovs dashboard for user identification and behavior analysis.
pushToken
Grovs.pushToken: String?Get or set the push notification token. Used for receiving push notifications for messages sent from the dashboard.
Methods
configure
Grovs.configure(APIKey: String, useTestEnvironment: Bool, baseURL: String? = nil, delegate: GrovsDelegate?, completion: GrovsBoolCompletion? = nil)Initialize the SDK with your API key.
| Parameter | Description |
|---|---|
APIKey | Your project API key from the Grovs dashboard. |
useTestEnvironment | When true, the SDK operates in test mode. |
baseURL | Optional domain for self-hosted backends (e.g. "https://your-domain.com"). The SDK appends the API path automatically. Defaults to the Grovs cloud. |
delegate | The delegate that receives deep link callbacks. |
completion | Optional callback indicating whether SDK authentication succeeded or failed. Called on the main thread. |
setSDK
Grovs.setSDK(enabled: Bool)Enable or disable the SDK.
setDebug
Grovs.setDebug(level: LogLevel)Set the debug logging level. See LogLevel for available values. Default is .error.
generateLink
Grovs.generateLink(
title: String? = nil,
subtitle: String? = nil,
imageURL: String? = nil,
data: [String: Any]? = nil,
tags: [String]? = nil,
customRedirects: CustomRedirects? = nil,
showPreviewiOS: Bool? = nil,
showPreviewAndroid: Bool? = nil,
trackingCampaign: String? = nil,
trackingSource: String? = nil,
trackingMedium: String? = nil,
completion: @escaping GrovsURLClosure
)Generate a smart link with the specified parameters.
lastReceivedPayload
Grovs.lastReceivedPayload(completion: @escaping GrovsPayloadClosure)Retrieve the last received deep link payload.
allReceivedPayloadsSinceStartup
Grovs.allReceivedPayloadsSinceStartup(completion: @escaping GrovsPayloadsClosure)Retrieve all payloads received since app launch.
handleSceneDelegate (openURLContexts)
Grovs.handleSceneDelegate(openURLContexts URLContexts: Set<UIOpenURLContext>)Forward open URL contexts from your SceneDelegate.
handleSceneDelegate (continue)
Grovs.handleSceneDelegate(continue userActivity: NSUserActivity)Forward user activity continuation from your SceneDelegate.
handleSceneDelegate (options)
Grovs.handleSceneDelegate(options connectionOptions: UIScene.ConnectionOptions)Forward connection options from your SceneDelegate.
handleAppDelegate (continue)
Grovs.handleAppDelegate(continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> BoolForward universal link continuation from your AppDelegate.
handleAppDelegate (open)
Grovs.handleAppDelegate(open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> BoolForward URL opening from your AppDelegate.
displayMessagesViewController
Grovs.displayMessagesViewController(completion: GrovsEmptyClosure?)Display the messages list as a modal.
numberOfUnreadMessages
Grovs.numberOfUnreadMessages(completion: @escaping GrovsIntClosure)Get the count of unread messages.
logInAppPurchase
Grovs.logInAppPurchase(transactionID: UInt64, completion: @escaping GrovsBoolCompletion)Log a StoreKit 2 in-app purchase. The SDK extracts price, currency, and product details from StoreKit automatically. Requires iOS 15+.
logCustomPurchase
Grovs.logCustomPurchase(
type: TransactionType,
priceInCents: Int,
currency: String,
productID: String,
startDate: Date? = nil,
completion: @escaping GrovsBoolCompletion
)Log a custom purchase, cancellation, or refund. TransactionType is one of .buy, .cancel, or .refund.
linkDetails
Grovs.linkDetails(path: String, completion: @escaping GrovsLinkClosure)Get details for a link with the given path.
Types
GrovsDelegate
public protocol GrovsDelegate: AnyObject {
func grovsReceivedPayloadFromDeeplink(link: String?, payload: [String: Any]?, tracking: [String: Any]?)
}Implement this protocol to receive deep link callbacks. All delegate methods are called on the main thread.
| Parameter | Description |
|---|---|
link | The deep link URL that opened the app, or nil if unavailable. |
payload | The custom data attached to the link. |
tracking | Attribution and tracking metadata associated with the link. |
LogLevel
public enum LogLevel {
case info
case warn
case error
}Controls the verbosity of SDK log output. Pass to setDebug(level:).
| Value | Description |
|---|---|
.info | All messages including informational logs. |
.warn | Warnings and errors only. |
.error | Errors only (default). |
TransactionType
public enum TransactionType {
case buy
case cancel
case refund
}The type of payment transaction. Used with logCustomPurchase.
CustomRedirects
public struct CustomRedirects {
public var ios: CustomLinkRedirect?
public var android: CustomLinkRedirect?
public var desktop: CustomLinkRedirect?
}Override the default redirect behavior per platform when generating a link.
CustomLinkRedirect
public struct CustomLinkRedirect {
public let link: String
public var openAppIfInstalled: Bool // default: true
}A platform-specific redirect. When openAppIfInstalled is true, the app opens if installed; otherwise the link URL is always used.