Is there some 'delegate' way to do the following? ...
# announcements
n
Is there some 'delegate' way to do the following?
Copy code
val container: Container
var property: Int
  set(value) {
    container.property = value
  }
  get() {
    container.property
  }
I was thinking about something like this, but that doesn't work obviously
Copy code
val container: Container
var property: Int by container.property
a
nhaarman: If you need this kind of code multiple times, you could write your own delegate
n
I tried, but it seems like this still needs a lot of boilerplate every time
a
@nhaarman can you show me what you've tried so far?