Files
swift-composable-architectu…/Examples/Search/README.md
Brandon Williams 4ece153d6b Add swift-clocks to TCA (#1547)
* Convert schedulers to clocks.

* wip

* wip

* wip

* wip

* Update 01-GettingStarted-Animations.swift (#1512)

Typo

* bump

* wip

* wip

* fix

* doc fix

* wip

* update

* update

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* update clocks

* wip

* clocks

* wip

* wip

Co-authored-by: Ken Grigsby <kgrigsby@mac.com>
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2022-10-23 22:28:31 -07:00

1.0 KiB

Search

This application demonstrates how to build a moderately complex search feature in the Composable Architecture:

  • Typing into the search field executes an API request to search for locations.
  • Tapping a location runs another API request to fetch the weather for that location, and when a response is received the data is displayed inline in that row.

In addition to those basic features, the following extra things are implemented:

  • Search API requests are debounced so that one is run only after the user stops typing for 300ms.
  • If you tap a location while a weather API request is already in-flight it will cancel that request and start a new one.
  • Dependencies and side effects are fully controlled. The reducer that runs this application needs a weather API client to run effects.
  • A full test suite is implemented. Not only is core functionality tested, but also failure flows and subtle edge cases (e.g. clearing the search query cancels any in-flight search requests).