From 5e5b0687219f1fecc005f88a22632c2cf4cb04c2 Mon Sep 17 00:00:00 2001 From: Bosco Ho Date: Fri, 9 Aug 2024 19:12:08 -0700 Subject: [PATCH 1/2] ~ Set deployment target to 16.0. ~ Replace deprecated NavigationView with NavigationStack. --- .../NiceArchitectureExample.xcodeproj/project.pbxproj | 8 ++++---- .../UI/Coordinator/PostsCoordinatorView.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj b/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj index 514a8da..d7b1659 100644 --- a/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj +++ b/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj @@ -598,7 +598,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -654,7 +654,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -675,7 +675,7 @@ DEVELOPMENT_TEAM = GH868RP95T; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = NiceArchitectureExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -700,7 +700,7 @@ DEVELOPMENT_TEAM = GH868RP95T; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = NiceArchitectureExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift b/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift index df9da5c..492203b 100644 --- a/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift +++ b/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift @@ -17,7 +17,7 @@ struct PostsCoordinatorView: View { @ObservedObject var coordinator: PostsCoordinator var body: some View { - NavigationView { + NavigationStack { PostsView(viewModel: coordinator.viewModel) .navigation(item: $coordinator.postDetailViewModel) { viewModel in PostDetailView(viewModel: viewModel) From a7bd74491b9c0196e880ff2cb77fd1eb8a111a5a Mon Sep 17 00:00:00 2001 From: Bosco Ho Date: Fri, 9 Aug 2024 19:25:44 -0700 Subject: [PATCH 2/2] ~ Set deployment target to 17.0 ~ Replace ObservableObject with @Observable [PostsCoordinator]. --- .../NiceArchitectureExample.xcodeproj/project.pbxproj | 8 ++++---- .../UI/Coordinator/PostsCoordinator.swift | 6 +++--- .../UI/Coordinator/PostsCoordinatorView.swift | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj b/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj index d7b1659..c95588f 100644 --- a/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj +++ b/NiceArchitectureExample/NiceArchitectureExample.xcodeproj/project.pbxproj @@ -598,7 +598,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -654,7 +654,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -675,7 +675,7 @@ DEVELOPMENT_TEAM = GH868RP95T; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = NiceArchitectureExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -700,7 +700,7 @@ DEVELOPMENT_TEAM = GH868RP95T; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = NiceArchitectureExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinator.swift b/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinator.swift index 62113e7..001832c 100644 --- a/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinator.swift +++ b/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinator.swift @@ -18,9 +18,9 @@ enum PostsRoute { /// it should be responsible for holding references to each of the viewModels it manages /// and use that information, plus any changes in state, to decide which View to present. /// ViewModels can interact with their coordinator to update the state or navigate to other pages. -class PostsCoordinator: ObservableObject, Coordinator { - @Published var viewModel: PostsViewModel! - @Published var postDetailViewModel: PostDetailViewModel? +@Observable class PostsCoordinator: Coordinator { + var viewModel: PostsViewModel! + var postDetailViewModel: PostDetailViewModel? init() { viewModel = PostsViewModel(coordinator: self) diff --git a/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift b/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift index 492203b..4ee0b3e 100644 --- a/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift +++ b/NiceArchitectureExample/NiceArchitectureExample/UI/Coordinator/PostsCoordinatorView.swift @@ -14,7 +14,7 @@ import SwiftUI /// managing transitioning between Views. /// Doing so reduces the complexity of individual Views, and helps with things like navigation. struct PostsCoordinatorView: View { - @ObservedObject var coordinator: PostsCoordinator + @Bindable var coordinator: PostsCoordinator var body: some View { NavigationStack {