Skip to content

Commit 8f337f6

Browse files
authored
[#97] ios 17 이상일 때 searchable의 포커싱이 안되는 문제 해결 (#110)
* style: 코드 인덴트 정리 * fix: 간헐적으로 자동 포커싱이 되지 않는 현상 해결
1 parent b05b559 commit 8f337f6

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

DevLog/UI/Search/SearchView.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ struct SearchView: View {
3636
}
3737
}
3838
.onAppear {
39-
viewModel.send(.setSearching(true))
39+
DispatchQueue.main.async {
40+
viewModel.send(.setSearching(true))
41+
}
4042
}
4143
.onChange(of: viewModel.state.isSearching) { isSearching in
4244
if !isSearching {
@@ -53,7 +55,6 @@ struct SearchView: View {
5355
}
5456
// TODO: iOS 16에서 introspect 모듈을 사용하여 .searchable의 isPresented를 관리한다
5557
// .introspect(.searchField, on: iOS(.v16)) { searchBar in }
56-
5758
}
5859
}
5960

@@ -96,12 +97,11 @@ struct SearchView: View {
9697
prompt: "검색"
9798
)
9899
} else {
99-
scrollContent
100-
.searchable(
101-
text: searchQueryBinding,
102-
placement: .navigationBarDrawer(displayMode: .always),
103-
prompt: "검색"
104-
)
100+
scrollContent.searchable(
101+
text: searchQueryBinding,
102+
placement: .navigationBarDrawer(displayMode: .always),
103+
prompt: "검색"
104+
)
105105
}
106106
}
107107
.onSubmit(of: .search) {

0 commit comments

Comments
 (0)