Latest 0.3.0
Homepage https://github.com/iSofTom/STDebugKit
License MIT
Platforms ios 5.0, requires ARC
Frameworks Foundation
Authors

Offer access to several debug tools within your app, such as CoreData browsing.

Introduction

STDebugKit Allow you to debug your app, even from a device !
From every screen you’ll have access to a little debug button that could open a debug center.
In that center you’ll find two kind of debug tools:

  • Global Tools : Tools that came with this component
  • Context Tools : Tools you can add from your app and that are context sensitives.

Configuration

All you have to do, is configure the debug kit by adding one instruction right before the return of your application:didFinishLaunchingWithOptions: method. Don’t forget to import STDebugKit.h for that, I recommend you to import it in your prefix.pch file.

DebugKitConfigure()

That’s all Folks, you’re ready to debug your app !

Adding Context Tools

Context tools are reachable only when the viewController that is associated to is visible.

Here is how to add a context tool.
In your viewWillAppear: method, add:

DebugKitAddAction(@"# Tool Name #", ^(id o){
        # Your action #
    })

You can also add an entire ViewController as a debug tool:

DebugKitAddAction(@"# Tool Name #", MyViewController, ^(id o){
        # Your can configure your view controller here (via the block parameter) #
    })

And in you viewWillDisappear: method, add:

DebugKitRemove()

More Configuration

In the prefix.pch file of the STDebugKit pod, you can do a lot of configurations.

You can enable or disable the modules you want to appear:

#define STDebugKitModuleSlowAnimationsEnabled
#define STDebugKitModuleInfosEnabled
//#define STDebugKitModuleKillEnabled
//The Kill module is now disabled

You can specify the modules order:

#define STDebugKitModuleCoreDataOrder           1
#define STDebugKitModuleSlowAnimationsOrder     2
#define STDebugKitModuleInfosOrder              3

You can choose the debug kit’s button’s size and colors:

#define STDebugKitButtonSize 30
#define STDebugKitButtonColor [UIColor colorWithRed:0.751 green:0.843 blue:0.900 alpha:1.000]
#define STDebugKitButtonBackgroundColor [UIColor whiteColor]

Modules

Core Data

Allow several actions on your database

  • Find objects based on a predicate
  • Count objects of a specific entity
  • Delete objects based on a predicate
  • Clear all instances of an entity

Warning: This module use MagicalRecord.

  • Enabled Key : STDebugKitModuleCoreDataEnabled
  • Order Key : STDebugKitModuleCoreDataOrder

Slow Animations

Allow to slow all the animations of your application in order to polish your UI.

  • Enabled Key : STDebugKitModuleSlowAnimationsEnabled
  • Order Key : STDebugKitModuleSlowAnimationsOrder

Infos

Allow to display the informations from your project info.plist.

  • Enabled Key : STDebugKitModuleInfosEnabled
  • Order Key : STDebugKitModuleInfosOrder

Kill

Allow to immediately kill the current app.

  • Enabled Key : STDebugKitModuleKillEnabled
  • Order Key : STDebugKitModuleKillOrder

More Modules Coming …

Installation

To include this component in your project, I recommend you to use Cocoapods:

  • Add pod "STDebugKit" to your Podfile.
  • Add pod "STDebugKit/CoreData" to your Podfile if you want the CoreData module (It uses MagicalRecord).

Contribution

Feel free to create and share your own tools.
Just don’t forget to add the below code in your class in order to automatically add your component in the debug kit.

#ifdef STDebugKitModule# Name #Enabled
+ (void)load
{
    STDebugTool* tool = [STDebugTool debugToolNamed:@"# Name #" viewControllerClass:[self class]];
#ifdef STDebugKitModule# Name #Order
    tool.order = STDebugKitModule# Name #Order;
#else
    tool.order = 999;
#endif
    [STDebugKit addGlobalDebugTool:tool];
}
#endif

Latest podspec

{
    "name": "STDebugKit",
    "version": "0.3.0",
    "summary": "Offer access to several debug tools within your app, such as CoreData browsing.",
    "description": "                    STDebugKit Allow you to debug your app, even from a device !n                    From every screen you'll have access to a little debug button that could open a debug center.n                    In that center you'll find global tools and context sensitive tools.n",
    "homepage": "https://github.com/iSofTom/STDebugKit",
    "license": "MIT",
    "authors": {
        "iSofTom": "[email protected]"
    },
    "source": {
        "git": "https://github.com/iSofTom/STDebugKit.git",
        "tag": "0.3.0"
    },
    "platforms": {
        "ios": "5.0"
    },
    "frameworks": "Foundation",
    "requires_arc": true,
    "default_subspec": "Core",
    "subspecs": [
        {
            "name": "Core",
            "source_files": [
                "STDebugKit/STDebugKit.*",
                "STDebugKit/STDebugKit_private.h",
                "STDebugKit/STDebugTool.*",
                "STDebugKit/STDebugKitRootViewController.*",
                "STDebugKit/STDebugKitModuleSlowAnimations.*",
                "STDebugKit/STDebugKitModuleInfos.*",
                "STDebugKit/STDebugKitModuleKill.*"
            ],
            "ios": {
                "frameworks": [
                    "Foundation",
                    "UIKit",
                    "QuartzCore"
                ]
            },
            "prefix_header_contents": "#ifdef DEBUGn    #define STDebugKitModuleSlowAnimationsEnabledn    #define STDebugKitModuleInfosEnabledn    #define STDebugKitModuleKillEnabledn    n    #define STDebugKitModuleSlowAnimationsOrder     2n    #define STDebugKitModuleInfosOrder              3n    #define STDebugKitModuleKillOrder               4n    n    #define STDebugKitButtonSize 30n    #define STDebugKitButtonPosition CGPointMake(1, 0.5)nt#define STDebugKitButtonColor [UIColor colorWithRed:0.751 green:0.843 blue:0.900 alpha:1.000]nt#define STDebugKitButtonBackgroundColor [UIColor whiteColor]n#endifn"
        },
        {
            "name": "CoreData",
            "dependencies": {
                "STDebugKit/Core": [],
                "MagicalRecord": [
                    "~> 2.1"
                ]
            },
            "source_files": [
                "STDebugKit/STDebugKitModuleCoreData.*",
                "STDebugKit/STDebugKitModuleCoreDataViewer.*"
            ],
            "prefix_header_contents": "#ifdef __OBJC__nt#define MR_SHORTHANDnt#import "CoreData+MagicalRecord.h"n#endifnn#ifdef DEBUGnt#define STDebugKitModuleCoreDataEnablednt#define STDebugKitModuleCoreDataOrder           1n#endifn",
            "ios": {
                "frameworks": "CoreData"
            }
        }
    ]
}

Pin It on Pinterest

Share This