swift - split now complains about missing "isSeparator" -
after latest upgrade of swift 1.2, can't figure out how split line of text words. used this:
let bits = split(value!, { $0 == " "}, maxsplit: int.max, allowemptyslices: false)
but no longer works, because...
cannot invoke 'split' argument list of type '(string, (_) -> _, maxsplit: int, allowemptyslices: bool)'
ummm, ok, though last build? whatever, let's try...
let bits = split(value!, { $0 == " "})
well , every other version can think of ends saying:
missing argument parameter 'isseparator' in call
let's hear beta-testing new programming languages! yay!
anyone know correct secret sauce 1.2?
it seems order of parameters changed in swift 1.2:
let bits = split(value!, maxsplit: int.max, allowemptyslices: false, isseparator: { $0 == " "})
or, using default values:
let bits = split(value!, isseparator: { $0 == " "})
the predicate last parameter , requires external parameter name isseparator
because preceded optional parameters.
the advantage of change can use trailing closure syntax:
let bits = split(value!, maxsplit: int.max, allowemptyslices: false) { $0 == " " }
or
let bits = split(value!) { $0 == " " }