Book Image

Swift by Example

By : Giordano Scalzo
Book Image

Swift by Example

By: Giordano Scalzo

Overview of this book

Table of Contents (15 chapters)

Completing the UI

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


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

import LatoFont
import WeatherIconsKit

The former is the font we've already used in the TodoList app; the latter is similar to AwesomeKit, 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(){
        layout(self) { view in
            view.height == 160
        layout(iconLbl) { view in
   == view.superview!.top
            view.left == view.superview!.left + 20
            view.width == 30
            view.width == view.height
        layout(weatherLbl, iconLbl) { view, view2 in