CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Jan 2017 |
Maintained by NianJi.
module and service management of ios app
management by cocoapods, use:
pod 'AppLord'
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>
@endthen, impl like this:
@AppLordModule(MyModule) // Annotation for regist the module, required
@implementation MyModule
// module object init
- (void)moduleDidInit:(ALContext *)context
{
// do some init thing
}
@endwe 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;
@endImpl 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
}
@endHow to get the instance of service?
id<MyService> service = [[ALContext sharedContext] findServiceByName:@"MyService"];
// or
id<MyService> service = [[ALContext sharedContext] findService:@protocol(MyService)];