Created
February 20, 2020 19:30
-
-
Save ppamorim/ee4b78405b2b48392d7c1a686be0e461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@available(iOS 13.0, *) | |
func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { | |
let actionProvider: UIContextMenuActionProvider = { _ in | |
let confirmDelete: UIMenu = UIMenu(title: "something".localized, options: [UIMenu.Options.destructive], children: [ | |
UIAction(title: "delete".localized, attributes: [.destructive]) { [weak self] _ in | |
//..... | |
}, | |
UIAction(title: "cancel".localized) { _ in } | |
]) | |
return UIMenu( | |
title: "options".localized, | |
children: [confirmDelete]) | |
} | |
return UIContextMenuConfiguration( | |
identifier: "SomeOptions" as NSCopying, | |
previewProvider: nil, | |
actionProvider: actionProvider) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment