So I am having a weird issue where in my view stack, .onAppear is running my function to pull data from my server, but it fails to display card elements that I have created for the interface. What I am trying to achieve is when the user opens the app and it takes them to the dashboard it will show the various headlines of the platform. I am not getting any errors, as the JSON Object is being read correctly.

Some things that I have read is that the view may need to be updated after .onAppear is called, but the resources I have found don't really explain how to do so. The first bit of code is my JSON Object:

{"results" : [{"id":1,"title":"Meet ergoWare","header_image":"http://gba.ergoware.io/cache/content/topstory/ergo_news_01.svg","summary":"GBA's New Ergonomic Portal!"}]}

That is pulled in through this function

func loadHeadlines(CDNLink: String) { guard let url = URL(string: CDNLink) else { print("Invalid URL") return } let request = URLRequest(url: url) URLSession.shared.dataTask(with: request) { data, response, error in if error != nil { print("Fetch failed: \(error?.localizedDescription ?? "Unknown error")") return } else { do { let decodedResponse = try JSONDecoder().decode(Response.self, from: data!) print(decodedResponse) self.results = decodedResponse.results } catch let err { print("Error parsing: \(err)") } } }.resume() }

Then tagging on .onAppear to my HStack, it preforms the function and runs my ForEach Statement like so

ScrollView(showsIndicators: false){ Text("HEADLINES") .font(.system(size: 18)) .fontWeight(.medium) .foregroundColor(.secondary) .frame(maxWidth: .infinity, alignment: .leading) ScrollView(.horizontal, showsIndicators: false) { HStack { ForEach(results) { result in CardView(image: result.header_image, heading: result.title, summary: result.summary) } }.onAppear(perform:{self.loadHeadlines(CDNLink: "http://\(self.defaults.object(forKey: "domain") as! String)/cdn?funct=fetchNews")}) }

So my question is, why is the CardView not showing when the scene loads? Using Simulator, if I build and test the app, then switch out of the app and back in, the cards start showing up. Thank you for any insight you can provide. Below I have some links to my full code.

Dashboard View CardView