Daily iOS
SwiftUI

Search tab design

This is a take-home assignment. Build the App Store "Search" tab in SwiftUI using the iTunes Search API. You need recent search terms (stored locally), a results list, and a result detail screen, and third-party libraries are not allowed. To finish in 4 to 8 hours with "concise code and a simple structure," how do you design the screen state and the search request handling (cancellation while typing, duplicates)?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Keep the screen state in a single enum (idle, recent, searching, results, empty, error), and run the search with .searchable plus .task(id: query) so the previous request is canceled automatically and a late response can't overwrite the latest results.

Share a question