Home

Awesome

DBDebugToolkit

Swift version Xcode - Build Version Carthage compatible Swift Package Manager compatible License Platform

DBDebugToolkit is a debugging library written in Objective-C and Swift. It is meant to provide as many easily accessible tools as possible while keeping the integration process seamless.

Features

Example

To run the example project, clone the repo, and run pod install from the Example directory first. The example project is written in Objective-C. The code examples in this README are written in Swift 3.0.

Requirements

DBDebugToolkit requires iOS 13.0 or later.

Usage

Setup

DBDebugToolkit was meant to provide as many useful debugging tools as possible. However, the second equally important goal was to keep the setup seamless for all the iOS projects. A good place for setting up DBDebugToolkit is in the AppDelegate, as it allows it to start as quickly as possible. The simplest setup consists of only one line:

import DBDebugToolkit

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    DBDebugToolkit.setup()
    return true
}

After such setup, simply shake the device to present the menu with all the debugging options:

<p align="center"> <img src="Assets/opening.gif"> </p>

Read more about triggers to find out how to customize menu presentation.

Triggers

Triggers are the objects that tell DBDebugToolkit to present the menu. There are 3 predefined triggers:

By default, DBDebugToolkit is set up with DBShakeTrigger. You can also provide your own array of triggers:

import DBDebugToolkit

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let tapTrigger = DBTapTrigger(numberOfTouchesRequired: 3)
    let longPressTrigger = DBLongPressTrigger(minimumPressDuration: 1.0)
    let shakeTrigger = DBShakeTrigger()
    DBDebugToolkit.setup(with: [tapTrigger, longPressTrigger, shakeTrigger])
    return true
}

These are just examples. Both DBTapTrigger and DBLongPressTrigger have more customization options.

You can also create your own trigger. To do this, create a class that conforms to protocol DBDebugToolkitTrigger. Then create an instance of this class and pass it to the setup method.

Features

The complete list of features with examples can now be found here: Features.

Installation

CocoaPods

DBDebugToolkit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DBDebugToolkit"

However, to provide some of its features, DBDebugToolkit does use private API. The code that uses it is obfuscated to minimize the risk of rejecting your application on the App Store, but it can not be guaranteed that it is enough. That being said, here are some safer ways to install DBDebugToolkit:

The setup with a separate target for App Store releases will help you prevent sending the build containing the private API calls included in DBDebugToolkit to the App Store review. However, you would have to remember about adding all the files to both targets during development. You will have to decide which way is the best for your project. Perhaps it will be easier to manually remove DBDebugToolkit from the podfile before each App Store release.

Carthage

To integrate DBDebugToolkit into your Xcode project using Carthage, specify it in your Cartfile:

github "dbukowski/DBDebugToolkit" ~> 0.7.0

Run carthage update to build the framework and drag the built DBDebugToolkit.framework into your Xcode project.

Author

Maintained by Gamada-d, debugtoolkit@outlook.de

Created by Dariusz Bukowski, dariusz.m.bukowski@gmail.com

License

DBDebugToolkit is available under the MIT license. See the LICENSE file for more info.