Fix for tvOS

This commit is contained in:
世界
2025-11-27 18:55:10 +08:00
parent 0bfb6d2516
commit 22de256d13
4 changed files with 155 additions and 104 deletions
@@ -26,35 +26,64 @@ public struct NavigationButtonsView: View {
}
public var body: some View {
HStack(spacing: 12) {
if showConnectionsButton {
Divider()
Text(verbatim: "\(connectionsCount)")
.font(.subheadline)
.foregroundStyle(.secondary)
.fixedSize()
Button {
onConnectionsTap()
} label: {
Label("Connections", systemImage: "list.bullet.rectangle.portrait.fill")
#if os(tvOS)
tvOSBody
#else
iOSBody
#endif
}
#if os(tvOS)
private var tvOSBody: some View {
viewBuilder {
if showConnectionsButton {
Button {
onConnectionsTap()
} label: {
Image(systemName: "list.bullet.rectangle.portrait.fill")
}
}
.labelStyle(.iconOnly)
.foregroundStyle(.primary)
}
if showGroupsButton {
Divider()
Text(verbatim: "\(groupsCount)")
.font(.subheadline)
.foregroundStyle(.secondary)
.fixedSize()
Button {
onGroupsTap()
} label: {
Label("Groups", systemImage: "rectangle.3.group.fill")
if showGroupsButton {
Button {
onGroupsTap()
} label: {
Image(systemName: "rectangle.3.group.fill")
}
}
.labelStyle(.iconOnly)
.foregroundStyle(.primary)
}
}
}
#else
private var iOSBody: some View {
HStack(spacing: 12) {
if showConnectionsButton {
Divider()
Text(verbatim: "\(connectionsCount)")
.font(.subheadline)
.foregroundStyle(.secondary)
.fixedSize()
Button {
onConnectionsTap()
} label: {
Label("Connections", systemImage: "list.bullet.rectangle.portrait.fill")
}
.labelStyle(.iconOnly)
.foregroundStyle(.primary)
}
if showGroupsButton {
Divider()
Text(verbatim: "\(groupsCount)")
.font(.subheadline)
.foregroundStyle(.secondary)
.fixedSize()
Button {
onGroupsTap()
} label: {
Label("Groups", systemImage: "rectangle.3.group.fill")
}
.labelStyle(.iconOnly)
.foregroundStyle(.primary)
}
}
}
#endif
}