Skip to content
An iOS static library to aid in the development of iOS apps.
Objective-C Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
DemoApp
PEDev-Console.xcodeproj
PEDev-Console
Resources/PEDev-Console.bundle/en.lproj
screenshots
.gitignore
.travis.yml
Default-568h@2x.png
LICENSE
PEDev-Console.podspec
Podfile
Podfile.lock
README.md
doxygen.config
make-doxygen-docset.sh
publish-pod.sh
release.sh
run-tests-xcodebuild-xcpretty.sh
run-tests-xcodebuild.sh

README.md

PEDev-Console

Build Status

PEDev-Console is an iOS static library for simplifying the development process of iOS applications. It provides a view controller that integrates into your application that enables you to jump to any screen of your application instantly. It also includes the functionality of PESimu-Select in order to enable HTTP response simulations.

PEDev-Console is part of the PE* iOS Library Suite.

Table of Contents

Motivation

When developing an iOS application, the development of view controllers in particular can be particularly painstakingly iterative in nature. This becomes more pronounced when developing views programmatically (i.e., not using interface builder). The ability to see the results of your code changes quickly is very important to developer-productivity.

You may often find yourself working on a particular screen of your application that is buried deeply underneath many other screens. Testing changes to this screen usually involves running the app, and manually navigating to the screen. If the screens above it require things like forms to be filled-out properly, etc, the workflow can soon become very slow and cumbersome.

PEDev-Console attempts to fix this situation. The idea is simple: after application launch, give your device a shake. The PEDev-Console dev console will appear, giving you a choice to view the full set of screens contained in your application. Simply tap the screen you want, and it will be instantiated and presented. As a bonus, from the dev console you can also --- if configured --- choose an HTTP response simulation to activate (provided by PESimu-Select integration).

Setup Guide

Have your app delegate conform to the PDVDevEnabled protocol.

#import "PDVDevEnabled.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate, PDVDevEnabled>

This step is to enable PESimu-Select functionality. Create a folder called application-screens. In this folder, create a sub folder for each screen of your application in which you want to integrate PESimu-Select functionality. Within each screen folder, create a folder for each use case the screen supports. For each use case folder, create a PESimu-Select simulation XML file for each HTTP response scenario you wish to test. The following screenshot shows our folder setup for PEDev-Console's demo application:

In your application delegate, declare a class-level PDVUtils instance:

@implementation AppDelegate {
  PDVUtils *_pdvUtils;
}

In your application delegate, instead of instantiating UIWindow, use PDVUIWindow. Also, instantiate your _pdvUtils instance (be sure to provide the correct name of your base screens folder name):

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [self setWindow:[[PDVUIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]];
  _pdvUtils = [[PDVUtils alloc] initWithBaseResourceFolderOfSimulations:@"application-screens"
                                                           screenGroups:[self screenGroups]];

In your application delegate, implement the screenGroups getter:

- (NSArray *)screenGroups {
NSArray *unauthenticatedScreens =
  @[ // Create Account screen
     [[PDVScreen alloc] initWithDisplayName:@"Create Account"
                                description:@"Create Account screen."
                        viewControllerMaker:^{return
                        [[PDVCreateAccountController alloc] init];}],
     // Login screen
     [[PDVScreen alloc] initWithDisplayName:@"Log In"
                                description:@"Log In screen."
                        viewControllerMaker:^{return [[PDVLoginController alloc] init];}]];
  PDVScreenGroup *unauthenticatedScreenGroup =
    [[PDVScreenGroup alloc] initWithName:@"Unauthenticated Screens"
                                 screens:unauthenticatedScreens];

  NSArray *authenticatedScreens =
    @[ // Authenticated landing screen
       [[PDVScreen alloc] initWithDisplayName:@"Authenticated Landing"
                                  description:@"Authenticated landing screen of pre-existing user with resident auth token."
                          viewControllerMaker:^{return [[PDVAuthenticatedLandingController alloc] init];}]];
  PDVScreenGroup *authenticatedScreenGroup =
    [[PDVScreenGroup alloc] initWithName:@"Authenticated Screens"
                                 screens:authenticatedScreens];
  return @[ unauthenticatedScreenGroup, authenticatedScreenGroup ];
}

What's going on here is that for each screen in your application, you'll create a PDVScreen instance to serve as a sort of container for it. These PDVScreen instances are used by PEDev-Console's screen selection view controller. Each PDVScreen instance is given a block (with signature: UIViewController *(^)(void)) that is used to instantiate your view controller if the user selects it from the screen selection controller. You also need to group each PDVScreen instance within a PDVScreenGroup instance. The purpose of PDVScreenGroup is to give you a basic mechanism for grouping logically-related screens. These groups are then used for creating the table-sections of the PEDev-Console screen selection controller's table view.

Next, in our application delegate, we implement the 2 methods from the PDVDevEnabled protocol:

- (PDVUtils *)pdvUtils {
  return _pdvUtils;
}
- (NSDictionary *)screenNamesForViewControllers {
  return @{
    NSStringFromClass([PDVCreateAccountController class]) : @"create-account-screen",
    NSStringFromClass([PDVLoginController class]) : @"login-screen",
    NSStringFromClass([PDVAuthenticatedLandingController class]) : @"authenticated-landing-screen"
  };
}

The purpose of screenNamesForViewControllers is to map the classes of your application view controllers to the their corresponding PESimu-Select HTTP response simulation folders.

Finally, in each of your application view controllers, include the following import:

#import "UIViewController+PEDevConsole.h"

And in your viewDidLoad method, include the following line:

// enables PEDev-Console integration
[self pdvDevEnable];

By doing this, a simple shake of the device will launch the dev console.

Screenshots

The following are taken from the DemoApp. The DemoApp has an initial launch screen, and 3 application screens (Log In, Create Account and Authenticated Home). Funny thing is, none of the application screens are accessible from the launch screen :)

First we launch the app.

Shaking the device presents the dev console screen.

From here we have 2 basic options: get our list of application screens, or bring up the list of HTTP response simulations (PESimu-Select). If we tap to view our applications screens, we get:

Here we see our 3 application screens, organized into 2 groups. We'll tap on 'Create Account' to launch that screen.

Voila! Lets shake again, and this time tap to view the set of available HTTP response simulations:

Now lets assume we tapped the 'Log In' row from the screen selector. Here we see our app's log in screen:

Shaking and tapping to view our HTTP response simulations gives us:

Notice that the set of HTTP response simulations available is based on our current screen - the log in screen.

Demo Application

The DemoApp is a working application illustrating how to use PEDev-Console.

Installation with CocoaPods

pod 'PEDev-Console', '~> 1.0.5'

PE* iOS Library Suite

(Each library is implemented as a CocoaPod-enabled iOS static library.)

You can’t perform that action at this time.