‘init(start:end:)’ is deprecated: it will be removed in Swift 3. Use the ‘..<’ operator
var continousDigitsRange:Range<Int> = Range<Int>(start: 0, end: 0)
Since update to Xcode 7.3 (Swift 2.2) I got the following hint:
'init(start:end:)' is deprecated: it will be removed in Swift 3. Use the '..<' operator.
新方法:
let string = “Who A U” string.substringWithRange(Range(string.startIndex.advancedBy(0) ..< string.startIndex.advancedBy(2)))
i++ i–
苹果认为 i++ 和 ++i在代码中容易产生理解错误。所以取消了 自增、自减。
改为 i += 1, 或 i -= 1
for var i = 0; i < 4; i++
-
for index in 0…3
-
for index in 0 ..< 4
//定义数组 var array = [String]() 或者 let array = ["a", "b", "c", "d"] for str in array { print("\(str)") } //如果是一个对象数组。比如一个Model -- Person.swift var array = [Person]() 或者 let array = [person1, person2, person3] for person in array { print("\(person.name)") }