So right now I have something like this: ``` priv...
# announcements
t
So right now I have something like this:
Copy code
private val journeyId by DetailFragmentArgs.journeyId
And I would like to make this lazy
a
What about
private val journeyId by lazy { DetailFragmentArgs.journeyId }
?
k
No, that's like
private val journeyId = DetailFragmentArgs.journeyId
but lazy.
It's not pretty but this should work:
val journeyId by lazy { DetailFragmentArgs.journeyId.getValue(this, this::journeyId ) }
t
I'll check if that works @karelpeeters
Nope, doesn't work, I get a recursion problem
a
@karelpeeters what can you do with your snippet that you can't do with mine? What am I missing? 😬
t
Then you are returning a lazy ReadOnlyProperty instead of the value itself
a
whats the type of
DetailFragmentArgs.journeyId
?
t
ReadOnlyProperty<R, T>
a
and what is your custom readonlyproperty doing?