KMM导入通用库没有颜色语法
您好,我正在使用 Kotlin 多平台项目创建一个新项目。 A 遵循官方文档中的所有说明: https://kotlinlang.org/ docs/multiplatform-mobile-getting-started.html 我所做的唯一更改是,我直接在 XCode 项目中将 Swift UI 项目转换为 Swift。 该项目成功编译并启动,但我的问题是颜色语法无法识别。
它被识别为纯文本,如下所示。
这个问题似乎甚至适用于 Kotlin 的示例官方 https://kotlinlang.org/docs/multiplatform-mobile-samples.html 。并出现在 Swift/Swift UI 项目中,它并没有阻止应用程序的编译,所有的东西似乎都工作正常,但它使文件的可读性不如我应有的那样。
我尝试:
- 删除派生数据和所有内容(如果 XCode 文件夹)
- 删除并安装 XCode
- 安装 XCode Beta
- 在 Swift 中创建一个新的 KMM 项目
- 在 Swift UI 中创建一个新的 KMM 项目
- 尝试在不进行任何修改的情况下已经工作的示例
没有任何颜色语法KMM 图书馆得到认可。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到了一个解决方案:
我将列出我的模块的头文件添加到编译源中目标的构建阶段。
例如,我在 Greeting Class 上执行了 cmd+单击,显示定义,然后右键单击,导航,在查找器中显示,最后将其拖动到编译源,重新启动 Xcode
Magic 应该会发生,并且颜色语法已添加。
PS:将其添加为参考,以便当您再次构建模块时它会跟踪更改
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