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

Implementing the UI

A UI that is as complicated as the one required can be really difficult to implement if we don't take the correct precautions.

A good way to minimize the complexity is to split the problem into more manageable sub-problems, so we'll define three sub-views: CurrentWeatherView, HourlyForecastView, and DailyForecastView. We'll implement them as separate entities. The following screenshot shows the view's structure:

Implementing the UI

The UI in blocks

As we just said, we implement the UI by creating three custom views, whose size and position we are temporarily hardcoding.

Let's start with CurrentWeatherView, adding it to PrettyWeatherViewController:

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