I'd like to use CharacterSet.whitespacesAndNewlines
to remove whitespace from a string.
However, the code below does not compile.
myString.replacingOccurrences(of: CharacterSet.whitespacesAndNewlines, with: "")
// Instance method 'replacingOccurrences(of:with:options:range:)' requires that 'CharacterSet' conform to 'StringProtocol'
What is a simple way to achieve the intended result?