The two languages that are currently being developed for iOS are OC and Swift, both of which are currently showing a trend. But in order to develop well, learning two languages is very necessary. Now I'm going to start learning swift. This is my first Swift program--hello world. Apple introduced a very good tool for developing swift in Xcode6, called playground. Using playground can show the output of the current code in real-time, which can be said to be 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 on the platform.
。
(3) Finally select the storage path, then create. A swift project is completed for creation. You can see that Swift has automatically created several lines of code, and Apple has a humorous explanation for the term playground: a place where people can play. A str variable "Hello,playground" is then declared. You can see the output of this variable in real time on the right. Can be said to be very convenient.
。
(4) Enter your own code "Hello World" and make the output. You can see that the expected output has already appeared on the right.
。
(5) Playground also has a very good hint effect, on the right side of the output there is a small eye, click the eye, you can zoom in another window to display the effect.
。
(6) next to the right side of the small eyes there is a plus, click the plus sign, you can prompt the output under the code. Visible playground is really fun. :
。
Start Learning Swift!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Swift Learning Notes (a)-My first Swift program Hello world