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