Cleanup and bump minimum iOS version to 15

This commit is contained in:
Angelo Stavrow 2024-08-10 10:40:52 -04:00
parent 06682d89b6
commit 5fbdc540e9
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
5 changed files with 25 additions and 13 deletions

View File

@ -15,10 +15,15 @@ final class WFNavigationState: ObservableObject {
struct WFNavigation<CollectionList, PostList, PostDetail>: View struct WFNavigation<CollectionList, PostList, PostDetail>: View
where CollectionList: View, PostList: View, PostDetail: View { where CollectionList: View, PostList: View, PostDetail: View {
@EnvironmentObject var model: WriteFreelyModel
@FetchRequest(sortDescriptors: []) var collections: FetchedResults<WFACollection>
private var collectionList: CollectionList private var collectionList: CollectionList
private var postList: PostList private var postList: PostList
private var postDetail: PostDetail private var postDetail: PostDetail
init( init(
@ViewBuilder collectionList: () -> CollectionList, @ViewBuilder collectionList: () -> CollectionList,
@ViewBuilder postList: () -> PostList, @ViewBuilder postList: () -> PostList,
@ -43,10 +48,22 @@ struct WFNavigation<CollectionList, PostList, PostDetail>: View
/// Consider converting this into a NavigationStack instead, and using `$model.selectedCollection` to set /// 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 /// 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. /// **WFNavigation** instead, so that it eventually encapsulates _all_ things related to app navigation.
NavigationSplitView { // NavigationSplitView {
collectionList // collectionList
} detail: { // } detail: {
postList // 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 { } else {
NavigationView { NavigationView {
@ -57,4 +74,5 @@ struct WFNavigation<CollectionList, PostList, PostDetail>: View
} }
#endif #endif
} }
} }

View File

@ -1,6 +1,6 @@
import SwiftUI import SwiftUI
@available(iOS 15, macOS 12.0, *) @available(iOS 15, macOS 13.0, *)
struct DeprecatedListView: View { struct DeprecatedListView: View {
@EnvironmentObject var model: WriteFreelyModel @EnvironmentObject var model: WriteFreelyModel
@Binding var searchString: String @Binding var searchString: String

View File

@ -35,7 +35,6 @@ struct PostListFilteredView: View {
#if os(iOS) #if os(iOS)
if #available(iOS 15, *) { if #available(iOS 15, *) {
SearchablePostListFilteredView( SearchablePostListFilteredView(
postCount: $postCount,
collections: collections, collections: collections,
fetchRequest: fetchRequest, fetchRequest: fetchRequest,
onDelete: delete(_:) onDelete: delete(_:)
@ -85,7 +84,6 @@ struct PostListFilteredView: View {
} }
#else #else
SearchablePostListFilteredView( SearchablePostListFilteredView(
postCount: $postCount,
collections: collections, collections: collections,
fetchRequest: fetchRequest, fetchRequest: fetchRequest,
onDelete: delete(_:) onDelete: delete(_:)

View File

@ -3,12 +3,8 @@ import SwiftUI
@available(iOS 15, macOS 12.0, *) @available(iOS 15, macOS 12.0, *)
struct SearchablePostListFilteredView: View { struct SearchablePostListFilteredView: View {
@EnvironmentObject var model: WriteFreelyModel @EnvironmentObject var model: WriteFreelyModel
@Binding var postCount: Int
@State private var searchString = "" @State private var searchString = ""
// Only used for NavigationStack in iOS 16/macOS 13 or later
// @State private var path: [WFAPost] = []
var collections: FetchedResults<WFACollection> var collections: FetchedResults<WFACollection>
var fetchRequest: FetchRequest<WFAPost> var fetchRequest: FetchRequest<WFAPost>
var onDelete: (WFAPost) -> Void var onDelete: (WFAPost) -> Void

View File

@ -1261,7 +1261,7 @@
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist; INFOPLIST_FILE = iOS/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0; IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@ -1285,7 +1285,7 @@
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist; INFOPLIST_FILE = iOS/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0; IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",