Learning Purpose: Learn swift by building a practical process for Web applications. Use the perfect framework to build a Web application (perfect is a web framework for swift).
This article introduces environment construction
Learning Resources:
Environment Construction: https://swift.org/getting-started/
Official English Course: https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/
Chinese Course: http://wiki.jikexueyuan.com/project/swift/
Perfect official Tutorial: https://www.perfect.org/docs/gettingStarted.html
Best practice of Swift (TODO ...)
1. Install dependencies
[Email protected]:sudoinstall clang libicu-dev
2. Download the swift-3.0.1-preview-1-ubuntu16.04 installation package from the https://swift.org/download/website, my operating system is Kbuntu16.04
Put it in/home/{user}/downloads/.
Unzip the file using the following command
[Email protected]:tar -xzf swift-3.0. 1-preview-1-ubuntu16. . tar. gz
Automatically generate the swift-3.0.1-preview-1-ubuntu16.04 folder in the current directory after decompression
3. Setting the environment variables for Swift
[Email protected]:VI ~/.BASHRC
Add this line at the end of the file (Vim editor, press i key to enter edit mode)
Export Path=/home/{user}/downloads/swift-3.0.1-preview-1-ubuntu16.04/usr/bin:"${path}"
{User} Here is the placeholder, is usually your current login using the user name, specifically, the previous section of the/home/{user}/downloads/, is your installation package storage path, according to the actual installation completed.
Press the ESC key to exit edit mode
Press: Wq Save exit file
Use the following statement to make the environment variable effective
[Email Protected]:source ~/.BASHRC
There is a space between source and ~ symbol, ~ indicates your home directory, is the alias of the home directory
Use
[email protected]:swift-version
command to see if the SWIFT environment is configured.
The output will be as follows
3.0 (swift-3.0. 1-preview-1) target:x86_64
So far, the environment is fully configured.
4. Use the REPL command-line interactive environment to learn basic syntax
(see http://wiki.jikexueyuan.com/project/swift/for Swift syntax and API learning)
Command line strikes Swift to enter the interactive environment
3.0 (swift-3.0. 1-preview-1 for assistance. 1
Input, enter the result after the return:
3.0 (swift-3.0. 1-preview-1 for assistance. 1 1+12 2
Press the CTRL and D keys to exit the REPL interactive environment
Ubuntu on Swift Development Learning 1