Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save bpisano/1c34e61f91ef24f05126726723d03496 to your computer and use it in GitHub Desktop.
Embedded code in my Weather article on Medium
struct CityHeaderView: View {
@ObjectBinding var city: City
var temperature: String {
guard let temperature = city.weather?.current.temperature else {
return "-ºC"
}
return temperature.formattedTemperature
}
var body: some View {
HStack(alignment: .center) {
Spacer()
HStack(alignment: .center, spacing: 16) {
city.weather?.current.icon.image
.font(.largeTitle)
Text(temperature)
.font(.largeTitle)
}
Spacer()
}
.frame(height: 110)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment