In Xcode 7 Beta 6 global function advance(startIndex, n) is no longer available. You must use Index.advancedBy(n) to get the same result. advance(startIndex, n) is very useful in substringing. Since you cannot pass an Int to the Index type in substring function.
Prior to Xcode 7 Beta 6
var str = "abc"
firstChar = str.substringToIndex(advance(str.startIndex, 1)) // a
Xcode 7 Beta6
var str = "abc"
firstChar = str.substringToIndex(str.startIndex.advancedBy(1)) // a
No comments:
Post a Comment