A simple app that checks the weather and current conditions using Swift Composable Architecture.
The library takes ideas from Facebook's Redux and Elm, using unidirectional flow --and particularly a reducer object-- to process all state changes. These state changes then get emitted/propogated back to the view via an observation regime. This library makes presentation layer state changes (which are all contained inside an Equatable
struct) and associated side-effects very testable and declarative. SCA also works very well with SwiftUI and Combine, the foundations of new UI for iOS 13.
Unit Tests
- Tests for its integration with the weather API, including test fixtures which test proper parsing
- Tests for properly parsing the query the user types into the user interface
- Tests for transforming querys into API queries and URLs
- Tests for Kelvin to Farenheieght text conversions
- Tests for app state equality
- Tests for app reducer level state changes including errors
UI Tests
- Several UI tests to integration test the application
Built with Xcode 11.6
iOS 13, due to the use of SwiftUI.
The app uses the free API from openweathermap.org to pull weather details. A sample API key is committed. Under normal circumstances this key would likely be hosted by a private API server.
Views are built using Swift UI. As a consequence we are sort of forced into using Swift Combine here and there. I've minimized usage of its more complex operators to keep things easy to understand and easy to extend.