"".split(whereSeparator: \.isNewline) // it's [], should it be [""]?

I'm surprised it's doing this. What's the reasoning?

just a spce works as I expect:

" ".split(whereSeparator: \.isNewline)   // [" "]

Try adding omittingEmptySubsequences: false to the call, see docs. There are two widely used conventions for how splitting should treat empty tokens, and this is the function parameter to control which way you want it to be. It's true by default.

1 Like

Wonder why auto complete do not show this version of split:

but I can type it out and use it just fine...

1 Like

Autocomplete doesn't show all variations of functions with defaulted parameters. It really should, with a better UI to choose the variant and parameters you want, but right now it doesn't.

1 Like

I hope autocomplete can be improved to show all choices.

It should also show any choices available from more specific conditional conformance

this would great help with api discovery and learning.

1 Like