From a82f10dfb3640d3eaeed2108332650f01d2ea6f2 Mon Sep 17 00:00:00 2001 From: opficdev Date: Fri, 6 Mar 2026 21:23:11 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20TodoEditorView=EC=97=90=20=EC=A4=91?= =?UTF-8?q?=EC=9A=94=20=ED=91=9C=EC=8B=9C=EB=A5=BC=20=ED=95=A0=20=EC=88=98?= =?UTF-8?q?=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/TodoEditorViewModel.swift | 13 +++++++++---- DevLog/Resource/Localizable.xcstrings | 3 +++ DevLog/UI/Home/TodoEditorView.swift | 11 +++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/DevLog/Presentation/ViewModel/TodoEditorViewModel.swift b/DevLog/Presentation/ViewModel/TodoEditorViewModel.swift index 55a40aed..49cf97b7 100644 --- a/DevLog/Presentation/ViewModel/TodoEditorViewModel.swift +++ b/DevLog/Presentation/ViewModel/TodoEditorViewModel.swift @@ -11,12 +11,14 @@ import OrderedCollections @Observable final class TodoEditorViewModel: Store { private struct Draft: Equatable { + let isPinned: Bool let title: String let content: String let dueDate: Date? let tags: [String] init(todo: Todo) { + self.isPinned = todo.isPinned self.title = todo.title self.content = todo.content self.dueDate = todo.dueDate @@ -24,6 +26,7 @@ final class TodoEditorViewModel: Store { } init(state: State) { + self.isPinned = state.isPinned self.title = state.title self.content = state.content self.dueDate = state.dueDate @@ -32,6 +35,7 @@ final class TodoEditorViewModel: Store { } struct State: Equatable { + var isPinned: Bool = false var title: String = "" var content: String = "" var dueDate: Date? @@ -58,6 +62,7 @@ final class TodoEditorViewModel: Store { case setTabViewTag(Tag) case setTagText(String) case setTitle(String) + case togglePinned case toggleDueDate } @@ -67,7 +72,6 @@ final class TodoEditorViewModel: Store { private let calendar = Calendar.current let navigationTitle: String private let id: String - private let isPinned: Bool private let isCompleted: Bool private let isChecked: Bool private let createdAt: Date? @@ -88,7 +92,6 @@ final class TodoEditorViewModel: Store { init(kind: TodoKind) { self.navigationTitle = "새 \(kind.localizedName) 추가" self.id = UUID().uuidString - self.isPinned = false self.isCompleted = false self.isChecked = false self.createdAt = nil @@ -101,13 +104,13 @@ final class TodoEditorViewModel: Store { init(todo: Todo) { self.navigationTitle = "편집" self.id = todo.id - self.isPinned = todo.isPinned self.isCompleted = todo.isCompleted self.isChecked = todo.isChecked self.createdAt = todo.createdAt self.completedAt = todo.completedAt self.kind = todo.kind self.originalDraft = Draft(todo: todo) + state.isPinned = todo.isPinned state.title = todo.title state.content = todo.content state.dueDate = todo.dueDate @@ -136,6 +139,8 @@ final class TodoEditorViewModel: Store { } case .setTabViewTag(let tag): state.tabViewTag = tag + case .togglePinned: + state.isPinned.toggle() case .toggleDueDate: if state.hasDueDate { state.dueDate = nil @@ -171,7 +176,7 @@ extension TodoEditorViewModel { let date = Date() return Todo( id: self.id, - isPinned: self.isPinned, + isPinned: state.isPinned, isCompleted: self.isCompleted, isChecked: self.isChecked, title: state.title, diff --git a/DevLog/Resource/Localizable.xcstrings b/DevLog/Resource/Localizable.xcstrings index 83e18e5a..d70a97f9 100644 --- a/DevLog/Resource/Localizable.xcstrings +++ b/DevLog/Resource/Localizable.xcstrings @@ -387,6 +387,9 @@ }, "제목" : { + }, + "중요" : { + }, "중요 표시" : { diff --git a/DevLog/UI/Home/TodoEditorView.swift b/DevLog/UI/Home/TodoEditorView.swift index 72e9c4be..651ef7b0 100644 --- a/DevLog/UI/Home/TodoEditorView.swift +++ b/DevLog/UI/Home/TodoEditorView.swift @@ -124,6 +124,17 @@ struct TodoEditorView: View { private var accessoryBar: some View { HStack { + Button { + viewModel.send(.togglePinned) + } label: { + Label { + Text("중요") + } icon: { + Image(systemName: viewModel.state.isPinned ? "star.fill" : "star.slash") + .foregroundStyle(.yellow) + } + .adaptiveButtonStyle() + } TagEditor( tags: viewModel.state.tags, addAction: { viewModel.send(.addTag($0)) }, From a989d68b13e7bd537ed19ec152c861f12fd00d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9C=A4=EC=A7=84?= Date: Fri, 6 Mar 2026 21:27:48 +0900 Subject: [PATCH 2/2] =?UTF-8?q?ui:=20=EC=82=AC=EC=9A=A9=EC=9E=90=20?= =?UTF-8?q?=EC=A7=81=EA=B4=80=EC=84=B1=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- DevLog/UI/Home/TodoEditorView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DevLog/UI/Home/TodoEditorView.swift b/DevLog/UI/Home/TodoEditorView.swift index 651ef7b0..2efc62ae 100644 --- a/DevLog/UI/Home/TodoEditorView.swift +++ b/DevLog/UI/Home/TodoEditorView.swift @@ -130,8 +130,8 @@ struct TodoEditorView: View { Label { Text("중요") } icon: { - Image(systemName: viewModel.state.isPinned ? "star.fill" : "star.slash") - .foregroundStyle(.yellow) + Image(systemName: viewModel.state.isPinned ? "star.fill" : "star") + .foregroundStyle(viewModel.state.isPinned ? .yellow : .gray) } .adaptiveButtonStyle() }