Latest 0.1.4
License MIT
Platforms ios 11.0, tvos 11.0
Dependencies Swifter


Stubplay lets you save http requests and replay them easily

Handles various http responses and includes text, html, json, images, videos and AVPlayer requests


  • [x] Saves full http request and response
  • [x] Unit tests are easy – no more having to write a bunch of boilerplate code for the network layer
  • [x] Automated UI tests are easy too
  • [x] Audit responses
    1. Server side dev said they didn’t change anything but you can prove they did because you saved the responses
  • [x] Api not ready? That’s ok you can create your own stubs by hand and use them until the api is ready
  • [x] Debug http requests – view requests being saved as responses are being processed
  • [x] Replay customer experiences -> need to upload to your server yourself


  • iOS 11.0+ / tvOS 11.0+
  • Xcode 10.2+
  • Swift 5+
  • Cocoapods 1.7+



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.7+ is required to build StubPlay

To integrate StubPlay into your Xcode project using CocoaPods, specify it in your Podfile:

source ''
platform :ios, '11.0'

target '<Your Target Name>' do
    pod 'StubPlay'

Then, run the following command:

$ pod install


We recommend enabling stubs as soon as possible – in your main.swift file or App delegate init()

By default: requests/response are saved in the caches/"com.mokten.stubplay" directory.
Everytime the app is run this directory will be cleared out.

Add a reference folder to your app. ie. "Stub/default", this is where your stubs will be read from

import StubPlay

// This will save all requests and responses to the app cache directory
// Start the app and navigate around
// Once you have completed your scenario then copy the files in the cache directory to your reading stub directory "Stub/default"
try StubPlay.default.enableStub(for: ["Stub/default"])

_ = UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, NSStringFromClass(Application.self), NSStringFromClass(AppDelegate.self))


  1. Stubbed request / response has 2 files
    1. request+response/rewrite rule file -> json format
    2. response body file -> native format

The response body is in its own file so that it can be easily be used by viewers/editers ie. image, json, text, html, videos


StubPlay is released under the MIT license. See LICENSE for details.

Latest podspec

    "name": "StubPlay",
    "version": "0.1.4",
    "swift_versions": "5.0",
    "summary": "Save https requests and responses and then replay them later on.",
    "description": "Stub http requests. Saves requests and replays them. Handles various http responses and includes text, html, json, videos, and images",
    "homepage": "",
    "license": {
        "type": "MIT"
    "authors": {
        "mokten": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.4"
    "source_files": "Source/**/*.swift",
    "platforms": {
        "ios": "11.0",
        "tvos": "11.0"
    "dependencies": {
        "Swifter": []
    "swift_version": "5.0"

Pin It on Pinterest

Share This