In UIWebView
, it was fairly easy to add UIDataDetectorTypes
to a view:
myUIWebView.dataDetectorTypes = UIDataDetectorTypePhoneNumber;
And so on. However, WKWebView
does not seem to have a similar property. This reference mentions that it has moved to the WKWebViewConfiguration
property at myWebKitView.configuration
, but both the official documentation and the headers themselves make no reference to dataDetectorTypes
.
I'm currently trying to migrate an app from using UIWebView
to WKWebView
, and this app currently has user-configurable UIDataDetectorTypes
. So, is there any way to implement this using the provided API, or would I have to write my own code to parse the HTML?
evaluateJavaScript:completionHandler:
to get the HTML of the web page on load, and then apply anNSDataDetector
to the text, but I'm not sure if that's an optimal method. – Hughey