For me using AuthorizationCenter.shared.authorizationStatus worked.
In my View I'm displaying a Button to ask for Screentime-Access, if the user didn't already approve it, otherwhise I'm showing some settings. Here's, what worked for me:
private var screentimeAccessButton: some View {
Button("Screentime-Access") {
Task {
try await AuthorizationCenter.shared.requestAuthorization(for: .individual)
// other handling
}
}
}
}
private var screentimeSettings: some View {
Section(L10n.commonScreentime) {
if AuthorizationCenter.shared.authorizationStatus != .approved {
screentimeAccessButton
} else {
// show other content
}
}
}
This worked, even when the user went into the settings and deactivated Screentime-Access. However, you still need to wait and maybe restart the app, until it has refreshed.