Split string into array

I’m puzzled why i’m getting an error here. It suggests that [String] is different from Array, but I don’t know what the conversion would be. Any pointers?

func StringSplit(s: String) -> [String] {
return s.componentsSeparated(by: " ")
}

I’m getting error: 'Type mismatch, expected “Swift.Array”

how/where is componentsSeparated(by) defined, and what’s it’s result type? probably NSArray, which is an immutable array, while [String] is mutable — this not directly assignable. try calling .mutableCopy.

i could/should probably add an explicit cast operator from immutable NSArray to Swift.Array. Will log an issue for that.

Thanks, logged as bugs://76891