Skip to content

Conversation

@ji-yeon224
Copy link
Collaborator

@ji-yeon224 ji-yeon224 commented Jan 23, 2026

#️⃣ Issue Number

🔎 작업 내용

검색 상태 및 액션 분리

  • 검색 관련 state와 action을 MapSearchFeature로 이동
  • MapSearchFeature를 MapFeature의 하위로 등록

검색 관련 네비게이션 로직 개선

지도 -> 검색 -> 꽃길 -> 디테일
지도 -> 검색 -> 리전 리스트 -> 디테일

이 두 케이스에 따라 SearchBar의 backbutton 탭 시 화면 이동 처리 과정이 필요
기존에는 상세 화면을 어디에서 들어왔는지에 따라 나눴는데, 코드 가독성이 좋지않았음.
현재 화면이 어디인지를 나타내는 enum을 보다 명확하게 정의하여 개선함.

public enum NavigationState: Equatable {
    case map                                    // 기본 지도 화면
    case regionList(RegionInfoEntity)          // 리전 검색 결과 리스트
    case flowerDetail(DetailSource)    // 꽃 상세 화면
    
    public enum DetailSource: Equatable {
      case fromSearch(FlowerSpotEntity)         // 검색에서 온 상세
      case fromRegionList(RegionInfoEntity)     // 리전리스트에서 온 상세
    }
  }

📷 스크린샷

🛠️ 기타 공유 내용

Summary by CodeRabbit

  • Refactor
    • Reorganized search functionality architecture for improved maintainability and feature scalability.

✏️ Tip: You can customize this high-level summary in your review settings.

- MapFeature에 mapSearch 의존성 주입 추가
- MapSearchFeature Action과 State를 MapFeature에 통합
- PIDAFeature에서 mapSearchReducer 생성 및 연결
- 지도 검색 기능을 위한 아키텍처 리팩토링
MapFeature의 검색 관련 기능을 하위 리듀서인 MapSearchFeature로 리팩토링:
- 검색 상태(searchResult, searchText)를 MapSearchFeature.State로 이동
- 검색 액션들(setSearchBarText, resetSearchBar 등)을 MapSearchFeature로 이동
- Delegate 패턴을 통해 MapFeature와 MapSearchFeature 간 통신
- 기존 기능 유지하면서 관심사 분리 및 모듈화 개선
검색 관련 모든 상태와 액션을 MapSearchFeature로 이동하여 관심사 분리:
- detailRoot, regionResult, isShowRegionList, regionSheetDetent 상태 이동
- showRegionList, changeRegionSheetDetent, searchBackButtonTapped 등 액션 이동
- 검색 백 네비게이션 로직 MapSearchFeature에서 처리
- MapView 바인딩 경로를 mapSearch로 수정
- DetailRoot enum도 MapSearchFeature로 이동하여 독립성 확보
복잡한 DetailRoot 기반 네비게이션을 명확한 NavigationState로 리팩토링:
- DetailRoot enum을 NavigationState로 교체하여 가독성 향상
- DetailSource로 상세화면 진입 경로를 명확히 구분
- handleSearchBackNavigation 로직을 switch 패턴으로 단순화
- setNavigationFromRegionList 액션 추가로 관심사 분리 강화
- 네비게이션 상태 관리가 MapSearchFeature에 집중되어 일관성 확보
@ji-yeon224 ji-yeon224 requested a review from usa4060 January 23, 2026 13:08
@ji-yeon224 ji-yeon224 self-assigned this Jan 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

This PR extracts search-related state, actions, and reducer logic from MapFeature into a dedicated MapSearchFeature module, establishing a new nested reducer architecture. The changes update MapView to reference the mapSearch namespace and wire the new reducer composition throughout the feature hierarchy, including PIDAFeature.

Changes

