Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Reading widget configuration intent when launching the app

I'm creating a configurable widget using AppIntentConfiguration in my SwiftUI app and wanted to read configuration's payload when the user taps on the widget and launches the app.

Having read the WidgetKit's documentation I noticed I can just call userActivity.widgetConfigurationIntent(of: MyWidgetConfigurationAppIntent.self) inside .onContinueUserActivity() modifier, to get the intent's instance.

This function works and returns the instance when user taps on the widget and the app is already running in the background, but returns nil when the app launches for the first time.

Am I doing something wrong here, is this a desired behaviour? Is using Deep Links a more suited solution for this use case? I'm really not liking the idea of serialising instances of Measurement and UnitMass/UnitTemperature into URLs.

Here's a sample code to illustrate:

@main
struct WidgetIntentTestApp: App {

    @State private var favouriteEmoji: String?

		private let intentActivityName = String(describing: ConfigurationAppIntent.self)

		var body: some Scene {
				WindowGroup {
						ContentView(favouriteEmoji: favouriteEmoji)
								.onContinueUserActivity(intentActivityName) { userActivity in
										guard let intent = userActivity.widgetConfigurationIntent(of: ConfigurationAppIntent.self) else {
													/// Intent is `nil` when the user activity `launches the app for the first time`.
													/// I would have expected this to work given the user activity's `.name` clearly matches the Intent's name
													fatalError("Expected intent but received `nil` - this should not have happened.")
										}

										favouriteEmoji = intent.favoriteEmoji
								}
				}
		}
}

I am having the same issue and similarly hoping not have to drop down into a URL. Would way rather use the Intent directly.

However, on Xcode 16.2 / iOS 18.2 I am seeing this same error. No intent when launching the widget without the app already open.

Same issue in Xcode 16.3 / iOS 18.4. What I also noticed is if you do WidgetCenter.shared.getCurrentConfigurations, it returns all configurations with their intents that can be successfully retrieved, but there's seemingly no way to know which from which configuration (i.e. from which widget from the home screen) the user launched the app.

I'd consider it a bug, but I won't bother sending a feedback into the black hole. Looks like I'm going to use deeplinks instead, it's a pity.

Reading widget configuration intent when launching the app
 
 
Q