Latest 0.0.3
Homepage https://github.com/cleexiang/AppDelegateDispatcher
License MIT
Platforms ios 8.0
Authors

Inspired by https://medium.com/ios-os-x-development/pluggableapplicationdelegate-e50b2c5d97dd, AppDelegateDispatcher used to decouple AppDelegate from services.

Installation

pod ‘AppDelegateDispatcher’

How to use?

  • make your service conformed protocol AppService
  • in the service, implement methods which you want to override.
@interface Service1 : NSObject <AppService>

@end
  • make your AppDelegate inherite from AppDelegateDispatcher
@interface AppDelegate : AppDelegateDispatcher

@property (strong, nonatomic) UIWindow *window;

@end
  • in AppDelegate.m, create instances of Services.
@implementation AppDelegate

- (instancetype)init {
    self = [super init];
    if (self) {
        self.services = @[[Service1 new],
                         [Service2 new],
                         [Service3 new]];
    }
    return self;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [super application:application didFinishLaunchingWithOptions:launchOptions];
    return YES;
}

@end

Latest podspec

{
    "name": "AppDelegateDispatcher",
    "version": "0.0.3",
    "summary": "Decouple AppDelegate from services",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/cleexiang/AppDelegateDispatcher",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "clee": "[email protected]"
    },
    "source": {
        "git": "https://github.com/cleexiang/AppDelegateDispatcher.git",
        "tag": "0.0.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Classes/**/*"
}

Pin It on Pinterest

Share This