[#273] TodoEditorView에서 마감일이 있을 때의 ui/ux를 개선한다#279
Conversation
opficdev
commented
Mar 16, 2026
- closed TodoEditorView에서 마감일이 있을 때의 ux를 개선한다 #273
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 풀 리퀘스트는 할 일 편집기 내에서 마감일을 설정하고 관리하는 사용자 경험을 개선하는 데 중점을 둡니다. ViewModel의 기본 로직을 간소화하고, UI에서 마감일의 시각적 표현과 상호 작용을 크게 업그레이드하여 사용자가 마감일을 확인하고, 설정하고, 지우는 것을 더욱 직관적으로 만들었습니다. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 TodoEditorView의 마감일 관련 UI/UX를 개선합니다. 기존의 체크박스 방식 대신, 마감일이 설정되면 날짜가 표시된 태그를 보여주고, 태그를 삭제하여 마감일을 제거할 수 있도록 변경되었습니다. 또한, 마감일이 현재 연도일 경우 연도를 생략하여 표시하는 등 날짜 포맷팅도 개선되었습니다.
전반적으로 좋은 개선이지만, 코드의 유지보수성과 테스트 용이성을 높이기 위한 몇 가지 제안 사항이 있습니다. ViewModel에서 사용되지 않는 것으로 보이는 액션을 정리하고, View의 날짜 포맷팅 함수를 순수 함수로 변경하는 것을 고려해볼 수 있습니다.
| case .toggleDueDate: | ||
| if state.hasDueDate { | ||
| state.dueDate = nil | ||
| } else { | ||
| if state.dueDate == nil { | ||
| state.dueDate = calendar.date(byAdding: .day, value: 1, to: Date()) | ||
| } else { | ||
| state.dueDate = nil | ||
| } |
| private func dueDateText(for dueDate: Date) -> String { | ||
| let currentYear = calendar.component(.year, from: Date()) | ||
| let dueDateYear = calendar.component(.year, from: dueDate) | ||
|
|
||
| if currentYear == dueDateYear { | ||
| return dueDate.formatted( | ||
| .dateTime.month(.defaultDigits).day(.defaultDigits) | ||
| ) | ||
| } | ||
|
|
||
| return dueDate.formatted( | ||
| .dateTime.year(.twoDigits).month(.defaultDigits).day(.defaultDigits) | ||
| ) | ||
| } |
There was a problem hiding this comment.
dueDateText(for:) 함수 내에서 Date()를 직접 호출하면 현재 시간에 의존하게 되어 테스트하기 어려워집니다. 함수를 순수 함수로 만들고 테스트 용이성을 높이기 위해 현재 날짜를 파라미터로 전달하고 기본값으로 Date()를 사용하는 것이 좋습니다.
| private func dueDateText(for dueDate: Date) -> String { | |
| let currentYear = calendar.component(.year, from: Date()) | |
| let dueDateYear = calendar.component(.year, from: dueDate) | |
| if currentYear == dueDateYear { | |
| return dueDate.formatted( | |
| .dateTime.month(.defaultDigits).day(.defaultDigits) | |
| ) | |
| } | |
| return dueDate.formatted( | |
| .dateTime.year(.twoDigits).month(.defaultDigits).day(.defaultDigits) | |
| ) | |
| } | |
| private func dueDateText(for dueDate: Date, now: Date = Date()) -> String { | |
| let currentYear = calendar.component(.year, from: now) | |
| let dueDateYear = calendar.component(.year, from: dueDate) | |
| if currentYear == dueDateYear { | |
| return dueDate.formatted( | |
| .dateTime.month(.defaultDigits).day(.defaultDigits) | |
| ) | |
| } | |
| return dueDate.formatted( | |
| .dateTime.year(.twoDigits).month(.defaultDigits).day(.defaultDigits) | |
| ) | |
| } |