title: How can I save a list of data so that it remains after the app is relaunched for any specific user?
body: <p>I create the empty savedList in my ViewModel</p>
  <pre><code>@Published var savedList:[Categories] = [Categories]()
  </code></pre>
  <p>Then I create the code so that any restaurant can be saved and then it is added to the array</p>
  <pre><code>struct DetailView2: View {
  
  var restaurantInfo:Categories
  @EnvironmentObject var a:CategoriesModel
  
  @State var isSaved = false
  
  var body: some View {
      
      VStack {
          ZStack(alignment: .bottomLeading) {
              Image(restaurantInfo.pic)
                  .resizable()
                  .scaledToFit()
              Button(action: {
                  if isSaved == true {
                      let i = a.savedList.firstIndex(of: restaurantInfo)
                      a.savedList.remove(at: i!)
                      isSaved = false
                  } else if isSaved == false {
                      a.savedList.append(restaurantInfo)
                      isSaved = true
                  }
              }, label: {
                  if a.savedList.contains(restaurantInfo) {
                      Image(systemName: &quot;bookmark.fill&quot;)
                          .padding()
                          .background(Color.blue)
                          .foregroundColor(.white)
                          .cornerRadius(12)
                          .padding()
                  } else {
                      Image(systemName: &quot;bookmark&quot;)
                          .padding()
                          .background(Color.blue)
                          .foregroundColor(.white)
                          .cornerRadius(12)
                          .padding()
                  }
              })
          }
  </code></pre>
  <p>This code saves the restaurants properly, but how do I make it so that the array remains saved even after any particular user exits the app and re enters it. @AppStorage doesn't work for arrays.</p>