Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coderyi/DecouplingKit
decoupling between modules in your iOS Project. iOS模块化过程中模块间解耦方案
https://github.com/coderyi/DecouplingKit
cocoapods coupling decoupling ios mediator modularization modules objective-c router service
Last synced: 9 days ago
JSON representation
decoupling between modules in your iOS Project. iOS模块化过程中模块间解耦方案
- Host: GitHub
- URL: https://github.com/coderyi/DecouplingKit
- Owner: coderyi
- License: mit
- Created: 2017-03-10T22:53:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-21T07:14:17.000Z (about 5 years ago)
- Last Synced: 2024-08-02T13:49:02.118Z (4 months ago)
- Topics: cocoapods, coupling, decoupling, ios, mediator, modularization, modules, objective-c, router, service
- Language: Objective-C
- Homepage: https://github.com/coderyi/DecouplingKit
- Size: 67.4 KB
- Stars: 139
- Watchers: 5
- Forks: 20
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - DecouplingKit - decoupling between modules in your iOS Project. (Code Quality)
- awesome-ios-star - DecouplingKit - decoupling between modules in your iOS Project. (Code Quality)
README
# DecouplingKit
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](http://twitter.com/coderyi9)
[中文readme](https://github.com/coderyi/DecouplingKit/blob/master/Documents/Readme_cn.md)
#### Podfile```ruby
platform :ios, '7.0'
pod 'DecouplingKit', '~> 0.0.2'```
DecouplingKit, decoupling between modules in your iOS Project.
![](https://github.com/coderyi/DecouplingKit/blob/master/Documents/DecouplingKit.png)
DDKServiceManager, used to load the service list DKService.plist, the service is a business's protocol. 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 decouple is 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"];```
singleton
```
id 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 business class
```
@protocol Bussiness2ServiceProtocol
@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](https://github.com/coderyi/DecouplingKit/blob/master/LICENSE).