Swiftpack.co - UserLeap/analytics-swift-sprig as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by UserLeap.
UserLeap/analytics-swift-sprig v1.2.9
The Sprig analytics-swift integration.
⭐️ 1
🕓 3 weeks ago
iOS watchOS tvOS
.package(url: "https://github.com/UserLeap/analytics-swift-sprig.git", from: "v1.2.9")

Analytics-Swift Sprig

Add Sprig device-mode support to your application via this plugin

Adding the dependency

via Xcode

In the Xcode File menu, click Add Packages. You'll see a dialog where you can search for Swift packages.


In the search field, enter the URL to this repo.


You'll then have the option to pin to a version, or specific branch, as well as which project in your workspace to add it to. Once you've made your selections, click the Add Package button.


via Package.swift

Open your Package.swift file and add the following to the dependencies section:

dependencies: [
    // ... other dependencies
            url: "https://github.com/UserLeap/analytics-swift-sprig.git",
            from: "1.2.1"

If you need to depend on a pre-released version of the SDK due to xcode compatibility issues, you should be on at least xcode 13.4 and specify the exact version.

dependencies: [
    // ... other dependencies
            url: "https://github.com/UserLeap/analytics-swift-sprig.git",
            exact: Version(1, 2, 1, prereleaseIdentifiers: ["alpha"]) // the version number are in sequence: major, minor, patch, prereleaseIdentifier without '-'.

Then specify the names of the package

targets: [
        name: "YourPackageName",
        dependencies: [
            .product(name: "SegmentSprig", package: "analytics-swift-sprig"),

Note the Sprig library itself will be installed as an additional dependency.

Using the Plugin in your App

Select your iOS Source from My Sources dashboard on segment, and get the value for Write Key from Settings -> API Keys

Open the file where you setup and configure the Analytics-Swift library. Add this plugin to the list of imports. Replace the write key value.

import Segment
import SegmentSprig // <-- Add this line

Just under your Analytics-Swift library setup, call analytics.add(plugin: ...) to add an instance of the plugin to the Analytics timeline.

let analytics = Analytics(configuration: Configuration(writeKey: "<YOUR WRITE KEY>")
analytics.add(plugin: SprigDestination())

Your events will now begin to flow to Sprig in device mode. When you track an event and receives a survey, the survey will show on the top view controller. To record attributes, you can make use of the traits parameter when you call identify function. Download Basic Example app for reference.


Please use Github issues, Pull Requests, or feel free to reach out to our support team.


Stars: 1
Last commit: 3 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

3 weeks ago

What's Changed

Full Changelog: https://github.com/UserLeap/analytics-swift-sprig/compare/v1.2.7...v1.2.9

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics