Swift Chinese is a very exciting thing. I am particularly important for English is not so impressive. The overall view of the time did not spend too much. Although look completely forgot. But after all, swift2.0 is the trend, and open source. So mastering swift not only makes it easy to write any code that OC can achieve, but it can greatly save the amount and time of coding. Give people more time to analyze the business logic and the overall framework.
Thanks again for the collaborative compilation of a group of Chinese developers for the benefit of people! Attach git address
Https://github.com/numbbbbb/the-swift-programming-language-in-chinese
(1) Let modifier constants, only one decision at a time. The string, \ () can quickly become a string. And you can add: the way to declare the type
Let apples = 3
Let oranges = 5
Let applesummary = "I have \ (apples) GE apples"
Let fruitsummary = "I has \ (apples + oranges) ge fruits"
println (Applesummary)
println (Fruitsummary)
(2) var is a variable that can be determined multiple times
/**
* Dictionary arrays are Var
*/
var array = ["hehe", "Xixi", "Lala"]
ARRAY[1] = "Ooooooo"
println (Array)
var dict = [
"hehe": "en",
"Xixi": "Enen"
]
dict["hhhhh"] = "new"
dict["hehe"] = "Enenenenen"
println (Dict)
(3) Create an empty dictionary, array
Let Emptyarray = [String] ()
Let emptydict = [String:float] ()
(4) Cycle
var a = [10,13,312,32,2]
var b = 0
For C in a{
If C > 50{
B + = 5
}else{
B + = 3
}
}
(5)
(6) switch
(7) Type aliases
(8) Meta-group
(9) Optional type
Forced parsing of optional types:
(10) Optional bindings
(one) Nil
(12) Assert:
You can add an assertion when the program needs to be judged and is not able to run when it is true to continue. For example, the age must be greater than 0, and an assertion is triggered if less than 0. The program is not running.
01.swift Foundation