ubuntu之swift环境搭建

想着学习一下很火的swift,首先肯定是 ubuntu里swift环境搭建,其实过程跟搭建java的环境是类似的

官网下载压缩包:https://swift.org/download/#releases  

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



你可能感兴趣的:(swift)