Created
June 18, 2019 09:47
-
-
Save bpisano/1c34e61f91ef24f05126726723d03496 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 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