I have got something like this:
let index = row.section?.index ?? -1
The nil-coalescing operator (a ?? b) unwraps an optional a if it contains a value, or returns a default value b if a is nil. The expression a is always of an optional type. The expression b must match the type that is stored inside a.
In this case, if row.section is nil, the entire expression (row.section?.index) is nil, therefore index will be set to -1
let index = row.section?.index should be incorrect. It must be wrapped into
let index = (row.section?.index)!