Skip to content

amardeep-thakuria/WeatherApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftUI Weather App

A simple SwiftUI app that displays the current weather and a 3-day forecast for the user's current location. Users can also search for weather information in different cities.

Features

  • Display current weather and 3-day forecast for the user's current location.
  • Search for weather information by city name.
  • MVVM architecture for clean and maintainable code.

Requirements

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/SwiftUIWeatherApp.git
    cd SwiftUIWeatherApp
  2. Open the project in Xcode:

    open SwiftUIWeatherApp.xcodeproj
  3. Add your OpenWeatherMap API key:

    • Open WeatherService.swift.
    • Replace YOUR_API_KEY with your actual OpenWeatherMap API key.
    private let apiKey = "YOUR_API_KEY"
  4. Update Info.plist:

    • Add the following keys to request location permissions:
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>We need your location to provide weather updates.</string>

Architecture

The app follows the MVVM (Model-View-ViewModel) architecture:

  • Model: Defines the data structures (Weather, Forecast, etc.).
  • ViewModel: Manages the data and business logic (WeatherViewModel).
  • View: Displays the data (ContentView).

Project Structure

  • Models: Contains data structures representing the weather data.
  • ViewModels: Contains the logic for fetching and managing weather data.
  • Views: Contains SwiftUI views that present the data.

Usage

  • Run the app on your device or simulator.
  • Allow location access when prompted to get the current weather for your location.
  • Use the search bar to find the weather information for different cities.

Project_preview

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-06-11.at.16.52.13.mp4

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

App is to check the weather of any city.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published