You determine what user chose within the completion handler of requestTrackingAuthorization by analysis status parameter.
Many resources on the web:
https://stackoverflow.com/questions/63587364/how-to-add-the-apptrackingtransparency-permission-to-your-ios-apps
import AppTrackingTransparency
import AdSupport
//NEWLY ADDED PERMISSIONS FOR iOS 14
func requestPermission() {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
// Tracking authorization dialog was shown
// and we are authorized
print("Authorized")
// Now that we are authorized we can get the IDFA
print(ASIdentifierManager.shared().advertisingIdentifier)
case .denied:
// Tracking authorization dialog was
// shown and permission is denied
print("Denied")
case .notDetermined:
// Tracking authorization dialog has not been shown
print("Not Determined")
case .restricted:
print("Restricted")
@unknown default:
print("Unknown")
}
}
}
}
much less detailed here:
https://medium.nextlevelswift.com/app-tracking-transparency-framework-in-swift-and-ios-14-5-45f73697174a
Hope that helps.