Latest0.3.0
Homepagehttps://github.com/Raizlabs/RZDebugMenu
LicenseMIT
Platformsios 8.0, requires ARC
DependenciesFXForms
Authors, ,

Build Status

RZDebugMenu gives you an easy way to add tweakable, debug-only preferences or settings to your application. This is useful for many settings you often want to change during development, but never in production, such as whether you are using a staging or production API endpoint.

RZDebugMenu is configured via Settings Bundle plist file, just like the ones you create for adding your (release build) settings to Settings.app. It supports almost all the Settings Bundle schema defined [here] (https://developer.apple.com/library/prerelease/ios/documentation/PreferenceSettings/Conceptual/SettingsApplicationSchemaReference).

Once you configure it at the start of your application, RZDebugMenu shows your menu automatically on a two-finger, three-tap gesture.

Usage

Setup

RZDebugMenu is driven off of a Settings bundle plist file, so the first thing you should is create this Plist and add it to your project.

To set up RZDebugMenu, add the following code to your Applcation Delegate’s application:didFinishLaunchingWithOptions: method.

    #if (DEBUG)
        // To activate the debug menu, call this method with the name of the settings plist you want to use. It should be included in your application bundle.
        [RZDebugMenu enableMenuWithSettingsPlistName:@"debug_settings"];
    #endif

Once you have your window, to set up the two-finger, three-tap gesture to show the menu, add the following code:

    #if (DEBUG)
    // To configure automatic show and hide of the debug menu via a 4-tap gesture, call this method with your app's primary window.
    [[RZDebugMenu sharedDebugMenu] registerDebugMenuPresentationGestureOnView:self.window];
    #endif

Accessing Settings

You can now access your debug settings via RZDebugMenuSettings.

    [RZDebugMenuSettings sharedSettings][@"my_setting_key"]

You can also use standard KVO on RZDebugMenuSettings to access settings, and to watch for changes.

    NSNumber *namePreference = [[RZDebugMenuSettings sharedSettings] valueForKey:@"name_preference"];
    [[RZDebugMenuSettings sharedSettings] addObserver:self forKeyPath:@"name_preference" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL];

Finally, you can detect changes in settings via an NSNotification, if you prefer that over KVO.

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(settingsChanged:) name:kRZDebugMenuSettingChangedNotification object:nil];

This notification will contain keys that describe the setting that has been changed, as well as the previous and new values.

Advanced Usage

Check the sample application for some patterns of advanced usage. Including:

  • Changing the way settings are stored (whether they are isolated from or connected to your normal NSUserDefaults.)
  • Manually showing and dismissing the menu.

Try It

To try RZDebugMenu, install CocoaPods and run

pod try RZDebugMenu

Installation

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

pod RZDebugMenu

Authors

Current Maintainer:

Previous Maintainers:

  • Clayton Reick
  • Nicholas Donaldson

Latest podspec

{
    "name": "RZDebugMenu",
    "version": "0.3.0",
    "summary": "In-app settings bundle using the plist API in XCode",
    "description": "RZDebugMenu mimics the behavior of a Settings.bundle, but is globally available within your app so you can change whatever setting you'd like at any point.",
    "homepage": "https://github.com/Raizlabs/RZDebugMenu",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Clayton Rieck": "[email protected]",
        "Nick Donalodson": "[email protected]",
        "Michael Gorbach": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Raizlabs/RZDebugMenu.git",
        "tag": "0.3.0"
    },
    "source_files": [
        "Classes",
        "Classes/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude",
    "requires_arc": true,
    "dependencies": {
        "FXForms": [
            "~>1.2"
        ]
    }
}

Pin It on Pinterest

Share This