Swift Development Learning (a): initial article

Source: Internet
Author: User

http://blog.csdn.net/powerlly/article/details/29351103

Swift Development Learning: the initial Chapter

About

Apple is in WWDC2014 (Apple Worldwide Developers Conference. June 2-6, San Francisco) publishes the new programming language--swift. Here does not repeat the introduction, this chapter is a brief list of several points, and then introduce the swift operation.

What is Swift?

    1. Swift is the programming language used to write iOS and OS X programs.
    2. Swift absorbs the benefits of C and objective-c and is more powerful and easy to use.
    3. Swift can use the existing cocoa and cocoa touch frameworks.
    4. Swift combines the high performance (performance) and scripting language interactivity (Interactive) of the compiled language.

What are the features of Swift?

    1. property, nullable Value (Nullable type), generic (Generic type) syntax, derived from C #;
    2. Format style: At the end of the sentence can be no semicolon, judging conditions do not need parentheses, with go style;
    3. The current instance uses the self reference syntax, the list/dictionary declaration syntax, and the Python style;
    4. Interval declaration syntax (such as: 1..) 3: Front closed rear open [1,2],1...3: Front closed rear closed [+]], with Haskell style;
    5. Protocol (Protocol) and Extension (extension), originating from Objective-c;
    6. Enum (enum) types can have members or methods, much like Java;
    7. Classes (Class) and struct (struct) concepts, similar to C #.

What IDE is used to develop swift

    1. Xcode6 begins support for Swift language
    2. XCODE6 provides a playground interface that allows you to see the execution effect while developing

Please keep this link for the original power reprint.

Environment preparation

    • MAC OS Version
      Does not need to be updated to the newly released OS X v10.10 and is not currently stable
      You can upgrade to OS X 10.9. Install Xcode6 Beta
    • Xcode6 Beta Download [can thunder]

Xcode6 Beta Installation

There is no need to worry about coverage issues with other versions of Xcode installed

When you download the xcode_6_beta.dmg installation, it installs to the new directory.

Create a project

Start our new Swift journey after the installation is successful.

First, let's create a swift language project.

As with the original project, simply select Swift in the language selection

Swift ranked first in the language option, showing how much Apple attaches to it. Future estimates will be the default option.

After the project is created, you will find nothing different from the previous Hello World

What about the playground? You will find in the lower right corner there is such a file type playground

You know what you're doing?

Hello Swift

Second, add the playground file

    1. Drag directly from the lower right corner to the project
    2. file-"new-" File ..., select playground

Middle: Code Editing area

Left: Live effect, not output OH

Bottom right: Post-run results, Note: execution effect


With the playground, the teachers no longer have to let the students yy ~~~!

Question: How do I execute the code in playground? Please see the next introduction

Please keep this link for the original power reprint.

Changelist:

June 9

Quick Create with Playground project

Before the start of Xcode setup is not realistic welcome interface, so did not notice also can quickly create playground project

Ways to open the Xcode Welcome screen:

    1. Menu: Window, Welcome to Xcode
    2. Shortcut keys: Shift + Command + 1

?? Show This window when Xcode launches

You can open the Welcome screen at startup

Select "Get started with a playground" to create a project with playground directly.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Swift Development Learning (a): initial article

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.