The problem of unwrapped and wrapped variable value
When we define a tableview, we can use 3 definitions, the first of which is defined as optional (anyobject? form, the second form of non-optional (Anyobject and anyobject! )。
variables in the optional mode need to be unpacked when used, as follows:
Because objects in View.addsubview only support unpacking objects (func addsubview (view: UIView)), you need to unpack the object when you add a child view.
The non-optional- mode variable is used directly when using the object, as follows:
So we need to remove all the unpacking operations:
Summary:
Although these little grammatical features are not so much of a concern, the design requirements are not complete when designing complex class structures that are not very clear at the end of the branch.
The problem of unwrapped and wrapped variable value