O'Reilly logo

Swift 2 By Example by Giordano Scalzo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required