fix visionOS build

This commit is contained in:
Thomas Ricouard 2024-09-10 11:44:14 +02:00
parent 8f7df06d21
commit 0a15f7ff1c
2 changed files with 4 additions and 2 deletions

View File

@ -142,12 +142,14 @@ struct AppView: View {
.tag(tab) .tag(tab)
} }
} }
.id(availableTabs.count) /// Resets the TabView state when the number of tabs changes to avoid navigation bar issues and prevent crashes .id(availableTabs.count)
#if !os(visionOS)
.introspect(.tabView, on: .iOS(.v17, .v18)) { (tabview: UITabBarController) in .introspect(.tabView, on: .iOS(.v17, .v18)) { (tabview: UITabBarController) in
tabview.tabBar.isHidden = horizontalSizeClass == .regular tabview.tabBar.isHidden = horizontalSizeClass == .regular
tabview.customizableViewControllers = [] tabview.customizableViewControllers = []
tabview.moreNavigationController.isNavigationBarHidden = true tabview.moreNavigationController.isNavigationBarHidden = true
} }
#endif
} }
var notificationsSecondaryColumn: some View { var notificationsSecondaryColumn: some View {

View File

@ -5,7 +5,7 @@ import SwiftUI
public extension View { public extension View {
func addTranslateView(isPresented: Binding<Bool>, text: String) -> some View { func addTranslateView(isPresented: Binding<Bool>, text: String) -> some View {
#if targetEnvironment(macCatalyst) #if targetEnvironment(macCatalyst) || os(visionOS)
return self return self
#else #else
if #available(iOS 17.4, *) { if #available(iOS 17.4, *) {