3

Summary

When a SwiftUI widget uses a Link containing an Image modified with .widgetAccentedRenderingMode (using any mode except .fullColor), tapping the image on the widget launches the app but does not pass the expected deep link URL to the SceneDelegate.

Steps to Reproduce

  1. Create a SwiftUI Widget View with a Link:

    struct ImageView: View { var image: UIImage var body: some View { Link(destination: URL(string: "myapp://image")!) { Image(uiImage: image) .resizable() .widgetAccentedRenderingMode(.accentedDesaturated) // Comment this line and deep link will work .scaledToFill() .clipped() } } } 
  2. Add Custom URL Scheme in Info.plist:

    <dict> <key>CFBundleURLName</key> <string>com.company.myapp</string> <key>CFBundleURLSchemes</key> <array> <string>myapp</string> </array> </dict> 
  3. Implement Deep Link Handling in SceneDelegate:

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if let url = connectionOptions.urlContexts.first?.url { handle(url) } } func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) { if let url = urlContexts.first?.url { handle(url) } } private func handle(_ url: URL) { // Process URL here } 
  4. Run the application on a device or simulator.

  5. Add the widget to the Home Screen.

  6. Tap the image inside the widget.

Expected Result

The application launches and receives the URL in SceneDelegate, as expected.

Actual Result

The application launches, but the URL is not passed to SceneDelegate

Example project: https://github.com/Igor-Palaguta/iOS26AccentedRenderingModeLinkIssue

Registered Apple Issue: https://developer.apple.com/forums/thread/795408

Workaround

Based on idea of @Funkybit:

struct AccentedLink<Content: View>: View { let destination: URL var content: Content var body: some View { content.overlay { Link(destination: destination) { Rectangle() .fill(.clear) } } } init(destination: URL, @ViewBuilder content: () -> Content) { self.destination = destination self.content = content() } } 

And then instead of Link we can use AccentedLink:

AccentedLink(destination: URL(string: "myapp://image")!) { Image(uiImage: image) .resizable() .widgetAccentedRenderingMode(.accentedDesaturated) .scaledToFill() .clipped() } 
0

1 Answer 1

1

I found a work-around, by adding an .overlay just containing a clear rectangle and prepping that rectangle with my link I got it working.

Image(..) .widgetAccentedRenderingMode(.desaturated) .overlay { Link(destination: linkUrl) { Rectangle() .fill(.clear) } } 
Sign up to request clarification or add additional context in comments.

1 Comment

Added AccentedLink workaround based on your idea to task description

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.