This gist demonstrates how to use a Kotlin MPP library which depends on an iOS Framework in a native iOS application (XCode project).
First, see [how the Kotlin MPP Library is built][lib-build].
Key ideas:
- We can currently only use a single Kotlin MPP library in an iOS project, so we need to create a MPP project local to our iOS XCode project whose sole purpose is to aggregate multiple MPP dependencies into a single Framework.
- To keep our working environment clean, we create the gradle project in a subdirectory instead of at the root of our iOS XCode project. I name my subdirectory
mpp
. - We need to have the Frameworks used by our dependencies locally, as we only have bindings provided by the
cinterop
klib
s, so we use [Carthage] again. - As the only goal of our gradle project is to create a Framework, we only use
ios*
targets. - Our project won't have any source code, but we NEED at least one source file, or Gradle will refuse to build anything, returning just a rude
NO-SOURCE
. Just create