Swift Getting Started Hello world! Swift.

Source: Internet
Author: User

Apple launches the new development language Swift, with regard to trends, appearances and OC What is not the same place.

Prerequisites: Xcode6-beta installed (this process is not a table)

1. Open Xcode6-beta, second select Create a Newxcode Project

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc3dpznrlcjiwmtq=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

2. Create a single View application for iOS



3. Enter project name: Helloswift, select Swift at the language office and click Next.



4. Select your Save workspace. Point creation



5. The interface comes out, isn't it look very familiar? Look carefully, the file folder is not very concise, a lot of endless header files are not.



6. Click Main-storyboard, the story panel came out, the following there is a Wany hAny. It allows you to resize the app's interface when clicked. The legendary Big Apple screen is expected to come out in September. I've chosen the top two here, the same width as today's iphone.



7. Locate the label control in the lower-right corner of the interface, and pull it into view to adjust the length and width and position. In the Properties panel of the label control, replace the font color with the one you like, and set the text to center.



8. Select iphone 5s as simulator in the upper left corner and click to execute button. Results for example with.

What Your simulator is so big? command+1,2,3 switch size. The average person I don't tell him)




9. Select 1, the source of the dual screen, the mouse right click 2, in the Pop-up dialog 3 in the selected outlet, the + number is selected, pull into the viewcontroller.swift, appear an underscore after release, Pop 4. Enter MyLabel in name and click Connect so that the label is created as a member variable.







10. Select the file viewcontroller.swift to return to its source file. Add code below viewdidload:myLabel. text = "Hello world.swift"



11. Click the top left corner again to execute the button. The emulator performs the effect.

This is the first Swift's Hello world. Have you learned it?




The article is a bit simple to write, mainly to hope for someone like me who has just started to learn a little help.


At last. There is no money to hold a field. I have a small application (QR code. You know that).



I wish you all the gold in the App Store!

^_^!



Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Swift Getting Started Hello world! Swift.

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.