Apple Swift programming language Novice Tutorial "China version"

Source: Internet
Author: User

Swift code Language Tutorials : At the WWDC2014 conference just past, Apple unveiled a new programming language, Swift. It is reported The swift language inherits the features of C and Objective-c, and overcomes the compatibility problem of C language. For the vast majority of developers, this is undoubtedly a dose irresistible stimulant. Hope Apple Swift programming language Novice Tutorial "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 Novice Tutorial "Chinese version"

Folder

1 Brief 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 Brief introduction

Swift is a new programming language for iOS and OS X applications. Based on C and objective-c, without some compatibility constraints for C.

Swift adopts a secure programming model and joins 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. 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. Through Arc (Automatic Reference counting. Self-referencing counts) to simplify memory management.

Our framework stack is always based on cocoa. Objective-c Evolution supports blocks, collection literal, and modules. Agree that the framework of modern language can be used without deep-dive. (by Gashero) thanks to these basic work to enable the introduction of new programming languages in Apple software development.

OBJECTIVE-C developers will feel Swift's déjà vu.

Swift uses the objective-c named parameters and the dynamic object model. Provides interoperability with the cocoa framework and the mix-and-match. Based on these fundamentals, Swift introduces a lot of new features and a combination of process-oriented and object-oriented features.

 

Swift is also friendly to the new program ape. He is an industrial-quality system programming language, yet as friendly as a scripting language.

He supported playground, agreeing to the program ape to experiment with a swift code function and see the results immediately, without the hassle of building and executing an application.

Swift integrates modern programming language ideas. And the wisdom of Appleproject culture. Compilers are optimized for performance, and languages are optimized for development without compromising on each other. (by Gashero) is able to learn and transition from "Hello, world" 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

The study of a new language should begin with the printing of "Hello, World". In Swift, there is one line:

println ("Hello, World")

Assuming you have written C or objective-c code, this syntax looks very 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 have to write a main () function. You do not have to write a semicolon after each statement.

This primer will give you enough information to complete a programming task.

Don't worry, you don't understand something. All of them are not explained clearly. may be explained in detail in this book.

Note

As a best practice. This chapter is open to Xcode's playground. Playground I agree with your editing code and see the results immediately.

Apple Swift programming language Novice Tutorial "China 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.