How to remove "look up, translate, search web" options and keep "Find selection" for selected text iOS 16

Viewed 30

Working with UITextView

//...
txtView.isFindInteractionEnabled = true
//...

My code:

override func buildMenu(with builder: UIMenuBuilder) {
    if #available(iOS 16.0, *) {
        builder.remove(menu: .lookup)
    }
    super.buildMenu(with: builder)
}

This will remove: Find selection, look up, translate, search web.

I want to keep only the option: "Find selection" and remove the others "look up, translate, search web"

1 Answers
    override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
        
        if action.description == "_findSelected:" {
            return true
        }else{
            return false
        }
    }
Related