From 7d1fc1116a9227d0efc2145783a063f89c8ee5e1 Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Fri, 26 Jun 2026 12:18:50 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20SearchView=20=EC=9E=90=EB=8F=99=20?= =?UTF-8?q?=ED=8F=AC=EC=BB=A4=EC=8A=A4=20=ED=83=80=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EB=B3=B5=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DevLogPresentation/Sources/Search/SearchView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Application/DevLogPresentation/Sources/Search/SearchView.swift b/Application/DevLogPresentation/Sources/Search/SearchView.swift index 4511d392..bbed1a54 100644 --- a/Application/DevLogPresentation/Sources/Search/SearchView.swift +++ b/Application/DevLogPresentation/Sources/Search/SearchView.swift @@ -41,7 +41,11 @@ struct SearchView: View { } } } - .onAppear { store.send(.binding(.set(\.isSearching, true))) } + .onAppear { + DispatchQueue.main.async { + store.send(.binding(.set(\.isSearching, true))) + } + } .onChange(of: store.isSearching) { _, isSearching in if !isSearching { dismiss() From 6b14090a69f98d1ed9408607b425d3eb3ea9d3be Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Fri, 26 Jun 2026 12:38:20 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20SearchView=20=ED=8F=AC=EC=BB=A4?= =?UTF-8?q?=EC=8A=A4=20=EC=9A=94=EC=B2=AD=EC=9D=84=20Feature=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Search/SearchFeature.swift | 6 ++++++ .../DevLogPresentation/Sources/Search/SearchView.swift | 6 +----- .../Tests/Search/SearchFeatureTestDoubles.swift | 7 +++++++ .../Tests/Search/SearchFeatureTests.swift | 9 +++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Application/DevLogPresentation/Sources/Search/SearchFeature.swift b/Application/DevLogPresentation/Sources/Search/SearchFeature.swift index 1cbbc1af..85a7d2b3 100644 --- a/Application/DevLogPresentation/Sources/Search/SearchFeature.swift +++ b/Application/DevLogPresentation/Sources/Search/SearchFeature.swift @@ -64,6 +64,7 @@ struct SearchFeature { } enum Action: BindableAction, Equatable { + case onAppear case alert(PresentationAction) case binding(BindingAction) case addRecentQuery(String) @@ -102,6 +103,11 @@ struct SearchFeature { BindingReducer() Reduce { state, action in switch action { + case .onAppear: + return .run { send in + await Task.yield() + await send(.binding(.set(\.isSearching, true))) + } case .alert: break case .binding(\.isSearching): diff --git a/Application/DevLogPresentation/Sources/Search/SearchView.swift b/Application/DevLogPresentation/Sources/Search/SearchView.swift index bbed1a54..9aafa79d 100644 --- a/Application/DevLogPresentation/Sources/Search/SearchView.swift +++ b/Application/DevLogPresentation/Sources/Search/SearchView.swift @@ -41,11 +41,7 @@ struct SearchView: View { } } } - .onAppear { - DispatchQueue.main.async { - store.send(.binding(.set(\.isSearching, true))) - } - } + .onAppear { store.send(.onAppear) } .onChange(of: store.isSearching) { _, isSearching in if !isSearching { dismiss() diff --git a/Application/DevLogPresentation/Tests/Search/SearchFeatureTestDoubles.swift b/Application/DevLogPresentation/Tests/Search/SearchFeatureTestDoubles.swift index 6bd8dec0..6853a8c8 100644 --- a/Application/DevLogPresentation/Tests/Search/SearchFeatureTestDoubles.swift +++ b/Application/DevLogPresentation/Tests/Search/SearchFeatureTestDoubles.swift @@ -82,6 +82,13 @@ struct SearchStoreTestAdapter { } } + func onAppear() async { + await store.send(.onAppear) + await store.receive(.binding(.set(\.isSearching, true))) { + $0.isSearching = true + } + } + func setShowAllTodos(_ value: Bool) async { await store.send(.setShowAllTodos(value)) { $0.showAllTodos = value diff --git a/Application/DevLogPresentation/Tests/Search/SearchFeatureTests.swift b/Application/DevLogPresentation/Tests/Search/SearchFeatureTests.swift index 72caa2ef..6674eaef 100644 --- a/Application/DevLogPresentation/Tests/Search/SearchFeatureTests.swift +++ b/Application/DevLogPresentation/Tests/Search/SearchFeatureTests.swift @@ -21,6 +21,15 @@ struct SearchFeatureTests { #expect(adapter.recentQueries == ["swift", "tca"]) } + @Test("onAppear는 검색 상태를 활성화한다") + func onAppear는_검색_상태를_활성화한다() async { + let adapter = SearchStoreTestAdapter() + + await adapter.onAppear() + + #expect(adapter.isSearching) + } + @Test("addRecentQuery는 공백을 제거하고 중복 제거 후 앞에 추가한다") func addRecentQuery는_공백을_제거하고_중복_제거_후_앞에_추가한다() async { let updateSpy = SearchUpdateRecentQueriesUseCaseSpy() From 21f057cad2c278b686bf83ca4d501ed801d98977 Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Fri, 26 Jun 2026 13:43:29 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20SearchView=20=ED=8F=AC=EC=BB=A4?= =?UTF-8?q?=EC=8A=A4=20=EC=A7=80=EC=97=B0=20=EC=B2=98=EB=A6=AC=20=EB=AA=85?= =?UTF-8?q?=ED=99=95=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DevLogPresentation/Sources/Search/SearchFeature.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Application/DevLogPresentation/Sources/Search/SearchFeature.swift b/Application/DevLogPresentation/Sources/Search/SearchFeature.swift index 85a7d2b3..a8517724 100644 --- a/Application/DevLogPresentation/Sources/Search/SearchFeature.swift +++ b/Application/DevLogPresentation/Sources/Search/SearchFeature.swift @@ -105,7 +105,10 @@ struct SearchFeature { switch action { case .onAppear: return .run { send in - await Task.yield() + // `.searchable` 바인딩이 화면에 붙은 뒤 포커스를 요청하도록 main queue 다음 턴으로 넘긴다. + await withCheckedContinuation { continuation in + DispatchQueue.main.async { continuation.resume() } + } await send(.binding(.set(\.isSearching, true))) } case .alert: