IOS Swift 基本學習
Swift是apple 提供的一個開法在ISO跟OS X上AP的工具 根據官網描述 是一個具有高開發跟效能的語言
Swift是base on cocoa跟cocoa touch框架
網路上有好心人放上翻譯的文件swift 中文翻譯檔
2017 apple 將Swift open出來 在pad上面有AP可以學習 並且有提供linux上面可以跑的bin file
安裝在 Linux
First, install clang:$ sudo apt-get install clang
apple Swift file Apple 在網路上提供Ubuntu 14.04跟 16.04 16.10版本可執行檔
|
|
基本上解開檔案增加bin file path 到PATH下就可以使用了
目前最新的版本是3.1.1
Run Swift
Swift 有提供read-eval-print Loop(REPL)開發環境 當你純粹打swift後面沒有接任何參數時會進去
你可執行基本的運算或編程跟python一樣 例如
另外可以透過"hi!".re<tab>
離開REPL command :exit
:q
Build an executable
Create command
|
|
build package
swift build
產生的執行檔在.build\debug
下面
Debug support
Swift 可以透過LLDB debug
LLDB is the default debugger in Xcode on Mac OS X and supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator.
透過swiftc -g ***.swift
產生debug要用的檔案 再透過lldb ***
去執行debug
|
|
|
|