在Sublime Text 2中构建Swift

时间:2014-08-23 17:54:32

标签: swift sublimetext2

我的swift.sublime-build文件的这些构建设置似乎几乎可以工作:

{
    "cmd": ["swift $file_name"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "path": "/Applications/Xcode6-Beta5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/",
    "selector": "source.swift",
    "shell": true
}

但是我在构建中得到了这个:

<unknown>:0: error: cannot load underlying module for 'CoreGraphics'
<unknown>:0: note: did you forget to set an SDK using -sdk or SDKROOT?
<unknown>:0: note: use "xcrun -sdk macosx swift" to select the default OS X SDK installed with Xcode
[Finished in 0.0s with exit code 1]

我的应用程序仅限控制台输出,因此我甚至不需要CoreGraphics。我不确定如何破坏该要求或如何使用-sdk参数。

2 个答案:

答案 0 :(得分:0)

这适用于Xcode 6.2

{
    "cmd": ["/usr/bin/xcrun", "swift", "$file"]
}

答案 1 :(得分:0)

这对我有用:

{
  "shell_cmd": "xcrun swift $file"
}