Created
June 18, 2019 09:48
-
-
Save bpisano/deccfc0c70ca862348fe5dff79d0dacf 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
| struct CityHourlyView : View { | |
| @ObjectBinding var city: City | |
| private let rowHeight: CGFloat = 110 | |
| var body: some View { | |
| ScrollView(alwaysBounceHorizontal: true, showsHorizontalIndicator: false) { | |
| HStack(spacing: 16) { | |
| ForEach(city.weather?.hours.list ?? []) { hour in | |
| VStack(spacing: 16) { | |
| Text(hour.time.formattedHour) | |
| .font(.footnote) | |
| hour.icon.image | |
| .font(.body) | |
| Text(hour.temperature.formattedTemperature) | |
| .font(.headline) | |
| } | |
| } | |
| } | |
| .frame(height: rowHeight) | |
| .padding(.trailing) | |
| } | |
| .listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) | |
| .frame(height: rowHeight) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment