建一个xcode工程。。OS X > Application > Command Line Tool因为我们只是想玩玩swift语言特性不做UI.
product name; example
org name: cyper
org id: me.cyper
bundle id: me.cyper.example
保存在桌面.
example > example.xcodeproj
example > example/main.swift
选择products>example,右边identity and type,type选择Unix-Executable可以看到生成的可执行文件的全路径
/Users/cyper/Library/Developer/Xcode/DerivedData/example-ajcwintjwwixdreqjjijwrzqriom/Build/Products/Debug/example
这个hello world文件大约5M
➜ Debug $ pwd /Users/cyper/Library/Developer/Xcode/DerivedData/example-ajcwintjwwixdreqjjijwrzqriom/Build/Products/Debug ➜ Debug $ ll total 10904 -rwxr-xr-x 1 cyper staff 5.3M Oct 10 20:03 example drwxr-xr-x 4 cyper staff 136B Oct 10 20:00 example.swiftmodule/ ➜ Debug $ ./example Hello,World! ➜ Debug $原文链接:https://www.f2er.com/swift/325780.html