Your Second iOS & SwiftUI App

Nov 4 2021 · Swift 5.5, iOS 15, Xcode 13

Part 3: Managing Rows

26. Swipe Actions

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 25. Sections Next episode: 27. Delete & Move Rows

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

We’ve been able to add books to our library for a few episodes now.

ForEach(books) { book in
          BookRow(book: book)
            🟩.swipeActions(edge: ######) { }
ForEach(books) { book in
          BookRow(book: book)
            .swipeActions(edge: 🟩.leading) { }
              🟩Button {
                
              } label: {
                
              }
              Button {
                  🟩book.readMe.toggle()
                  library.sortBooks()🟥
              } label: {
              Button {
                🟩withAnimation {
                  book.readMe.toggle()
                  library.sortBooks()
                🟩}
} label: {
  🟩book.readMe
  ?
? 🟩Label("Finished", systemImage: "bookmark.slash")
? Label("Finished", systemImage: "bookmark.slash")
🟩: Label("Read Me!", systemImage: "bookmark")
                : Label("Read Me!", systemImage: "bookmark")
              }
              🟩.tint(.accentColor)
        }
        .labelStyle(.iconOnly)
      } header: {
.swipeActions(edge: .trailing) {
Button(role: .destructive) {

} label: {

}
} label: {
  🟩Label("Delete", systemImage: "trash")
}
Button(role: .destructive) {
  🟩// TODO: Delete book
} label: {
  func deleteBooks() {

  }
  func deleteBook() {
    // TODO: Remove Book
    // TODO: Remove Image
  }