From 504de69dd1c765c09f676a8b780a172fa15420fb Mon Sep 17 00:00:00 2001
From: Diogo Simao Marques <dogo@videolabs.io>
Date: Tue, 18 Feb 2025 16:28:52 +0100
Subject: [PATCH] AppearanceManager: Properly set the interface style

The user interface style is now properly set on iOS as it used to
be and still supports the visionOS windows.

This fixes a visual glitch previously introduced with the support
of the visionOS compilation.
---
 Sources/Helpers/AppearanceManager.swift | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Sources/Helpers/AppearanceManager.swift b/Sources/Helpers/AppearanceManager.swift
index 4aa3a1788..899b1e2b3 100644
--- a/Sources/Helpers/AppearanceManager.swift
+++ b/Sources/Helpers/AppearanceManager.swift
@@ -59,9 +59,13 @@ class AppearanceManager: NSObject {
                            initialSpringVelocity: 0,
                            options: .curveEaseIn,
                            animations: {
+#if os(iOS)
+                UIApplication.shared.keyWindow?.overrideUserInterfaceStyle = theme.isDark ? .dark : .light
+#else
                 if let window = UIApplication.shared.delegate?.window {
                     window?.overrideUserInterfaceStyle = theme.isDark ? .dark : .light
                 }
+#endif
             })
         }
     }
-- 
GitLab