Benjamin RD
Benjamin RD

Reputation: 12034

Change View using EmptyView fullScreenCover not working in iOS 15

Days ago, I was using:

class SplashViewModel: ObservableObject {
    @Published var isActive: Bool = false
    @Published var isMantinance: Bool = false
    @Published var hasPreviousLogIn:Bool = false
}


struct SplashView: View {
@ObservedObject var model = SplashViewModel()

func verifyMantinance() {
   model.isActive = true
}

var body: some View {
        
        Color.init(hex: "#FFFFFF")
            .overlay(
            
        ZStack {
            VStack {
                
                EmptyView().fullScreenCover(isPresented: $model.isActive)
                      { QueryView() }

                GeometryReader { gp in
                    ZStack {
                        
                        Image("logo")
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                            .padding(EdgeInsets(top: 35, leading: 20, bottom: 10, trailing: 20))
                            .frame(width: UIScreen.main.bounds.width * 0.75)
                            .position(x: gp.size.width / 2, y: gp.size.height / 2)
                            
                            .onAppear {
                                DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
                                    self.verify()
                                }
                            }
                        
                        
                    }
                }
            }
        }
            
            ).ignoresSafeArea(.all)
        
    }
}

It's was working properly with iOS 14, once I updated my device to iOS 15, the redirection with EmptyView().fullScreenCover is not working anymore. Nothing happens, no error, no warning, nothing related to this process.

Someone have an idea about how I can make it work again?

Upvotes: 1

Views: 676

Answers (1)

this is easily fixed, just "attach"

.fullScreenCover(isPresented: $model.isActive){ QueryView() } 

to the VStack. There is no need for the EmptyView

Upvotes: 1

Related Questions