struct ContentView: View {
   @Environment(ApplicationData.self) private var appData

   var body: some View {
      List {
         ForEach(appData.userData) { book in
            CellBook(book: book)
               .swipeActions {
                  Button(role: .destructive, action: {
                     removeBook(book: book)
                  }, label: {
                     Image(systemName: "trash")
                  })
               }
         }
      }.listStyle(.plain)
   }
   func removeBook(book: Book) {
      var indexes = IndexSet()
      if let index = appData.userData.firstIndex(where: { $0.id == book.id }) {
         indexes.insert(index)
      }
      appData.userData.remove(atOffsets: indexes)
   }
}