WeatherApp is a sleek and intuitive iOS application that provides real-time weather updates for your current location. Built with SwiftUI and leveraging the OpenWeatherMap API, this app offers a seamless user experience with visually appealing graphics and accurate weather data.
- Real-time Weather Data: Get up-to-date weather information for your current location.
- Beautiful UI: Enjoy a clean and modern user interface designed with SwiftUI.
- Location Services: Automatically fetch weather data based on your current location.
- Weather Details: View detailed weather information including temperature, humidity, wind speed, and more.
- Dynamic Backgrounds: Experience visually appealing backgrounds that change based on the weather conditions.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/WeatherApp.git cd WeatherApp
-
Open the project in Xcode:
open WeatherApp.xcodeproj
-
Install dependencies: Ensure you have the necessary dependencies installed. You can use CocoaPods or Swift Package Manager if required.
-
Run the app: Select the target device or simulator and hit the
Run
button in Xcode.
- Launch the app on your iOS device or simulator.
- Allow location access when prompted to get weather updates for your current location.
- View the weather details including temperature, weather conditions, and more.
WeatherApp.swift
: The main entry point of the app.ContentView.swift
: The main view that handles location and weather data fetching.WeatherView.swift
: Displays the weather information.WelcomeView.swift
: Initial view prompting the user to share their location.WeatherManager.swift
: Handles API calls to fetch weather data.ModelData.swift
: Loads preview data for SwiftUI previews.WeatherRow.swift
: A reusable component to display individual weather details.
This app uses the OpenWeatherMap API to fetch real-time weather data. Ensure you have an API key from OpenWeatherMap and replace the placeholder in WeatherManager.swift
with your actual API key.
let url = URL(string: "https://api.openweathermap.org/data/2.5/weather?lat=\(latitude)&lon=\(longtitude)&appid=\("YOUR_API_KEY")&units=metric")
Contributions are welcome! If you have any suggestions or improvements, feel free to create a pull request or open an issue.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- OpenWeatherMap for providing the weather data API.
- SwiftUI for the amazing UI framework.
- CoreLocation for location services.
Thank you for checking out WeatherApp! We hope you find it useful and enjoyable.