编译命令行终端 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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • lombok几个基本注解的使用@Data@AllArgsConstructor@NoArgsConstructor@Builder

    lombok几个基本注解的使用@Data@AllArgsConstructor@NoArgsConstructor@Builderlombok是一款在java开发中简洁化代码十分有用的插件工具,这篇博客对较为常用的几种注解进行记录,分享学习心得。使用lombok注解,目的和作用就在于不用再去写经常反复去写的(如Getter,Setter,Constructor等)一些代码了。首先,用到的几个注解:@Data使用这个注解,就不用再去手写Getter,Setter,equals,canEqual,hasCode,toS…

    2022年10月18日
    4
  • drawcall优化_unity降低drawcall

    drawcall优化_unity降低drawcallunity3D对于移动平台的支持无可厚非,但是也有时候用Unity3D开发出来的应用、游戏在移动终端上的运行有着明显的效率问题,比如卡、画质等各种问题。自己在做游戏开发的时候偶有所得。对于主要影响性能的因素做个总结。主要因素有:       1.     Savedbybatching值过大  —->这个值主要是针对Mesh的批处理,这个值越高,应用就越卡

    2025年11月19日
    5
  • 用正则表达式验证身份证号码_用正则表达式验证身份证号

    用正则表达式验证身份证号码_用正则表达式验证身份证号JS正则表达式验证中国大陆身份证号码/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$///正则表达式:varidcardReg=/^[1-9]\d{7}((0\d)|(1[…

    2025年7月8日
    2
  • mybatis中resultMap配置细则

    mybatis中resultMap配置细则resultMap算是mybatis映射器中最复杂的一个节点了,能够配置的属性较多,我们在mybatis映射器配置细则这篇博客中已经简单介绍过resultMap的配置了,当时我们介绍了resultMap中的id和result节点,那么在resultMap中除了这两个之外,还有其他节点,今天我们就来详细说说resultMap中的这些节点。如果小伙伴对mybatis尚不了解,建议先翻看博主前面几篇

    2025年7月12日
    6
  • pycharm调整字体大小快捷键_调整字体大小在哪里

    pycharm调整字体大小快捷键_调整字体大小在哪里这个方法是最好的:https://blog.csdn.net/awyyauqpmy/article/details/79334496?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

    2022年8月25日
    8
  • ubuntu 卸载命令_Ubuntu怎么卸载

    ubuntu 卸载命令_Ubuntu怎么卸载前言本文重点介绍Ubuntu卸载软件的4种方法。他们分别是图形化界面的synaptic、自动解决依赖关系的apt-get,处理依赖关系更强大的aptitude,还有安装本地deb包的dpkg。方法一:Ubuntu使用synaptic图形化界面管理软件oucanrong@zcwyou:~$sudoapt-getinstallsynaptic-y以下是使用Synaptic管理软件的教程。输…

    2022年9月28日
    2

发表回复

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

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