Search code examples
listviewswiftuiswiftui-listswiftui-navigationlink

dynamic content not updating in list Swift UI


I am having real trouble here. I have a list that I am trying to add a new item to the list each time I add a new line of data to my data file however it is just showing the same data.

I have scoured the internet and even tried following the apple developer site.

Data

List Item

List View


Solution

  • struct ListItem: View {
         var item: VocabItem
          ...  
    }
    
    struct VocabList {
         .
         .
         .
           
           ForEach(items) { item in
               ListItem(item: item)
           }
    }