Cohort / File(s) Summary
MapFeatureInterface State/Action Restructuring
Projects/Feature/Map/MapFeatureInterface/Sources/MapFeature/MapFeature.swift, Projects/Feature/Map/MapFeatureInterface/Sources/MapFeature/SubFeature/MapSearchFeature.swift
Adds mapSearch reducer property and state to MapFeature; removes search-related properties (searchResult, searchText, detailRoot, regionResult, isShowRegionList, regionSheetDetent) and action cases; introduces DetailRoot enum removal; MapSearchFeature gains multiple new state fields and action/delegate cases including navigation state machine with NavigationState and DetailSource enums
MapFeature Implementation Reducer
Projects/Feature/Map/MapFeature/Sources/MapFeature/MapFeature.swift
Wires mapSearch dependency into initializer; delegates search-related action handling (markerTapped, showSearchResult, showSearchRegionList) to MapSearch via delegation paths instead of direct state mutation
MapSearchFeature Reducer Logic
Projects/Feature/Map/MapFeature/Sources/MapFeature/SubFeature/MapSearchFeature.swift
Implements comprehensive action handlers for new cases including setSearchBarText, showSearchResult, showRegionList, hideRegionList, searchBackButtonTapped, and complex handleSearchBackNavigation with multi-path navigation routing based on current state (search → detail, region list context switching)
MapView UI Binding Updates
Projects/Feature/Map/MapFeatureInterface/Sources/MapView/MapView.swift
Updates all store references to use mapSearch namespace: focusDatastore.mapSearch.searchResult, region list visibility → store.mapSearch.isShowRegionList, search text → store.mapSearch.searchText; redirects action routing to .mapSearch(...) cases
Composition & Configuration
Projects/Feature/Map/Project.swift, Projects/PIDA/Sources/PIDAFeature.swift
Adds .Client.Search dependency; introduces mapSearchReducer instance and wires it into MapFeature composition; updates action dispatching for search results to route through mapSearch namespace

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~23 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • usa4060

Poem

🐰 A search feature hops from map to its own nest,
Nested reducers dancing, each handling its quest,
Navigation states bloom like clover so bright,
MapSearch takes the stage—architecture takes flight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main refactoring objective: separating search-related logic from MapFeature into a dedicated MapSearchFeature subcomponent.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@Projects/Feature/Map/MapFeatureInterface/Sources/MapView/MapView.swift`:
- Around line 224-228: The regionListSheet function is shadowing the outer Map
feature store: its parameter is typed StoreOf<SearchRegionListFeature> but the
bindings use $store.mapSearch which belong to the MapFeature store; rename the
parameter (e.g., to regionListStore) and change the bindings to use the outer
MapFeature store (the MapFeature Store property used elsewhere in this file) for
isPresented and detent (instead of $store.mapSearch...), so regionListSheet
keeps a correctly typed StoreOf<SearchRegionListFeature> parameter while binding
presentation state to the MapFeature store.

Comment on lines 224 to +228
private func regionListSheet(store: StoreOf<SearchRegionListFeature>) -> some View {
DetentBottomSheet(isPresented: $store.isShowRegionList, detent: $store.regionSheetDetent) {
DetentBottomSheet(
isPresented: $store.mapSearch.isShowRegionList,
detent: $store.mapSearch.regionSheetDetent
) {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix regionListSheet bindings to avoid Store shadowing.

store here is StoreOf<SearchRegionListFeature>, so $store.mapSearch... doesn’t exist and will fail to compile. Use the MapFeature store for the bindings and rename the parameter to avoid shadowing.

🐛 Proposed fix
-private func regionListSheet(store: StoreOf<SearchRegionListFeature>) -> some View {
-  DetentBottomSheet(
-    isPresented: $store.mapSearch.isShowRegionList,
-    detent: $store.mapSearch.regionSheetDetent
-  ) {
-    SearchRegionListView(store: store)
-  }
-}
+private func regionListSheet(store regionStore: StoreOf<SearchRegionListFeature>) -> some View {
+  DetentBottomSheet(
+    isPresented: $store.mapSearch.isShowRegionList,
+    detent: $store.mapSearch.regionSheetDetent
+  ) {
+    SearchRegionListView(store: regionStore)
+  }
+}
🤖 Prompt for AI Agents
In `@Projects/Feature/Map/MapFeatureInterface/Sources/MapView/MapView.swift`
around lines 224 - 228, The regionListSheet function is shadowing the outer Map
feature store: its parameter is typed StoreOf<SearchRegionListFeature> but the
bindings use $store.mapSearch which belong to the MapFeature store; rename the
parameter (e.g., to regionListStore) and change the bindings to use the outer
MapFeature store (the MapFeature Store property used elsewhere in this file) for
isPresented and detent (instead of $store.mapSearch...), so regionListSheet
keeps a correctly typed StoreOf<SearchRegionListFeature> parameter while binding
presentation state to the MapFeature store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants