Swift: A basic overview

Source: Internet
Author: User

Before introducing Swift, let's say a little episode.

Swift Chinese is translated as "Swift".


< Span style= "line-height:1.8" > and before Apple launches Swift, you search for Swift on Google as a result: taylor Swift ( United States country music )

So after the introduction of Swift, Apple inadvertently pushed her to the top of the rankings ~ ~ ~

Anyway

< Span style= "line-height:1.8" > What language is Swift?

The Swift language is Apple June 3, 2014 officially launched a new language. It also has the high performance of the compiled language and the flexibility of the scripting language. The Swift language is primarily capable of developing iOS and Mac-related apps. The efficiency of execution is higher than c,c++,objective_c Development is more efficient ( Honestly, I'm skeptical, Because Swift is a more object-oriented and type-safe language, similar to C # and Java, they all encapsulate the C language. Therefore, the higher the package, the more the sacrifice is the system energy. And a lot of people have already verified that its efficiency is really not as exaggerated as Apple officially said. You may be confused, I am not introducing the use of Swift? Why instead refute its argument. Because Swift's code writing is really a lot better than objective-c. It's easier for many beginners to be willing to go to Swift. And it keeps the method name Class name as consistent as possible in objective-c, which makes it easy for some programmers who have long been engaged in objective-c development to move to swift development.

Second, the swift language is very strange, easy to learn?

I generally preview some swift syntax, the basic style of Swift Grammar and C #, JavaScript syntax is very similar. For programmers with chained programming styles, there is little difficulty.

Third, the swift language is replaced objective-C language?

Objective_c language for Apple for more than 20 years, but also Apple's trump card language. Apple can't give up the objective_c language. As the Objective_c language is written differently from other languages, many developers are reluctant to go to the Apple platform, and now Apple has pushed more developers to the Apple development platform to launch the latest Swift language.

Iv. comparison of Swift and objective-c codes

OBJECTIVE-C Create a button:

UIButton *btn = [[UIButton alloc] Init];btn.frame = CGRectMake (+,--); btn.backgroundcolor = [Uicolor Bluecolor] ; [Self.view ADDSUBVIEW:BTN];

Swift Create button notation:

var btn = UIButton () Btn.frame = CGRectMake (+, +, +) Btn.backgroundcolor = Uicolor.bluecolor () Self.view.addSubview (BTN)

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

Swift: A basic overview

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.