1a_I_See_No_Nil.playground, optToString compiler warning
Closed this issue · 1 comments
Leglaw commented
Using Swift 2.1,
let v = split(value) { $0 == "(" || $0 == ")" }
Compiler complains:
Cannot invoke 'split' with an argument list of type '(String, (String) -> Bool)'
alskipp commented
Since Swift 2, most functions have become methods. Also String
is no longer a CollectionType
which introduces further complication. The following works, but it involves a fair amount of work.
let value = "(one)(two)(three)"
let v = value.characters.split { $0 == "(" || $0 == ")" }
print(v.map(String.init)) // ["one", "two", "three"]
Incidentally the project has just been updated to Swift 2.1, so all Playgrounds should all work as expected now.