The Swift compiler complains about
let insets : UIEdgeInsets? = UIApplication.shared.delegate?.window?.safeAreaInsets
with the error message
Value of optional type UIWindow? must be unwrapped to refer to member safeAreaInsets of wrapped base type UIWIndow. Chain the optional using '?' to access member safeAreaInsets only for non-nil base values.
The code
let insets : UIEdgeInsets? = UIApplication.shared.delegate?.window??.safeAreaInsets
works fine. Why is the second question mark after window
required? The two question marks here do not seem to constitute the nil-coalescing operator. I'm obviously missing something.