Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

how to unwrap arrays with optional value in swift

let arrayOfOptionals: [String?] = ["Seems", "like", "an", nil, "of", "optionals"]
let arrayWithNoOptionals = arrayOfOptionals.compactMap { $0 }
 
PREVIOUS NEXT
Tagged: #unwrap #arrays #optional #swift
ADD COMMENT
Topic
Name
1+8 =