Docs

Quick Start

Install and configure the Grovs iOS SDK in your app

Installation

Swift Package Manager

  1. In Xcode, go to File → Swift Packages → Add Package Dependency
  2. Enter the repository URL: https://github.com/grovs-io/grovs-iOS.git
  3. Select the version range that fits your project
  4. Click Next, then Finish

CocoaPods

Add the pod to your Podfile:

Ruby
pod 'Grovs'

Then run:

Bash
pod install

Configuration

Import the module and initialize the SDK in your AppDelegate:

Swift
import Grovs
 
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, delegate: self)
 
    // Optional: enable debug logging
    Grovs.setDebug(level: .info)
 
    // Optional: set user identity
    Grovs.userIdentifier = "user_id_from_your_app"
    Grovs.userAttributes = ["name": "John Doe", "plan": "premium"]
 
    return true
}

Delegate setup

Apps using SceneDelegate

If your app uses a SceneDelegate, forward these calls to the SDK:

Swift
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    Grovs.handleSceneDelegate(openURLContexts: URLContexts)
}
 
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    Grovs.handleSceneDelegate(continue: userActivity)
}
 
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    Grovs.handleSceneDelegate(options: connectionOptions)
}

Apps using AppDelegate only

If your app does not use a SceneDelegate, forward these calls instead:

Swift
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    return Grovs.handleAppDelegate(continue: userActivity, restorationHandler: restorationHandler)
}
 
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
    return Grovs.handleAppDelegate(open: url, options: options)
}

Next steps