📜  如何在 swift 代码示例中解开具有可选值的数组

📅  最后修改于: 2022-03-11 15:01:03.504000             🧑  作者: Mango

代码示例1
let arrayOfOptionals: [String?] = ["Seems", "like", "an", nil, "of", "optionals"]
let arrayWithNoOptionals = arrayOfOptionals.compactMap { $0 }