Objective-C Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DecouplingKit.xcodeproj
DecouplingKit update Mar 10, 2017
Documents
Example update Mar 13, 2017
.gitignore init Mar 10, 2017
DecouplingKit.podspec update Mar 10, 2017
LICENSE
Readme.md Update Readme.md Mar 16, 2017

Readme.md

DecouplingKit

Twitter

中文readme

Podfile

	platform :ios, '7.0'
	pod 'DecouplingKit', '~> 0.0.2'

DecouplingKit, decoupling between modules in your iOS Project.

DecouplingKit only one class DKServiceManager, used to load the service list DKService.plist, the service is a business's protocol, there are other business needs to call the method, attributes and so on. DKService.plist includes service and impl, service is protocol, impl is the implementation of the protocol class.

DecouplingKit is based on [BeeHive] (https://github.com/alibaba/BeeHive), Another way to decoupling is through the runtime, such as [CTMediator] (https://github.com/casatwy/CTMediator), this is a very good program.

Use

Register the default DKService.plist service list

    [[DKServiceManager sharedInstance] registerLocalServices];

Register a list of custom paths for services

    [[DKServiceManager sharedInstance] registerLocalServicesWithServiceConfigName:@"DecouplingKit.bundle/DKService"];

Create an instance, if the Bussiness2ServiceProtocol corresponding to the class to achieve the sharedInstance method,so generate a singleton, and then call the corresponding instance method

    id<Bussiness2ServiceProtocol> bussiness2 =[[DKServiceManager sharedInstance] createInstance:@protocol(Bussiness2ServiceProtocol)];
    
    NSDictionary *data =[bussiness2 fetchBussiness2DataWithName:@"DecouplingKit" age:@"1"];

Create a class and then call the corresponding class method

   Class Bussiness2 = [[DKServiceManager sharedInstance] createClass:@protocol(Bussiness2ServiceProtocol)];

    [Bussiness2 callClassMethod];

Create a service protocol for your own business line class

@protocol Bussiness2ServiceProtocol <DKServiceProtocol>
@property (nonatomic,copy) NSString *name;
- (NSDictionary *)fetchBussiness2DataWithName:(NSString *)name age:(NSString *)age;
+ (void)callClassMethod;

@end

Licenses

All source code is licensed under the MIT License.