-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FXIOS-10205 [Swiftlint] Resolve 1 implicitly_unwrapped_optional violations in BottomSheetViewController #23795
Refactor FXIOS-10205 [Swiftlint] Resolve 1 implicitly_unwrapped_optional violations in BottomSheetViewController #23795
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi 👋 Thank you so much for this contribution! This code looks good to me I just had one small question. Thanks again for your help.
let contentViewBottomConstraint = sheetView.bottomAnchor.constraint(equalTo: view.bottomAnchor) | ||
self.contentViewBottomConstraint = contentViewBottomConstraint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change needed as part of the unwrapped optional change? Couldn't we continue to set the classes property directly without needing to create an intermediate property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi 👋
This property is then used in NSLayoutContraints.activate([...])
, so there is two possible approaches here, either use an intermediate property like this that will be non optional, or assign the property directly and right after add a guard let
statement to safely unwrap the property before using it in the constraints array, which seemed a bit awkward to me for a property that is just initialized here.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. That makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Cramsden, as suggested by @PARAIPAN9 in #23833 it's actually more consistent with the rest of the codebase to just activate the newly created constraint in place after initialising it as a class property instead of using a temporary local property, see the latest commit for details.
ComponentLibrary: Coverage: 32.33
Generated by 🚫 Danger Swift against ad250b0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonell-m, great job and thanks for addressing the change!!
…nal violations in BottomSheetViewController (#23795) * Resolve warnings in BottomSheetViewController * Initialise and activate constraint in place --------- Co-authored-by: Marceau Tonelli <[email protected]>
📜 Tickets
Jira ticket
Github issue
💡 Description
Continuing resolving
implicitly_unwrapped_optional
violations in order to enable the rule for further developments.📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120
)