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 SurveySurfaceViewController (#23889)

Resolve implicitly_unwrapped_optional violations in SurveySurfaceViewController
  • Loading branch information
tonell-m authored Dec 21, 2024
1 parent 3e1fc42 commit 0914cc1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SurveySurfaceViewController: UIViewController, Themeable {
var notificationCenter: NotificationProtocol
var themeManager: ThemeManager
var themeObserver: NSObjectProtocol?
var imageViewYConstraint: NSLayoutConstraint!
var imageViewYConstraint: NSLayoutConstraint?
let windowUUID: WindowUUID
var currentWindowUUID: UUID? { windowUUID }

Expand Down Expand Up @@ -136,13 +136,13 @@ class SurveySurfaceViewController: UIViewController, Themeable {

private func constrainViews() {
imageViewYConstraint = imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor)
imageViewYConstraint?.isActive = true

NSLayoutConstraint.activate(
[
imageView.heightAnchor.constraint(equalToConstant: UX.imageViewSize.height),
imageView.widthAnchor.constraint(equalToConstant: UX.imageViewSize.width),
imageView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
imageViewYConstraint,

titleLabel.topAnchor.constraint(
equalTo: imageView.bottomAnchor,
Expand Down Expand Up @@ -211,12 +211,12 @@ class SurveySurfaceViewController: UIViewController, Themeable {
/// Changes the constraint of the imageView. This needs to be done separately
/// if we want to do it in an animation.
private func changeImageViewConstraint() {
NSLayoutConstraint.deactivate([imageViewYConstraint])
imageViewYConstraint?.isActive = false
imageViewYConstraint = imageView.centerYAnchor.constraint(
equalTo: view.centerYAnchor,
constant: -(view.frame.height * UX.imageViewCenterYOffset)
)
NSLayoutConstraint.activate([imageViewYConstraint])
imageViewYConstraint?.isActive = true
}

// MARK: - Button Actions
Expand Down

0 comments on commit 0914cc1

Please sign in to comment.