Skip to content

Commit 4d08349

Browse files
committed
Update SwiftUI FAB
1 parent fa77ac3 commit 4d08349

File tree

1 file changed

+31
-7
lines changed
  • Modules/Sources/DesignSystem/Components

1 file changed

+31
-7
lines changed

Modules/Sources/DesignSystem/Components/FAB.swift

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,43 @@ public struct FAB: View {
1010
}
1111

1212
public var body: some View {
13-
content
14-
.dynamicTypeSize(...DynamicTypeSize.accessibility1) // important to be attached from the outside
13+
#if compiler(>=6.2)
14+
if #available(iOS 26, *) {
15+
modern
16+
} else {
17+
legacy
18+
}
19+
#else
20+
legacy
21+
#endif
1522
}
1623

24+
@available(iOS 26, *)
1725
@ViewBuilder
18-
private var content: some View {
19-
if let action {
20-
Button(action: action) {
26+
private var modern: some View {
27+
Button(action: action ?? {}) {
28+
Image(systemName: "plus")
29+
.font(.system(size: 24, weight: .semibold))
30+
.frame(width: 38, height: 38)
31+
.foregroundStyle(Color(.systemBackground))
32+
}
33+
.buttonStyle(.glassProminent)
34+
.buttonBorderShape(.circle)
35+
.tint(Color(.label).opacity(0.8))
36+
}
37+
38+
@ViewBuilder
39+
private var legacy: some View {
40+
Group {
41+
if let action {
42+
Button(action: action) {
43+
FABContentView(image: image)
44+
}
45+
} else {
2146
FABContentView(image: image)
2247
}
23-
} else {
24-
FABContentView(image: image)
2548
}
49+
.dynamicTypeSize(...DynamicTypeSize.accessibility1) // important to be attached from the outside
2650
}
2751
}
2852

0 commit comments

Comments
 (0)