forked from github/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsLink.swift
More file actions
42 lines (37 loc) · 1001 Bytes
/
SettingsLink.swift
File metadata and controls
42 lines (37 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import SwiftUI
struct SettingsLink: View {
let url: URL
let title: String
let subtitle: String?
init(_ url: URL, title: String, subtitle: String? = nil) {
self.url = url
self.title = title
self.subtitle = subtitle
}
init(url: String, title: String, subtitle: String? = nil) {
self.init(URL(string: url)!, title: title, subtitle: subtitle)
}
var body: some View {
Link(destination: url) {
VStack(alignment: .leading) {
Text(title)
.font(.body)
if let subtitle = subtitle {
Text(subtitle)
.font(.footnote)
}
}
Spacer()
Image(systemName: "chevron.right")
}
.foregroundStyle(.primary)
.padding(10)
}
}
#Preview {
SettingsLink(
url: "https://example.com",
title: "Example",
subtitle: "This is an example"
)
}