Hi i am creating a new project using Kotlin Multi Platform project. A followed all the instruction from the official documentation : https://kotlinlang.org/docs/multiplatform-mobile-getting-started.html The only change I made, is that i converted the Swift UI project to Swift directly in the XCode project. The project compile successfully and launch but my problem is that the color syntax is not recognised.
It is recognised as Plain Text as shown below.
Xcode Screen shot after modifying the color of Plain Text
This issue seems to be even for Samples from Kotlin Officals https://kotlinlang.org/docs/multiplatform-mobile-samples.html . And appear for Swift/Swift UI project and it is not blocking the compilation of the application and everything appart off that seems to work fine, but it make the file not as readable as it should be for me.
I tried to :
- Delete Derived data and everything if the XCode folder
- Delete and install XCode
- Install XCode Beta
- Create a new KMM Project in Swift
- Create a new KMM project in Swift UI
- Try on sample that already work without any modification
Nothings have made the color syntax of KMM library recognised.
I finally found a solution :
I added to the Build Phase of the target in the compile sources the header file listing my module.
So for example i did a cmd+click on my Greeting Class, Show definition, then right click, Navigate, show in finder, and finally drag it to the compile sources, restart Xcode
Magic should happen and color syntax has been added.
PS : Added it as reference so when you build again the module it will keep track of changes