Swift Learning Notes (i)--My first Swift program Hello world

Source: Internet
Author: User

The two languages that are currently being developed for iOS are OC and swift, and these two languages now present a trend that is fading. But for good development, it is necessary to learn two languages well. Now I will start Swift's study. This is my first Swift program--hello world. Apple has introduced a very good tool to develop Swift in Xcode6, called playground. Using playground can display the output of the current code in real time, which can be said to be very fun.

(1) Open Xcode and select the first option "get started with a playground".

.


(2) Enter the project name and platform in the dialog box and choose iOS for the platform.


(3) Finally choose to store the path, and then create. A swift project is complete for creation. You can see Swift automatically creates a few lines of code, and Apple has a humorous explanation for the term playground: a place where people can play. Then a str variable "Hello,playground" is declared. You can see the output of this variable in real time on the right. It can be said to be very convenient.


(4) Enter your own code "Hello World" and do the output. You can see that the expected output appears on the right.



(5) Playground also has a very good hint effect, in the output right there is a small eye, click on the eye, you can enlarge the display in another window.


(6) On the right side of the small eyes there is a plus, click the plus sign, you can be prompted to output the results below the code. It can be seen that playground is really fun. As shown in the figure:


Start learning Swift.


GitHub home: https://github.com/chenyufeng1991. You are welcome to visit.

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.