From 5fbdc540e9a70fce3d85280aa020c748268e876a Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Sat, 10 Aug 2024 10:40:52 -0400 Subject: [PATCH] Cleanup and bump minimum iOS version to 15 --- Shared/Navigation/WFNavigation.swift | 26 ++++++++++++++++--- Shared/PostList/DeprecatedListView.swift | 2 +- Shared/PostList/PostListFilteredView.swift | 2 -- .../SearchablePostListFilteredView.swift | 4 --- .../project.pbxproj | 4 +-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Shared/Navigation/WFNavigation.swift b/Shared/Navigation/WFNavigation.swift index 91a25b9..d3b6859 100644 --- a/Shared/Navigation/WFNavigation.swift +++ b/Shared/Navigation/WFNavigation.swift @@ -15,10 +15,15 @@ final class WFNavigationState: ObservableObject { struct WFNavigation: View where CollectionList: View, PostList: View, PostDetail: View { + @EnvironmentObject var model: WriteFreelyModel + @FetchRequest(sortDescriptors: []) var collections: FetchedResults + private var collectionList: CollectionList private var postList: PostList private var postDetail: PostDetail + + init( @ViewBuilder collectionList: () -> CollectionList, @ViewBuilder postList: () -> PostList, @@ -43,10 +48,22 @@ struct WFNavigation: View /// 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 - } detail: { - postList +// NavigationSplitView { +// collectionList +// } detail: { +// postList +// } + + NavigationStack { + List(collections, id: \.self, selection: $model.navState.selectedPost) { collection in + NavigationLink("\(collection.title)", destination: PostListView(selectedCollection: model.navState.selectedCollection, showAllPosts: model.navState.showAllPosts)) + } +// List(fetchRequest.wrappedValue, id: \.self, selection: $model.navState.selectedPost) { post in +// NavigationLink( +// "\(post.title.isEmpty ? "UNTITLED" : post.title)", +// destination: PostEditorView(post: post) +// ) +// } } } else { NavigationView { @@ -57,4 +74,5 @@ struct WFNavigation: View } #endif } + } diff --git a/Shared/PostList/DeprecatedListView.swift b/Shared/PostList/DeprecatedListView.swift index 1c4fb10..cf403d1 100644 --- a/Shared/PostList/DeprecatedListView.swift +++ b/Shared/PostList/DeprecatedListView.swift @@ -1,6 +1,6 @@ import SwiftUI -@available(iOS 15, macOS 12.0, *) +@available(iOS 15, macOS 13.0, *) struct DeprecatedListView: View { @EnvironmentObject var model: WriteFreelyModel @Binding var searchString: String diff --git a/Shared/PostList/PostListFilteredView.swift b/Shared/PostList/PostListFilteredView.swift index 0bbdab4..b3fec78 100644 --- a/Shared/PostList/PostListFilteredView.swift +++ b/Shared/PostList/PostListFilteredView.swift @@ -35,7 +35,6 @@ struct PostListFilteredView: View { #if os(iOS) if #available(iOS 15, *) { SearchablePostListFilteredView( - postCount: $postCount, collections: collections, fetchRequest: fetchRequest, onDelete: delete(_:) @@ -85,7 +84,6 @@ struct PostListFilteredView: View { } #else SearchablePostListFilteredView( - postCount: $postCount, collections: collections, fetchRequest: fetchRequest, onDelete: delete(_:) diff --git a/Shared/PostList/SearchablePostListFilteredView.swift b/Shared/PostList/SearchablePostListFilteredView.swift index 8c79d5e..56d2c29 100644 --- a/Shared/PostList/SearchablePostListFilteredView.swift +++ b/Shared/PostList/SearchablePostListFilteredView.swift @@ -3,12 +3,8 @@ import SwiftUI @available(iOS 15, macOS 12.0, *) struct SearchablePostListFilteredView: View { @EnvironmentObject var model: WriteFreelyModel - @Binding var postCount: Int @State private var searchString = "" - // Only used for NavigationStack in iOS 16/macOS 13 or later -// @State private var path: [WFAPost] = [] - var collections: FetchedResults var fetchRequest: FetchRequest var onDelete: (WFAPost) -> Void diff --git a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj index 32925bb..59b9e1f 100644 --- a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj +++ b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj @@ -1261,7 +1261,7 @@ DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1285,7 +1285,7 @@ DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks",