Remove nil elements from an array while changing the array type

I always forget how to remove nil elements from an array in a functional way in Swift.

Here it is:

let arrayWthOptionals: [String?] = ...
let arrayWithoutOptionals: [String] = arrayWthOptionals.compactMap ({ $0 })

The resulting array is an array of non-optional.