Skip to content

Commit

Permalink
Fix demo: handle size updates animated if navigationController doesn'…
Browse files Browse the repository at this point in the history
…t exist
  • Loading branch information
mikhailmaslo committed Aug 15, 2022
1 parent 821ac4c commit 1870921
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,17 @@ final class ResizeViewController: UIViewController {

private func updateContentHeight(newValue: CGFloat) {
guard newValue >= 200 && newValue < 5000 else { return }

currentHeight = newValue
updatePreferredContentSize()

let updates = { [self] in
currentHeight = newValue
updatePreferredContentSize()
}

if navigationController == nil {
UIView.animate(withDuration: 0.25, animations: updates)
} else {
updates()
}
}

@objc
Expand Down

0 comments on commit 1870921

Please sign in to comment.