module and service management of ios app
Switch branches/tags
Nothing to show
Clone or download
Latest commit 1149c43 Oct 18, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
AppLord.xcodeproj 添加注解方案 Nov 23, 2016
AppLord change ALTask Oct 17, 2017
Demo/AppLordDemo 添加注解方案 Nov 23, 2016
.gitignore Initial commit Nov 9, 2015
AppLord.podspec add 1.2.1 podspec Jan 30, 2017
LICENSE Initial commit Nov 9, 2015
README.md update readme Nov 23, 2016

README.md

AppLord

module and service management of ios app

add to your project

management by cocoapods, use:

pod    'AppLord'

module

what is module? every business or task could be module.

when the module init? when app launch or after app launch

how to impl?

first, create class:

#import <AppLord/AppLord.h>
@interface MyModule : NSObject <ALModule>
@end

then, impl like this:

@AppLordModule(MyModule) // Annotation for regist the module, required
@implementation MyModule

// module object init
- (void)moduleDidInit:(ALContext *)context
{
    // do some init thing
}

@end

service

we can receive events from other modules in a module, but it does not always meet the demand. we can't notify back to the sender. so we provide another way to transfer event between modules: service.

How to use?

Define your custom service

@protocol MyService <ALService>

- (void)doSomething;

@end

Impl it

@interface MyServiceImpl : NSObject <MyService>

@end

@AppLordService(MyService, MyServiceImpl) // regist MyService's Impl class: MyServiceImpl
@implementation MyServiceImpl

- (void)doSomething
{

}

// optional
+ (BOOL)globalVisible
{
    // if return YES, service will be always in the memory
}

@end

How to get the instance of service?

id<MyService> service = [[ALContext sharedContext] findServiceByName:@"MyService"];
// or
id<MyService> service = [[ALContext sharedContext] findService:@protocol(MyService)];