Swift SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
46
stars
79
commits
Swift
primary language
Feb 22, 2026
updated

Instrument your apps with Aptabase, an Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps.
Add the following lines to your Package.swift file:
let package = Package(
...
dependencies: [
...
.package(name: "Aptabase", url: "https://github.com/aptabase/aptabase-swift.git", from: "0.3.4"),
],
targets: [
.target(
name: "MyApp",
dependencies: ["Aptabase"] // Add as a dependency
)
]
)
Use this guide to add aptabase-swift to your project. Use https://github.com/aptabase/aptabase-swift for the URL when Xcode asks.
Aptabase is also available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Aptabase', :git => 'https://github.com/aptabase/aptabase-swift.git', :tag => '0.3.4'
If you're targeting macOS, you must first enable the
Outgoing Connections (Client)checkbox under theApp Sandboxsection.
First, you need to get your App Key from Aptabase, you can find it in the Instructions menu on the left side menu.
Initialized the SDK as early as possible in your app, for example:
import SwiftUI
import Aptabase
@main
struct ExampleApp: App {
init() {
Aptabase.shared.initialize(appKey: "<YOUR_APP_KEY>") // 👈 this is where you enter your App Key
}
var body: some Scene {
WindowGroup {
MainView()
}
}
}
Afterward, you can start tracking events with trackEvent:
import Aptabase
Aptabase.shared.trackEvent("app_started") // An event with no properties
Aptabase.shared.trackEvent("screen_view", with: ["name": "Settings"]) // An event with a custom property
A few important notes:
trackEvent manually.
trackEvent function is a non-blocking operation as it runs in the background.When submitting your app to the Apple App Store, you'll need to fill out the App Privacy form. You can find all the answers on our How to fill out the Apple App Privacy when using Aptabase guide.
For AI/LLM integration instructions, see llms.txt
Swift
96.7%
Ruby
3.3%
Swift SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
46
stars
79
commits
Swift
primary language
Feb 22, 2026
updated

Instrument your apps with Aptabase, an Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps.
Add the following lines to your Package.swift file:
let package = Package(
...
dependencies: [
...
.package(name: "Aptabase", url: "https://github.com/aptabase/aptabase-swift.git", from: "0.3.4"),
],
targets: [
.target(
name: "MyApp",
dependencies: ["Aptabase"] // Add as a dependency
)
]
)
Use this guide to add aptabase-swift to your project. Use https://github.com/aptabase/aptabase-swift for the URL when Xcode asks.
Aptabase is also available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Aptabase', :git => 'https://github.com/aptabase/aptabase-swift.git', :tag => '0.3.4'
If you're targeting macOS, you must first enable the
Outgoing Connections (Client)checkbox under theApp Sandboxsection.
First, you need to get your App Key from Aptabase, you can find it in the Instructions menu on the left side menu.
Initialized the SDK as early as possible in your app, for example:
import SwiftUI
import Aptabase
@main
struct ExampleApp: App {
init() {
Aptabase.shared.initialize(appKey: "<YOUR_APP_KEY>") // 👈 this is where you enter your App Key
}
var body: some Scene {
WindowGroup {
MainView()
}
}
}
Afterward, you can start tracking events with trackEvent:
import Aptabase
Aptabase.shared.trackEvent("app_started") // An event with no properties
Aptabase.shared.trackEvent("screen_view", with: ["name": "Settings"]) // An event with a custom property
A few important notes:
trackEvent manually.
trackEvent function is a non-blocking operation as it runs in the background.When submitting your app to the Apple App Store, you'll need to fill out the App Privacy form. You can find all the answers on our How to fill out the Apple App Privacy when using Aptabase guide.
For AI/LLM integration instructions, see llms.txt
Swift
96.7%
Ruby
3.3%