Skip to content

Commit

Permalink
Update demo project from latest merge request
Browse files Browse the repository at this point in the history
  • Loading branch information
lascic committed May 12, 2022
1 parent cc69ac0 commit e0edcb6
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ final class UIOnboardingViewController: UIViewController {
}
private var overlayIsHidden: Bool = false
private var hasScrolledToBottom: Bool = false
private var needsUIRefresh: Bool = true

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return device.userInterfaceIdiom == .pad ? .all : .portrait
Expand Down Expand Up @@ -78,7 +79,15 @@ final class UIOnboardingViewController: UIViewController {

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
updateUI()
if needsUIRefresh {
updateUI()
needsUIRefresh = false
}
}

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
needsUIRefresh = true
}

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
Expand All @@ -93,6 +102,7 @@ final class UIOnboardingViewController: UIViewController {
} else {
onboardingTextView.font = UIFontMetrics.default.scaledFont(for: .systemFont(ofSize: traitCollection.horizontalSizeClass == .regular ? 15 : 13), maximumPointSize: traitCollection.horizontalSizeClass == .regular ? 21 : 19)
}
needsUIRefresh = true
onboardingTextView.layoutIfNeeded()
continueButton.layoutIfNeeded()
}
Expand Down

0 comments on commit e0edcb6

Please sign in to comment.