Case 1
self.view
is force cast to SKView?
(a.k.a. Optional<SKView>
). If this cast fails (when self.view
isn't actually an SKView?
), then the program will crash to prevent going into an inconsistent state.
The resulting SKView?
is then safely unwrapped and assigned to view
if it's not nil
, otherwise the else
case is executed, if there is one.
Case 2
self.view
is safely cast to SKView
. The result of this expression is a SKView
. It will have a valid value (if the cast was possible), or nil
if the cast wasn't possible. Unlike the first case, it won't crash.
The resulting SKView?
is then safely unwrapped and assigned to view
if it's not nil
, otherwise the else
case is executed, if there is one.