is there a workaround to have an inner class with ...
# getting-started
e
is there a workaround to have an inner class with its body defined in some other file in order to not bloat the parent class itself?
y
You could use a
context(Foo) class Bar
+ a
fun Foo.Bar(unit: Unit = Unit) = Bar()
pity 😞
I'll just pass an instance of the parent class in the constructor then
v
What is the reason for inner class use? Maybe there is a pattern that could do something similar with less bloat? if you want the parent class, perhaps you can use inheritance and extend the class?
e
I'm parsing some format and the inner classes represent groups of logical properties (tens), a couple of these are so much more important than the others that have to be available directly on the parent class. However, they do need some preprocessing
v
Could you define them in another file and just pass them in? If you have koin you can even inject properties directly
e
yes, that's what I did
🙌 1