SwiftUI Links & Sharing
External Safari link rows, icon triggers, markdown links, and native iOS App Store ShareLink views. (5 components available in Compot).
1 of 5Free ComponentiOS 16.0+
Link Row Settings
Settings row that opens external Safari URLs with an external link indicator.
LinkRowSettings.swift
import SwiftUI
struct LinkRowSettings: View {
var body: some View {
Form {
LabelRowLink(destinationUrl: "https://compotui.com", visibleUrl: "compotui.com", title: "Website", iconTitle: "globe", supportingIcon: "arrow.up.forward.app")
}
}
}
#Preview {
LinkRowSettings()
}
struct LabelRowLink: View {
let destinationUrl: String
let visibleUrl: String?
let title: String
let iconTitle: String
let supportingIcon: String?
var body: some View {
Link(destination: URL(string: destinationUrl)!, label: {
HStack(alignment: .center) {
Label(title, systemImage: iconTitle)
Spacer()
HStack(alignment: .center) {
Text(visibleUrl ?? "")
Image(systemName: supportingIcon ?? "")
}
.foregroundStyle(.secondary)
}
})
}
}LinkAsIcon.swift
import SwiftUI
struct LinkAsIcon: View {
var body: some View {
Link(destination: URL(string: "https://www.compotui.com")!, label: {
Image(systemName: "arrow.up.right.square")
.resizable()
.scaledToFit()
.frame(width: 64, height: 64)
.foregroundStyle(.red)
})
}
}
#Preview {
LinkAsIcon()
}4 of 5Pro ComponentiOS 16.0+
Link as Markdown Text with Emoji
Inline text link styled with emojis and markdown parsing.
LinkAsMarkdownTextWithEmoji.swiftPro
import SwiftUI
struct UseLinkAsMarkdownTextWEmoji: View {
var body: some View {
LinkAsMarkdownTextWEmoji(emojiUnicode: 0x1F517, accentColor: .blue, url: "[Connect with us](https://www.compotui.com)")
.padding()
}
// ...
// Complete source code available in Compot Pro on the App Store.Compot Pro Component
Unlock full code & interactive preview
Interactive live preview and complete SwiftUI code available in the Compot App.
Available for macOS & iOS • 85+ free components included
Explore other SwiftUI categories
Buttons (34)Texts & Typography (18)Banners & Promos (10)Cards & Content Displays (8)Settings, Lists & Rows (9)Avatars & User Profiles (7)Charts & Gauges (5)Icons & Badges (7)Navigation Links & Banners (3)Onboarding & Welcome Screens (3)Paywalls & Subscriptions (3)Images & Effects (3)Labels (4)SF Symbols & Animations (4)Inputs & Text Editors (2)Shapes, Chat & Real-Time (2)Tiles & Selectables (2)Badges & Pills (1)Alerts & Modals (1)Toasts & Feedback (1)Developer Templates & Architecture (3)