From 5109a6968201a097b9364eb61a6b90ecd740a293 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 4 Nov 2024 20:23:26 -0800 Subject: [PATCH] Fix deprecation warning by using registerForTraitChanges. --- .../InteractiveNavigationController.swift | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/iOS/UIKit Extensions/InteractiveNavigationController.swift b/iOS/UIKit Extensions/InteractiveNavigationController.swift index eb939fc3d..95ec8a304 100644 --- a/iOS/UIKit Extensions/InteractiveNavigationController.swift +++ b/iOS/UIKit Extensions/InteractiveNavigationController.swift @@ -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 } - }