I'm subclassing NSURLRequest. Creating custom init methods for the class created. While coding, i ended up with the following error.. "'required' initializer 'init(coder:)' must be provided by subclass of 'NSURLRequest'"...
My code is
import Foundation
class URLRequest: NSURLRequest {
init (UrlRequestWithURL: NSString, setHTTPBody: NSData, shouldHandleCookies: Bool, isHTTPMethodPost: Bool, withTimeoutInterval: NSTimeInterval)
{
}
// Here it shows the error
}
Help me regarding this..
Apart from the above question....
Do i really need to subclass NSUrlRequest.. (Purpose of creating urlrequest variable, is that creating several requests that have to assigned for urlsession variable.) Else is there any other way that the purpose gets satisfied?
How to create a singleton class in swift. All these days i worked with objc. I find hard in formulating it.
NSCodingyou must also implementNSCoding, which requires that you implement the required initialiser. Do you need to subclass NSURLRequest? Probably not, but you haven't clearly explained why you are doing so. There is a good chance you can use an extension - Paulw11