Is there a didSet/willSet analog in Kotlin?

Although Kotlin doesn’t provide a built-in Swift-style solution for property changes observation, you can still do it in several ways depending on what your goal is. There is observable(…) delegate (in stdlib) that allows you to handle the property changes. Usage example: var foo: String by Delegates.observable(“bar”) { property, old, new -> println(“$property has changed … Read more

Options, Settings, Properties, Configuration, Preferences — when and why?

Tricky, this, as there’s no one single consistent style followed by all applications. As you say they are (broadly) synonyms. In truth it doesn’t really matter so long as your expected audience understands what you mean. The biggest difference is between Properties, which usually affect a component or object, and the others, which affect the … Read more

Error in Swift class: Property not initialized at super.init call

Quote from The Swift Programming Language, which answers your question: “Swift’s compiler performs four helpful safety-checks to make sure that two-phase initialization is completed without error:” Safety check 1 “A designated initializer must ensure that all of the “properties introduced by its class are initialized before it delegates up to a superclass initializer.” Excerpt From: … Read more