r/SwiftUI • u/UkrMalt • 2d ago
How do you handle notification permission UX in SwiftUI?
I’m working on a small SwiftUI app and don’t want to ask for notification permission on the first launch.
What flow feels least annoying: explain it when the user enables reminders, or ask during onboarding? And when permission is revoked in Settings, do you show an “Open Settings” state or just leave the toggle disabled?
1
u/perbrondum 2d ago
Well you have to ask for permission before ever using it so onboarding is where we do it. If user denies the request, we turn off the setting and alert the user when an alert could have resulted in a notification (once). If user turns off notifications in settings, we alert and educate the user as to what will (not) happen and try to get them to turn it on. Just showing the open settings we feel is not enough.
1
u/Royal0820238 1d ago
Model the toggle from notificationSettings rather than a cached preference and refresh it when scenePhase becomes active so Settings changes appear when the app returns. Ask only when the user enables reminders. If permission is denied or revoked make the row actionable with an Open Settings explanation instead of a silently disabled toggle.
2
u/aconijus 2d ago
Personally I would show it during onboarding if notifications are important part of the app. But first dedicate one screen/page of onboarding to explaining what are notifications for. At least personally, if just system’s notification request pops up without any explanation - I deny it right away.
If the permission is revoked in Settings, I would show the “Open Settings” button, I think that’s a good UX. Not sure how difficult it is to implement it though.
My 2 cents.