diff --git a/package-kuring/Package.resolved b/package-kuring/Package.resolved index 01421e10..b33a34ff 100644 --- a/package-kuring/Package.resolved +++ b/package-kuring/Package.resolved @@ -96,7 +96,7 @@ "location" : "https://github.com/ku-ring/ios-maps", "state" : { "branch" : "main", - "revision" : "d0a83b7c3e6b69d77647001f17f162e1090e9489" + "revision" : "35b3e2d67e4f8b180ba0672df988110c992e6f27" } }, { diff --git a/package-kuring/Sources/Features/SearchFeatures/Search.swift b/package-kuring/Sources/Features/SearchFeatures/Search.swift index 1583c6aa..8ac86d29 100644 --- a/package-kuring/Sources/Features/SearchFeatures/Search.swift +++ b/package-kuring/Sources/Features/SearchFeatures/Search.swift @@ -166,7 +166,11 @@ public struct SearchFeature { // 최근 검색어 추가 if !state.recents.contains(state.searchInfo.text) { // 중복체크 state.recents.append(state.searchInfo.text) - + recentSearch.add(state.searchInfo.text) + } else if let idx = state.recents.firstIndex(where: {$0 == state.searchInfo.text}) { + state.recents.remove(at: idx) + state.recents.append(state.searchInfo.text) + recentSearch.remove(state.searchInfo.text) recentSearch.add(state.searchInfo.text) } diff --git a/package-kuring/Sources/UIKit/SearchUI/SearchView.swift b/package-kuring/Sources/UIKit/SearchUI/SearchView.swift index fbeef015..3b1108d2 100644 --- a/package-kuring/Sources/UIKit/SearchUI/SearchView.swift +++ b/package-kuring/Sources/UIKit/SearchUI/SearchView.swift @@ -85,7 +85,7 @@ public struct SearchView: View { /// 최근 검색어 목록 ScrollView(.horizontal, showsIndicators: false) { LazyHStack { - ForEach(store.recents, id: \.self) { recent in + ForEach(store.recents.reversed(), id: \.self) { recent in HStack(alignment: .center, spacing: 6) { Button { store.send(.recentSearchKeywordTapped(recent))