Change to use a view instead of a function for the navigation wrapper
This commit is contained in:
parent
367bd90ec9
commit
f32b0bfdc3
|
@ -71,13 +71,13 @@ struct SidebarView: View {
|
||||||
if let containerID = sidebarItem.containerID {
|
if let containerID = sidebarItem.containerID {
|
||||||
DisclosureGroup(isExpanded: $expandedContainers[containerID]) {
|
DisclosureGroup(isExpanded: $expandedContainers[containerID]) {
|
||||||
ForEach(sidebarItem.children) { sidebarItem in
|
ForEach(sidebarItem.children) { sidebarItem in
|
||||||
buildSidebarItemNavigation(sidebarItem)
|
SidebarItemNavigation(sidebarItem: sidebarItem)
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
buildSidebarItemNavigation(sidebarItem)
|
SidebarItemNavigation(sidebarItem: sidebarItem)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buildSidebarItemNavigation(sidebarItem)
|
SidebarItemNavigation(sidebarItem: sidebarItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
|
@ -90,20 +90,27 @@ struct SidebarView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildSidebarItemNavigation(_ sidebarItem: SidebarItem) -> some View {
|
struct SidebarItemNavigation: View {
|
||||||
#if os(macOS)
|
|
||||||
return SidebarItemView(sidebarItem: sidebarItem).tag(sidebarItem.feed!.feedID!)
|
@EnvironmentObject private var sidebarModel: SidebarModel
|
||||||
#else
|
var sidebarItem: SidebarItem
|
||||||
return ZStack {
|
|
||||||
SidebarItemView(sidebarItem: sidebarItem)
|
@ViewBuilder var body: some View {
|
||||||
NavigationLink(destination: TimelineContainerView(feeds: sidebarModel.selectedFeeds),
|
#if os(macOS)
|
||||||
tag: sidebarItem.feed!.feedID!,
|
SidebarItemView(sidebarItem: sidebarItem).tag(sidebarItem.feed!.feedID!)
|
||||||
selection: $sidebarModel.selectedFeedIdentifier) {
|
#else
|
||||||
EmptyView()
|
ZStack {
|
||||||
}.buttonStyle(PlainButtonStyle())
|
SidebarItemView(sidebarItem: sidebarItem)
|
||||||
|
NavigationLink(destination: TimelineContainerView(feeds: sidebarModel.selectedFeeds),
|
||||||
|
tag: sidebarItem.feed!.feedID!,
|
||||||
|
selection: $sidebarModel.selectedFeedIdentifier) {
|
||||||
|
EmptyView()
|
||||||
|
}.buttonStyle(PlainButtonStyle())
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue