Contents

presentEditMenu(with:)

Presents an edit menu using the object you provide for configuration.

Declaration

func presentEditMenu(with configuration: UIEditMenuConfiguration)

Parameters

  • configuration:

    The object containing the configuration details for the menu.

Discussion

You use this method to display the edit menu. The method calls editMenuInteraction(_:menuFor:suggestedActions:) on the interaction object’s delegate and updates the UI with the menu the delegate returns. This method dismisses any active menus before presenting the new menu.

The following example presents the menu from a gesture recognizer and provides the location of the gesture as the location for this interaction.

    @objc func didLongPress(_ recognizer: UIGestureRecognizer) {
        let location = recognizer.location(in: self.view)
        let configuration = UIEditMenuConfiguration(identifier: nil, sourcePoint: location)

        if let interaction = editMenuInteraction {
            // Presenting the edit menu interaction
            interaction.presentEditMenu(with: configuration)
        }
    }

See Also

Managing edit menu interactions