Optional of optional in Swift
Issue #58
Do you know that an optional can itself contain an optional, that contains another optional? In that case, we need to unwrap multiple times
You mostly see it when you try to access window
1 | let window = UIApplication.shared.delegate?.window // UIWindow?? |
It is because delegate
can be nil, and its window
can be nil too.
1 | window??.backgroundColor = .yellow |