The UI part (IBOutlet) linked from the StoryBoard will be of the ImplicitlyUnwrappedOptionsal type, but will it not become nil after the linked class is instantiated?
Migrating from Objective-C to Swift and
Until now, when I changed the frame of the associated UI part, I initialized it again as follows, assuming that it was nil, but I got an error with Swift.
If it does not become nil, I think I can handle it by changing only the value as below, but what do you think?swift xcode swift3
Quote from this Discussion:
This method establishes a strong reference to view and sets next responder to the receiver, which is new superview.
Because Superview strongly references Subview, it does not become
nil.This is the same with View deployments in Storyboard/Interface Builder.
*From Swift3, the ImplicitlyUnwrappedOptionsal type has been deprecated.
The type with
! is the Optional type with the Auto Unwrap option and is not different from the Optional type.
© 2023 OneMinuteCode. All rights reserved.