mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Cleanup and bump minimum iOS version to 15
This commit is contained in:
parent
06682d89b6
commit
5fbdc540e9
@ -15,10 +15,15 @@ final class WFNavigationState: ObservableObject {
|
||||
struct WFNavigation<CollectionList, PostList, 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 postList: PostList
|
||||
private var postDetail: PostDetail
|
||||
|
||||
|
||||
|
||||
init(
|
||||
@ViewBuilder collectionList: () -> CollectionList,
|
||||
@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
|
||||
/// 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<CollectionList, PostList, PostDetail>: View
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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(_:)
|
||||
|
@ -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<WFACollection>
|
||||
var fetchRequest: FetchRequest<WFAPost>
|
||||
var onDelete: (WFAPost) -> Void
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user