Skip to content

Instantly share code, notes, and snippets.

@bpisano
Created June 18, 2019 09:43
Show Gist options
  • Select an option

  • Save bpisano/f232e1a1d0379984a3b63d99f7bd54fe to your computer and use it in GitHub Desktop.

Select an option

Save bpisano/f232e1a1d0379984a3b63d99f7bd54fe to your computer and use it in GitHub Desktop.
Embedded code in my Weather article on Medium
import SwiftUI
struct CityView : View {
@ObjectBinding var city = City(name: "Chambéry")
var body: some View {
List {
Section(header: Text("Now")) {
CityHeaderView(city: city)
}
Section(header: Text("Hourly")) {
CityHourlyView(city: city)
}
Section(header: Text("This week")) {
ForEach(city.weather?.week.list ?? []) { day in
CityDailyView(day: day)
}
}
}
.navigationBarTitle(Text(city.name))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment