Docs

API Reference

Complete iOS SDK properties and methods reference

Properties

delegate

Swift
Grovs.delegate: GrovsDelegate?

The delegate that receives deep link callbacks from the SDK.

userIdentifier

Swift
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

Swift
Grovs.userAttributes: [String: Any]?

Get or set user attributes. These appear in the Grovs dashboard for user identification and behavior analysis.

pushToken

Swift
Grovs.pushToken: String?

Get or set the push notification token. Used for receiving push notifications for messages sent from the dashboard.

screenNameProvider

Swift
Grovs.screenNameProvider: ((UIViewController) -> GrovsScreenName)?

Optional resolver consulted before the SDK's built-in name resolution for automatically tracked screens. Called on the main thread. See Events & Screen Tracking.


Methods

configure

Swift
Grovs.configure(
    APIKey: String,
    useTestEnvironment: Bool,
    baseURL: String? = nil,
    autoTrackScreenViews: Bool = true,
    clipboardDomains: [String]? = nil,
    delegate: GrovsDelegate?,
    completion: GrovsBoolCompletion? = nil
)

Initialize the SDK with your API key.

ParameterDescription
APIKeyYour project API key from the Grovs dashboard.
useTestEnvironmentWhen true, the SDK operates in test mode.
baseURLOptional domain for self-hosted backends (e.g. "https://your-domain.com"). The SDK appends the API path automatically. Defaults to the Grovs cloud.
autoTrackScreenViewsTrack screen views automatically by hooking viewDidAppear. Defaults to true.
clipboardDomainsExtra link hosts accepted by clipboard-assisted deferred deep linking (e.g. ["links.example.com"]). Grovs-owned hosts are always accepted.
delegateThe delegate that receives deep link payloads and SDK errors.
completionOptional callback indicating whether SDK authentication succeeded or failed. Called on the main thread.

setSDK

Swift
Grovs.setSDK(enabled: Bool)

Enable or disable the SDK. Disabling stops all collection — link generation, lifecycle events, custom events, and automatic screen tracking. Events already queued stay on disk and are sent if the SDK is re-enabled.

setDebug

Swift
Grovs.setDebug(level: LogLevel)

Set the debug logging level. See LogLevel for available values. Default is .error.

Swift
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,
    copyToClipboardiOS: Bool? = nil,
    copyToClipboardAndroid: Bool? = nil,
    trackingCampaign: String? = nil,
    trackingSource: String? = nil,
    trackingMedium: String? = nil,
    completion: @escaping GrovsURLClosure
)

Generate a smart link with the specified parameters. See Link Creation for the full parameter table.

lastReceivedPayload

Swift
Grovs.lastReceivedPayload(completion: @escaping GrovsPayloadClosure)

Retrieve the last received deep link payload.

allReceivedPayloadsSinceStartup

Swift
Grovs.allReceivedPayloadsSinceStartup(completion: @escaping GrovsPayloadsClosure)

Retrieve all payloads received since app launch.

handleSceneDelegate (openURLContexts)

Swift
Grovs.handleSceneDelegate(openURLContexts URLContexts: Set<UIOpenURLContext>)

Forward open URL contexts from your SceneDelegate.

handleSceneDelegate (continue)

Swift
Grovs.handleSceneDelegate(continue userActivity: NSUserActivity)

Forward user activity continuation from your SceneDelegate.

handleSceneDelegate (options)

Swift
Grovs.handleSceneDelegate(options connectionOptions: UIScene.ConnectionOptions)

Forward connection options from your SceneDelegate.

handleAppDelegate (continue)

Swift
Grovs.handleAppDelegate(continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool

Forward universal link continuation from your AppDelegate.

handleAppDelegate (open)

Swift
Grovs.handleAppDelegate(open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool

Forward URL opening from your AppDelegate.

displayMessagesViewController

Swift
Grovs.displayMessagesViewController(completion: GrovsEmptyClosure?)

Display the messages list as a modal.

numberOfUnreadMessages

Swift
Grovs.numberOfUnreadMessages(completion: @escaping GrovsIntClosure)

Get the count of unread messages.

logInAppPurchase

Swift
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

Swift
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.

track

Swift
Grovs.track(_ name: String, properties: [String: Any]? = nil, tags: [String]? = nil)

Track a custom event. The name must be non-empty and must not be a reserved system event name. See Events & Screen Tracking.

trackScreenView

Swift
Grovs.trackScreenView(_ screenName: String, properties: [String: Any]? = nil)

Track a screen view. screen_name is injected into properties automatically. Repeats of the same name within one second are dropped.

setGlobalTags

Swift
Grovs.setGlobalTags(_ tags: [String]?)

Set tags attached to every subsequent event, or nil to clear them.

setScreenAliases

Swift
Grovs.setScreenAliases(_ aliases: [String: String])

Map view controller class names to friendly dashboard names, e.g. ["CheckoutViewController": "Checkout Page"].

linkDetails

Swift
Grovs.linkDetails(path: String, completion: @escaping GrovsLinkClosure)

Get details for a link with the given path.


Types

GrovsDelegate

Swift
public protocol GrovsDelegate: AnyObject {
    func grovsReceivedPayloadFromDeeplink(link: String?, payload: [String: Any]?, tracking: [String: Any]?)
    func grovsDidEncounterError(_ error: GrovsError, message: String)
}

Implement this protocol to receive deep link callbacks. All delegate methods are called on the main thread.

grovsReceivedPayloadFromDeeplink parameters:

ParameterDescription
linkThe deep link URL that opened the app, or nil if unavailable.
payloadThe custom data attached to the link.
trackingAttribution and tracking metadata associated with the link.

grovsDidEncounterError has a default no-op implementation, so it is optional to adopt.

GrovsError

Swift
public enum GrovsError: Int, CustomStringConvertible {
    case authenticationFailed = 1
    case networkRequestFailed = 2
    case eventDispatchFailed = 3
    case linkGenerationFailed = 4
}

Failure categories reported through grovsDidEncounterError. description gives the snake-case name, e.g. "authentication_failed". See Handling SDK errors.

GrovsScreenTracking

Swift
public protocol GrovsScreenTracking {
    var grovsScreenName: String? { get }
}

Conform on a UIViewController to give it an explicit name for automatic screen tracking. Return nil to skip the controller.

GrovsScreenName

Swift
public enum GrovsScreenName {
    case automatic
    case suppress
    case name(String)
}

Returned from screenNameProvider. .automatic falls through to the SDK's own resolution, .suppress skips the controller, .name(_:) overrides the name.

LogLevel

Swift
public enum LogLevel {
    case info
    case warn
    case error
}

Controls the verbosity of SDK log output. Pass to setDebug(level:).

ValueDescription
.infoAll messages including informational logs.
.warnWarnings and errors only.
.errorErrors only (default).

TransactionType

Swift
public enum TransactionType {
    case buy
    case cancel
    case refund
}

The type of payment transaction. Used with logCustomPurchase.

CustomRedirects

Swift
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

Swift
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.


SwiftUI

grovsScreen

Swift
func grovsScreen(_ screenName: String, properties: [String: Any]? = nil) -> some View
func grovsScreen(properties: [String: Any]? = nil) -> some View

Tracks a screen view when the view appears, and suppresses automatic tracking for the enclosing hosting controller so the screen is not double-counted. The no-name overload derives the name from the file nameCheckoutView.swift becomes "Checkout".

trackScreenView(_:properties:) is an alias for the named form and behaves identically.

Edit this page on GitHubLast updated 2026-09-03