Since iOS10 the "3D Touch link preview" has been enabled by default, but how can I disable it in my app? Documentation says it's possible by setting allowsLinkPreview to false, but doing it separately for each use case is too much code. There must be an easier way, right?
I thought this would do it, but I get error "Property does not override any property from its superclass". I hope there's just a small mistake, help would be appreciated:
extension WKWebView {
override open var allowsLinkPreview: Bool {
set {
// no-op
}
get {
return false
}
}
}
You could extend
WKWebViewwith a convenience initializer and set the property inside of it. Then use this initializer to instantiate web views.Another option is to make a subclass of
WKWebViewand add this convenience initializer there.