Apple Swift programming language Introductory Tutorial "Chinese version"

Source: Internet
Author: User

Swift code Language Tutorials : At the WWDC2014 conference just past, Apple has released a new programming language, Swift. It is reported that the swift language inherits the C language and the objective-c characteristic, and overcomes the C language compatibility question, for the vast number of developers, this is undoubtedly a dose irresistible stimulant. Hope that the Apple Swift programming language introductory Course "Chinese version", can help you master it more quickly.

Note: This article extracts and extracts from Apple's official book "The Swift Programming Language". We hope to help you with your IOS&OSX development. "Official Apple Tutorial"

Apple Swift programming language Introductory Tutorial "Chinese version"

Directory

1 Introduction

2 Getting Started with Swift

3 Simple values

4 Control Flow

5 Functions and closures

6 Objects and classes

7 Enumerations and structs

1 Introduction

Swift is a new programming language for iOS and OS X applications, based on C and objective-c, without some of the compatibility constraints of C. Swift uses a secure programming model and adds modern features to make programming easier, more flexible, and more fun. The interface is based on the cocoa and cocoa touch framework, which is popular with the people, and shows the new direction of software development.

Swift has existed for many years. Apple is based on an existing compiler, debugger, and framework as its infrastructure. Simplify memory management with arc (Automatic Reference counting, auto reference count). Our framework stack is always based on cocoa. Objective-c Evolution supports blocks, collection literal, and modules, allowing the framework of modern languages to be used without deep access. Thanks to these basic work, the new programming language can be introduced in Apple software development (by Gashero).

OBJECTIVE-C developers will feel Swift's déjà vu. Swift uses objective-c named parameters and a dynamic object model. Provides interoperability with the cocoa framework and the mix-and-match. Based on these fundamentals, Swift introduces a number of new features and a combination of process-oriented and object-oriented features.

 

Swift is also friendly to the new programmer. He is an industrial-quality system programming language, yet as friendly as a scripting language. He supports playground, allowing programmers to experiment with a swift code feature and immediately see results without having to build and run an application in a hassle.

Swift integrates modern programming language ideas and the wisdom of Apple's engineering culture. Compilers are optimized for performance, and languages are optimized for development without compromising on each other. (by Gashero) can start from "Hello, World" to learn and transition to the entire system. All of this makes swift a source of innovation for Apple software developers.

Swift is a fantastic way to write iOS and OSX apps, and will continue to drive the introduction of new features. We can't wait to see you do something with him.

2 Getting Started with Swift

Learning a new language should start with the print "Hello, World". In Swift, there is one line:

println ("Hello, World")

If you have written C or objective-c code, this syntax looks familiar, and in Swift, this is the complete program. You do not need to import (import) a separate library for input and output and string processing. The globally scoped code is the entry for the program, so you don't need to write a main () function. You do not have to write semicolons after each statement.

This primer will give you enough information to teach you to complete a programming task. No need to worry that you do not understand some things, all the unexplained, will be explained in detail later in this book.

Note

As a best practice, you can open this chapter in the playground of Xcode. Playground allows you to edit the code and see the results immediately.

Apple Swift programming language Introductory Tutorial "Chinese version"

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.