Apple Swift programming language entry guide [Chinese Version], swift entry guide

Source: Internet
Author: User

Apple Swift programming language entry guide [Chinese Version], swift entry guide

Swift code language Tutorial: At the past WWDC2014, Apple released a new programming language Swift. It is reported that Swift inherits the features of C and Objective-C, and overcomes the compatibility problem of C language. For developers, this is undoubtedly an irresistible stimulant. I hope Apple's Swift programming language getting started [Chinese Version] will help you learn about it more quickly.

Note: This article is excerpted and extracted from The Swift Programming Language published by Apple. I hope it will be helpful for iOS & OSX development. [Apple official tutorial]

 

Apple Swift programming language tutorial [Chinese version]

 

Directory

 

1 Overview

2 Swift getting started

3 simple value

4 control flow

5. Functions and closures

6 objects and Classes

7 enumeration and Structure

 

1 Overview

 

Swift is a new programming language for iOS and OS X application programming. Based on C and Objective-C, Swift has no compatibility constraints for C. Swift adopts a secure programming mode and adds modern functions to make programming simpler, more flexible, and more interesting. The interface is based on the Cocoa and Cocoa Touch frameworks widely loved by the masses, demonstrating the new direction of software development.

 

Swift has existed for many years. Apple uses existing compilers, debuggers, and frameworks as its infrastructure. Using ARC (Automatic Reference Counting, Automatic Reference Counting) to simplify memory management. Our framework stack is always based on Cocoa. Objective-C evolved to support blocks, collection literal, and modules, allowing modern language frameworks to be used without going deep. (By gashero) thanks to these basic work, we can introduce new programming languages in Apple software development.

 

Objective-C developers may feel familiar with Swift. Swift uses Objective-C named parameters and dynamic object models. Provides interoperability between the Cocoa framework and mix-and-match. Based on these foundations, Swift introduces many new features and combines process-oriented and object-oriented features.

 

Swift is also friendly to new programmers. He is an industrial-level system programming language, but as friendly as a scripting language. He supports playground, allowing programmers to experiment with a piece of Swift code and immediately see the results without having to bother building and running an application.

 

Swift integrates modern programming language ideas and the wisdom of Apple's engineering culture. The compiler is optimized based on performance, while the language is optimized for development without compromise between each other. (By gashero) You can start learning from "Hello, world" and transition to the entire system. All these make Swift a source of innovation for Apple software developers.

 

Swift is a fantastic way to write iOS and OSX applications, and will continue to introduce new features. We can't wait to see what you want to do with him.

 

2 Swift getting started

 

Learning a new language starts with printing "Hello, world. In Swift, there is a line:

 

Println ("Hello, world ")

 

If you have written C or Objective-C code, this syntax looks familiar. In Swift, This is the complete program. You do not need to import a separate library for input/output and string processing. The code in the global scope is used for the program entry, so you do not need to write a main () function. You do not need to write a semicolon after each statement.

 

This will give you enough information to complete a programming task. You don't have to worry about something you don't understand. Anything you haven't explained clearly will be explained in detail later in this book.

 

Note

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


Recently, Apple released a new programming language, Swift. Can anyone learn from me?

I like to learn it. I just sent it out. It must be a 0-level Foundation .... It's easy for people who know java to learn.

Will the swift programming language just released by Apple become popular, and a large influx of developers will emerge? Let's talk about our opinions.

I don't know about swift object-C, and I feel awkward. I want to learn ios development, but I feel a little hesitant to see object-c.
 

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.