编译命令行终端 swift

编译命令行终端 swift

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

  
  
So, this is where swift lives, after you've installed XCode 6 Beta:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
Also, there's a directory named swift which has various libraries:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
To start playing in a terminal:
export PATH=/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH
You could also change this in XCode 6's Preferences.

I use it via xcrun:

$ xcrun swift -v -o test test.swift
Swift version 1.0 (swift-600.0.34.4.5)
Target: x86_64-apple-darwin14.0.0
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file test.swift -enable-objc-attr-requires-objc-module -target x86_64-apple-darwin14.0.0 -module-name test -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -color-diagnostics -o /var/folders/2p/rs8p19s957ggyxzntnj3tp_40000gn/T/test-bb5ff8.o
/usr/bin/ld /var/folders/2p/rs8p19s957ggyxzntnj3tp_40000gn/T/test-bb5ff8.o -force_load /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a -syslibroot /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -lSystem -arch x86_64 -L /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -rpath /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -macosx_version_min 10.10.0 -no_objc_category_merging -o test

Note however the swift libraries are loaded (via @rpath) from /Applications/Xcode6-Beta/.../swift/macosx so the binary won't work on another system unless it's got the same version of Xcode installed in the same place. Unless you want to do lots of copying/install_name_tool calls to sort it out...

$ otool -l test |fgrep path
         name @rpath/libswiftAppKit.dylib (offset 24)
         name @rpath/libswiftCoreGraphics.dylib (offset 24)
         name @rpath/libswiftDarwin.dylib (offset 24)
         name @rpath/libswiftDispatch.dylib (offset 24)
         name @rpath/libswiftFoundation.dylib (offset 24)
         name @rpath/libswiftObjectiveC.dylib (offset 24)
         name @rpath/libswift_stdlib_core.dylib (offset 24)
         path /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.x

1. 安装xcode 6 beta

2. 设置路径:

export PATH=/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH

3. vim test.swift

println("Hello swift")

4.

xcrun swift -v -o test test.swift
5 ./test

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/116893.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 怎样查看MySql数据库物理文件存放位置

    怎样查看MySql数据库物理文件存放位置

    2022年2月9日
    53
  • 易经六十四卦详解与应用_六十四卦推演方法

    易经六十四卦详解与应用_六十四卦推演方法文章目录六十四卦图卦象工具/原料方法/步骤注意事项六十四卦图卦象工具/原料一块钱的硬币 三枚方法/步骤第一,占卜前要把手洗干净,然后心里要虔诚,其他的事情不要胡思乱想,心里就想着自己要占卜问的事情。第二,取出三枚一元的硬币,有一元字体的为正面,花的那面为反面。然后将三枚硬币放在手中,双手合拢摇晃几下,最后开出来。结果的话有四种情况。三个全是正面的记作老阳——x,只有一个正面…

    2022年8月18日
    11
  • Http.sys远程代码执行漏洞处理「建议收藏」

    Http.sys远程代码执行漏洞处理「建议收藏」项目的相关漏扫报告,级别紧急。处理方式也很简单,打上相应补丁即可.官网补丁下载路径:找到对应的系统版本补丁安装重启就可修改该漏洞https://docs.microsoft.com/zh-cn/security-updates/securitybulletins/2015/ms15-034漏洞描述:漏洞确认:用牛刀Metasploit确认存在相关漏洞安装补丁重启后复测已确认修复…

    2022年7月18日
    14
  • LaTeX数学公式-详细教程

    LaTeX数学公式-详细教程LaTeX数学公式,包含前言,注意事项,插入公式,注释,编号,转义字符,换行与对齐,字体,空格,上下标,括号,大括号和行标,分式,开方,对数,省略号,最值,方程组和分段函数,累加和累乘,矢量,积分,极限,导数与偏导,矩阵,表格,希腊字母,运算符,戴帽符号,特殊符号,等等。

    2022年5月23日
    34
  • 学习笔记——在vue中如何配置Jest(一)

    最近在搞Jest单元测试,如何在vue中安装和使用jest我就不说了,前一篇文章简单的说了一下在使用jest时遇到的一些问题,但是我觉得并没有真正的解决的很好。后面会在学习过程中更新前面的那篇文章,加

    2022年3月25日
    46
  • git下载与安装教程[通俗易懂]

    git下载与安装教程[通俗易懂]1.下载地址官网:https://git-scm.com/download/win2.安装选中文件编辑器选notepad++编辑器记得要先安装好3.测试安装是否成功鼠标右键桌面,显示如图说明安装成功打开gitbaseHere输入git–version可以查看版本4.配置全局用户和邮箱信息1)打开gitbaseHere,输入如下命令,回车即可gitconfig–globaluser.nam…

    2022年6月3日
    31

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号