Skip to content

Instantly share code, notes, and snippets.

@ar-android
Created December 13, 2017 00:52
Show Gist options
  • Save ar-android/6376fe4fb326c73bd785aea377c9c8f9 to your computer and use it in GitHub Desktop.
Save ar-android/6376fe4fb326c73bd785aea377c9c8f9 to your computer and use it in GitHub Desktop.
class WeatherBuilder{
var currentDegrees: String? = null
var currentLocation: String? = null
val forecast = mutableListOf<Forecast>()
fun forecast(block: ForecastBuilder.() -> Unit){
forecast.add(ForecastBuilder().apply(block).build())
}
fun build(): Weather = Weather(currentDegrees, currentLocation, forecast)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment