Skip to content

pugdevgit/WeatherApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeatherApp

A simple SwiftUI app that shows a 7-day weather forecast for a typed location using OpenWeather.

Features

  • Switch temperature units between °C and °F
  • Search by city, address, or place name (geocoded via CoreLocation)
  • Daily forecast list with icon, high/low, precipitation probability, clouds, and humidity
  • Loading state and basic error handling

Tech Stack

  • SwiftUI
  • MVVM (ViewModel-driven rendering)
  • CoreLocation (geocoding)
  • URLSession (networking)
  • SDWebImageSwiftUI (remote weather icons)

Requirements

  • Xcode 15+ (Swift 5.9+)
  • iOS 16+ target (can be adjusted in the project settings)
  • OpenWeather API key

Configuration

This project reads configuration values from Info.plist which are mapped from Config.xcconfig.

  1. Open WeatherApp/Config.xcconfig and set your values:
//MARK: - API Keys
OPEN_WEATHER_MAP_KEY = <your_openweathermap_api_key>
//MARK: - Server URLs
BASE_URL = https://api.openweathermap.org
  1. Ensure Info.plist has the placeholders (already configured in this repo):
  • OPEN_WEATHER_MAP_KEY = $(OPEN_WEATHER_MAP_KEY)
  • BASE_URL = $(BASE_URL)

The app accesses these via Config to build requests.

Build & Run

  • Open WeatherApp.xcodeproj in Xcode
  • Select an iOS Simulator or device
  • Press Run

No extra steps are required; SDWebImageSwiftUI is managed by Xcode (SPM) via the project settings.

Usage

  • Launch the app
  • Enter a location (e.g., "Berlin", "New York", or a full address)
  • Tap the search icon
  • Toggle the unit picker to switch between °C and °F

Notes

  • Forecast data is fetched via OpenWeather One Call API 3.0: /data/3.0/onecall
  • Only daily forecasts are requested (current/minutely/hourly/alerts excluded)
  • Temperature conversion is done from Kelvin to the selected unit in ForecastViewModel

Troubleshooting

  • Empty results or error: verify your API key and network connectivity
  • Geocoding errors: try a more specific location string
  • If icons don't load, check network access and that SDWebImageSwiftUI is properly resolved

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages