appleexposure notification service code example
Example: Sample code Exposure Notification API
let nextDiagnosisKeyFileIndex = LocalStore.shared.nextDiagnosisKeyFileIndex
Server.shared.getDiagnosisKeyFileURLs(startingAt: nextDiagnosisKeyFileIndex) { result in
let dispatchGroup = DispatchGroup()
var localURLResults = [Result<[URL], Error>]()
switch result {
case let .success(remoteURLs):
for remoteURL in remoteURLs {
dispatchGroup.enter()
Server.shared.downloadDiagnosisKeyFile(at: remoteURL) { result in
localURLResults.append(result)
dispatchGroup.leave()
}
}
case let .failure(error):
finish(.failure(error))
}