Skip to content

SmallYing2014/AppLord

Repository files navigation

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>@interfaceMyModule : NSObject <ALModule> @end

then, impl like this:

@AppLordModule(MyModule) // Annotation for regist the module, required@implementationMyModule// 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

@protocolMyService <ALService> - (void)doSomething; @end

Impl it

@interfaceMyServiceImpl : NSObject <MyService> @end @AppLordService(MyService, MyServiceImpl) // regist MyService's Impl class: MyServiceImpl@implementationMyServiceImpl - (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"]; // orid<MyService> service = [[ALContext sharedContext] findService:@protocol(MyService)];

About

module and service management of ios app

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C93.3%
  • Ruby3.7%
  • C3.0%