项目
在 GitHub 查看
NianJi/AppLord
关于
module and service management of ios app
网站与应用开发实测星标增长
- 24小时
- +1
- 7天
- +2
- 15天
- +2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
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)];
探索相关项目
加载中…