Gold Challenge - tough one

In Chapter 10, they have you create a custom table view cell; that might be what you would need to do to have more control over the placement of the button control within the cell. But I’m not sure how that would work out in practice. In order to implement a useful button, you would need to know which row the button was in when it was pressed and that isn’t part of the UIButton interface.

As for the other questions, I went with the recommended approach & implemented swipe right to toggle favorite on & off for an item:

Click to see code
    override func tableView(_ tableView: UITableView,
                            leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

        let favorite = getSectionItems(for: indexPath.section)[indexPath.row].favorite
        let title = favorite ?
            NSLocalizedString("Unfavorite", comment: "Unfavorite") :
            NSLocalizedString("Favorite", comment: "Favorite")

        let action = UIContextualAction(style: .normal,
                                        title: title,
                                        handler: { (action, view, completionHandler) in
                                            // Update data source when user taps action
                                            self.getSectionItems(for: indexPath.section)[indexPath.row].setFavorite(!favorite)
                                            completionHandler(true)
                                        }
        )

        action.backgroundColor = favorite ? .red : .green
        let configuration = UISwipeActionsConfiguration(actions: [action])
        return configuration
    }