{"id":15055327,"url":"https://github.com/telemetrydeck/swiftsdk","last_synced_at":"2025-12-11T23:01:34.253Z","repository":{"id":42000897,"uuid":"301763289","full_name":"TelemetryDeck/SwiftSDK","owner":"TelemetryDeck","description":"Swift SDK for TelemetryDeck, a privacy-conscious analytics service for apps and websites.","archived":false,"fork":false,"pushed_at":"2025-03-29T11:08:23.000Z","size":473,"stargazers_count":181,"open_issues_count":19,"forks_count":33,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-04T01:11:14.382Z","etag":null,"topics":["analytics","hacktoberfest","ios","privacy-protection","swift","swiftui","telemetry"],"latest_commit_sha":null,"homepage":"https://telemetrydeck.com/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TelemetryDeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-06T14:58:01.000Z","updated_at":"2025-04-01T21:22:26.000Z","dependencies_parsed_at":"2023-02-10T02:16:27.298Z","dependency_job_id":"3e5b3cd9-9a17-4ded-b616-dce9ad05adc7","html_url":"https://github.com/TelemetryDeck/SwiftSDK","commit_stats":{"total_commits":198,"total_committers":23,"mean_commits":8.608695652173912,"dds":0.6414141414141414,"last_synced_commit":"1d9ac496ff02969c7b87cccac17e46ee7c148453"},"previous_names":["telemetrydeck/swiftclient"],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TelemetryDeck%2FSwiftSDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TelemetryDeck%2FSwiftSDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TelemetryDeck%2FSwiftSDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TelemetryDeck%2FSwiftSDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TelemetryDeck","download_url":"https://codeload.github.com/TelemetryDeck/SwiftSDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248632535,"owners_count":21136707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","hacktoberfest","ios","privacy-protection","swift","swiftui","telemetry"],"created_at":"2024-09-24T21:40:53.861Z","updated_at":"2025-12-11T23:01:28.951Z","avatar_url":"https://github.com/TelemetryDeck.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swift SDK for TelemetryDeck\n\nThis package allows you to send signals to [TelemetryDeck](https://telemetrydeck.com) from your Swift code. Sign up for a free account at telemetrydeck.com\n\n## Installation\n\nThe easiest way to install TelemetryDeck is using [Swift Package Manager](https://www.swift.org/package-manager/), Apple's solution which is built into Xcode. In Xcode, press _File \u003e Add Packages..._, then in the resulting window enter `https://github.com/TelemetryDeck/SwiftSDK` into the search field. Set the _Dependency Rule_ field to _Up to Next Major Version_, then press the _Add Package_ button. Xcode will download it, then you can choose which target of your app to add the \"TelemetryDeck\" library to (note that \"TelemetryClient\" is the old name of the lib).\n\nSee our [detailed setup guide](https://telemetrydeck.com/docs/guides/swift-setup/?source=github) for more information.\n\n## Initialization\n\nInit the Telemetry Manager at app startup, so it knows your App ID (you can retrieve the App ID from your [TelemetryDeck Dashboard](https://dashboard.telemetrydeck.com/) under Set Up App)\n\n```swift\nlet config = TelemetryDeck.Config(appID: \"\u003cYOUR-APP-ID\u003e\")\n// optional: modify the config here\nTelemetryDeck.initialize(config: config)\n```\n\nFor example, if you're building a scene based app, in the `init()` function for your `App`:\n\n```swift\nimport SwiftUI\nimport TelemetryDeck\n\n@main\nstruct TelemetryTestApp: App {\n    var body: some Scene {\n        WindowGroup {\n            ContentView()\n        }\n    }\n\n    init() {\n        // Note: Do not add this code to `WindowGroup.onAppear`, which will be called\n        //       *after* your window has been initialized, and might lead to our initialization\n        //       occurring too late.\n        let config = TelemetryDeck.Config(appID: \"\u003cYOUR-APP-ID\u003e\")\n        TelemetryDeck.initialize(config: config)\n    }\n}\n```\n\nThen send signals like so:\n\n```swift\nTelemetryDeck.signal(\"App.launchedRegularly\")\n```\n\n## Debug -\u003e Test Mode\n\nIf your app's build configuration is set to \"Debug\", all signals sent will be marked as testing signals. In the Telemetry Viewer app, activate **Test Mode** to see those.\n\nIf you want to manually control whether test mode is active, you can set the `config.testMode` property.\n\n## User Identifiers\n\nTelemetry Manager will create a user identifier for you user that is specific to app installation and device. If you have a better user identifier available, such as an email address or a username, you can use that instead, by passing it on to the `TelemetryDeck.Config` (the identifier will be hashed before sending it).\n\n```swift\nconfig.defaultUser = \"myuser@example.com\"\n```\n\nYou can update the configuration after TelemetryDeck is already initialized.\n\n## Parameters\n\nYou can also send additional parameters with each signal:\n\n```swift\nTelemetryDeck.signal(\"Database.updated\", parameters: [\"numberOfDatabaseEntries\": \"3831\"])\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eTelemetryDeck will automatically send base parameters, expand to see common examples\u003c/summary\u003e\n\n- TelemetryDeck.Accessibility.isBoldTextEnabled\n- TelemetryDeck.Accessibility.preferredContentSizeCategory\n- TelemetryDeck.AppInfo.buildNumber\n- TelemetryDeck.AppInfo.version\n- TelemetryDeck.Device.architecture\n- TelemetryDeck.Device.modelName\n- TelemetryDeck.Device.operatingSystem\n- TelemetryDeck.Device.orientation\n- TelemetryDeck.Device.platform\n- TelemetryDeck.Device.screenResolutionHeight\n- TelemetryDeck.Device.screenResolutionWidth\n- TelemetryDeck.Device.systemMajorMinorVersion\n- TelemetryDeck.Device.systemMajorVersion\n- TelemetryDeck.Device.systemVersion\n- TelemetryDeck.Device.timeZone\n- TelemetryDeck.RunContext.isAppStore\n- TelemetryDeck.RunContext.isDebug\n- TelemetryDeck.RunContext.isSimulator\n- TelemetryDeck.RunContext.isTestFlight\n- TelemetryDeck.RunContext.language\n- TelemetryDeck.RunContext.targetEnvironment\n- TelemetryDeck.SDK.version\n- TelemetryDeck.UserPreference.colorScheme\n- TelemetryDeck.UserPreference.language\n- TelemetryDeck.UserPreference.layoutDirection\n- TelemetryDeck.UserPreference.region\n\nSee our [related documentation page](https://telemetrydeck.com/docs/api/default-parameters/?source=github.com) for a full list.\n\u003c/details\u003e\n\n## Sessions\n\nWith each Signal, the client sends a hash of your user ID as well as a _session ID_. This gets automatically generated when the client is initialized, so if you do nothing, you'll get a new session each time your app is started from cold storage.\n\nOn iOS, tvOS, and watchOS, the session identifier will automatically update whenever your app returns from background, or if it is launched from cold storage. On other platforms, a new identifier will be generated each time your app launches. If you'd like more fine-grained session support, write a new random session identifier into the `TelemetryDeck.Config`'s `sessionID` property each time a new session begins.\n\n## Custom Salt\n\nBy default, user identifiers are hashed by the TelemetryDeck SDK, and then sent to the Ingestion API, where we'll add a salt to the received identifier and hash it again.\n\nThis is enough for most use cases, but if you want to extra privacy conscious, you can add in you own salt on the client side. The TelemetryDeck SDK will append the salt to all user identifers before hashing them and sending them to us.\n\nIf you'd like to use a custom salt, you can do so by passing it on to the `TelemetryDeck.Config`\n\n```swift\nlet config = TelemetryDeck.Config(appID: \"\u003cYOUR-APP-ID\u003e\", salt: \"\u003cA RANDOM STRING\u003e\")\n```\n\n## Custom Server\n\nA very small subset of our customers will want to use a custom signal ingestion server or a custom proxy server. To do so, you can pass the URL of the custom server to the `TelemetryDeck.Config`:\n\n```swift\nlet config = TelemetryDeck.Config(appID: \"\u003cYOUR-APP-ID\u003e\", baseURL: \"https://nom.telemetrydeck.com\")\n```\n\n## Custom Logging Strategy\n\nBy default, some logs helpful for monitoring TelemetryDeck are printed out to the console. This behaviour can be customised by overriding `config.logHandler`. This struct accepts a minimum allows log level (any log with the same or higher log level will be accepted) and a closure.\n\nThis allows for compatibility with other logging solutions, such as [swift-log](https://github.com/apple/swift-log), by providing your own closure.\n\n## Developing this SDK\n\nYour PRs on TelemetryDeck's Swift SDK are very much welcome. Check out the [SwiftClientTester](https://github.com/TelemetryDeck/SwiftClientTester) project, which provides a harness you can use to work on the library and try out new things.\n\nWhen making a new release, run `./tag-release.sh MAJOR.MINOR.PATCH` to bump the version string in the SDK, create a new commit and tag that commit accordingly all in one step.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelemetrydeck%2Fswiftsdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelemetrydeck%2Fswiftsdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelemetrydeck%2Fswiftsdk/lists"}