Sunday, May 19, 2024
HomeiOS Developmentios - Situation with Listing in SwiftUI

ios – Situation with Listing in SwiftUI


I’ve the next view which consists of an inventory of swimming pools:

var physique: some View {

    ScrollView {

        ForEach(Array(self.poolStore.swimming pools.enumerated()), id: .ingredient) { index, ingredient in

            NavigationLink(vacation spot: PoolMasterViewDetails(poolMasterViewRouter: EditDetails(), pool: ingredient)) {
                            
                smallcardView(pool: ingredient)
                                
            }

        }

    }
    .onAppear() {

        self.fetchPoolsInDashboard()

    }

}



struct smallcardView: View {

    let pool: Pool

    var physique: some View {

        VStack() {
        
            HStack {

                if (pool.sort == "Survivor") {
                    
                    Picture("survival")
                        .resizable()
                        .body(width: 120, peak: 90)
                        .cornerRadius(10)
                    
                } else {
                    
                    Picture("pickem")
                        .resizable()
                        .body(width: 120, peak: 90)
                        .cornerRadius(10)
                    
                }


                VStack(alignment: .main) {
  
                    Spacer()
                    
                    Textual content(pool.title)
                        .foregroundColor(Colour.textColor)
                        .font(.title3)
                        .body(width: 225, alignment: .main)
                        .padding(.backside, 0.1)
                    
                    Textual content(pool.id)
                        .foregroundColor(Colour.textColor)
                        .font(.system(dimension: 16))
                    
                    Spacer()

                }
                .padding(.main)
                
                Spacer()

            }
        
        }
        .padding()
        .body(maxWidth: .infinity)
        .body(peak: 120)

    }

}

IF the checklist comprises a number of swimming pools within the customers dashboard, if the person click on let’s imagine the final merchandise within the checklist, goes to the detailed view of the pool.

After they navigate again to the dashboard (checklist of swimming pools) the merchandise they chose is on the prime of the checklist as a substitute of it being on the backside of the checklist (as anticipated). The checklist can also be scrolled to the highest of the checklist as nicely within the dashboard view!?

Because the checklist can also be ordered by poolID which is why it was on the on the backside of the checklist within the first place!?

I’m not sure the right way to get this fastened.

I’m anticipating that the person clicks on an merchandise within the checklist, navigates to the detailed view and after they navigate again that the checklist is in the identical order (by poolID) and that the person is in the identical scroll location or whereabouts from the merchandise they clicked.

Can any present any perception on this, are you aware if this can be a bug in SwiftUI?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments