AtmosWeather is a simple weather app built with SwiftUI that showcases various Swift techniques for fetching and displaying weather data from the OpenWeatherMap API.
- Clean and Minimalist UI: Easily view the current temperature for any city.
- Asynchronous Networking with
async/await
: Leverages Swift's modern concurrency features for seamless data fetching. - Structured Error Handling: Uses
try/catch
blocks for robust error management and user feedback. - Custom Structs and Enums: Encapsulates data and functionality for improved code organization.
- JSON Decoding: Parses API responses into Swift structures for easy manipulation.
- API Key Management: Securely stores and accesses API keys for external services.
- Temperature Conversion: Converts temperature units with a custom
MeasurementFormatter
extension. - URL Construction: Employs an enum (
APIEndpoint
) for building flexible and maintainable API URLs.
- Clone this repository:
git clone https://github.com/your-username/AtmosWeather.git
- Open the project in Xcode.
- Obtain an API key from OpenWeatherMap (https://openweathermap.org/appid) and replace the placeholder value (
xxxxx
) inKeyConstant.swift
with your actual API key. - Build and run the app in the simulator or on a device.
- Type the name of a city in the text field and press Enter or tap the "Go" button.
- The app will fetch the current temperature for that city and display it.