Jason
11/06/2024, 10:57 PMorg.jetbrains.androidx.lifecycle:lifecycle-viewmodel
library in gradle, on the iOS side the ViewModelStoreOwner
class name is created as Lifecycle_viewmodelViewModelStoreOwner
instead of just ViewModelStoreOwner
. I've seen some examples where it does create names like this and also some that don't, for instance in the FantasyPremierLeague repo, Swift can reference the class ViewModelStoreOwner just like that. I had this issue w/ Koin at one point, but Koin exported classes are not renamed any longer like the androidx lifecycle viewmodel classes are.François
11/07/2024, 4:43 AMBoy Hoody
11/07/2024, 8:39 AMcommonMain.dependencies {
api(libs.androidx.lifecycle.viewmodel)
}
In my case, that was the reason for the weird namingFrançois
11/07/2024, 8:42 AMBoy Hoody
11/07/2024, 9:04 AMFrançois
11/07/2024, 9:23 AMMichael Krussel
11/07/2024, 1:11 PMFrançois
11/07/2024, 1:20 PMFrançois
11/07/2024, 1:21 PMJason
11/07/2024, 5:11 PMcommonMain.dependencies {
api(libs.androidx.lifecycle.viewmodel)
...
}
@Michael Krussel I am using the type in my public common API but I also export the library in gradle like so. If I remove that export below, it seems it isn't even needed as I still can access the `Lifecycle_viewmodelViewModelStoreOwner`since it's being used in one of my common public API's. if I don't use that type in my public common API, even with the explicit export of the lib below, that type is not exported, seems like I have to be using it in the API for it be available in Native side.
targets.withType<KotlinNativeTarget> {
binaries.withType<Framework> {
isStatic = false
export(libs.androidx.lifecycle.viewmodel)
transitiveExport = false
}
}
@François I am not exporting everything, i have transitiveExport = false
, so I don't expose everything to native, just the ones I explicitly export. I will look into explicitApi() haven't seen that but sounds like it behaves similar to the transitiveExport maybe.
Thanks for your help again, while I'm ok with the verbose naming of exported type names, I do want to understand how to avoid it. Will keep trying.Michael Krussel
11/07/2024, 5:46 PMexplicitApi
just reports warnings if you do not explicitly specify your visibility and return types. It doesn't change what gets exported, but instead encourages you not to accidentally export something you don't mean to.François
11/07/2024, 5:57 PMFrançois
11/07/2024, 5:58 PM