Skip to content

Commit

Permalink
slight tweak of the context menu interface
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed Aug 3, 2021
1 parent 4a8e297 commit 017a62c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Sources/UIComponent/Components/TappableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ open class TappableView: ComponentView {
}
}

public var contextMenuProvider: UIContextMenuActionProvider? {
public var contextMenuProvider: ((TappableView) -> UIMenu?)? {
didSet {
if contextMenuProvider != nil {
addInteraction(contextMenuInteraction)
Expand Down Expand Up @@ -106,7 +106,10 @@ open class TappableView: ComponentView {

extension TappableView: UIContextMenuInteractionDelegate {
public func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil, actionProvider: contextMenuProvider)
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { [weak self] _ in
guard let self = self else { return nil }
return self.contextMenuProvider?(self)
}
}
}

Expand Down

0 comments on commit 017a62c

Please sign in to comment.