Hello, our team uses Kotlin Multiplatform to reuse...
# ios
д
Hello, our team uses Kotlin Multiplatform to reuse code between iOS and Android. We are reusing business logic and ViewModel for screen. This is about 20 screens at the moment. The code for an individual screen is in a separate module. KMP for iOS is built in XCFramework via the umbrella module. We got a problem that the build on iOS is very slow after changes to the KMP code. The reason is that the iOS project uses multimodularity. When I change the KMP code, all modules to which the KMP Framework is connected are rebuilt. That is, I make a change in the business logic of one screen, and the build happens in all iOS modules to which the Framework is connected. I wanted to split one common Framework into several. But then, as I realized, each of them will have its own Kotlin Runtime. That doesn’t work for me, because KMP code contains common components, like Ktor client. Has anyone solved this problem?
p
Very interested to hear of any findings that you collate. Lack of cohesive modularisation is a major problem for any chance at widespread KMP adoption IMO.
I've been quite conscious about minimising the public interface of the single kmp module exposed by using
internal
everywhere possible but it's still a fair chunk. Being able to split binaries without other disadvantages would be amazing.