https://kotlinlang.org logo
Title
s

StavFX

05/18/2023, 9:37 PM
I'm trying to figure out how to structure everything so that
fun foo(dep)
isn't exposed to consumers. Right now I have something like this
//commonMain
interface MultiplatformComponent {
  val foo: Foo
}

//androidApp
@Component
interface AndroidAppComponent : MultiplatformComponent, AndroidFooModule, SomeOtherModule

// I'm coming from Dagger, so I didn't really have a better name for these
interface AndroidFooModule {
  fun provideFoo(dep...): Foo {...}
}
Is there a better way to modularize how dependencies are satisfied?
(I kinda wish interfaces could have protected methods)
e

evant

05/18/2023, 10:38 PM
Yeah I'd say that's a recommended pattern. And agree.
s

StavFX

05/19/2023, 12:41 AM
so in my MainActivity I can see
appComponent.provideFoo
. It's not the end of the world, I would have just liked to somehow keep that from leaking
e

evant

05/19/2023, 12:52 AM
You can pass around MultiplatformComponent
s

StavFX

05/19/2023, 12:53 AM
hmm yeah, if I don't need Context or something platform specific, I guess I can hide the actual type