Skip to content

naodroid/swiftui_weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftUI + Async Weather

Showing Weather forecast using SwiftUI + Async.

Select a area, and show daily forecasts, using WeatherKit

Highlight of this app

  • SwiftUI.framework
  • Swift6 Support
  • Using LocationButton, which are new APIs in iOS 15.
  • MKMapView with CoreLocation
    • GPS with async/await
    • detect tap and add pin at tap position
  • Adapt dark mode with asset-catalog-colors
  • Use WeatherKit

how to run

  • Install Xcode16.0 or later
  • Build and Run

By default, this app will access local-json file.
If you want to use network-api, please do as following

  • sign in OpenWeather and create Api Key
  • rename Config-sample.plist to Config.plist
  • Write your Api Key in Constants.plist

city_list.json from Openweather is too big (20MB!). So I shrinked it. Please check city_json/

WeatherKit

To run devices, you need to set up your project as follows.

https://developer.apple.com/documentation/weatherkit/fetching_weather_forecasts_with_weatherkit

file structure

  • /
    +- RootView.swift : view at app-launching
    +- Theme.swift : Color list
    +- asset/ : cities and sample json
    +- Actions/ : side-effects
    +- CommonView/ : common views
    +- Utils/
    +- View/

app structure

  • Simplify structure, no view-models
  • Actions/ has complex side-effect operations with @Environment

thanks

  • OpenWeather
  • Many repositories using SwiftUI and authors.

About

SwiftUI + Async/Await Example, using OpenWeather API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published