Create WFNavigationState class to replace published vars in WFModel

This commit is contained in:
Angelo Stavrow 2024-08-03 07:21:01 -04:00
parent 3425cc7226
commit 62e781c52e
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 13 additions and 3 deletions

View File

@ -12,6 +12,7 @@ final class WriteFreelyModel: ObservableObject {
@Published var preferences = PreferencesModel()
@Published var posts = PostListModel()
@Published var editor = PostEditorModel()
@Published var navState = WFNavigationState()
// MARK: - Error handling
@Published var hasError: Bool = false
@ -45,9 +46,6 @@ final class WriteFreelyModel: ObservableObject {
@Published var isLoggingIn: Bool = false
@Published var isProcessingRequest: Bool = false
@Published var hasNetworkConnection: Bool = true
@Published var selectedPost: WFAPost?
@Published var selectedCollection: WFACollection?
@Published var showAllPosts: Bool = true
@Published var isPresentingDeleteAlert: Bool = false
@Published var postToDelete: WFAPost?
#if os(iOS)

View File

@ -1,5 +1,17 @@
import SwiftUI
// MARK: - Navigation State
final class WFNavigationState: ObservableObject {
@Published var selectedCollection: WFACollection?
@Published var selectedPost: WFAPost?
@Published var showAllPosts: Bool = true
}
// MARK: - Navigation Implementation
struct WFNavigation<CollectionList, PostList, PostDetail>: View
where CollectionList: View, PostList: View, PostDetail: View {