Skip to content

Commit c7bb349

Browse files
authored
PushNotificationListView의 시트에서 툴바가 보이도록 하고, 수정 버튼이 없도록 구현한다 (#178)
1 parent 58c3cb6 commit c7bb349

3 files changed

Lines changed: 22 additions & 12 deletions

File tree

DevLog/Presentation/ViewModel/TodoDetailViewModel.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,21 @@ final class TodoDetailViewModel: Store {
3535
}
3636

3737
private(set) var state: State = .init()
38+
let showEditButton: Bool
3839
private let fetchUseCase: FetchTodoByIDUseCase
3940
private let upsertUseCase: UpsertTodoUseCase
4041
private let todoID: String
4142

4243
init(
4344
fetchUseCase: FetchTodoByIDUseCase,
4445
upsertUseCase: UpsertTodoUseCase,
45-
todoID: String
46+
todoID: String,
47+
showEditButton: Bool = true
4648
) {
4749
self.fetchUseCase = fetchUseCase
4850
self.upsertUseCase = upsertUseCase
4951
self.todoID = todoID
52+
self.showEditButton = showEditButton
5053
}
5154

5255
func reduce(with action: Action) -> [SideEffect] {

DevLog/UI/Home/TodoDetailView.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@ struct TodoDetailView: View {
5252
Image(systemName: "info.circle")
5353
}
5454
}
55-
if #available(iOS 26.0, *) {
56-
ToolbarSpacer(.fixed, placement: .topBarTrailing)
57-
}
58-
ToolbarItem(placement: .topBarTrailing) {
59-
Button {
60-
viewModel.send(.setShowEditor(true))
61-
} label: {
62-
Text("수정")
55+
if viewModel.showEditButton {
56+
if #available(iOS 26.0, *) {
57+
ToolbarSpacer(.fixed, placement: .topBarTrailing)
58+
}
59+
ToolbarItem(placement: .topBarTrailing) {
60+
Button {
61+
viewModel.send(.setShowEditor(true))
62+
} label: {
63+
Text("수정")
64+
}
6365
}
6466
}
6567
}

DevLog/UI/PushNotification/PushNotificationListView.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,18 @@ struct PushNotificationListView: View {
7979
get: { viewModel.state.selectedTodoID },
8080
set: { viewModel.send(.setSelectedTodoID($0)) }
8181
)) { item in
82-
VStack(spacing: 0) {
83-
Spacer(minLength: 16)
82+
NavigationStack {
8483
TodoDetailView(viewModel: TodoDetailViewModel(
8584
fetchUseCase: container.resolve(FetchTodoByIDUseCase.self),
8685
upsertUseCase: container.resolve(UpsertTodoUseCase.self),
87-
todoID: item.id
86+
todoID: item.id,
87+
showEditButton: false
8888
))
89+
.toolbar {
90+
ToolbarLeadingButton {
91+
viewModel.send(.setSelectedTodoID(nil))
92+
}
93+
}
8994
}
9095
.background(Color(.secondarySystemBackground))
9196
.presentationDragIndicator(.visible)

0 commit comments

Comments
 (0)