Check out example codes for "how to unwrap arrays with optional value in swift". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com