Recall an ObservedObject so that I can view my Array?

0

I am able to to populate my SwiftUi with this code in the ContentView with no problems. What I am trying to do is to recall my Array in a ForEach loop as a Function Call

Can someone tell me on how I can recall my @ObservedObject var networkStoryManager = StoriesNetworkManager()

struct ContentView: View {

@ObservedObject var networkStoryManager = StoriesNetworkManager()

var body: some View {

   VStack{
               List(networkStoryManager.stories) { story in
                Text(story.event)

                }
                .padding(.leading)
                .navigationBarTitle("Story")
                .frame(minWidth: 0, maxWidth: 400, minHeight: 0, maxHeight: 595)

             }
    .onAppear {
      self.networkStoryManager.fetchStoryData()
       }

    }
}

@hcri1950 Do you still have issues with this?

Hi @hcri1950,
SwiftUI is changing like Swift was around 2014-2015, so things keep changing and Apple’s own documentation is not stellar either. Many are trying to make sense of things as they understand and experiment or learn about this topic. So it can be a bit difficult to get a response as fast as you expect.

Have you had access to the books on Combine and SwiftUI? They do address how to fetch data into an observedObject.

cheers,

This topic was automatically closed after 166 days. New replies are no longer allowed.