Implicitly unwrapped optionals are a useful feature of Swift for things like UI elements that are not assigned during a class's constructor, but can be safely be assumed to be non-null for the majority of functions (as they will have been assigned in a viewDidLoad).
eg.
@IBOutlet weak var textView : UITextView!
Is there an equivalent for Kotlin, or a workaround that achieves the same effect?
lateinit var
may be a suitable solution. Kotlin just assumes they are not null.
https://kotlinlang.org/docs/reference/properties.html#late-initialized-properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With