mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-13 21:40:43 +00:00
add debounce to searchBar
This commit is contained in:
parent
6640a8a4b7
commit
78865f9330
1 changed files with 1 additions and 1 deletions
|
|
@ -325,7 +325,7 @@ struct SearchBar: View {
|
||||||
.onChange(of: text){newValue in
|
.onChange(of: text){newValue in
|
||||||
debounceTimer?.invalidate()
|
debounceTimer?.invalidate()
|
||||||
// Start a new timer to wait before performing the action
|
// Start a new timer to wait before performing the action
|
||||||
debounceTimer = Timer.scheduledTimer(withTimeInterval: 0.25, repeats: false) { _ in
|
debounceTimer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in
|
||||||
// Perform the action after the delay (debouncing)
|
// Perform the action after the delay (debouncing)
|
||||||
onSearchButtonClicked()
|
onSearchButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue