Repository navigation
Replies: 1 comment
|
Implementing this would also resolve the discussion raised in #197 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Proposal: Add
prefersInAppsupport toOpenURLEffectfor OS 26+Hi Point-Free team,
Thank you for the fantastic work on swift-dependencies. It has become an essential building block in how we manage side effects in our SwiftUI apps.
I'd like to propose adding first-class support for the new
prefersInAppparameter introduced inOpenURLActionon OS 26, and I'd be happy to work on a PR if this sounds like a good direction.Motivation
OS 26 introduced a new overload of
OpenURLAction.callAsFunction(_:prefersInApp:), which allows callers to opt into opening URLs viaSFSafariViewController(an in-app browser) rather than routing them to Safari. This can also be configured at the view level via the.onOpenURL(prefersInApp:)modifier.Many apps benefit from keeping users within the app when opening web content — this addition makes that straightforward without requiring a custom
WKWebViewsetup or third-party libraries.The Problem
The current
OpenURLEffectin swift-dependencies only exposes:swift-dependencies/Sources/Dependencies/DependencyValues/OpenURL.swift
Lines 41 to 58 in e1f234a
There is no way to express
prefersInApp: truethrough the existing API. While it's possible to define a project-localOpenURLEffectreplacement, opening URLs is one of the most fundamental effects in a SwiftUI app. HavingprefersInAppsupport baked into the package itself would benefit the entire community without burdening each project with boilerplate.Proposed Addition
Add a new
callAsFunctionoverload toOpenURLEffectthat accepts aprefersInAppparameter, and update theliveValuehandler accordingly:The
liveValuewould be updated to forwardprefersInApptoEnvironmentValues().openURL(_:prefersInApp:)on supported OS versions, with a fallback to the current behavior on earlier versions.Question
Would adding
prefersInAppsupport toOpenURLEffectbe something you'd consider including in the library?I'm happy to:
(URL) async -> Booland using a separate overload-based approach)Thanks again for all the great work — looking forward to hearing your thoughts!
All reactions