diff --git a/DevLog/Presentation/ViewModel/TodoDetailViewModel.swift b/DevLog/Presentation/ViewModel/TodoDetailViewModel.swift index 5a9df4d6..e8f403c2 100644 --- a/DevLog/Presentation/ViewModel/TodoDetailViewModel.swift +++ b/DevLog/Presentation/ViewModel/TodoDetailViewModel.swift @@ -35,6 +35,7 @@ final class TodoDetailViewModel: Store { } private(set) var state: State = .init() + let showEditButton: Bool private let fetchUseCase: FetchTodoByIDUseCase private let upsertUseCase: UpsertTodoUseCase private let todoID: String @@ -42,11 +43,13 @@ final class TodoDetailViewModel: Store { init( fetchUseCase: FetchTodoByIDUseCase, upsertUseCase: UpsertTodoUseCase, - todoID: String + todoID: String, + showEditButton: Bool = true ) { self.fetchUseCase = fetchUseCase self.upsertUseCase = upsertUseCase self.todoID = todoID + self.showEditButton = showEditButton } func reduce(with action: Action) -> [SideEffect] { diff --git a/DevLog/UI/Home/TodoDetailView.swift b/DevLog/UI/Home/TodoDetailView.swift index a1696db1..0ca66119 100644 --- a/DevLog/UI/Home/TodoDetailView.swift +++ b/DevLog/UI/Home/TodoDetailView.swift @@ -52,14 +52,16 @@ struct TodoDetailView: View { Image(systemName: "info.circle") } } - if #available(iOS 26.0, *) { - ToolbarSpacer(.fixed, placement: .topBarTrailing) - } - ToolbarItem(placement: .topBarTrailing) { - Button { - viewModel.send(.setShowEditor(true)) - } label: { - Text("수정") + if viewModel.showEditButton { + if #available(iOS 26.0, *) { + ToolbarSpacer(.fixed, placement: .topBarTrailing) + } + ToolbarItem(placement: .topBarTrailing) { + Button { + viewModel.send(.setShowEditor(true)) + } label: { + Text("수정") + } } } } diff --git a/DevLog/UI/PushNotification/PushNotificationListView.swift b/DevLog/UI/PushNotification/PushNotificationListView.swift index e6b43f14..5440b417 100644 --- a/DevLog/UI/PushNotification/PushNotificationListView.swift +++ b/DevLog/UI/PushNotification/PushNotificationListView.swift @@ -79,13 +79,18 @@ struct PushNotificationListView: View { get: { viewModel.state.selectedTodoID }, set: { viewModel.send(.setSelectedTodoID($0)) } )) { item in - VStack(spacing: 0) { - Spacer(minLength: 16) + NavigationStack { TodoDetailView(viewModel: TodoDetailViewModel( fetchUseCase: container.resolve(FetchTodoByIDUseCase.self), upsertUseCase: container.resolve(UpsertTodoUseCase.self), - todoID: item.id + todoID: item.id, + showEditButton: false )) + .toolbar { + ToolbarLeadingButton { + viewModel.send(.setSelectedTodoID(nil)) + } + } } .background(Color(.secondarySystemBackground)) .presentationDragIndicator(.visible)