I have a simple UIMenu in my app. As expected the interface style updates with the system. However, my app has the option of overriding the system interface style (i.e. light/dark), so I want to be able to override this default behavior.
There is no overrideUserInterfaceStyle property on UIMenu.
I have tried overriding the user interface style of the VC, which didn't work.
None of the solutions from this post work: Is there any way to override the (dark/light) user interface style of iOS 13 Context Menus?
It works for me:
if let keyWindow = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.flatMap { $0.windows }.first { $0.isKeyWindow } {
keyWindow.overrideUserInterfaceStyle = darkThemeIsNeeded ? .dark : .light
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With