ios-nd-networking
ios-nd-networking copied to clipboard
"Swipe to delete" functionality on watchlist/favorites list
Many apps using tables will allow you to manage the list directly from the table view. As a simple new feature, we can do this for the watchlist and favorites list.
To get the "swipe to "delete" functionality, you'll want to implement some methods on your watchlist or favorites view controllers.
tableView(_:canEditRowAt:)
:
https://developer.apple.com/documentation/uikit/uitableviewdatasource/1614900-tableview
tableView(_:commit:forRowAt:)
:
https://developer.apple.com/documentation/uikit/uitableviewdatasource/1614871-tableview
In tableView(_:commit:forRowAt:)
, once you know the movie that's been deleted, you can simply remove it from the watchlist/favorites list using the same methods you used in MovieDetailViewController
, and don't forget to update the lists in MovieModel
accordingly.