Skip to content

Small iOS app made using Clean Architecture and with tests

Notifications You must be signed in to change notification settings

oliveira-marcio/WeatherApp

Repository files navigation

WeatherApp

Weather App for iOS - Small iOS app made with Swift and UIKit, based on Clean Architecture, and using Weatherstack API.

Features

  • Fetches current weather for a location using a query search
  • Keeps history of recent search terms for quick search
  • UI in plain UIKit (no Storyboards 🎉)
  • Structured concurrency with async/await and actors
  • Extra Mock target to run the app with mocked data (more details below)
  • Ready for localization
  • Dark mode
  • Tests:
    • Unit tests
    • Component tests (basically presenter tests with real domain dependencies, except for the gateways, views, and routers)
    • UI tests
  • Based on architectures like VIPER and Clean Swift, with the following layers
    • Domain (Use cases, a.k.a, interactors)
    • Data (Gateways for API and DB)
    • Presentation (Presenter, Views, ViewModels, and Router, using an MVP approach)

Things to improve

  • Should implement a real DB with CoreData for persisting the recent search terms (currently using an in-memory DB)
  • Project should be modularized in packages with no code related to iOS (Domain, Data and Presentation), so unit tests can run in a MacOS target without simulators
  • UI with SwiftUI, so we'll have live preview and less boilerplate

Run App

API keys must be added on a new file: /WeatherApp/WeatherApp/Configuration/Secrets.xcconfig

  weather_api_api_key = xxxxxxxxxxxxxxxxxx

Note: You can also try the app with mocked data without using the API. Just place any value in the file above and run the app with the Mock target (check the session below)

Run Mock

App can run with mocked gateways so canned answers will be provided by those gateways. Select the target Mock and run the app

You can choose some presets to run the mocked app accordingly to /WeatherApp/WeatherApp/System/LaunchEnvironmentKey.swift

Just edit the Mock Scheme and enable the desired environment as the image below:

Environment

Run tests

  • ./run_tests.sh
  • ./run_ui_tests.sh

Note: Maybe you'll want to edit the target simulator in those files above with the one available in your machine.

Screenshots

Main screen in light mode

Main screen in dark mode

About

Small iOS app made using Clean Architecture and with tests

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published