Fix deprecation warning by using registerForTraitChanges.

This commit is contained in:
Brent Simmons 2024-11-04 20:23:26 -08:00
parent e60a9e55d7
commit 5109a69682

View File

@ -28,15 +28,13 @@ class InteractiveNavigationController: UINavigationController {
super.viewDidLoad()
poppableDelegate.navigationController = self
interactivePopGestureRecognizer?.delegate = poppableDelegate
registerForTraitChanges([UITraitUserInterfaceStyle.self], target: self, action: #selector(userInterfaceStyleDidChange))
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
configure()
}
@objc func userInterfaceStyleDidChange() {
configure()
}
}
// MARK: Private
@ -62,5 +60,4 @@ private extension InteractiveNavigationController {
toolbar.compactAppearance = toolbarAppearance
toolbar.tintColor = AppAssets.primaryAccentColor
}
}