The Go Blog

Apple Swift in Terminal

bantana
12 September 2014

alias

swift='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk'

命令行build

swift hello.swift

命令行run

swift -i hello.swift

~/bin/swiftrun

xcrun /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -i $1

~/bin/swiftbuild

xcrun /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk $1

~/.vimrc

Bundle 'toyamarinyon/vim-swift'

" apple swift {{{
augroup ft_swift
    au!
    au BufRead,BufNewFile *.swift set filetype=swift
    au Filetype swift setlocal makeprg=swiftbuild\ %
    au Filetype swift nnoremap <leader>r :!~/bin/swiftrun %<CR>

augroup END
" }}}

Related articles