Xcode 6.1 Swift 扩展 - SourceKit 服务崩溃 [英] Xcode 6.1 Swift Extensions - SourceKit Service Crash

查看:23
本文介绍了Xcode 6.1 Swift 扩展 - SourceKit 服务崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向 Swift 添加扩展,以便我可以按照此处的答案中的格式设置双打

I am trying to add an extension to Swift so I can format Doubles as found in this answer here

Swift 中的精确字符串格式说明符

不理想,但目前我能找到的最佳解决方案.但是我似乎无法向我的项目添加扩展.扩展在操场上运行良好,但是当我尝试将它添加到我的项目时,每次尝试添加代码时我都会收到 SourceKit 服务崩溃错误.我还收到一条错误消息,指出声明仅在文件范围内有效".

Not ideal, but best solution I can find so far. However I cannot seem to add extensions to my project. Extensions work fine on playground, but when I try to add it to my project, I get the SourceKit service crash error every time I try to add the code in. I also get an error stating "declaration is only valid at file scope".

我之前没有在 Swift 中使用过扩展,所以我不知道这是否与 Xcode 6.1 更新直接相关.

I have not previously used extensions in Swift before, so I cannot tell if this is directly related to Xcode 6.1 update or not.

有没有其他人遇到过这个问题或知道如何解决这个问题?

Has anyone else had this issues or know anyway to solve this?

推荐答案

SourceKit 服务崩溃错误非常烦人,而且不仅仅发生在扩展中.我发现将您的项目分成不同的文件有所帮助.

The SourceKit service crash error is pretty annoying and doesn't only happen with Extensions. I have found breaking your project up into different files has helped.

这篇关于Xcode 6.1 Swift 扩展 - SourceKit 服务崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