Hi. How it is the proper way to init a weak reference on Kotlin?
02/27/2017, 12:02 PM
val reference = WeakReference<String>("A”)
02/27/2017, 12:03 PM
Should it work better with a lateinit?
02/27/2017, 12:06 PM
I don’t quite understand, lateinit is used to declare a var which has looser null safety checks - as in, you don’t have to use ?/!! all the time but it should be assigned by the time you use it or it’ll immediately error
If you want to reload the value on access time if it’s been GC’d, then you could probably do something neat with a delegate? Not quite sure your use case tho
02/27/2017, 12:19 PM
The use case it have a reference to a view interface on a presenter