fix: support older iOS SDKs again

This commit is contained in:
Kenta Kubo 2025-09-06 21:54:49 +09:00
parent e963a83588
commit a8d2123154
No known key found for this signature in database
GPG key ID: 3D79E20285C94BE8
2 changed files with 21 additions and 10 deletions

View file

@ -189,12 +189,14 @@ extension ContentView: View {
.navigationTitle(Bundle.main.displayName!)
.navigationBarTitleDisplayMode(self.navigationBarTitleDisplayMode)
.toolbar {
if #available(iOS 26, *) {
ToolbarItem(placement: .subtitle) {
self.statusIndicator
.foregroundStyle(.secondary)
#if canImport(SwiftUI, _version: 7)
if #available(iOS 26, *) {
ToolbarItem(placement: .subtitle) {
self.statusIndicator
.foregroundStyle(.secondary)
}
}
}
#endif
self.toolbarContent
}
.alert(self.alertTitle, isPresented: self.$isAlertPresented) {
@ -323,6 +325,9 @@ extension ContentView: View {
}
ToolbarItem(placement: .status) {
if #available(iOS 26, *) {
#if !canImport(SwiftUI, _version: 7)
self.statusIndicator
#endif
} else {
self.statusIndicator
}

View file

@ -38,15 +38,21 @@ extension DetailView: View {
HowToActivateView()
.toolbar {
ToolbarItem(placement: .cancellationAction) {
if #available(iOS 26, *) {
Button("Close", systemImage: "xmark", role: .close) {
self.isGuidePresented = false
#if canImport(SwiftUI, _version: 7)
if #available(iOS 26, *) {
Button("Close", systemImage: "xmark", role: .close) {
self.isGuidePresented = false
}
} else {
Button("Close", systemImage: "xmark", role: .cancel) {
self.isGuidePresented = false
}
}
} else {
#else
Button("Close", systemImage: "xmark", role: .cancel) {
self.isGuidePresented = false
}
}
#endif
}
}
}