Ubuntu on Swift Development Learning 1

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.