Skip to content

Add Link#61

Merged
colemancda merged 5 commits into
masterfrom
feature/link
Jul 24, 2026
Merged

Add Link#61
colemancda merged 5 commits into
masterfrom
feature/link

Conversation

@colemancda

Copy link
Copy Markdown
Member

Link("title", destination:) and Link(destination:) { label } — opens a URL outside the app.

No bridge involvement

The whole hop stays out of Swift: the interpreter hands the address to Compose's LocalUriHandler, so the platform picks which app answers it. No callback registered, no bridge entry. The label takes the accent colour (via the existing LocalInheritedColor fold) so it reads as a link, unless something upstream already tinted it — and the open is wrapped in runCatching so a malformed or unhandled address can't crash the app.

Verification

  • swift test — 2 new tests, 107 passing: the destination and label emit, no onTap callback is registered (the interpreter opens it itself), and a custom HStack label survives.
  • Emulator — tapping "Open swift.org" fired act=android.intent.action.VIEW dat=https://swift.org, and dumpsys confirmed Chrome became the resumed activity. The URL genuinely opened in the browser, not just a logged intent. The custom-label link (icon + text) and the in-sentence link both render correctly.

Scope

http(s) and other app-resolvable schemes go through the system handler. Link doesn't style beyond the accent colour (no underline — Compose Text has it, but SwiftUI's own Link doesn't underline either), and there's no OpenURLAction environment override.

@colemancda
colemancda merged commit 29356bc into master Jul 24, 2026
6 checks passed
@colemancda
colemancda deleted the feature/link branch July 24, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant