Skip to content

A single-screen weather app written in Swift/SwiftUI that follows a Model-View-ViewModel (MVVM) architecture, which helps maintain separation of concerns and ensures a clean and scalable codebase.

License

Notifications You must be signed in to change notification settings

salvatop/AboutTheWeather

Repository files navigation

CodeQL GitHub Issues Total Commits GitHub commit activity License Contributions welcome

About The Weather

A single-screen weather app written in Swift/SwiftUI that follows a Model-View-ViewModel (MVVM) architecture, which helps maintain separation of concerns and ensures a clean and scalable codebase.

Here's an overview of the architecture

  1. Model:
    API Data Model : Represents the structure of weather data, including properties like temperature, humidity, wind speed, weather conditions, etc. This model is used to decode data from the weather API.

  2. ViewModel:
    WeatherViewModel : Acts as an intermediary between the Model and View layers. Also responsible for making API requests to fetch weather data from the weather service provider OpenWeatherMap and formats it for presentation.

    LocationViewModel: Manages location services, retrieving the user's current location and passing it to the WeatherViewModel for weather data retrieval.

  3. View:
    ContentView : This is the main SwiftUI view that presents the weather information to the user.
    Subcomponents : SwiftUI Views

  4. Service:
    Location Service : Interacts with the device's location services to fetch the user's current location.

  5. Common:
    This contains reauseble tools shared app wise, like extensions, helper functions, etc.

  6. Network:
    Endpoint : url used to call the open weather API, which contains the configuable parameter and the APIKey.
    NetworkManager : network layer with generic functions to make http calls and map data to data models

Usage

Get the API key from and configure it in the endpoint file

enum Endpoint {
    ..
    private var apiKey: String { return "&appid=APIKEY" }
    ..

How the App looks like?

About

A single-screen weather app written in Swift/SwiftUI that follows a Model-View-ViewModel (MVVM) architecture, which helps maintain separation of concerns and ensures a clean and scalable codebase.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages