Skip to content

Commit

Permalink
- fixed an issue when the heightConstraint receives an infinite value
Browse files Browse the repository at this point in the history
  • Loading branch information
BalazsSzamody committed Apr 25, 2022
1 parent 30b2942 commit 4fd8550
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,16 @@ open class KeyboardLayoutGuide: UILayoutGuide {
let intersectionFrame = activeWindow.frame.intersection(owningFrameInRoot)

let windowHeight = activeWindow.frame.height
let bottomDifference = windowHeight - (intersectionFrame.height + intersectionFrame.origin.y)
let bottomDifference = windowHeight - intersectionFrame.maxY

height -= bottomDifference
}


guard height != .infinity else {
// When the app is running in multiple windows, it can happen that both windows are `foregroundActive`
// and the intersection frame's origin can become infinite as the owning view is in the other window and the app would crash.
return
}
heightConstraint?.constant = height
if duration > 0.0 {
animate(note)
Expand Down

0 comments on commit 4fd8550

Please sign in to comment.