A weather app built with SwiftUI, MVVM architecture, SwiftData persistence, and WeatherAPI.
- Dynamic background based on time of day
- Morning (5AM – 6PM): sky blue → golden gradient + black font
- Evening (6PM – 5AM): deep navy → dusk purple + white font
- Current location name, temperature, condition, H/L temps
- Real weather icon from WeatherAPI
- 3-Day Forecast list → tap any day to see hourly breakdown
- Stats grid: Visibility, Humidity, Feels Like, Pressure
- Opens when tapping a forecast day
- Today → starts from current hour with "Now" label
- Tomorrow / Day after → shows all 24 hours from midnight
- Search any city globally with live suggestions
- Save cities to a persistent list via SwiftData
- Each saved card shows live weather (temp + icon + condition)
- Long press → Delete with confirmation alert
- Tap any city → opens full weather detail
- App launches → Splash screen
- Requests location permission automatically
- If approved → fetch real GPS coordinates
- Fetch weather data from WeatherAPI using coordinates
- Display Today Screen with current weather details
- User can:
- Search any city globally
- Save locations using SwiftData
- View hourly forecast for selected days
- Delete saved locations
File → New → File → Configuration Settings File → Secrets.xcconfig
WEATHER_API_KEY = your_actual_api_key_here
Key: WEATHER_API_KEY
Value: $(WEATHER_API_KEY)
private let apiKey: String = {
Bundle.main.object(forInfoDictionaryKey: "WEATHER_API_KEY") as? String ?? ""
}()Secrets.xcconfig
Get your free API key at weatherapi.com
One persistent model:
@Model
final class SavedLocation {
var id: UUID
var name: String
var country: String
var lat: Double
var lon: Double
var addedAt: Date
}- Stored locally on device
- Sorted by
addedAtdescending (newest first) - Duplicate prevention using coordinate comparison (±0.001°)
- Delete via long press → context menu → confirmation alert
- Requests
WhenInUsepermission on launch - Shows permission dialog automatically
- Approved → uses real GPS coordinates
- Denied → shows permission denied screen with Open Settings button
- GPS error → shows error state
Add to Info.plist:
Key: Privacy - Location When In Use Usage Description
Value: SkySays needs your location to show local weather
- Xcode 15+
- iOS 17+
- Swift 5.9+
- WeatherAPI free account
- Clone / open project in Xcode
- Create
Secrets.xcconfigwith your API key (see above) - Add Location permission to
Info.plist - Run on Simulator or real device (iOS 17+)