Created
June 18, 2019 09:43
-
-
Save bpisano/f232e1a1d0379984a3b63d99f7bd54fe to your computer and use it in GitHub Desktop.
Embedded code in my Weather article on Medium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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