Search: persistent recent searches + clear input on pop
Created by: jedmund
Summary
- Adds a
UserDefaults-backedRecentSearchesStorethat keeps the user's last 10 tag submissions, LRU-promoted on repeat, JSON-encoded underrecentSearches.v1. -
SearchViewsurfaces the list below the input whenever the field is empty; suggestions take over the moment any text is typed. No dividers between rows per design. - Tapping a recent row performs the search instantly (no intermediate field-fill).
-
performSearchrecords every submission (including keyboard-submitted raw text) and clearssearchTextpost-push, so popping back from a feed lands on a clean Search screen showing recents.
Test plan
-
Type a query, pick a suggestion → feed pushes; pop back → field is empty, recent appears at the top of the list -
Type raw text, hit return → same behavior; recent with no translation -
Submit the same query twice → one entry, most recent on top -
Submit 11 distinct queries → only the 10 most recent are kept -
Kill the app and relaunch → recents persist -
Start typing → recents hide, suggestions take over -
Clear the field via the X → recents return