Wednesday, October 21, 2026
HomeiOS Developmentios - Errors in displaying knowledge from a couple of API in...

ios – Errors in displaying knowledge from a couple of API in the identical view

[ad_1]

I’ve two API hyperlinks, they’re of the identical mannequin

However every unit is transferred to a special view with design and knowledge

I am attempting to indicate them beneath one another in the identical view earlier than transferring on

However each time I obtain new knowledge, I’ve issues with one in all them disappearing

Right here I’m displaying the 2 collectively

struct VideoViewAll : View {

@StateObject var mannequin = Api() // frist knowledge
@StateObject var model2 = Api() // Second knowledge

var physique: some View {

    VStack {
        ScrollView(.vertical, showsIndicators: false) {
            ForEach(mannequin.fashions) { merchandise in
                HStack {
                    NavigationLink(vacation spot: detiles(mannequin: merchandise)) {
                        Spacer()
                        VStack(alignment: .trailing, spacing: 15) {
                            Textual content(merchandise.title)
                            Textual content(merchandise.algiment)
                        }.padding(.trailing, 5)
                        let hyperlink = URL(string: APIgetURL.PathImage + (merchandise.image_path ?? ""))
                        URLImage(hyperlink!) { picture in
                            picture
                                .resizable()                          .body(maxWidth: 80, maxHeight: 80)
                        }
                    }.padding(.prime)
                }.padding(.trailing, 5)
                ForEach(model2.fashions) { merchandise in
                    HStack {
                        NavigationLink(vacation spot: detiles2(mannequin: merchandise)) {
                            Spacer()
                            VStack(alignment: .trailing, spacing: 15) {
                                Textual content(merchandise.title)
                                Textual content(merchandise.algiment)
                            }.padding(.trailing, 5)
                            let hyperlink = URL(string: APIgetURL.PathImage + (merchandise.image_path ?? ""))
                            URLImage(hyperlink!) { picture in
                                picture
                                    .resizable()                                     .body(maxWidth: 80, maxHeight: 80)
                            }
                        }
                    }.padding(.trailing, 5)
                }
            }
        }
    }
    .onAppear() {
        mannequin.getData(url: APIgetURL.Tap1)
        model2.getData(url: APIgetURL.Tap2)
    }
}
}

Is my methodology of displaying two knowledge mistaken?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments