Просмотр исходного кода

ensure the tabbar isn't transparent

Mike Plante 1 год назад
Родитель
Сommit
28dcf7f443
1 измененных файлов с 20 добавлено и 0 удалено
  1. 20 0
      FreeAPS/Sources/Application/FreeAPSApp.swift

+ 20 - 0
FreeAPS/Sources/Application/FreeAPSApp.swift

@@ -62,12 +62,32 @@ import Swinject
             .default,
             "Trio Started: v\(Bundle.main.releaseVersionNumber ?? "")(\(Bundle.main.buildVersionNumber ?? "")) [buildDate: \(BuildDetails.default.buildDate())] [buildExpires: \(BuildDetails.default.calculateExpirationDate())]"
         )
+
+        // Configure global appearance for UITabBar
+        configureTabBarAppearance()
+
+        // Load services
         loadServices()
 
         // Clear the persistentHistory and the NSManagedObjects that are older than 90 days every time the app starts
         cleanupOldData()
     }
 
+    // Function to configure global tab bar appearance
+    private func configureTabBarAppearance() {
+        let appearance = UITabBarAppearance()
+        appearance.configureWithDefaultBackground()
+
+        // Blur the background
+        appearance.backgroundEffect = UIBlurEffect(style: .systemChromeMaterial)
+
+        // Keep background semi-transparent
+        appearance.backgroundColor = UIColor.clear
+
+        UITabBar.appearance().standardAppearance = appearance
+        UITabBar.appearance().scrollEdgeAppearance = appearance
+    }
+
     var body: some Scene {
         WindowGroup {
             Main.RootView(resolver: resolver)