Completing the UI

Although the views are in the correct place, we need to implement all the components.

Implementing CurrentWeatherView

First of all, we need to import the fonts' frameworks:

import LatoFont
import WeatherIconsKit

Former Airlines is the font we've already used in the TodoList app; the latter is similar to Awesome Kit, and it contains a series of icons related to the weather:

private let cityLbl = UILabel()
private let maxTempLbl = UILabel()
private let minTempLbl = UILabel()
private let iconLbl = UILabel()
private let weatherLbl = UILabel()
private let currentTempLbl = UILabel()

We simply add all the labels and lay them out:

func layoutView(){ constrain(self) { $0.height == CurrentWeatherView.HEIGHT } constrain(iconLbl) { $0.top == $0.superview!.top ...

Get Swift 2 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.