Skip to content

Commit 82004a0

Browse files
committed
Refactors to avoid force unwrapping
1 parent 89bf8ef commit 82004a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

KeyboardLayoutGuide/KeyboardLayoutGuide/Keyboard+LayoutGuide.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ extension Notification {
118118
}
119119
// Weirdly enough UIKeyboardFrameEndUserInfoKey doesn't have the same behaviour
120120
// in ios 10 or iOS 11 so we can't rely on v.cgRectValue.width
121-
return (UIApplication.shared.keyWindow?.bounds.height)! - v.cgRectValue.minY
121+
let screenHeight = UIApplication.shared.keyWindow?.bounds.height ?? UIScreen.main.bounds.height
122+
return screenHeight - v.cgRectValue.minY
122123
}
123124
}
124125

0 commit comments

Comments
 (0)