Showing weather details

A very small part of the app is left now. Let's show some more details to the user. Along with this, we will also learn a few more features of Kotlin. We have created a showDetailedForecast function that takes the City and Forecast objects as parameters. The following code snippets provide two things to learn:

    fun showDetailedForecast(city: City, forecast: Forecast) {      val root = document.getElementById("container")      val weatherDetailDiv = document.create.div(classes =        "detailsContainer")      val basicDetailDiv = document.create.div {        p(classes = "secondaryText") {          +"${city.name}, ${city.country}              (${city.coord.lat},${city.coord.lon})"        }        p(classes = "secondaryText") {          +forecast.dt.getFullDate()        }        p(classes = "secondaryText" ...

Get Kotlin Blueprints 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.