The DP3T-SDK for iOS





GitHub Stars



Last Commit

2mos ago










DP3T-SDK for iOS

Swift Package Manager compatible CocoaPods compatible License: MPL 2.0 build


The Decentralised Privacy-Preserving Proximity Tracing (DP-3T) project is an open protocol for COVID-19 proximity tracing using Bluetooth Low Energy functionality on mobile devices that ensures personal data and computation stays entirely on an individual's phone. It was produced by a core team of over 25 scientists and academic researchers from across Europe. It has also been scrutinized and improved by the wider community.

DP-3T is a free-standing effort started at EPFL and ETHZ that produced this protocol and that is implementing it in an open-sourced app and server.


This is the implementation of the DP-3T protocol using the Exposure Notification Framework of Apple/Google. Only approved government public health authorities can access the APIs. Therefore, using this SDK will result in an API error unless you were granted the com.apple.developer.exposure-notification entitlement by Apple. We are using Exposure Notification Framework version 2, and the deployment target is therefore set to 13.7.

Our prestandard solution that is not using the Apple/Google framework can be found under the tag prestandard.


For an example project using the SDK look at the Swiss contact tracing app SwissCovid.

Further Documentation

The full set of documents for DP3T is at https://github.com/DP-3T/documents. Please refer to the technical documents and whitepapers for a description of the implementation.

DP3T Exposure Score Calculation

The in-depth technical specification of the methodology used for the score calculation can be found here.

A description of the usage of the Apple Exposure Notification API can be found here.

Calibration App

Included in this repository is a Calibration App that can run, debug and test the SDK directly without implementing it in a new app first. Various parameters of the SDK are exposed and can be changed at runtime. Additionally it provides an overview of how to use the SDK.

Function overview


NameDescriptionFunction Name
initInitializes the SDK and configures itinitialize(applicationDescriptor:urlSession:backgroundHandler:federationGateway)

Methods & Properties

NameDescriptionFunction/Variable Name
startTracingStarts EN tracingfunc startTracing(completionHandler:)
stopTracingStops EN tracingfunc stopTracing(completionHandler:)
syncPro-actively triggers sync with backend to refresh exposed listfunc sync(callback:)
statusReturns a TracingState-Object describing the current state. This contains:
- numberOfHandshakes : Int
- trackingState : TrackingState
- lastSync : Date
- infectionStatus:InfectionStatus
- backgroundRefreshState:UIBackgroundRefreshStatus
func status(callback:)
iWasExposedThis method must be called upon positive test.func iWasExposed(onset:authentication:isFakeRequest:callback:)
federationGatewaySpecifies whether keys should be exchanged with other compatible countries. Possible values are 'yes', 'no', 'unspecified' (default)var federationGateway
resetRemoves all SDK related datafunc reset()


Swift Package Manager

DP3T-SDK is available through Swift Package Manager

  1. Add the following to your Package.swift file:

    dependencies: [
        .package(url: "https://github.com/DP-3T/dp3t-sdk-ios.git", .branch("develop"))


DP3T-SDK is available through Cocoapods

  1. Add the following to your Podfile:

    pod 'DP3TSDK', => '2.3.0'

This version points to the HEAD of the develop branch and will always fetch the latest development status. Future releases will be made available using semantic versioning to ensure stability for depending projects.

Using the SDK

In order to use the SDK with iOS 14 you need to specify the region for which the app works and the version of the Exposure Notification Framework which should be used.

This is done by adding ENDeveloperRegion as an Info.plist property with the according ISO 3166-1 country code as its value. The SDK works with EN Framework version 2 and therefore we need to specify ENAPIVersion with a value of 2 in the Info.plist.


Starting with DP3T SDK version 2.0 the required backend version is 2.0.


In your AppDelegate in the didFinishLaunchingWithOptions function you have to initialize the SDK.

let url = URL(string: "https://example.com/your/api/")!
DP3TTracing.initialize(with: .init(appId: "com.example.your.app", 
                                   bucketBaseUrl: url, 
                                   reportBaseUrl: url))

Certificate pinning

The SDK accepts a URLSession as an optional argument to the initializer. This can be used to enable certificate pinning. If no session is provided URLSession.shared will be used.

Start / Stop tracing

To start and stop tracing use


Checking the current tracing status

let status = DP3TTracing.status

The TracingState object contains all information regarding the current tracing status.

To receive callbacks and notifications when the state changes, you should assign a delegate object conforming to DP3TTracingDelegate:

DP3TTracing.delegate = yourDelegateObject // weak retained by the SDK

// Delegate method
func DP3TTracingStateChanged(_ state: TracingState) {


The SDK will call your delegate on every state change, this includes: Handshake detection, start/stop of tracing, change in exposure, errors...

Report user exposed

DP3TTracing.iWasExposed(onset: Date(), authentication: .none) { result in
    // Handle result here

Sync with backend for exposed user

The SDK automatically syncs with the backend for new exposed users by scheduling a background task.

DP3TTracing.sync() { result in
    // Handle result here

Background Tasks

The SDK supports iOS 13 background tasks. It uses the provided exposure-notification background processing task as well as the BGAppRefreshTask. To enable them the app has to support the Background process and Background fetch capabilities and include org.dpppt.exposure-notification and org.dpppt.refresh in the BGTaskSchedulerPermittedIdentifiers Info.plist property.

Info.plist sample:


If a DP3TBackgroundHandler was passed to the SDK on initialisation it will be called on each background task execution by the SDK.

Apps using the DP3T-SDK for iOS

NameCountrySource codeStoreRelease-Date
SwissCovidSwitzerlandGithubAppStore25. Mai 2020
ASIEcuadorminka.gob.ecAppStore2. August 2020
HoiaEstoniakoodivaramu.eesti.eeAppStore19. August 2020
STAYAWAY COVIDPortugalGithubAppStore28. August 2020
Radar COVIDSpainGithubAppStore

If your project/country is not yet listed but uses the DP3T-SDK feel free to send a pull-request to add it to the README.


This project is licensed under the terms of the MPL 2 license. See the LICENSE file.

Rate & Review

Great Documentation0
Easy to Use0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Unwelcoming Community0