Skip to content

Commit

Permalink
Refactor FXIOS-10205 [Swiftlint] Resolve 1 implicitly_unwrapped_optio…
Browse files Browse the repository at this point in the history
…nal violations in CreditCardBottomSheetHeaderView (#23807)

* Resolve warnings in CreditCardBottomSheetHeaderView

* Fix resulting error in CreditCardBottomSheetViewController

---------

Co-authored-by: Marceau Tonelli <[email protected]>
  • Loading branch information
tonell-m and tonelli-m authored Dec 17, 2024
1 parent b3e04b8 commit 97727b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CreditCardBottomSheetHeaderView: UITableViewHeaderFooterView, ReusableCell
static let logoSize: CGFloat = 36.0
static let closeButtonMarginAndWidth: CGFloat = 46.0
}
public var titleLabelTrailingConstraint: NSLayoutConstraint!
public var titleLabelTrailingConstraint: NSLayoutConstraint?

// MARK: Views
public var viewModel: CreditCardBottomSheetViewModel? {
Expand Down Expand Up @@ -88,10 +88,11 @@ class CreditCardBottomSheetHeaderView: UITableViewHeaderFooterView, ReusableCell

addSubview(mainContainerStackView)
let isCloseButtonOverlapping = traitCollection.horizontalSizeClass != .regular
titleLabelTrailingConstraint = titleLabel.trailingAnchor.constraint(
let titleLabelTrailingConstraint = titleLabel.trailingAnchor.constraint(
equalTo: firstRowContainerView.trailingAnchor,
constant: isCloseButtonOverlapping ? -UX.closeButtonMarginAndWidth : 0
)
self.titleLabelTrailingConstraint = titleLabelTrailingConstraint

NSLayoutConstraint.activate(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class CreditCardBottomSheetViewController: UIViewController,
let contentViewWidth = contentWidthCheck ? size.width - UX.containerPadding : UX.contentViewWidth
contentWidthConstraint.constant = contentViewWidth
if let header = cardTableView.headerView(forSection: 0) as? CreditCardBottomSheetHeaderView {
header.titleLabelTrailingConstraint.constant = contentWidthCheck ? -UX.closeButtonMarginAndWidth : 0
header.titleLabelTrailingConstraint?.constant = contentWidthCheck ? -UX.closeButtonMarginAndWidth : 0
}
}

Expand Down

0 comments on commit 97727b4

Please sign in to comment.