1. 程式人生 > >ubuntu之swift環境搭建

ubuntu之swift環境搭建

想著學習一下很火的swift,首先肯定是 ubuntu裡swift環境搭建,其實過程跟搭建java的環境是類似的

Requirements
Ubuntu 14.04 or 15.10 (64-bit)

由於是在VirtualBox虛擬機器環境下,上面的壓縮包有ubuntu版本要求,我安裝的是15.10 (64-bit) ,安裝過程可以參考上一篇 ,不會分割槽啥的就別點自己分割槽了,還是預設選第一個,讓系統自己去分。

虛擬機器安裝好後,我是弄了一個共性資料夾,把下載好的 swift-2.2-RELEASE-ubuntu15.10.tar.gz 複製進虛擬機器解壓

mkdir swift && cd swift;

tar xvt swift-2.2-RELEASE-ubuntu15.10.tar.gz

cd swift-2.2-RELEASE-ubuntu15.10

接著配置環境:

gedit $HOME/.bashrc

在最後新增:

#swift
export SWIFT_HOME=$HOME/swift/swift-2.2-RELEASE-ubuntu15.10
export PATH=$SWIFT_HOME/usr/bin:$PATH
export LD_LIBRARY_PATH=$SWIFT_HOME/usr/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$SWIFT_HOME/usr/lib:$LIBRARY_PATH

重啟一下環境:source ~/.bashrc(不放心你就重啟  reboot -h )

然後輸入: swift  出現如下


環境就配好了

在上面的輸入模式下

:help   開啟幫助

:q   退出

1> let hello = "hello";
hello: String = "hello"
2> print(hello);
hello 
3>hello.   ///然後按Tab ,會有提示
Available completions:
    append(c: Character) -> Void
    append(x: UnicodeScalar) -> Void
appendContentsOf(newElements: S) -> Void appendContentsOf(other: String) -> Void characters: String.CharacterView debugDescription: String endIndex: Index hashValue: Int insert(newElement: Character, atIndex: Index) -> Void insertContentsOf(newElements: S, at: Index) -> Void isEmpty: Bool lowercaseString: String nulTerminatedUTF8: ContiguousArray<CodeUnit> removeAll() -> Void removeAll(keepCapacity: Bool) -> Void removeAtIndex(i: Index) -> Character removeRange(subRange: Range<Index>) -> Void replaceRange(subRange: Range<Index>, with: C) -> Void replaceRange(subRange: Range<Index>, with: String) -> Void reserveCapacity(n: Int) -> Void startIndex: Index unicodeScalars: String.UnicodeScalarView uppercaseString: String utf16: String.UTF16View utf8: String.UTF8View withCString(f: UnsafePointer<Int8> throws -> ResultUnsafePointer<Int8> throws -> Result) -> Result withMutableCharacters(body: (inout String.CharacterView) -> R(inout String.CharacterView) -> R) -> R write(other: String) -> Void writeTo(&target: Target) -> Void 4> hello.isEmpty $R0: Bool = false
參考:http://www.linuxidc.com/Linux/2015-12/125983.htm

- - - - - - - - - - - - 新增 - - - - - - -  -

ubuntu下火狐瀏覽器觀看視訊外掛安裝:

sudo apt-get update

apt-get install flashplugin-nonfree