Hi there.
I would like to create a custom
WKWebView
class, because I want to set a custom HTTP
header. But I get this error:Overriding method with selector 'loadRequest:' has incompatible type '(NSURLRequest) -> WKNavigation?'
My code is the following code.
import WebKit
class CustomWkWebView: WKWebView {
override func loadRequest(request: NSURLRequest) -> WKNavigation? {
var mutable_request = request.mutableCopy() as! NSMutableURLRequest
mutable_request.setValue("SHOTWORKS_IOS_APLICATION", forHTTPHeaderField: "App-MyParameter")
return super.loadRequest(mutable_request.copy() as! NSURLRequest)
}
}
I have only written it by suggestion.
I don't know why i couldn't override.
What should I do?
Following capture is this error.