Hi everyone,
I’m working on an app that uses WKWebView. Due to security concerns, our customers want the app to disable copy-paste functionality and similar options (such as Lookup and Share, allowing users to extract text from the app or save it as a file.
I was able to disable copy-paste and remove UIMenu options like Lookup and Share.
Everything worked fine until the iOS 18.1 beta, which introduced a new menu called Writing Tools (Apple Intelligence) that has its own copy and share buttons
I've tried several ways to remove it
- Remove all UIMenu items using canPerformAction, and it works for all menus but Writing Tools, which still remains
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
return false
}
- Remove it from UIMenuBuilder
override func buildMenu(with builder: UIMenuBuilder) {
builder.remove(menu: .lookup)
builder.remove(menu: .share)
}
But unfortunately, UIMenuBuilder does not have an identifier for Writing Tools, and it seems like there are no API changes from Xcode 15 to Xcode 16 (https://developer.apple.com/documentation/uikit/uimenu/identifier)
It seems like the only way to disable it through MDM configuration (key: allowWritingTools), but we don't use MDM
https://developer.apple.com/documentation/devicemanagement/restrictions
Environment
- iOS Version: iOS 18.1 beta4
- Device: iPhone 15 Pro
- App platform: iOS
- Xcode version: 16.0
- MacOS: 15.0
Thank you
Hello @stevz,
Thank you for asking this question!
You can disable Writing Tools on your WKWebView by setting the writingToolsBehavior of your WKWebViewConfiguration to .none
.
Best regards,
Greg