A clean, modular iOS weather application that allows users to search for locations and view current weather conditions using multiple weather service providers.
- 🔍 Search & Add Locations: Search for cities and save them to track weather conditions
- 🔄 Multiple Weather Providers: Toggle between Apple Weather and Pirate Weather services
- 🛡️ Automatic Fallback System: If one weather provider fails, the app automatically tries alternative providers
- 🧩 Modular Architecture: Service providers can be easily swapped or extended
- 🎨 Adaptive UI: Visual styling adapts based on the selected weather provider
- 🔒 Input Validation: Validation for location searches and coordinate handling
- 💾 Persistent Storage: SwiftData integration for saving location preferences
- ✅ Comprehensive Testing: Unit and UI tests for data reliability and feature verification via Swift Testing
The app follows a clean architecture approach with:
- MVVM Pattern: Separation of UI (Views) from business logic (ViewModels)
- Protocol-Based Services: Weather and location services defined through protocols
- Factory Pattern: Easy creation and switching between weather service providers
- Composite Pattern: Fallback service implementation that chains multiple providers
- SwiftData: Modern persistence framework for storing location data
- 🍎 Apple Weather: Uses WeatherKit for official Apple weather data
- 🏴☠️ Pirate Weather: Uses the Pirate Weather API as an alternative source
- 🔄 Fallback System: Automatically tries alternative providers if the primary one fails
- iOS 17.0+
- Xcode 15.0+
- Swift 5.9+
- Apple Developer account (for WeatherKit)
- Pirate Weather API key (for Pirate Weather provider)
- Clone the repository
- Open the project in Xcode 15.0+
- Build and run on a device or simulator running iOS 17.0+
- Sign in to your Apple Developer account in Xcode
- Enable WeatherKit capability in your app target:
- Select your app target in Xcode
- Go to the "Signing & Capabilities" tab
- Click "+ Capability" and add "WeatherKit"
- Complete WeatherKit activation in App Store Connect:
- Log in to App Store Connect
- Navigate to your app
- Under "App Services", enable WeatherKit
- Accept the WeatherKit terms and conditions
- Get a Pirate Weather API key from pirateweather.net
- Add your API key to the project using one of these methods:
- Set
PIRATE_WEATHER_API_KEYin your environment variables - Add it to your
Info.plistunder the keyPirateWeatherAPIKey - Create a Constants.swift file with your API key (make sure to add this to .gitignore)
- Set
The app includes:
- Unit tests for service implementations and data models
- Specific tests for the fallback mechanism between weather providers
- UI tests for core user interactions
Run tests using Cmd+U or through the Test navigator in Xcode.
- Factory Pattern: Makes it easy to add new weather service providers
- Protocol-Based Services: Ensures a consistent interface regardless of the provider
- Fallback System: Improves reliability by automatically using alternative providers when needed
- SwiftData: Modern, type-safe persistence with minimal boilerplate code
- Adaptive UI: Different color schemes and icons based on the selected provider
This project is available under the MIT license.
Christian Skorobogatow - GitHub Profile
