Hi. How it is the proper way to init a weak refere...
# announcements
j
Hi. How it is the proper way to init a weak reference on Kotlin?
r
johannes.lagos: val reference = WeakReference<String>("A”) ?
j
Should it work better with a lateinit?
r
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
j
The use case it have a reference to a view interface on a presenter