From 4e6a44102106a6bcceda41040b693e1295fcd44b Mon Sep 17 00:00:00 2001 From: opficdev Date: Thu, 5 Mar 2026 20:37:21 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20Picker=20=ED=98=95=ED=83=9C?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Domain/Entity/PushNotificationQuery.swift | 2 +- DevLog/UI/Home/TodoListView.swift | 76 +++++++------------ .../PushNotificationListView.swift | 21 ++--- 3 files changed, 35 insertions(+), 64 deletions(-) diff --git a/DevLog/Domain/Entity/PushNotificationQuery.swift b/DevLog/Domain/Entity/PushNotificationQuery.swift index 0c2d62ce..6cf88403 100644 --- a/DevLog/Domain/Entity/PushNotificationQuery.swift +++ b/DevLog/Domain/Entity/PushNotificationQuery.swift @@ -13,7 +13,7 @@ struct PushNotificationQuery: Equatable { case oldest } - enum TimeFilter: Equatable { + enum TimeFilter: Equatable, Hashable { case none case hours(Int) case days(Int) diff --git a/DevLog/UI/Home/TodoListView.swift b/DevLog/UI/Home/TodoListView.swift index e501478b..c7d70ffa 100644 --- a/DevLog/UI/Home/TodoListView.swift +++ b/DevLog/UI/Home/TodoListView.swift @@ -311,35 +311,29 @@ struct TodoListView: View { private var sortMenu: some View { Menu { - Section { + Picker(selection: Binding( + get: { viewModel.state.query.sortTarget }, + set: { viewModel.send(.setSortTarget($0)) } + )) { ForEach([TodoQuery.SortTarget.createdAt, .updatedAt], id: \.self) { option in - Button { - viewModel.send(.setSortTarget(option)) - } label: { - selectionLabel( - title: option.title, - isSelected: viewModel.state.query.sortTarget == option - ) - } + Text(option.title).tag(option) } - } header: { + } label: { Text("정렬 기준") } + .tint(.blue) - Section { + Picker(selection: Binding( + get: { viewModel.state.query.sortOrder }, + set: { viewModel.send(.setSortOrder($0)) } + )) { ForEach([TodoQuery.SortOrder.latest, .oldest], id: \.self) { option in - Button { - viewModel.send(.setSortOrder(option)) - } label: { - selectionLabel( - title: option.title, - isSelected: viewModel.state.query.sortOrder == option - ) - } + Text(option.title).tag(option) } - } header: { + } label: { Text("정렬 순서") } + .tint(.blue) } label: { let condition = viewModel.state.query.sortTarget == .createdAt && viewModel.state.query.sortOrder == .latest HStack { @@ -353,27 +347,21 @@ struct TodoListView: View { private var filterMenu: some View { Menu { - Button { - viewModel.send(.togglePinnedOnly) - } label: { - selectionLabel( - title: "중요 표시", - isSelected: viewModel.state.query.isPinned == true - ) + Toggle(isOn: Binding( + get: { viewModel.state.query.isPinned == true }, + set: { _ in viewModel.send(.togglePinnedOnly) } + )) { + Text("중요 표시") } - Section { + Picker(selection: Binding( + get: { viewModel.state.query.completionFilter }, + set: { viewModel.send(.setCompletionFilter($0)) } + )) { ForEach([TodoQuery.CompletionFilter.all, .incomplete, .completed], id: \.self) { option in - Button { - viewModel.send(.setCompletionFilter(option)) - } label: { - selectionLabel( - title: option.title, - isSelected: viewModel.state.query.completionFilter == option - ) - } + Text(option.title).tag(option) } - } header: { + } label: { Text("완료 상태") } } label: { @@ -402,19 +390,7 @@ struct TodoListView: View { .background(Circle().fill(backgroundColor)) } - private func selectionLabel(title: String, isSelected: Bool) -> some View { - HStack { - Text(title) - Spacer() - if isSelected { - Image(systemName: "checkmark") - .tint(.blue) - } - } - .frame(maxWidth: .infinity, alignment: .leading) - } - - private enum Path: Hashable { +private enum Path: Hashable { case detail(String) } } diff --git a/DevLog/UI/PushNotification/PushNotificationListView.swift b/DevLog/UI/PushNotification/PushNotificationListView.swift index 07ae6d03..44f33554 100644 --- a/DevLog/UI/PushNotification/PushNotificationListView.swift +++ b/DevLog/UI/PushNotification/PushNotificationListView.swift @@ -168,20 +168,15 @@ struct PushNotificationListView: View { } Menu { - ForEach(PushNotificationQuery.TimeFilter.availableOptions, id: \.id) { option in - Button { - viewModel.send(.setTimeFilter(option)) - } label: { - HStack { - Text(option.title) - Spacer() - if viewModel.state.query.timeFilter == option { - Image(systemName: "checkmark") - .tint(.blue) - } - } - .frame(maxWidth: .infinity, alignment: .leading) + Picker(selection: Binding( + get: { viewModel.state.query.timeFilter }, + set: { viewModel.send(.setTimeFilter($0)) } + )) { + ForEach(PushNotificationQuery.TimeFilter.availableOptions, id: \.self) { option in + Text(option.title).tag(option) } + } label: { + Text("기간") } } label: { let condition = viewModel.state.query.timeFilter == .none From b1a27ffb700df5d87127b0a35530a2bd44f87896 Mon Sep 17 00:00:00 2001 From: opficdev Date: Thu, 5 Mar 2026 21:13:13 +0900 Subject: [PATCH 2/2] =?UTF-8?q?ui:=20=EB=8F=99=EC=9E=91=ED=95=98=EC=A7=80?= =?UTF-8?q?=20=EC=95=8A=EB=8A=94=20=EB=AA=A8=EB=94=94=ED=8C=8C=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DevLog/UI/Home/TodoListView.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/DevLog/UI/Home/TodoListView.swift b/DevLog/UI/Home/TodoListView.swift index c7d70ffa..3bf6049b 100644 --- a/DevLog/UI/Home/TodoListView.swift +++ b/DevLog/UI/Home/TodoListView.swift @@ -321,8 +321,6 @@ struct TodoListView: View { } label: { Text("정렬 기준") } - .tint(.blue) - Picker(selection: Binding( get: { viewModel.state.query.sortOrder }, set: { viewModel.send(.setSortOrder($0)) } @@ -333,7 +331,6 @@ struct TodoListView: View { } label: { Text("정렬 순서") } - .tint(.blue) } label: { let condition = viewModel.state.query.sortTarget == .createdAt && viewModel.state.query.sortOrder == .latest HStack {