stringscompactMap
stringscompactMap is a method available on collections of strings in Swift. It's designed to transform each string in the collection into an optional string and then collect all the non-nil results into a new array. This is particularly useful when you need to perform an operation on each string that might not always yield a valid result, such as converting a string to an integer or parsing a string into a specific object.
The compactMap operation iterates through the original collection. For each string, it applies a given closure.
This method is a more concise and efficient way to achieve the same result as using a