let arr = ["foo", "bar", nil, "baz"]
when I print it I get:
print(arr) // [Optional("foo"), Optional("bar"), nil, Optional("baz")]
However I'm looking to get an output that looks like:
print(arr) // ["foo", "bar", nil, "baz"]
I'm new to Swift's type system and the idea of downcasting and optionals. I know Optionals can be unwrapped using the !
operator or let x = arr.first {...}
but I'm not sur how to get the result I'm looking for or if it's even possible.