For our iOS project we create a Framework from our...
# multiplatform
d
For our iOS project we create a Framework from our shared Kotlin code. We actually have two multiplatform kotlin modules: 'shared' and 'shared-ui', where 'shared-ui' has a dependency on 'shared'. When importing the generated framework from the 'shared-ui' module, we can access everything in 'shared-ui' from Swift, but not from its dependency 'shared'. There are some exceptions: if for example a function in 'shared-ui' takes a type from 'shared' as an argument, then that type is exposed to Swift, but with a
Shared
prefix. Some other types that are exposed in 'shared', but not used in the api of 'shared-ui' seem not accessible at all from Swift code. Is there a way to fix this? We'd like all code from both the 'shared' and the 'shared-ui' module to be available to Swift. Ideally also without the
Shared
prefix, but that is something we could live with if needed.
Nevermind, I just found the export option which does exactly what we need! 👌
👍 2
p
I noticed that KMP will export any transitive dependency if it detects is in a public position. Like the case you mentioned, a public function that exposes it. Related to the naming prefix you can also name specific classes using the annotation
@ObjCName