Merge pull request #75 from nanoterran/main

Fixing macOS build
This commit is contained in:
jack
2025-07-09 11:13:03 +02:00
committed by GitHub
+5 -2
View File
@@ -15,8 +15,9 @@ struct LinkPreviewView: View {
let url: URL
let title: String?
@Environment(\.colorScheme) var colorScheme
#if os(iOS)
@State private var metadata: LPLinkMetadata?
#endif
private var textColor: Color {
colorScheme == .dark ? Color.green : Color(red: 0, green: 0.5, blue: 0)
}
@@ -85,11 +86,13 @@ struct LinkPreviewView: View {
VStack(alignment: .leading, spacing: 4) {
// Title
#if os(iOS)
Text(metadata?.title ?? title ?? url.host ?? "Link")
.font(.system(size: 14, weight: .semibold, design: .monospaced))
.foregroundColor(textColor)
.lineLimit(2)
.multilineTextAlignment(.leading)
#endif
// Host
Text(url.host ?? url.absoluteString)
@@ -287,4 +290,4 @@ extension String {
LinkPreviewView(url: URL(string: "https://example.com")!, title: "Example Website")
.padding()
}
}
}