Add support for back navigation
Some checks failed
Deploy Docs / publish (push) Has been cancelled

This commit is contained in:
david-swift 2024-11-11 06:29:34 +01:00
parent 0591941373
commit adf4cfa8df

View File

@ -34,7 +34,16 @@ public struct NavigationView<Item>: WinUIWidget where Item: NavigationViewItem {
/// The currently selected item. /// The currently selected item.
var selectedItem: Selection { var selectedItem: Selection {
get { get {
if let last = path.last { if let last = path.last(
where: { item in
switch item {
case .settings:
return settings
case let .custom(item):
return items.contains(item)
}
}
) {
last last
} else if let first = items.first { } else if let first = items.first {
.custom(item: first) .custom(item: first)