Search code examples
iosswiftswift2xcode7-beta5

Split method in swift 2.0 (XCode 7 beta 5)


I have just updated Xcode 7 to beta5 and have found out that the split function is replaced with split method. I am not that experienced in Swift yet to figure out how to update my current code to the new syntax.

let components = split(name.characters){$0 == "."}.map { String($0) }
// 'split(_:maxSplit:allowEmptySlices:isSeparator:)' is unavailable: Use the split() method instead.

Solution

  • If split function was replaced by a split method, then shouldn't the new code look like this?

    let components = name.characters.split {$0 == "."}.map { String($0) }