3 ms·
let 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, b
by bsaul 7y ago
let 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.