Skip to content
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 WallpaperSelectorViewController #23846

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WallpaperSelectorViewController: WallpaperBaseViewController, Themeable {

// Views
private lazy var contentView: UIView = .build { _ in }
private var collectionViewHeightConstraint: NSLayoutConstraint!
private var collectionViewHeightConstraint: NSLayoutConstraint?

private lazy var headerLabel: UILabel = .build { label in
label.font = FXFontStyles.Regular.headline.scaledFont()
Expand Down Expand Up @@ -89,7 +89,7 @@ class WallpaperSelectorViewController: WallpaperBaseViewController, Themeable {
// make collection view fixed height so the bottom sheet can size correctly
let height = collectionView.collectionViewLayout.collectionViewContentSize.height +
WallpaperSelectorViewController.UX.cardShadowHeight
collectionViewHeightConstraint.constant = height
collectionViewHeightConstraint?.constant = height
view.layoutIfNeeded()

collectionView.selectItem(at: viewModel.selectedIndexPath, animated: false, scrollPosition: [])
Expand Down Expand Up @@ -145,7 +145,8 @@ private extension WallpaperSelectorViewController {
view.addSubview(contentView)

collectionViewHeightConstraint = collectionView.heightAnchor.constraint(equalToConstant: 300)
collectionViewHeightConstraint.priority = UILayoutPriority(999)
collectionViewHeightConstraint?.priority = UILayoutPriority(999)
collectionViewHeightConstraint?.isActive = true

NSLayoutConstraint.activate([
contentView.topAnchor.constraint(equalTo: view.topAnchor),
Expand All @@ -165,7 +166,6 @@ private extension WallpaperSelectorViewController {
collectionView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
collectionView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -43),
collectionView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
collectionViewHeightConstraint
])
}

Expand Down