Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save bpisano/deccfc0c70ca862348fe5dff79d0dacf to your computer and use it in GitHub Desktop.
Embedded code in my Weather article on Medium
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