Skip to content
venmoPublic

About

Network testing for Swift

Resources

Stars

642 stars

Watchers

31 watching

Forks

Repository files navigation

DVR

Version Status Swift Version Carthage compatible Swift Package Manager

DVR is a simple Swift framework for making fake NSURLSession requests for iOS, watchOS, and OS X based on VCR.

Easy dependency injection is the main design goal. The API is the same as NSURLSession. DVR.Session is a subclass of NSURLSession so you can use it as a drop in replacement anywhere. (Currently only data tasks are supported.)

Usage

let session = Session(cassetteName: "example")
let task = session.dataTask(with: request) { data, response, error in
    // Do something with the response
}

// Nothing happens until you call `resume` as you'd expect.
task.resume()

This will playback the example cassette. The completion handler exactly the same way it normally would. In this example, DVR will look for a cassette named