HomeiOS Developmentios - Components of my view turn into unresponsive after returning to...

ios – Components of my view turn into unresponsive after returning to app after prolonged length of time


In my venture, I’ve a difficulty. I’ve tried to copy the bug however I can not seem to do it. Nevertheless, it usually happens when I’m utilizing the app all through the day. It appears the bug happens once I return to the app after a big length of time after it has been dismissed however not terminated.

Components of my Residence view turn into unresponsive. I’m not certain why that is the case, perhaps it’s my view hierarchy?

In the true model of the venture, I’m displaying steps through HealthKit and a local advert utilizing Google Admob. Since I must make the code I provide reproducible I’ve stored the construction of the view however eliminated facets.

I’ve additionally eliminated the .onAppear technique (this might have one thing to do with the bug?)

Any concepts on what may very well be inflicting this? All over the place else within the app appears to work effective however I can not see something I’m doing otherwise.

Right here is the view hierarchy and fundamental construction:

struct HomeTest: View {
        
    var physique: some View {
        
        NavigationView {
            
            ZStack {
                Colour.white
                    .ignoresSafeArea()
                                
                VStack(spacing: 10) {
                    
                    // This HStack stays responsive
                    HStack {
                        
                        Picture(systemName: "apple.brand")
                                                
                        Spacer()
                        
                        NavigationLink(vacation spot: ExampleView()) {
                            Textual content("Faucet me")
                            
                        }
                      
                    }
                    .padding()
                   
                    ScrollView(.vertical, showsIndicators: false) {
                        
                        VStack {
                            // This turns into unresponsive
                                NavigationLink(vacation spot: ExampleView()) {
                                    HStack(spacing: 12) {
                                        VStack(alignment: .main, spacing: 4) {
                                            
                                            Textual content("Nav Hyperlink")
                                            
                                            
                                            
                                        }
                                    }
                                    .padding(16)
                                    .background(
                                        RoundedRectangle(cornerRadius: 12)
                                            .foregroundColor(.yellow)
                                    )
                                    .padding(.main)
                                    .padding(.trailing)
                                }
                        }
                        
                        VStack {
                            
                            HStack(alignment: .backside, spacing: 16) {
                                
                                // This turns into unresponsive
                                Button(motion: {
                                    print("Button Tapped")

                                })  {
                                    HStack {
                                        Textual content("A button")
                                        
                                        Picture(systemName: "chevron.proper")
                                    }
                                    .padding(10)
                                    .background(.orange)
                                    .cornerRadius(20)
                                }
                                                                
                                Divider()
                                    .body(top: 50)
                                                           
                                // This turns into unresponsive
                                NavigationLink(vacation spot: ExampleView()) {
                                    Picture(systemName: "particular person.2.fill")
                                }
                            }
                            .padding(.horizontal, 20)
                            .padding(.prime, 35)
                        }
                        .offset(y: -25)
                    }
                }
            }
        }
    }
}

struct ExampleView: View {
    var physique: some View {
        Textual content("Instance view")
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments