aptabase/aptabase-swift
aptabase/aptabase-swift has 48 GitHub stars and 22 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-13 19:46 UTC. Last push 2026-10-23.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
Swift SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
데이터README.md
Original
Swift SDK for Aptabase
Instrument your apps with Aptabase, an Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps.
Install
Option 1: Swift Package Manager
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.4.0"),
],
targets: [
.target(
name: "MyApp",
dependencies: ["Aptabase"] // Add as a dependency
)
]
)
Option 2: Adding package dependencies with Xcode
Use this guide to add aptabase-swift to your project. Use https://github.com/aptabase/aptabase-swift for the URL when Xcode asks.
Option 3: CocoaPods
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.4.0'
Usage
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()
}
}
}
You can also pass options to customize behavior:
Aptabase.shared.initialize(appKey: "<YOUR_APP_KEY>", with: InitOptions(
host: "https://your-self-hosted-instance.com", // For self-hosted Aptabase
flushInterval: 30, // Custom flush interval in seconds
trackingMode: .asRelease, // Force release mode
appVersion: "2.0.0" // Override the app version
))
host— Custom server URL for self-hosted Aptabase instances (required forA-SH-*app keys)flushInterval— Interval in seconds for batching and sending events (default: automatic)trackingMode—.readFromEnvironment(default),.asDebug, or.asReleaseappVersion— Override the app version reported with events (default: read from app bundle)
Afterward, you can start tracking events with trackEvent:
Delivery starts when the SDK is initialized, including in macOS app extensions that do not receive application activation notifications. Initialize on the main thread so the delivery timer uses the main run loop. The configured flush interval also controls retries after transient failures. Events remain in memory, so an extension terminated before delivery can lose pending events.
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:
- The SDK will automatically enhance the event with some useful information, like the OS, the app version, and other things.
- You're in control of what gets sent to Aptabase. This SDK does not automatically track any events, you need to call
trackEventmanually.- Because of this, it's generally recommended to at least track an event at startup
- The
trackEventfunction is a non-blocking operation as it runs in the background. - Only strings and numbers values are allowed on custom properties
Error Reporting
Error reporting is in beta. Reports appear on the
Errorspage of your Aptabase dashboard.
Use trackError to report errors you've caught and handled:
import Aptabase
do {
try someFailingFunction()
} catch {
Aptabase.shared.trackError(error) // severity: error
}
For errors your app can't recover from, mark the report as fatal:
Aptabase.shared.trackError(error, fatal: true) // severity: fatal
A few important notes about error reporting:
- Each report includes the error type, message, stack trace, severity (
errororfatal) and how it was captured (handled, orcrashwhenfatalis set). Swift errors are reported under their type name with their description; errors from Apple frameworks (NSError,URLError,CocoaError) are grouped by domain and code, for exampleNSURLErrorDomain -1009. - The stack trace is captured where
trackErroris called, since Swift errors carry no stack of their own. The SDK's own frames are removed so the first frame is your call site. - Reports are sent immediately and kept in memory for retry when the network is unavailable (up to 25 pending reports). They are not persisted to disk, so a report may be lost if the app terminates right after
trackErrorreturns. - Fields longer than the server accepts (for example a 10,000 character stack trace) are truncated rather than rejected.
- Errors count against a separate monthly error quota. When the quota is exhausted, the server rejects new reports until it resets.
- Uncaught exceptions and crashes are not reported automatically yet. Call
trackErrorfrom your own error handling.
Preparing for Submission to Apple App Store
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
관련 프로젝트 살펴보기
Asabeneh/30-Days-Of-Python
30 Days of Python 프로그래밍 챌린지는 Python 프로그래밍 언어를 30일 동안 배우기 위한 단계별 가이드입니다. 이 챌린지는 100일 이상 걸릴 수 있습니다. 자신의 속도에 맞춰 진행하세요. 다음 동영상도 도움이 될 수 있습니다: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,703 스타grafana/grafana
개방적이고 조합 가능한 옵저버빌리티 및 데이터 시각화 플랫폼입니다. Prometheus, Loki, Elasticsearch, InfluxDB, Postgres 등 여러 소스의 메트릭, 로그, 트레이스를 시각화합니다.
77,890 스타redis/redis
실시간 데이터 기반 애플리케이션을 구축하는 개발자에게 Redis는 가장 선호되고, 가장 빠르며, 기능이 가장 풍부한 캐시, 데이터 구조 서버이자 문서 및 벡터 쿼리 엔진입니다.
77,493 스타apache/superset
Apache Superset는 데이터 시각화 및 데이터 탐색 플랫폼입니다.
75,519 스타