6 ms·
> you see another language try to come up to solutions to a problem you never had ...didn't Swift have the same problem to witch it came with the same solution
by nnq 7y ago
> you see another language try to come up to solutions to a problem you never had
...didn't Swift have the same problem to witch it came with the same solution? (I mean `?.`)
- bsaul 7y agolet a:[Int]? = nil let ai = a?[0] and let b: [Int:[Int]]? = nil let bi = b?[0]?[0] are valid in swift. ?. is used when you want to access a property, but i've never thought of it as an operator. Rather, i see it as "a?" (aka : unwrap a) followed by "." dot operator to access a property. I basically just replace a with a? every time a becomes nullable, and that's it.