Skip to content

Commit 900e669

Browse files
Use glass buttons for desktop welcome window
1 parent b877e21 commit 900e669

File tree

2 files changed

+45
-21
lines changed

2 files changed

+45
-21
lines changed

MCMaps/Shared/Views/Launch Experience/DocumentLaunchView+Mobile.swift

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,3 @@ import SwiftUI
8585
}
8686
#endif
8787
#endif
88-
89-
private struct DocumentLaunchViewButtonModifier: ViewModifier {
90-
func body(content: Content) -> some View {
91-
content
92-
.frame(maxWidth: .infinity)
93-
.padding(.horizontal, 16)
94-
.padding(.vertical, 10)
95-
.background(Color.secondary.opacity(0.1))
96-
.controlSize(.extraLarge)
97-
.buttonStyle(.borderless)
98-
.bold()
99-
.clipped()
100-
.clipShape(.rect(cornerRadius: 10))
101-
}
102-
}
103-
104-
extension View {
105-
func documentLaunchViewButtonStyle() -> some View {
106-
self.modifier(DocumentLaunchViewButtonModifier())
107-
}
108-
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// DocumentLaunchViewButtonModifier.swift
3+
// MCMaps
4+
//
5+
// Created by Marquis Kurt on 27-10-2025.
6+
//
7+
8+
import SwiftUI
9+
10+
private struct DocumentLaunchViewButtonModifier: ViewModifier {
11+
func body(content: Content) -> some View {
12+
if #available(macOS 26, iOS 26, *) {
13+
self.glassStyle(content: content)
14+
} else {
15+
self.classicButtonStyle(content: content)
16+
}
17+
}
18+
19+
@available(iOS 26, macOS 26, *)
20+
private func glassStyle(content: Content) -> some View {
21+
content
22+
.frame(maxWidth: .infinity)
23+
.controlSize(.extraLarge)
24+
.buttonStyle(.glass)
25+
.bold()
26+
}
27+
28+
private func classicButtonStyle(content: Content) -> some View {
29+
content
30+
.padding(.horizontal, 16)
31+
.padding(.vertical, 10)
32+
.background(Color.secondary.opacity(0.1))
33+
.controlSize(.extraLarge)
34+
.buttonStyle(.borderless)
35+
.bold()
36+
.clipped()
37+
.clipShape(.rect(cornerRadius: 10))
38+
}
39+
}
40+
41+
extension View {
42+
func documentLaunchViewButtonStyle() -> some View {
43+
self.modifier(DocumentLaunchViewButtonModifier())
44+
}
45+
}

0 commit comments

Comments
 (0)