Spindl
  • 👋Overview
    • Introduction
    • Attribution
    • Privacy
  • Your Spindl app setup
    • Managing team members
  • 🪄Features
    • 📈Onchain Attribution
      • 📉Plotting attribution
    • 📊Web3-native Analytics
      • Chart Builder
      • Event Selection and Filtering
      • Line Chart
      • Funnel
      • Cohort Retention
      • Sankey Diagram
      • Big Numbers
      • Pies and Donuts
    • 🧍‍♂️Audiences
      • Creating an audience
    • 🔗Short Links
      • 🖇️Custom Domains
    • 🤝Referrals
      • Management and reporting
      • ⏩Quick Start
      • ⛓️Technical Details
  • ⚙️Techncial
    • ⏩Start Here
    • Google GTM Guide
    • Javascript SDK / HTML Script Guide
      • ➡️Install
      • ➡️Wallet Connects
      • ➡️Page Views
      • ➡️Custom Events
      • ✅Verify That Events Are Sent Correctly
      • React, Next.js & Html Examples
      • Setup a Reverse Proxy
        • Using Next.js
        • Using Cloudflare Workers
        • Netlify
      • ➡️Referrals
      • Default vs Lite SDK Versions
      • Security
    • API
      • ➡️Short Links
      • ➡️Custom Events API
      • Data Exports
    • Android SDK
    • iOS (Swift) SDK
    • On-Chain
      • ➡️Rewards
  • Contact Spindl
  • Ads
    • ⏩Start Here
    • 📢Creative Specifications
      • Web Banner Ads
      • Discord Embeds
Powered by GitBook
On this page
  • Install Using Swift Package Manager (requires Xcode 12+)
  • Initialize SDK
  • Track Events
  • Identify Users
  1. Techncial

iOS (Swift) SDK

PreviousAndroid SDKNextOn-Chain

Last updated 1 year ago

Install Using Swift Package Manager (requires Xcode 12+)

  1. In Xcode, select File > Swift Packages > Add Package Dependency.

  2. Paste the URL and a minimum semantic version of v1.0.1. You can see in the , our latest releases.

Initialize SDK

Initialize the SDK with your API key upon launching the app, usually in the AppDelegate, or App protocol implementor:

import SpindlSDK

struct MyApp : App {

  init() {
    Spindl.initialize("<your API key goes here>")
  }
  
  ...
}

Track Events

Track events with the track method:

  • name is required

  • properties are optional

private func myButtonTappedExample() async throws {
    try await Spindl.shared.track(name: "myButtonTapped", properties: ["view":"MyFancyView","otherProperty":"Another one"])
    ...
}

Identify Users

Once customers enter their customer ID (such as email) and/or wallet information (e.g., after logging in), connect that to the analytics by calling the identify method of the Spindl singleton:

private func saveUserIdentityExample(wallet: String?, email: String?) async throws {
    try await Spindl.shared.identify(walletAddress: wallet, customerUserId: email)
    ...
}

⚙️
https://github.com/spindl-xyz/spindl-ios/
tags sections