diff --git a/Shared/Navigation/WFNavigation.swift b/Shared/Navigation/WFNavigation.swift index e3ee29f..b113545 100644 --- a/Shared/Navigation/WFNavigation.swift +++ b/Shared/Navigation/WFNavigation.swift @@ -1,39 +1,48 @@ import SwiftUI struct WFNavigation: View where CollectionList: View, PostList: View, PostDetail: View { private var collectionList: CollectionList private var postList: PostList private var postDetail: PostDetail init( @ViewBuilder collectionList: () -> CollectionList, @ViewBuilder postList: () -> PostList, @ViewBuilder postDetail: () -> PostDetail ) { self.collectionList = collectionList() self.postList = postList() self.postDetail = postDetail() } var body: some View { - if #available(iOS 16, macOS 13, *) { - /// This works better in iOS 17.5 but still has some issues: - /// - Does not respect the editor-launching policy, going right to the NoSelectedPostView + #if os(macOS) + NavigationSplitView { + collectionList + } content: { + postList + } detail: { + postDetail + } + #else + if #available(iOS 16, *) { + /// Consider converting this into a NavigationStack instead, and using `$model.selectedCollection` to set + /// the detail view that should be shown. Try moving navigation state out of **WriteFreelyModel** and into + /// **WFNavigation** instead, so that it eventually encapsulates _all_ things related to app navigation. NavigationSplitView { collectionList - } content: { - postList } detail: { - postDetail + postList } } else { NavigationView { collectionList postList postDetail } } + #endif } }