SVEApplicationDelegate 0.1.0

SVEApplicationDelegate 0.1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • Sérgio Estêvão

A service oriented ApplicationDelegate. Check the rational for this approach here.

SVEApplicationDelegate is tested on iOS 5 and requires ARC. Released under the MIT license.

Example

Open up the included Xcode project for an example app and the tests.

Usage

On your ApplicationDelegate .h file inherit from SVEApplication Delegate.

#import "SVEApplicationDelegate.h"

@interface AppDelegate : SVEApplicationDelegate

@end

Then in your ApplicationDelegate .m file just add the services you need and just configure your Root Controller and you are done.

- (NSArray *) services {
    static NSArray * _services;
    static dispatch_once_t _onceTokenServices;
    dispatch_once(&_onceTokenServices, ^{
        _services = @[[DataController sharedInstance], [PushNotificationController sharedInstance], [LocationController sharedInstance]];
    });
    return _services;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Invoke super to startup all the services
    [super application:application didFinishLaunchingWithOptions:launchOptions];

    // Setup the view controllers
    UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
    MasterViewController *controller = (MasterViewController *)navigationController.topViewController;
    controller.managedObjectContext = [DataController sharedInstance].managedObjectContext;

    return YES;
}

See the header for full documentation.

Installation

Simply add the files in the SVEApplicationDelegate.h and SVEApplicationDelegate.m to your project or add SVEApplicationDelegate to your Podfile if you're using CocoaPods.