Search feature design
Design the search screen of a music app: autocomplete while typing, a results list, and recent searches. Focus on how you keep a request from going out on every keystroke.
Design the search screen of a music app: autocomplete while typing, a results list, and recent searches. Focus on how you keep a request from going out on every keystroke.
Debounce input (200 to 300ms) and ignore anything under 2 characters to cut request volume. Autocomplete uses a short-TTL memory cache, recent searches and downloaded content live in a local DB for offline search, and results render in sections (tracks, albums, artists) with a diffable source.
ConcurrencyShort answerBasics
Calling the API on every keystroke in a search field floods it with requests. Can you…
#search #debounce #cancellation
ConcurrencyShort answerAdvanced
You scheduled DispatchQueue.main.asyncAfter(deadline: .now() + 2) { showTooltip() }, and…
#debounce #cancellation
ConcurrencyShort answerBasics
When the search query changes, the previous search's network, decoding, and image work…
#search #cancellation
CS fundamentals and algorithmsShort answerExpert
You need search autocomplete that works offline: 500,000 candidate words, and on every…
#search #autocomplete