I'm new on Swift and Objective-C. I'm doing TDD to develop my first app and I can't find a way of mocking a NSURLSession in Swift (I'm creating a dataTaskWithURL from that session). I googled for a while and all the resources I founded said nothing about it.
I need to be able to call this delegates with custom data:
public func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?);
func URLSession(session: NSURLSession!, dataTask: NSURLSessionDataTask, didReceiveResponse response: NSURLResponse, completionHandler: ((NSURLSessionResponseDisposition) -> Void));
public func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveData data: NSData)
What's the best approach? Thanks!
Aucun commentaire:
Enregistrer un commentaire