Swift Remova o espaço da corda

let freedSpaceString = str.filter {!$0.isWhitespace}
Adventurous Anteater