How to remove whitespace in String using pure Swift?

How to remove whitespace in String using pure Swift?

UIAlertController in Swift – Swift India – Medium

UIAlertController in Swift – Swift India – Medium