This operator is generally used to provide a default value when an expression or variable produces an optional result. for ex:
let i: Int? = 5
let j: Int? = nil
let value1 = i ?? 9 //value1 will be 5 non-optional
let value2 = j ?? 9 //value2 will be 9 non-optional
You can chain multiple of these operators as such:
let value3 = j ?? i ?? 9 //value3 will be 5 non-optional
The chain terminates whenever a non nil value is found. The result of the expression will be a optional/non-optional depending on the type of last expression in the chain.
The example you've provided although syntactically correct is redundant, as omitting the ?? nil
would have no result on the outcome.