Skip to content

[#166] TodoListView에서 searchable을 버튼화하고 검색 로직을 구현한다#170

Merged
opficdev merged 6 commits intodevelopfrom
feat/#166-TodoListView-search
Mar 3, 2026
Merged

[#166] TodoListView에서 searchable을 버튼화하고 검색 로직을 구현한다#170
opficdev merged 6 commits intodevelopfrom
feat/#166-TodoListView-search

Conversation

@opficdev
Copy link
Copy Markdown
Owner

@opficdev opficdev commented Mar 3, 2026

@opficdev opficdev self-assigned this Mar 3, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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!

이 Pull Request는 TodoListView에 포괄적인 검색 기능을 도입합니다. 표준 목록 뷰와 새로운 검색 인터페이스 사이를 전환할 수 있도록 UI를 리팩토링했으며, 검색 바와 검색 결과의 동적 표시를 포함합니다. 기본 뷰 모델은 검색 상태를 처리하고, 디바운스된 검색 쿼리를 구현하며, FetchTodosUseCase에서 결과를 가져오도록 업데이트되었습니다. 이 개선 사항은 할 일 목록 내에서 효율적인 검색을 가능하게 하여 사용자 경험을 크게 향상시킵니다.

Highlights

  • 검색 기능 구현: TodoListView에 검색 기능을 추가했습니다. 여기에는 검색 바, 검색 로직, 검색 결과 표시가 포함됩니다.
  • TodoScope 제거: 검색 기준(제목, 내용)을 정의했던 TodoScope 열거형이 제거되었습니다. 이는 검색이 이제 두 가지 모두를 포함하거나 다른 메커니즘을 사용함을 의미합니다.
  • 검색을 위한 UI/UX 변경: TodoListView는 이제 일반 할 일 목록 또는 전용 검색 콘텐츠 뷰를 조건부로 렌더링합니다. 검색 모드를 트리거하기 위해 툴바에 돋보기 버튼이 추가되었습니다.
  • 디바운스 검색 로직: TodoListViewModel에 디바운스 검색 기능이 추가되어 입력 시 과도한 API 호출을 방지합니다.
Changelog
  • DevLog/Presentation/Enum/TodoScope.swift
    • TodoScope 열거형이 제거되었습니다.
  • DevLog/Presentation/ViewModel/TodoListViewModel.swift
    • State에 searchResults, isSearching, showAllSearchResults 속성이 추가되었습니다.
    • setIsSearching, setShowAllSearchResults, setSearchQuery, fetchSearchResults 액션이 추가되었습니다.
    • State에서 setScope 액션과 scope 속성이 제거되었습니다.
    • 검색 결과를 가져오기 위한 search 사이드 이펙트가 도입되었습니다.
    • 검색 쿼리 디바운싱을 위해 searchDebounceDelay 및 searchDebounceTask가 추가되었습니다.
    • scheduleDebouncedQuery 및 cancelDebounce 메서드가 구현되었습니다.
    • 새로운 검색 액션 및 이펙트를 처리하도록 reduceByUser, reduceByView, reduceByRun이 업데이트되었습니다.
    • searchResultsLimit 상수가 추가되었습니다.
  • DevLog/Resource/Localizable.xcstrings
    • TodoScope.content 및 TodoScope.title 키가 오래된 것으로 표시되었습니다.
    • "검색어를 입력해주세요."에 대한 새로운 지역화 키가 추가되었습니다.
  • DevLog/UI/Home/TodoListView.swift
    • body가 todoSearchContent 또는 todoListContent를 조건부로 표시하도록 리팩토링되었습니다.
    • 기존 목록 뷰 로직이 todoListContent private 변수로 이동되었습니다.
    • 검색 바, 검색 결과 표시 및 "더보기" 기능을 포함하는 새로운 todoSearchContent private 변수가 추가되었습니다.
    • 검색 모드를 활성화하기 위해 툴바에 돋보기 버튼이 추가되었습니다.
    • searchScopes 수정자가 제거되었습니다.
    • iOS 17.0 이상에서 isPresented를 사용하도록 searchable 수정자가 업데이트되었습니다.
Activity
  • 이 PR은 이슈 #166을 해결합니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

안녕하세요. 이번 PR은 TodoListView의 검색 기능을 개선하여, 기존의 searchable을 버튼으로 대체하고 검색 로직을 구현하는 내용이네요. 전체적인 리팩토링 방향이 좋고, 상태 관리를 ViewModel로 옮겨 잘 분리한 점이 인상적입니다. 몇 가지 수정이 필요한 부분을 코드 리뷰에 남겼습니다. 주요 내용은 다음과 같습니다:

  • 검색어 입력 후 모두 지웠을 때 로딩 상태가 초기화되지 않는 버그 수정
  • ToolbarSpacer의 iOS 가용성 버전 체크 오류 수정
  • iOS 17 미만 버전에서 검색 취소 시 화면이 정상적으로 전환되지 않는 문제 해결 제안
  • 불필요해 보이는 .onAppear 코드에 대한 검토 요청

수고 많으셨습니다!

Comment thread DevLog/Presentation/ViewModel/TodoListViewModel.swift
Image(systemName: "plus")
}
}
if #available(iOS 26.0, *) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

iOS 버전 체크가 26.0으로 되어있습니다. ToolbarSpacer는 iOS 16.0에서 도입되었으므로 16.0으로 수정해야 합니다.

Suggested change
if #available(iOS 26.0, *) {
if #available(iOS 16.0, *) {

Comment on lines +221 to +227
} else {
content.searchable(
text: searchTextBinding,
placement: .navigationBarDrawer(displayMode: .always),
prompt: "\(viewModel.state.kind.localizedName) 검색"
)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

iOS 17 미만 버전에서는 .searchableisPresented 파라미터를 사용할 수 없어 사용자가 검색을 취소했을 때 isSearching 상태가 false로 변경되지 않는 문제가 있습니다. 이로 인해 사용자는 검색 화면에서 벗어날 수 없습니다.

이 문제를 해결하려면 @Environment(\.isSearching)을 사용하여 검색 UI의 활성 상태를 감지해야 합니다.

  1. TodoListView@Environment(\.isSearching) private var isSearchingInEnvironment 프로퍼티를 추가합니다.
  2. todoSearchContentsearchable 수정자 아래에 .onChange(of: isSearchingInEnvironment)를 추가하여, isSearchingInEnvironmentfalse가 될 때 viewModel.send(.setIsSearching(false))를 호출하도록 구현해야 합니다.

예시:

.onChange(of: isSearchingInEnvironment) { isSearching in
    if !isSearching, viewModel.state.isSearching {
        viewModel.send(.setIsSearching(false))
    }
}

이 수정은 iOS 17 이상에서도 중복 호출을 방지하며 안전하게 동작할 것입니다.

Comment on lines +229 to 233
.onAppear {
DispatchQueue.main.async {
viewModel.send(.setIsSearching(true))
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

todoSearchContent 뷰는 viewModel.state.isSearchingtrue일 때만 나타납니다. 따라서 .onAppear에서 다시 setIsSearching(true)를 호출하는 것은 불필요합니다. 이 코드는 중복 호출을 유발하며, 제거하는 것이 좋아 보입니다. 만약 특정 문제를 해결하기 위해 추가된 코드라면, 주석으로 그 이유를 설명하는 것이 좋겠습니다.

@opficdev opficdev merged commit 56f71da into develop Mar 3, 2026
1 check passed
@opficdev opficdev deleted the feat/#166-TodoListView-search branch March 3, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TodoListView에서 searchable을 버튼화하고 검색 로직을 구현한다

1 participant