Start by defining your quick actions. You can use UIApplicationShortcutIcon(type:) for predefined icons, or use UIApplicationShortcutIcon(systemImageName:) for SFSymbol
Set dynamic screen quick actions at any point, but the sample sets them in the sceneWillResignActive(_:) function of the scene delegate. During the transition to a background state is a good time to update any dynamic quick actions, because the system executes this code before the user returns to the Home Screen.
@main structPastePaliOSApp: App{ @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @Environment(\.scenePhase) var scenePhase
var body: some Scene { WindowGroup { main } .onChange(of: scenePhase) { scenePhase in switch scenePhase { case .background: addDynamicQuickActions() case .active: QuickActionService.shared.perform() default: break } } }
If the app isn’t already loaded, it’s launched and passes details of the shortcut item in through the connectionOptions parameter of the scene(_:willConnectTo:options:) function in AppDelegate
If your app is already loaded, the system calls the windowScene(_:performActionFor:completionHandler:) function of your SceneDelegate