Skip to content

Commit

Permalink
Don't use forced unwrapping for view
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed May 16, 2024
1 parent 41dddd7 commit 3cac587
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ class InstantOnboardingViewController: UIViewController, ProgressAlertHandler {

// MARK: - Notifications
@objc private func keyboardWillShow(_ notification: Notification) {
guard let userInfo = notification.userInfo else { return }
guard let userInfo = notification.userInfo,
var keyboardFrame: CGRect = userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as? CGRect,
let contentView = contentView else { return }

var keyboardFrame: CGRect = (userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue
keyboardFrame = view.convert(keyboardFrame, from: nil)

var contentInset = contentView.contentScrollView.contentInset
Expand All @@ -185,9 +186,9 @@ class InstantOnboardingViewController: UIViewController, ProgressAlertHandler {
}

@objc private func keyboardWillHide(_ notification: Notification) {
contentView.spacer.isHidden = false
contentView.bottomSpacer.isHidden = true
contentView.contentScrollView.contentInset = UIEdgeInsets.zero
contentView?.spacer.isHidden = false
contentView?.bottomSpacer.isHidden = true
contentView?.contentScrollView.contentInset = UIEdgeInsets.zero
}

// MARK: - action: configuration
Expand Down

0 comments on commit 3cac587

Please sign in to comment.