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 BottomSheetViewController #23795

Merged
Merged
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 @@ -58,7 +58,7 @@ public class BottomSheetViewController: UIViewController,
private lazy var sheetView: UIView = .build { _ in }
private lazy var contentView: UIView = .build { _ in }
private lazy var scrollContentView: UIView = .build { _ in }
private var contentViewBottomConstraint: NSLayoutConstraint!
private var contentViewBottomConstraint: NSLayoutConstraint?
private var viewTranslation = CGPoint(x: 0, y: 0)
private let windowUUID: WindowUUID

Expand Down Expand Up @@ -103,7 +103,7 @@ public class BottomSheetViewController: UIViewController,
listenForThemeChange(view)
setupView()

contentViewBottomConstraint.constant = childViewController.view.frame.height
contentViewBottomConstraint?.constant = childViewController.view.frame.height
view.layoutIfNeeded()
}

Expand All @@ -114,7 +114,7 @@ public class BottomSheetViewController: UIViewController,

override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
contentViewBottomConstraint.constant = 0
contentViewBottomConstraint?.constant = 0
UIView.animate(withDuration: viewModel.animationTransitionDuration) {
self.view.backgroundColor = self.viewModel.backgroundColor
self.view.layoutIfNeeded()
Expand Down Expand Up @@ -176,6 +176,8 @@ public class BottomSheetViewController: UIViewController,
view.accessibilityElements = [closeButton, sheetView]

contentViewBottomConstraint = sheetView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
contentViewBottomConstraint?.isActive = true

let scrollViewHeightConstraint = scrollView.heightAnchor.constraint(
greaterThanOrEqualTo: scrollContentView.heightAnchor)

Expand All @@ -193,7 +195,6 @@ public class BottomSheetViewController: UIViewController,
sheetView.topAnchor.constraint(greaterThanOrEqualTo: view.topAnchor,
constant: BottomSheetViewController.UX.minVisibleTopSpace),
sheetView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
contentViewBottomConstraint,
sheetView.trailingAnchor.constraint(equalTo: view.trailingAnchor),

contentView.topAnchor.constraint(equalTo: sheetView.topAnchor),
Expand Down Expand Up @@ -284,7 +285,7 @@ public class BottomSheetViewController: UIViewController,

public func dismissSheetViewController(completion: (() -> Void)? = nil) {
childViewController.willDismiss()
contentViewBottomConstraint.constant = childViewController.view.frame.height
contentViewBottomConstraint?.constant = childViewController.view.frame.height
UIView.animate(
withDuration: viewModel.animationTransitionDuration,
animations: {
Expand Down