Implement changes on GNOME
Some checks failed
SwiftLint / SwiftLint (push) Has been cancelled
SwiftLint / SwiftLint (pull_request) Has been cancelled

This commit is contained in:
david-swift 2025-02-11 18:49:35 +01:00
parent 7b38fd8381
commit 0c2ac1ca57
3 changed files with 21 additions and 7 deletions

View File

@ -93,6 +93,16 @@ public struct Alert: SimpleView {
dialog = dialog.cancelButton(close.0, action: close.1)
return dialog
#else
let extraChild: Body?
if let textField {
extraChild = [
Form {
EntryRow(textField.0, text: textField.1)
}
]
} else {
extraChild = nil
}
var dialog = AlertDialog(
visible: $visible,
child: child,

View File

@ -264,12 +264,14 @@ public struct FlatNavigation<Item>: View where Item: FlatNavigationItem {
return [flat]
}
#else
HierarchicalNavigation(stack: stack, initialPageLabel: navigationTitle ?? "") { item in
content(item)
} initialView: {
self
}
.hideDefaultToolbar()
[
HierarchicalNavigation(stack: stack, initialPageLabel: navigationTitle ?? "") { item in
content(item)
} initialView: {
self
}
.hideDefaultToolbar()
]
#endif
}

View File

@ -59,6 +59,7 @@ struct ContentView: WindowView {
@State private var forceSplitView = true
@State private var stack: NavigationStack<GenericItem> = .init()
@State private var showAlert = false
@State private var text = ""
var view: Body {
FlatNavigation(Item.allCases, selection: $selectedItem) {
@ -128,9 +129,10 @@ struct ContentView: WindowView {
.alert(visible: $showAlert, title: "Sample Alert", content: "This is the main content", closeLabel: "Close") {
print("Close")
}
.primaryResponse("Primary", style: .suggested) {
.primaryResponse(text, style: .suggested) {
print("Primary")
}
.textField("Hello", text: $text)
}
func window(_ window: Window) -> Window {