In Swift, Optional,? And! The relationship between
Optional <ClassName> equivalence with ClassName?
Yes, ClassName! forcing a value causes a crash ( if the object is nil, the value crashes )
imageview!. Image is a imageView forced unpacking, ImageView. image! is the forced unpacking of the image, and if it is found to be nil after unpacking, the crash
Apart from! And? , there is a kind of thing called nilliteralconvertible
'? ' must is followed by a call, member lookup, or subscript
Summary
1. Use a question mark? The object allows nil to appear, using an exclamation point! The object appears nil will crash
2. Use a question mark? Scenarios require content on the right side of the object, except when declared
3. Can I put a question mark? With an exclamation point! Understood as unpacking operations,? Support Package is empty, and! Crashes when the package is empty
In Swift, Optional,? And! The relationship between