HenrikSwahn / DV1431

0 stars 0 forks source link

Implement insertion into WishList #4

Closed devinant closed 8 years ago

devinant commented 8 years ago

3 needs to be done before this.

When the user swipes on a search item and selects "+ Wish List", then this item needs to be added into the wishlist. This code is located in SearchEntryTableViewController

Affected code:

// MARK: - Wishlist
func wishAction() -> (action: UITableViewRowAction, indexPath: NSIndexPath) -> Void {
    return { [unowned self] (action, indexPath) in
        // [Code for adding the item into the wishlist here] 
        // Remember to use self.context here. It will give you what type of media this is
        self.tableView.setEditing(false, animated: true)
    }
}
devinant commented 8 years ago

Optional: The code above can be refactored to:

func wishAction(action: UITableViewRowAction, indexPath: NSIndexPath) -> Void {
    // [Code for adding the item into the wishlist here] 
    // Remember to use self.context here. It will give you what type of media this is
    self.tableView.setEditing(false, animated: true)
}