├── .gitignore ├── DecouplingKit.podspec ├── DecouplingKit.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── DecouplingKit ├── DKService.plist ├── DKServiceManager.h ├── DKServiceManager.m └── DKServiceProtocol.h ├── Documents ├── DecouplingKit.graffle ├── DecouplingKit.png ├── Readme_cn.md └── Readme_en.md ├── Example ├── Bussiness1 │ ├── Bussiness1.podspec │ ├── Bussiness1.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── Bussiness1.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Bussiness1 │ │ ├── Bussiness1ViewController.h │ │ └── Bussiness1ViewController.m │ ├── Podfile │ └── Podfile.lock ├── Bussiness2 │ ├── Bussiness2.podspec │ ├── Bussiness2.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── Bussiness2.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Bussiness2 │ │ ├── Bussiness2Manager.h │ │ ├── Bussiness2Manager.m │ │ ├── Bussiness2Model.h │ │ ├── Bussiness2Model.m │ │ ├── Bussiness2ViewController.h │ │ └── Bussiness2ViewController.m │ ├── Podfile │ └── Podfile.lock ├── BussinessPublicService │ ├── BussinessPublicService.podspec │ ├── BussinessPublicService.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── BussinessPublicService │ │ └── Bussiness2Service.h └── DecouplingKitExample │ ├── DecouplingKitExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── DecouplingKitExample.xcworkspace │ └── contents.xcworkspacedata │ ├── DecouplingKitExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── main.m │ ├── Podfile │ └── Podfile.lock ├── LICENSE └── Readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | -------------------------------------------------------------------------------- /DecouplingKit.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "DecouplingKit" 5 | s.version = "0.0.2" 6 | s.summary = "DecouplingKit" 7 | s.description = "DecouplingKit" 8 | s.license = "MIT" 9 | 10 | 11 | 12 | s.homepage = "https://github.com/coderyi/DecouplingKit" 13 | 14 | 15 | s.author = { "coderyi" => "coderyi@foxmail.com" } 16 | s.platform = :ios, "7.0" 17 | s.source = { :git => "https://github.com/coderyi/DecouplingKit.git", :tag => "#{s.version}" } 18 | 19 | s.source_files = "DecouplingKit/**/*.{h,m,mm}" 20 | s.requires_arc = true 21 | s.resources = "DecouplingKit/**/*.{png,plist}" 22 | 23 | 24 | end 25 | -------------------------------------------------------------------------------- /DecouplingKit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EEB0B20D1E70091000FDE436 /* DKServiceProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = EEB0B20B1E70091000FDE436 /* DKServiceProtocol.h */; }; 11 | EEE710271E6B0F7900E65CB4 /* DKService.plist in Resources */ = {isa = PBXBuildFile; fileRef = EEE710221E6B0F7900E65CB4 /* DKService.plist */; }; 12 | EEE710281E6B0F7900E65CB4 /* DKServiceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = EEE710231E6B0F7900E65CB4 /* DKServiceManager.h */; }; 13 | EEE710291E6B0F7900E65CB4 /* DKServiceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = EEE710241E6B0F7900E65CB4 /* DKServiceManager.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | EEB0B20B1E70091000FDE436 /* DKServiceProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKServiceProtocol.h; sourceTree = ""; }; 18 | EEE710151E6B0F5E00E65CB4 /* DecouplingKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DecouplingKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | EEE710221E6B0F7900E65CB4 /* DKService.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = DKService.plist; sourceTree = ""; }; 20 | EEE710231E6B0F7900E65CB4 /* DKServiceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DKServiceManager.h; sourceTree = ""; }; 21 | EEE710241E6B0F7900E65CB4 /* DKServiceManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DKServiceManager.m; sourceTree = ""; }; 22 | /* End PBXFileReference section */ 23 | 24 | /* Begin PBXFrameworksBuildPhase section */ 25 | EEE710111E6B0F5E00E65CB4 /* Frameworks */ = { 26 | isa = PBXFrameworksBuildPhase; 27 | buildActionMask = 2147483647; 28 | files = ( 29 | ); 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXFrameworksBuildPhase section */ 33 | 34 | /* Begin PBXGroup section */ 35 | EEE7100B1E6B0F5E00E65CB4 = { 36 | isa = PBXGroup; 37 | children = ( 38 | EEE710171E6B0F5E00E65CB4 /* DecouplingKit */, 39 | EEE710161E6B0F5E00E65CB4 /* Products */, 40 | ); 41 | sourceTree = ""; 42 | }; 43 | EEE710161E6B0F5E00E65CB4 /* Products */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | EEE710151E6B0F5E00E65CB4 /* DecouplingKit.framework */, 47 | ); 48 | name = Products; 49 | sourceTree = ""; 50 | }; 51 | EEE710171E6B0F5E00E65CB4 /* DecouplingKit */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | EEE710221E6B0F7900E65CB4 /* DKService.plist */, 55 | EEE710231E6B0F7900E65CB4 /* DKServiceManager.h */, 56 | EEE710241E6B0F7900E65CB4 /* DKServiceManager.m */, 57 | EEB0B20B1E70091000FDE436 /* DKServiceProtocol.h */, 58 | ); 59 | path = DecouplingKit; 60 | sourceTree = ""; 61 | }; 62 | /* End PBXGroup section */ 63 | 64 | /* Begin PBXHeadersBuildPhase section */ 65 | EEE710121E6B0F5E00E65CB4 /* Headers */ = { 66 | isa = PBXHeadersBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | EEE710281E6B0F7900E65CB4 /* DKServiceManager.h in Headers */, 70 | EEB0B20D1E70091000FDE436 /* DKServiceProtocol.h in Headers */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXHeadersBuildPhase section */ 75 | 76 | /* Begin PBXNativeTarget section */ 77 | EEE710141E6B0F5E00E65CB4 /* DecouplingKit */ = { 78 | isa = PBXNativeTarget; 79 | buildConfigurationList = EEE7101D1E6B0F5E00E65CB4 /* Build configuration list for PBXNativeTarget "DecouplingKit" */; 80 | buildPhases = ( 81 | EEE710101E6B0F5E00E65CB4 /* Sources */, 82 | EEE710111E6B0F5E00E65CB4 /* Frameworks */, 83 | EEE710121E6B0F5E00E65CB4 /* Headers */, 84 | EEE710131E6B0F5E00E65CB4 /* Resources */, 85 | ); 86 | buildRules = ( 87 | ); 88 | dependencies = ( 89 | ); 90 | name = DecouplingKit; 91 | productName = DecouplingKit; 92 | productReference = EEE710151E6B0F5E00E65CB4 /* DecouplingKit.framework */; 93 | productType = "com.apple.product-type.framework"; 94 | }; 95 | /* End PBXNativeTarget section */ 96 | 97 | /* Begin PBXProject section */ 98 | EEE7100C1E6B0F5E00E65CB4 /* Project object */ = { 99 | isa = PBXProject; 100 | attributes = { 101 | LastUpgradeCheck = 0820; 102 | ORGANIZATIONNAME = coderyi; 103 | TargetAttributes = { 104 | EEE710141E6B0F5E00E65CB4 = { 105 | CreatedOnToolsVersion = 8.2; 106 | ProvisioningStyle = Automatic; 107 | }; 108 | }; 109 | }; 110 | buildConfigurationList = EEE7100F1E6B0F5E00E65CB4 /* Build configuration list for PBXProject "DecouplingKit" */; 111 | compatibilityVersion = "Xcode 3.2"; 112 | developmentRegion = English; 113 | hasScannedForEncodings = 0; 114 | knownRegions = ( 115 | en, 116 | ); 117 | mainGroup = EEE7100B1E6B0F5E00E65CB4; 118 | productRefGroup = EEE710161E6B0F5E00E65CB4 /* Products */; 119 | projectDirPath = ""; 120 | projectRoot = ""; 121 | targets = ( 122 | EEE710141E6B0F5E00E65CB4 /* DecouplingKit */, 123 | ); 124 | }; 125 | /* End PBXProject section */ 126 | 127 | /* Begin PBXResourcesBuildPhase section */ 128 | EEE710131E6B0F5E00E65CB4 /* Resources */ = { 129 | isa = PBXResourcesBuildPhase; 130 | buildActionMask = 2147483647; 131 | files = ( 132 | EEE710271E6B0F7900E65CB4 /* DKService.plist in Resources */, 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXResourcesBuildPhase section */ 137 | 138 | /* Begin PBXSourcesBuildPhase section */ 139 | EEE710101E6B0F5E00E65CB4 /* Sources */ = { 140 | isa = PBXSourcesBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | EEE710291E6B0F7900E65CB4 /* DKServiceManager.m in Sources */, 144 | ); 145 | runOnlyForDeploymentPostprocessing = 0; 146 | }; 147 | /* End PBXSourcesBuildPhase section */ 148 | 149 | /* Begin XCBuildConfiguration section */ 150 | EEE7101B1E6B0F5E00E65CB4 /* Debug */ = { 151 | isa = XCBuildConfiguration; 152 | buildSettings = { 153 | ALWAYS_SEARCH_USER_PATHS = NO; 154 | CLANG_ANALYZER_NONNULL = YES; 155 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 156 | CLANG_CXX_LIBRARY = "libc++"; 157 | CLANG_ENABLE_MODULES = YES; 158 | CLANG_ENABLE_OBJC_ARC = YES; 159 | CLANG_WARN_BOOL_CONVERSION = YES; 160 | CLANG_WARN_CONSTANT_CONVERSION = YES; 161 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 162 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 163 | CLANG_WARN_EMPTY_BODY = YES; 164 | CLANG_WARN_ENUM_CONVERSION = YES; 165 | CLANG_WARN_INFINITE_RECURSION = YES; 166 | CLANG_WARN_INT_CONVERSION = YES; 167 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 168 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 169 | CLANG_WARN_UNREACHABLE_CODE = YES; 170 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 171 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 172 | COPY_PHASE_STRIP = NO; 173 | CURRENT_PROJECT_VERSION = 1; 174 | DEBUG_INFORMATION_FORMAT = dwarf; 175 | ENABLE_STRICT_OBJC_MSGSEND = YES; 176 | ENABLE_TESTABILITY = YES; 177 | GCC_C_LANGUAGE_STANDARD = gnu99; 178 | GCC_DYNAMIC_NO_PIC = NO; 179 | GCC_NO_COMMON_BLOCKS = YES; 180 | GCC_OPTIMIZATION_LEVEL = 0; 181 | GCC_PREPROCESSOR_DEFINITIONS = ( 182 | "DEBUG=1", 183 | "$(inherited)", 184 | ); 185 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 186 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 187 | GCC_WARN_UNDECLARED_SELECTOR = YES; 188 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 189 | GCC_WARN_UNUSED_FUNCTION = YES; 190 | GCC_WARN_UNUSED_VARIABLE = YES; 191 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 192 | MTL_ENABLE_DEBUG_INFO = YES; 193 | ONLY_ACTIVE_ARCH = YES; 194 | SDKROOT = iphoneos; 195 | TARGETED_DEVICE_FAMILY = "1,2"; 196 | VERSIONING_SYSTEM = "apple-generic"; 197 | VERSION_INFO_PREFIX = ""; 198 | }; 199 | name = Debug; 200 | }; 201 | EEE7101C1E6B0F5E00E65CB4 /* Release */ = { 202 | isa = XCBuildConfiguration; 203 | buildSettings = { 204 | ALWAYS_SEARCH_USER_PATHS = NO; 205 | CLANG_ANALYZER_NONNULL = YES; 206 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 207 | CLANG_CXX_LIBRARY = "libc++"; 208 | CLANG_ENABLE_MODULES = YES; 209 | CLANG_ENABLE_OBJC_ARC = YES; 210 | CLANG_WARN_BOOL_CONVERSION = YES; 211 | CLANG_WARN_CONSTANT_CONVERSION = YES; 212 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 213 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 214 | CLANG_WARN_EMPTY_BODY = YES; 215 | CLANG_WARN_ENUM_CONVERSION = YES; 216 | CLANG_WARN_INFINITE_RECURSION = YES; 217 | CLANG_WARN_INT_CONVERSION = YES; 218 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 219 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 220 | CLANG_WARN_UNREACHABLE_CODE = YES; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 223 | COPY_PHASE_STRIP = NO; 224 | CURRENT_PROJECT_VERSION = 1; 225 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 226 | ENABLE_NS_ASSERTIONS = NO; 227 | ENABLE_STRICT_OBJC_MSGSEND = YES; 228 | GCC_C_LANGUAGE_STANDARD = gnu99; 229 | GCC_NO_COMMON_BLOCKS = YES; 230 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 232 | GCC_WARN_UNDECLARED_SELECTOR = YES; 233 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 234 | GCC_WARN_UNUSED_FUNCTION = YES; 235 | GCC_WARN_UNUSED_VARIABLE = YES; 236 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 237 | MTL_ENABLE_DEBUG_INFO = NO; 238 | SDKROOT = iphoneos; 239 | TARGETED_DEVICE_FAMILY = "1,2"; 240 | VALIDATE_PRODUCT = YES; 241 | VERSIONING_SYSTEM = "apple-generic"; 242 | VERSION_INFO_PREFIX = ""; 243 | }; 244 | name = Release; 245 | }; 246 | EEE7101E1E6B0F5E00E65CB4 /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | CODE_SIGN_IDENTITY = ""; 250 | DEFINES_MODULE = YES; 251 | DYLIB_COMPATIBILITY_VERSION = 1; 252 | DYLIB_CURRENT_VERSION = 1; 253 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 254 | INFOPLIST_FILE = ""; 255 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 256 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 257 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 258 | MACH_O_TYPE = staticlib; 259 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.DecouplingKit; 260 | PRODUCT_NAME = "$(TARGET_NAME)"; 261 | SKIP_INSTALL = YES; 262 | }; 263 | name = Debug; 264 | }; 265 | EEE7101F1E6B0F5E00E65CB4 /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | CODE_SIGN_IDENTITY = ""; 269 | DEFINES_MODULE = YES; 270 | DYLIB_COMPATIBILITY_VERSION = 1; 271 | DYLIB_CURRENT_VERSION = 1; 272 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 273 | INFOPLIST_FILE = ""; 274 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 275 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 276 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 277 | MACH_O_TYPE = staticlib; 278 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.DecouplingKit; 279 | PRODUCT_NAME = "$(TARGET_NAME)"; 280 | SKIP_INSTALL = YES; 281 | }; 282 | name = Release; 283 | }; 284 | /* End XCBuildConfiguration section */ 285 | 286 | /* Begin XCConfigurationList section */ 287 | EEE7100F1E6B0F5E00E65CB4 /* Build configuration list for PBXProject "DecouplingKit" */ = { 288 | isa = XCConfigurationList; 289 | buildConfigurations = ( 290 | EEE7101B1E6B0F5E00E65CB4 /* Debug */, 291 | EEE7101C1E6B0F5E00E65CB4 /* Release */, 292 | ); 293 | defaultConfigurationIsVisible = 0; 294 | defaultConfigurationName = Release; 295 | }; 296 | EEE7101D1E6B0F5E00E65CB4 /* Build configuration list for PBXNativeTarget "DecouplingKit" */ = { 297 | isa = XCConfigurationList; 298 | buildConfigurations = ( 299 | EEE7101E1E6B0F5E00E65CB4 /* Debug */, 300 | EEE7101F1E6B0F5E00E65CB4 /* Release */, 301 | ); 302 | defaultConfigurationIsVisible = 0; 303 | defaultConfigurationName = Release; 304 | }; 305 | /* End XCConfigurationList section */ 306 | }; 307 | rootObject = EEE7100C1E6B0F5E00E65CB4 /* Project object */; 308 | } 309 | -------------------------------------------------------------------------------- /DecouplingKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DecouplingKit/DKService.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | service 7 | Bussiness1ServiceProtocol 8 | impl 9 | Bussiness1Manager 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /DecouplingKit/DKServiceManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // DKServiceManager.h 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/3. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DKServiceManager : NSObject 12 | + (instancetype)sharedInstance; 13 | - (void)registerLocalServices; 14 | - (void)registerLocalServicesWithServiceConfigName:(NSString *)serviceConfigName; 15 | - (id)createInstance:(Protocol *)service; 16 | - (Class)createClass:(Protocol *)service; 17 | @end 18 | -------------------------------------------------------------------------------- /DecouplingKit/DKServiceManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DKServiceManager.m 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/3. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "DKServiceManager.h" 10 | 11 | static const NSString *kService = @"service"; 12 | static const NSString *kImpl = @"impl"; 13 | 14 | 15 | @interface DKServiceManager() 16 | 17 | @property (nonatomic, strong) NSRecursiveLock *lock; 18 | @property (nonatomic, strong) NSMutableArray *allServices; 19 | 20 | @end 21 | @implementation DKServiceManager 22 | 23 | + (instancetype)sharedInstance 24 | { 25 | static DKServiceManager *_sharedInstance = nil; 26 | static dispatch_once_t onceToken; 27 | dispatch_once(&onceToken, ^{ 28 | _sharedInstance = [[self alloc] init]; 29 | }); 30 | return _sharedInstance; 31 | } 32 | - (void)registerLocalServices { 33 | [self registerLocalServicesWithServiceConfigName:@"DKService"]; 34 | } 35 | 36 | - (void)registerLocalServicesWithServiceConfigName:(NSString *)serviceConfigName 37 | { 38 | 39 | NSString *plistPath = [[NSBundle mainBundle] pathForResource:serviceConfigName ofType:@"plist"]; 40 | if (!plistPath) { 41 | return; 42 | } 43 | 44 | NSArray *serviceList = [[NSArray alloc] initWithContentsOfFile:plistPath]; 45 | 46 | [self.lock lock]; 47 | [self.allServices addObjectsFromArray:serviceList]; 48 | [self.lock unlock]; 49 | } 50 | 51 | 52 | - (Class)createClass:(Protocol *)service { 53 | 54 | if (![self checkValidService:service]) { 55 | NSLog(@"%@", [NSString stringWithFormat:@"%@ protocol does not been registed", NSStringFromProtocol(service)] ); 56 | } 57 | 58 | Class implClass = [self serviceImplClass:service]; 59 | 60 | return implClass; 61 | } 62 | 63 | - (id)createInstance:(Protocol *)service 64 | { 65 | id implInstance = nil; 66 | 67 | if (![self checkValidService:service]) { 68 | NSLog(@"%@", [NSString stringWithFormat:@"%@ protocol does not been registed", NSStringFromProtocol(service)] ); 69 | } 70 | 71 | Class implClass = [self serviceImplClass:service]; 72 | 73 | if ([[implClass class] respondsToSelector:@selector(sharedInstance)]) 74 | implInstance = [[implClass class] sharedInstance]; 75 | else 76 | implInstance = [[implClass alloc] init]; 77 | 78 | 79 | 80 | return implInstance; 81 | } 82 | 83 | 84 | 85 | 86 | - (NSMutableArray *)allServices 87 | { 88 | if (!_allServices) { 89 | _allServices = [NSMutableArray array]; 90 | } 91 | return _allServices; 92 | } 93 | 94 | - (NSRecursiveLock *)lock 95 | { 96 | if (!_lock) { 97 | _lock = [[NSRecursiveLock alloc] init]; 98 | } 99 | return _lock; 100 | } 101 | 102 | 103 | 104 | - (NSArray *)servicesArray 105 | { 106 | [self.lock lock]; 107 | NSArray *array = [self.allServices copy]; 108 | [self.lock unlock]; 109 | return array; 110 | } 111 | 112 | - (BOOL)checkValidService:(Protocol *)service 113 | { 114 | for (NSDictionary *serviceInfo in [self servicesArray]) { 115 | NSString *protocolStr = [serviceInfo objectForKey:kService]; 116 | if ([protocolStr isEqualToString:NSStringFromProtocol(service)]) { 117 | return YES; 118 | } 119 | } 120 | return NO; 121 | } 122 | 123 | - (Class)serviceImplClass:(Protocol *)service 124 | { 125 | for (NSDictionary *serviceInfo in [self servicesArray]) { 126 | NSString *protocolStr = [serviceInfo objectForKey:kService]; 127 | if ([protocolStr isEqualToString:NSStringFromProtocol(service)]) { 128 | NSString *classStr = [serviceInfo objectForKey:kImpl]; 129 | return NSClassFromString(classStr); 130 | } 131 | } 132 | 133 | return nil; 134 | } 135 | 136 | 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /DecouplingKit/DKServiceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // DKServiceProtocol.h 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/8. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol DKServiceProtocol 12 | + (instancetype)sharedInstance; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Documents/DecouplingKit.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/DecouplingKit/b69d0eded8b9ac49a3f514322a30d5ab159205ee/Documents/DecouplingKit.graffle -------------------------------------------------------------------------------- /Documents/DecouplingKit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/DecouplingKit/b69d0eded8b9ac49a3f514322a30d5ab159205ee/Documents/DecouplingKit.png -------------------------------------------------------------------------------- /Documents/Readme_cn.md: -------------------------------------------------------------------------------- 1 | # DecouplingKit 2 | 3 | 4 | [![Twitter](https://img.shields.io/badge/twitter-@coderyi9-green.svg?style=flat)](http://twitter.com/coderyi9) 5 | 6 | #### Podfile 7 | 8 | ```ruby 9 | 10 | platform :ios, '7.0' 11 | pod 'DecouplingKit', '~> 0.0.2' 12 | 13 | ``` 14 | 15 | 16 | DecouplingKit是一个用于模块之间解耦的方案。 17 | 18 | 当App团队的人数增长到一定人数之后会分出业务线,这样就会通过模块化工作来隔离开各个业务线,以便让各个团队能够独立工作。通用的方案是采用cocoapods把业务代码分别拆到各个仓库,一个业务线就是一个业务仓库,当然如果更大拆分力度的话,一个小模块就是一个cocoapods仓库。这样就对业务线就进行了物理路径的隔离,各个业务线就不能随便调用其他业务线的代码。不过对于一定要调用的话还是可以引入头文件来调用,所以本质上来讲根本没有解除各个业务仓库之间的耦合。 19 | 20 | 解除耦合其中一部分是业务线页面之间的跳转,现在流行的方案是通过router来做。另外一部分很容易忽略就是业务线之间调用方法,属性等,所以就有了DecouplingKit这个中间层来解决这个问题。DecouplingKit之后的业务逻辑可以看下图。 21 | 22 | ![](https://github.com/coderyi/DecouplingKit/blob/master/Documents/DecouplingKit.png) 23 | 24 | DecouplingKit 只有一个类DKServiceManager,用来加载服务列表DKService.plist,服务就是一个业务中类提供的protocol,里面有其他业务需要调用的方法,属性等。DKService.plist里面每一项有service和impl,service对于protocol,impl就是实现protocol的类。 25 | 26 | 比如业务1需要调用业务2的方法,只需要DKServiceManager通过protocol来找到对应业务2中的impl就可以了。其中protocol会集中放在BussinessPublicService仓库,这里不依赖任何仓库,protocol里面的方法对于入参和返回值都通过UIKit,Foundation等系统框架中类型,不需要自己的model类。对于业务2的实现类只要实现对应的方法就好。 27 | 28 | DKServiceManager既可以返回实例,也可以返回类方法,当然对于你如果实现了父协议DKServiceProtocol的sharedInstance方法,也可以返回单例。 29 | 30 | DecouplingKit是基于[BeeHive](https://github.com/alibaba/BeeHive)改造的,BeeHive包括AppDelegate管理和模块调用解耦两部分,DecouplingKit专注于模块调用解耦这部分,DecouplingKit只有一个类比起BeeHive轻量,支持调用实例和类方法,属性。对比解耦的另一种方式就是通过runtime来做,例如[CTMediator](https://github.com/casatwy/CTMediator),通过一个中间层(对应BussinessPublicService)来公布对应的接口,接口调用CTMediator(runtime)来实现,这也是一种非常好的方案。 31 | 32 | 33 | #### 使用 34 | 35 | 注册默认的DKService.plist服务列表 36 | 37 | ``` 38 | [[DKServiceManager sharedInstance] registerLocalServices]; 39 | ``` 40 | 41 | 注册自定义路径的服务列表 42 | ``` 43 | [[DKServiceManager sharedInstance] registerLocalServicesWithServiceConfigName:@"DecouplingKit.bundle/DKService"]; 44 | 45 | ``` 46 | 47 | 创建一个实例,如果这个Bussiness2ServiceProtocol对应的类实现了sharedInstance方法则生成单例,然后调用对应的实例方法 48 | ``` 49 | id bussiness2 =[[DKServiceManager sharedInstance] createInstance:@protocol(Bussiness2ServiceProtocol)]; 50 | 51 | NSDictionary *data =[bussiness2 fetchBussiness2DataWithName:@"DecouplingKit" age:@"1"]; 52 | 53 | ``` 54 | 55 | 56 | 创建一个类,然后调用对应类方法 57 | 58 | ``` 59 | Class Bussiness2 = [[DKServiceManager sharedInstance] createClass:@protocol(Bussiness2ServiceProtocol)]; 60 | 61 | [Bussiness2 callClassMethod]; 62 | 63 | ``` 64 | 65 | 66 | 创建自己业务线类的服务协议 67 | 68 | ``` 69 | @protocol Bussiness2ServiceProtocol 70 | @property (nonatomic,copy) NSString *name; 71 | - (NSDictionary *)fetchBussiness2DataWithName:(NSString *)name age:(NSString *)age; 72 | + (void)callClassMethod; 73 | 74 | @end 75 | 76 | ``` 77 | 78 | 79 | 80 | 81 | #### Licenses 82 | 83 | All source code is licensed under the [MIT License](https://github.com/coderyi/DecouplingKit/blob/master/LICENSE). 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Documents/Readme_en.md: -------------------------------------------------------------------------------- 1 | # DecouplingKit 2 | 3 | 4 | [![Twitter](https://img.shields.io/badge/twitter-@coderyi9-green.svg?style=flat)](http://twitter.com/coderyi9) 5 | 6 | #### Podfile 7 | 8 | ```ruby 9 | 10 | platform :ios, '7.0' 11 | pod 'DecouplingKit', '~> 0.0.2' 12 | 13 | ``` 14 | 15 | 16 | 17 | DecouplingKit, decoupling between modules in your iOS Project. 18 | 19 | 20 | 21 | ![](https://github.com/coderyi/DecouplingKit/blob/master/Documents/DecouplingKit.png) 22 | 23 | 24 | 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. 25 | 26 | 27 | 28 | 29 | 30 | 31 | 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. 32 | 33 | #### Use 34 | 35 | Register the default DKService.plist service list 36 | 37 | ``` 38 | [[DKServiceManager sharedInstance] registerLocalServices]; 39 | ``` 40 | 41 | Register a list of custom paths for services 42 | 43 | ``` 44 | [[DKServiceManager sharedInstance] registerLocalServicesWithServiceConfigName:@"DecouplingKit.bundle/DKService"]; 45 | 46 | ``` 47 | 48 | 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 49 | 50 | ``` 51 | id v4 =[[DKServiceManager sharedInstance] createInstance:@protocol(Bussiness2ServiceProtocol)]; 52 | 53 | NSDictionary *data =[v4 fetchBussiness2DataWithName:@"DecouplingKit" age:@"1"]; 54 | 55 | ``` 56 | 57 | 58 | Create a class and then call the corresponding class method 59 | 60 | ``` 61 | Class Bussiness2 = [[DKServiceManager sharedInstance] createClass:@protocol(Bussiness2ServiceProtocol)]; 62 | 63 | [Bussiness2 callClassMethod]; 64 | 65 | ``` 66 | 67 | 68 | Create a service protocol for your own business line class 69 | 70 | ``` 71 | @protocol Bussiness2ServiceProtocol 72 | @property (nonatomic,copy) NSString *name; 73 | - (NSDictionary *)fetchBussiness2DataWithName:(NSString *)name age:(NSString *)age; 74 | + (void)callClassMethod; 75 | 76 | @end 77 | 78 | ``` 79 | 80 | 81 | 82 | 83 | #### Licenses 84 | 85 | All source code is licensed under the [MIT License](https://github.com/coderyi/DecouplingKit/blob/master/LICENSE). 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /Example/Bussiness1/Bussiness1.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "Bussiness1" 5 | s.version = "0.0.1" 6 | s.summary = "Bussiness1" 7 | s.description = "Bussiness1" 8 | 9 | 10 | 11 | s.homepage = "https://github.com/coderyi/Bussiness1" 12 | 13 | 14 | s.author = { "coderyi" => "coderyi@foxmail.com" } 15 | s.platform = :ios, "7.0" 16 | s.source = { :git => "https://github.com/coderyi/Bussiness1", :tag => "#{s.version}" } 17 | 18 | s.source_files = "Bussiness1/**/*.{h,m,mm}" 19 | s.requires_arc = true 20 | s.resources = "Bussiness1/**/*.{png,plist}" 21 | 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Example/Bussiness1/Bussiness1.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 52AF4E4A84EDFCCA10985C53 /* libPods-Bussiness1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6712C0745387B868511485ED /* libPods-Bussiness1.a */; }; 11 | EE82B5D11E6ECA5F00058FF6 /* Bussiness1ViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = EE82B5CF1E6ECA5F00058FF6 /* Bussiness1ViewController.h */; }; 12 | EE82B5D21E6ECA5F00058FF6 /* Bussiness1ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE82B5D01E6ECA5F00058FF6 /* Bussiness1ViewController.m */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXFileReference section */ 16 | 6712C0745387B868511485ED /* libPods-Bussiness1.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Bussiness1.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 17 | A7B58DC735CA26224288AE22 /* Pods-Bussiness1.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bussiness1.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Bussiness1/Pods-Bussiness1.debug.xcconfig"; sourceTree = ""; }; 18 | E89B95D6F828DB598508E716 /* Pods-Bussiness1.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bussiness1.release.xcconfig"; path = "Pods/Target Support Files/Pods-Bussiness1/Pods-Bussiness1.release.xcconfig"; sourceTree = ""; }; 19 | EE82B5CF1E6ECA5F00058FF6 /* Bussiness1ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bussiness1ViewController.h; sourceTree = ""; }; 20 | EE82B5D01E6ECA5F00058FF6 /* Bussiness1ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Bussiness1ViewController.m; sourceTree = ""; }; 21 | EECB64A11E6B9AA200F3DC7E /* Bussiness1.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Bussiness1.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | /* End PBXFileReference section */ 23 | 24 | /* Begin PBXFrameworksBuildPhase section */ 25 | EECB649D1E6B9AA200F3DC7E /* Frameworks */ = { 26 | isa = PBXFrameworksBuildPhase; 27 | buildActionMask = 2147483647; 28 | files = ( 29 | 52AF4E4A84EDFCCA10985C53 /* libPods-Bussiness1.a in Frameworks */, 30 | ); 31 | runOnlyForDeploymentPostprocessing = 0; 32 | }; 33 | /* End PBXFrameworksBuildPhase section */ 34 | 35 | /* Begin PBXGroup section */ 36 | 9493DA794EF13621D8101E76 /* Pods */ = { 37 | isa = PBXGroup; 38 | children = ( 39 | A7B58DC735CA26224288AE22 /* Pods-Bussiness1.debug.xcconfig */, 40 | E89B95D6F828DB598508E716 /* Pods-Bussiness1.release.xcconfig */, 41 | ); 42 | name = Pods; 43 | sourceTree = ""; 44 | }; 45 | D3A248FFB75A95A14413FD1C /* Frameworks */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | 6712C0745387B868511485ED /* libPods-Bussiness1.a */, 49 | ); 50 | name = Frameworks; 51 | sourceTree = ""; 52 | }; 53 | EECB64971E6B9AA200F3DC7E = { 54 | isa = PBXGroup; 55 | children = ( 56 | EECB64A31E6B9AA200F3DC7E /* Bussiness1 */, 57 | EECB64A21E6B9AA200F3DC7E /* Products */, 58 | 9493DA794EF13621D8101E76 /* Pods */, 59 | D3A248FFB75A95A14413FD1C /* Frameworks */, 60 | ); 61 | sourceTree = ""; 62 | }; 63 | EECB64A21E6B9AA200F3DC7E /* Products */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | EECB64A11E6B9AA200F3DC7E /* Bussiness1.framework */, 67 | ); 68 | name = Products; 69 | sourceTree = ""; 70 | }; 71 | EECB64A31E6B9AA200F3DC7E /* Bussiness1 */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | EE82B5CF1E6ECA5F00058FF6 /* Bussiness1ViewController.h */, 75 | EE82B5D01E6ECA5F00058FF6 /* Bussiness1ViewController.m */, 76 | ); 77 | path = Bussiness1; 78 | sourceTree = ""; 79 | }; 80 | /* End PBXGroup section */ 81 | 82 | /* Begin PBXHeadersBuildPhase section */ 83 | EECB649E1E6B9AA200F3DC7E /* Headers */ = { 84 | isa = PBXHeadersBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | EE82B5D11E6ECA5F00058FF6 /* Bussiness1ViewController.h in Headers */, 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXHeadersBuildPhase section */ 92 | 93 | /* Begin PBXNativeTarget section */ 94 | EECB64A01E6B9AA200F3DC7E /* Bussiness1 */ = { 95 | isa = PBXNativeTarget; 96 | buildConfigurationList = EECB64A91E6B9AA200F3DC7E /* Build configuration list for PBXNativeTarget "Bussiness1" */; 97 | buildPhases = ( 98 | BA89F23F2BC10075D4BBCAEE /* [CP] Check Pods Manifest.lock */, 99 | EECB649C1E6B9AA200F3DC7E /* Sources */, 100 | EECB649D1E6B9AA200F3DC7E /* Frameworks */, 101 | EECB649E1E6B9AA200F3DC7E /* Headers */, 102 | EECB649F1E6B9AA200F3DC7E /* Resources */, 103 | 9DB2BF9F1B1914ACDF84CB51 /* [CP] Copy Pods Resources */, 104 | ); 105 | buildRules = ( 106 | ); 107 | dependencies = ( 108 | ); 109 | name = Bussiness1; 110 | productName = Bussiness1; 111 | productReference = EECB64A11E6B9AA200F3DC7E /* Bussiness1.framework */; 112 | productType = "com.apple.product-type.framework"; 113 | }; 114 | /* End PBXNativeTarget section */ 115 | 116 | /* Begin PBXProject section */ 117 | EECB64981E6B9AA200F3DC7E /* Project object */ = { 118 | isa = PBXProject; 119 | attributes = { 120 | LastUpgradeCheck = 0820; 121 | ORGANIZATIONNAME = coderyi; 122 | TargetAttributes = { 123 | EECB64A01E6B9AA200F3DC7E = { 124 | CreatedOnToolsVersion = 8.2; 125 | ProvisioningStyle = Automatic; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = EECB649B1E6B9AA200F3DC7E /* Build configuration list for PBXProject "Bussiness1" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | ); 136 | mainGroup = EECB64971E6B9AA200F3DC7E; 137 | productRefGroup = EECB64A21E6B9AA200F3DC7E /* Products */; 138 | projectDirPath = ""; 139 | projectRoot = ""; 140 | targets = ( 141 | EECB64A01E6B9AA200F3DC7E /* Bussiness1 */, 142 | ); 143 | }; 144 | /* End PBXProject section */ 145 | 146 | /* Begin PBXResourcesBuildPhase section */ 147 | EECB649F1E6B9AA200F3DC7E /* Resources */ = { 148 | isa = PBXResourcesBuildPhase; 149 | buildActionMask = 2147483647; 150 | files = ( 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | /* End PBXResourcesBuildPhase section */ 155 | 156 | /* Begin PBXShellScriptBuildPhase section */ 157 | 9DB2BF9F1B1914ACDF84CB51 /* [CP] Copy Pods Resources */ = { 158 | isa = PBXShellScriptBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | ); 162 | inputPaths = ( 163 | ); 164 | name = "[CP] Copy Pods Resources"; 165 | outputPaths = ( 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | shellPath = /bin/sh; 169 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Bussiness1/Pods-Bussiness1-resources.sh\"\n"; 170 | showEnvVarsInLog = 0; 171 | }; 172 | BA89F23F2BC10075D4BBCAEE /* [CP] Check Pods Manifest.lock */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "[CP] Check Pods Manifest.lock"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 185 | showEnvVarsInLog = 0; 186 | }; 187 | /* End PBXShellScriptBuildPhase section */ 188 | 189 | /* Begin PBXSourcesBuildPhase section */ 190 | EECB649C1E6B9AA200F3DC7E /* Sources */ = { 191 | isa = PBXSourcesBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | EE82B5D21E6ECA5F00058FF6 /* Bussiness1ViewController.m in Sources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXSourcesBuildPhase section */ 199 | 200 | /* Begin XCBuildConfiguration section */ 201 | EECB64A71E6B9AA200F3DC7E /* Debug */ = { 202 | isa = XCBuildConfiguration; 203 | buildSettings = { 204 | ALWAYS_SEARCH_USER_PATHS = NO; 205 | CLANG_ANALYZER_NONNULL = YES; 206 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 207 | CLANG_CXX_LIBRARY = "libc++"; 208 | CLANG_ENABLE_MODULES = YES; 209 | CLANG_ENABLE_OBJC_ARC = YES; 210 | CLANG_WARN_BOOL_CONVERSION = YES; 211 | CLANG_WARN_CONSTANT_CONVERSION = YES; 212 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 213 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 214 | CLANG_WARN_EMPTY_BODY = YES; 215 | CLANG_WARN_ENUM_CONVERSION = YES; 216 | CLANG_WARN_INFINITE_RECURSION = YES; 217 | CLANG_WARN_INT_CONVERSION = YES; 218 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 219 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 220 | CLANG_WARN_UNREACHABLE_CODE = YES; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 223 | COPY_PHASE_STRIP = NO; 224 | CURRENT_PROJECT_VERSION = 1; 225 | DEBUG_INFORMATION_FORMAT = dwarf; 226 | ENABLE_STRICT_OBJC_MSGSEND = YES; 227 | ENABLE_TESTABILITY = YES; 228 | GCC_C_LANGUAGE_STANDARD = gnu99; 229 | GCC_DYNAMIC_NO_PIC = NO; 230 | GCC_NO_COMMON_BLOCKS = YES; 231 | GCC_OPTIMIZATION_LEVEL = 0; 232 | GCC_PREPROCESSOR_DEFINITIONS = ( 233 | "DEBUG=1", 234 | "$(inherited)", 235 | ); 236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 238 | GCC_WARN_UNDECLARED_SELECTOR = YES; 239 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 240 | GCC_WARN_UNUSED_FUNCTION = YES; 241 | GCC_WARN_UNUSED_VARIABLE = YES; 242 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 243 | MTL_ENABLE_DEBUG_INFO = YES; 244 | ONLY_ACTIVE_ARCH = YES; 245 | SDKROOT = iphoneos; 246 | TARGETED_DEVICE_FAMILY = "1,2"; 247 | VERSIONING_SYSTEM = "apple-generic"; 248 | VERSION_INFO_PREFIX = ""; 249 | }; 250 | name = Debug; 251 | }; 252 | EECB64A81E6B9AA200F3DC7E /* Release */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | ALWAYS_SEARCH_USER_PATHS = NO; 256 | CLANG_ANALYZER_NONNULL = YES; 257 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 258 | CLANG_CXX_LIBRARY = "libc++"; 259 | CLANG_ENABLE_MODULES = YES; 260 | CLANG_ENABLE_OBJC_ARC = YES; 261 | CLANG_WARN_BOOL_CONVERSION = YES; 262 | CLANG_WARN_CONSTANT_CONVERSION = YES; 263 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 264 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INFINITE_RECURSION = YES; 268 | CLANG_WARN_INT_CONVERSION = YES; 269 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 270 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | CURRENT_PROJECT_VERSION = 1; 276 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 277 | ENABLE_NS_ASSERTIONS = NO; 278 | ENABLE_STRICT_OBJC_MSGSEND = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 288 | MTL_ENABLE_DEBUG_INFO = NO; 289 | SDKROOT = iphoneos; 290 | TARGETED_DEVICE_FAMILY = "1,2"; 291 | VALIDATE_PRODUCT = YES; 292 | VERSIONING_SYSTEM = "apple-generic"; 293 | VERSION_INFO_PREFIX = ""; 294 | }; 295 | name = Release; 296 | }; 297 | EECB64AA1E6B9AA200F3DC7E /* Debug */ = { 298 | isa = XCBuildConfiguration; 299 | baseConfigurationReference = A7B58DC735CA26224288AE22 /* Pods-Bussiness1.debug.xcconfig */; 300 | buildSettings = { 301 | CODE_SIGN_IDENTITY = ""; 302 | DEFINES_MODULE = YES; 303 | DYLIB_COMPATIBILITY_VERSION = 1; 304 | DYLIB_CURRENT_VERSION = 1; 305 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 306 | INFOPLIST_FILE = ""; 307 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 308 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 309 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 310 | MACH_O_TYPE = staticlib; 311 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.Bussiness1; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SKIP_INSTALL = YES; 314 | }; 315 | name = Debug; 316 | }; 317 | EECB64AB1E6B9AA200F3DC7E /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | baseConfigurationReference = E89B95D6F828DB598508E716 /* Pods-Bussiness1.release.xcconfig */; 320 | buildSettings = { 321 | CODE_SIGN_IDENTITY = ""; 322 | DEFINES_MODULE = YES; 323 | DYLIB_COMPATIBILITY_VERSION = 1; 324 | DYLIB_CURRENT_VERSION = 1; 325 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 326 | INFOPLIST_FILE = ""; 327 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 328 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 329 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 330 | MACH_O_TYPE = staticlib; 331 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.Bussiness1; 332 | PRODUCT_NAME = "$(TARGET_NAME)"; 333 | SKIP_INSTALL = YES; 334 | }; 335 | name = Release; 336 | }; 337 | /* End XCBuildConfiguration section */ 338 | 339 | /* Begin XCConfigurationList section */ 340 | EECB649B1E6B9AA200F3DC7E /* Build configuration list for PBXProject "Bussiness1" */ = { 341 | isa = XCConfigurationList; 342 | buildConfigurations = ( 343 | EECB64A71E6B9AA200F3DC7E /* Debug */, 344 | EECB64A81E6B9AA200F3DC7E /* Release */, 345 | ); 346 | defaultConfigurationIsVisible = 0; 347 | defaultConfigurationName = Release; 348 | }; 349 | EECB64A91E6B9AA200F3DC7E /* Build configuration list for PBXNativeTarget "Bussiness1" */ = { 350 | isa = XCConfigurationList; 351 | buildConfigurations = ( 352 | EECB64AA1E6B9AA200F3DC7E /* Debug */, 353 | EECB64AB1E6B9AA200F3DC7E /* Release */, 354 | ); 355 | defaultConfigurationIsVisible = 0; 356 | defaultConfigurationName = Release; 357 | }; 358 | /* End XCConfigurationList section */ 359 | }; 360 | rootObject = EECB64981E6B9AA200F3DC7E /* Project object */; 361 | } 362 | -------------------------------------------------------------------------------- /Example/Bussiness1/Bussiness1.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Bussiness1/Bussiness1.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Bussiness1/Bussiness1/Bussiness1ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness1ViewController.h 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/2. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Bussiness1ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Bussiness1/Bussiness1/Bussiness1ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness1ViewController.m 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/2. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "Bussiness1ViewController.h" 10 | #import "Bussiness2Service.h" 11 | #import "DKServiceManager.h" 12 | @interface Bussiness1ViewController () 13 | @property (nonatomic,strong) UILabel *label; 14 | @end 15 | 16 | @implementation Bussiness1ViewController 17 | @synthesize label; 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view. 21 | self.view.backgroundColor = [UIColor whiteColor]; 22 | self.title =@"Bussiness1"; 23 | 24 | label = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 300)/2, 0, 300, 300)]; 25 | label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 26 | label.textAlignment = NSTextAlignmentCenter; 27 | label.text = [NSString stringWithFormat:@"%@", @"null data"]; 28 | label.numberOfLines = 0; 29 | [self.view addSubview:label]; 30 | 31 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMidX(self.view.frame)-50, 32 | CGRectGetMaxY(label.frame)-20, 33 | 100, 34 | 80)]; 35 | btn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 36 | btn.backgroundColor = [UIColor blackColor]; 37 | 38 | [btn setTitle:@"click me" forState:UIControlStateNormal]; 39 | 40 | [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; 41 | 42 | [self.view addSubview:btn]; 43 | 44 | 45 | } 46 | 47 | 48 | -(void)click:(UIButton *)btn 49 | { 50 | //创建一个实例,如果这个Bussiness2ServiceProtocol对应的类实现了sharedInstance方法则生成单例 51 | id bussiness2 =[[DKServiceManager sharedInstance] createInstance:@protocol(Bussiness2ServiceProtocol)]; 52 | 53 | //调用服务 54 | NSDictionary *data =[bussiness2 fetchBussiness2DataWithName:@"DecouplingKit" age:@"1"]; 55 | 56 | //创建一个类 57 | Class Bussiness2 = [[DKServiceManager sharedInstance] createClass:@protocol(Bussiness2ServiceProtocol)]; 58 | //调用类方法 59 | [Bussiness2 callClassMethod]; 60 | label.text =[NSString stringWithFormat:@"call bussiness2 instance method \n call bussiness2 class method"]; 61 | 62 | } 63 | 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Example/Bussiness1/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | target "Bussiness1” do 4 | pod 'DecouplingKit', :path=>'../../’ 5 | pod 'BussinessPublicService', :path=>'../BussinessPublicService’ 6 | #pod 'Bussiness2', :path=>'/Users/youku/Music/github/DecouplingKit1/Bussiness2’ 7 | 8 | end 9 | -------------------------------------------------------------------------------- /Example/Bussiness1/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BussinessPublicService (0.0.1) 3 | - DecouplingKit (0.0.1) 4 | 5 | DEPENDENCIES: 6 | - BussinessPublicService (from `../BussinessPublicService`) 7 | - DecouplingKit (from `../../`) 8 | 9 | EXTERNAL SOURCES: 10 | BussinessPublicService: 11 | :path: "../BussinessPublicService" 12 | DecouplingKit: 13 | :path: "../../" 14 | 15 | SPEC CHECKSUMS: 16 | BussinessPublicService: 671cb1e5f60c09eefdf5f28eaee170220068a654 17 | DecouplingKit: b161139761b02057b107f0b4fc8871c11611f947 18 | 19 | PODFILE CHECKSUM: bf9066636b339656f63262344b3e56cd02d59837 20 | 21 | COCOAPODS: 1.0.1 22 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "Bussiness2" 5 | s.version = "0.0.1" 6 | s.summary = "Bussiness2" 7 | s.description = "Bussiness2" 8 | 9 | 10 | 11 | s.homepage = "https://github.com/coderyi/Bussiness2" 12 | 13 | 14 | s.author = { "coderyi" => "coderyi@foxmail.com" } 15 | s.platform = :ios, "7.0" 16 | s.source = { :git => "https://github.com/coderyi/Bussiness2", :tag => "#{s.version}" } 17 | 18 | s.source_files = "Bussiness2/**/*.{h,m,mm}" 19 | s.requires_arc = true 20 | s.resources = "Bussinesss2/**/*.{png,plist}" 21 | 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 624480A5E3A17AD54BED8492 /* libPods-Bussiness2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EECD7697C3D8E5EB4153C3 /* libPods-Bussiness2.a */; }; 11 | EE82B5CB1E6ECA5100058FF6 /* Bussiness2Manager.h in Headers */ = {isa = PBXBuildFile; fileRef = EE82B5C71E6ECA5100058FF6 /* Bussiness2Manager.h */; }; 12 | EE82B5CC1E6ECA5100058FF6 /* Bussiness2Manager.m in Sources */ = {isa = PBXBuildFile; fileRef = EE82B5C81E6ECA5100058FF6 /* Bussiness2Manager.m */; }; 13 | EE82B5CD1E6ECA5100058FF6 /* Bussiness2Model.h in Headers */ = {isa = PBXBuildFile; fileRef = EE82B5C91E6ECA5100058FF6 /* Bussiness2Model.h */; }; 14 | EE82B5CE1E6ECA5100058FF6 /* Bussiness2Model.m in Sources */ = {isa = PBXBuildFile; fileRef = EE82B5CA1E6ECA5100058FF6 /* Bussiness2Model.m */; }; 15 | EE82B5D51E6ECA6600058FF6 /* Bussiness2ViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = EE82B5D31E6ECA6600058FF6 /* Bussiness2ViewController.h */; }; 16 | EE82B5D61E6ECA6600058FF6 /* Bussiness2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE82B5D41E6ECA6600058FF6 /* Bussiness2ViewController.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 22EECD7697C3D8E5EB4153C3 /* libPods-Bussiness2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Bussiness2.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | BB2B39081495930401FA623D /* Pods-Bussiness2.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bussiness2.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Bussiness2/Pods-Bussiness2.debug.xcconfig"; sourceTree = ""; }; 22 | E83A679425067A181AD04724 /* Pods-Bussiness2.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bussiness2.release.xcconfig"; path = "Pods/Target Support Files/Pods-Bussiness2/Pods-Bussiness2.release.xcconfig"; sourceTree = ""; }; 23 | EE82B5C71E6ECA5100058FF6 /* Bussiness2Manager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bussiness2Manager.h; sourceTree = ""; }; 24 | EE82B5C81E6ECA5100058FF6 /* Bussiness2Manager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Bussiness2Manager.m; sourceTree = ""; }; 25 | EE82B5C91E6ECA5100058FF6 /* Bussiness2Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bussiness2Model.h; sourceTree = ""; }; 26 | EE82B5CA1E6ECA5100058FF6 /* Bussiness2Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Bussiness2Model.m; sourceTree = ""; }; 27 | EE82B5D31E6ECA6600058FF6 /* Bussiness2ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bussiness2ViewController.h; sourceTree = ""; }; 28 | EE82B5D41E6ECA6600058FF6 /* Bussiness2ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Bussiness2ViewController.m; sourceTree = ""; }; 29 | EECB64BC1E6B9B3100F3DC7E /* Bussiness2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Bussiness2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | EECB64B81E6B9B3100F3DC7E /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | 624480A5E3A17AD54BED8492 /* libPods-Bussiness2.a in Frameworks */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 0AD0DC134AEF46E9B07CDB54 /* Frameworks */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | 22EECD7697C3D8E5EB4153C3 /* libPods-Bussiness2.a */, 48 | ); 49 | name = Frameworks; 50 | sourceTree = ""; 51 | }; 52 | 2D22F124F54704F3CB3F33D7 /* Pods */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | BB2B39081495930401FA623D /* Pods-Bussiness2.debug.xcconfig */, 56 | E83A679425067A181AD04724 /* Pods-Bussiness2.release.xcconfig */, 57 | ); 58 | name = Pods; 59 | sourceTree = ""; 60 | }; 61 | EECB64B21E6B9B3100F3DC7E = { 62 | isa = PBXGroup; 63 | children = ( 64 | EECB64BE1E6B9B3100F3DC7E /* Bussiness2 */, 65 | EECB64BD1E6B9B3100F3DC7E /* Products */, 66 | 2D22F124F54704F3CB3F33D7 /* Pods */, 67 | 0AD0DC134AEF46E9B07CDB54 /* Frameworks */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | EECB64BD1E6B9B3100F3DC7E /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | EECB64BC1E6B9B3100F3DC7E /* Bussiness2.framework */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | EECB64BE1E6B9B3100F3DC7E /* Bussiness2 */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | EE82B5D31E6ECA6600058FF6 /* Bussiness2ViewController.h */, 83 | EE82B5D41E6ECA6600058FF6 /* Bussiness2ViewController.m */, 84 | EE82B5C71E6ECA5100058FF6 /* Bussiness2Manager.h */, 85 | EE82B5C81E6ECA5100058FF6 /* Bussiness2Manager.m */, 86 | EE82B5C91E6ECA5100058FF6 /* Bussiness2Model.h */, 87 | EE82B5CA1E6ECA5100058FF6 /* Bussiness2Model.m */, 88 | ); 89 | path = Bussiness2; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXHeadersBuildPhase section */ 95 | EECB64B91E6B9B3100F3DC7E /* Headers */ = { 96 | isa = PBXHeadersBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | EE82B5CB1E6ECA5100058FF6 /* Bussiness2Manager.h in Headers */, 100 | EE82B5CD1E6ECA5100058FF6 /* Bussiness2Model.h in Headers */, 101 | EE82B5D51E6ECA6600058FF6 /* Bussiness2ViewController.h in Headers */, 102 | ); 103 | runOnlyForDeploymentPostprocessing = 0; 104 | }; 105 | /* End PBXHeadersBuildPhase section */ 106 | 107 | /* Begin PBXNativeTarget section */ 108 | EECB64BB1E6B9B3100F3DC7E /* Bussiness2 */ = { 109 | isa = PBXNativeTarget; 110 | buildConfigurationList = EECB64C41E6B9B3100F3DC7E /* Build configuration list for PBXNativeTarget "Bussiness2" */; 111 | buildPhases = ( 112 | 5E79F199461EC45D9C78F3A2 /* [CP] Check Pods Manifest.lock */, 113 | EECB64B71E6B9B3100F3DC7E /* Sources */, 114 | EECB64B81E6B9B3100F3DC7E /* Frameworks */, 115 | EECB64B91E6B9B3100F3DC7E /* Headers */, 116 | EECB64BA1E6B9B3100F3DC7E /* Resources */, 117 | 6C2FDB9000081C242DE0925D /* [CP] Copy Pods Resources */, 118 | ); 119 | buildRules = ( 120 | ); 121 | dependencies = ( 122 | ); 123 | name = Bussiness2; 124 | productName = Bussiness2; 125 | productReference = EECB64BC1E6B9B3100F3DC7E /* Bussiness2.framework */; 126 | productType = "com.apple.product-type.framework"; 127 | }; 128 | /* End PBXNativeTarget section */ 129 | 130 | /* Begin PBXProject section */ 131 | EECB64B31E6B9B3100F3DC7E /* Project object */ = { 132 | isa = PBXProject; 133 | attributes = { 134 | LastUpgradeCheck = 0820; 135 | ORGANIZATIONNAME = coderyi; 136 | TargetAttributes = { 137 | EECB64BB1E6B9B3100F3DC7E = { 138 | CreatedOnToolsVersion = 8.2; 139 | ProvisioningStyle = Automatic; 140 | }; 141 | }; 142 | }; 143 | buildConfigurationList = EECB64B61E6B9B3100F3DC7E /* Build configuration list for PBXProject "Bussiness2" */; 144 | compatibilityVersion = "Xcode 3.2"; 145 | developmentRegion = English; 146 | hasScannedForEncodings = 0; 147 | knownRegions = ( 148 | en, 149 | ); 150 | mainGroup = EECB64B21E6B9B3100F3DC7E; 151 | productRefGroup = EECB64BD1E6B9B3100F3DC7E /* Products */; 152 | projectDirPath = ""; 153 | projectRoot = ""; 154 | targets = ( 155 | EECB64BB1E6B9B3100F3DC7E /* Bussiness2 */, 156 | ); 157 | }; 158 | /* End PBXProject section */ 159 | 160 | /* Begin PBXResourcesBuildPhase section */ 161 | EECB64BA1E6B9B3100F3DC7E /* Resources */ = { 162 | isa = PBXResourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXShellScriptBuildPhase section */ 171 | 5E79F199461EC45D9C78F3A2 /* [CP] Check Pods Manifest.lock */ = { 172 | isa = PBXShellScriptBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | ); 176 | inputPaths = ( 177 | ); 178 | name = "[CP] Check Pods Manifest.lock"; 179 | outputPaths = ( 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | shellPath = /bin/sh; 183 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 184 | showEnvVarsInLog = 0; 185 | }; 186 | 6C2FDB9000081C242DE0925D /* [CP] Copy Pods Resources */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "[CP] Copy Pods Resources"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Bussiness2/Pods-Bussiness2-resources.sh\"\n"; 199 | showEnvVarsInLog = 0; 200 | }; 201 | /* End PBXShellScriptBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | EECB64B71E6B9B3100F3DC7E /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | EE82B5D61E6ECA6600058FF6 /* Bussiness2ViewController.m in Sources */, 209 | EE82B5CC1E6ECA5100058FF6 /* Bussiness2Manager.m in Sources */, 210 | EE82B5CE1E6ECA5100058FF6 /* Bussiness2Model.m in Sources */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXSourcesBuildPhase section */ 215 | 216 | /* Begin XCBuildConfiguration section */ 217 | EECB64C21E6B9B3100F3DC7E /* Debug */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | ALWAYS_SEARCH_USER_PATHS = NO; 221 | CLANG_ANALYZER_NONNULL = YES; 222 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 223 | CLANG_CXX_LIBRARY = "libc++"; 224 | CLANG_ENABLE_MODULES = YES; 225 | CLANG_ENABLE_OBJC_ARC = YES; 226 | CLANG_WARN_BOOL_CONVERSION = YES; 227 | CLANG_WARN_CONSTANT_CONVERSION = YES; 228 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 229 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 230 | CLANG_WARN_EMPTY_BODY = YES; 231 | CLANG_WARN_ENUM_CONVERSION = YES; 232 | CLANG_WARN_INFINITE_RECURSION = YES; 233 | CLANG_WARN_INT_CONVERSION = YES; 234 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 235 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 236 | CLANG_WARN_UNREACHABLE_CODE = YES; 237 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 238 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 239 | COPY_PHASE_STRIP = NO; 240 | CURRENT_PROJECT_VERSION = 1; 241 | DEBUG_INFORMATION_FORMAT = dwarf; 242 | ENABLE_STRICT_OBJC_MSGSEND = YES; 243 | ENABLE_TESTABILITY = YES; 244 | GCC_C_LANGUAGE_STANDARD = gnu99; 245 | GCC_DYNAMIC_NO_PIC = NO; 246 | GCC_NO_COMMON_BLOCKS = YES; 247 | GCC_OPTIMIZATION_LEVEL = 0; 248 | GCC_PREPROCESSOR_DEFINITIONS = ( 249 | "DEBUG=1", 250 | "$(inherited)", 251 | ); 252 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 253 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 254 | GCC_WARN_UNDECLARED_SELECTOR = YES; 255 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 256 | GCC_WARN_UNUSED_FUNCTION = YES; 257 | GCC_WARN_UNUSED_VARIABLE = YES; 258 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 259 | MTL_ENABLE_DEBUG_INFO = YES; 260 | ONLY_ACTIVE_ARCH = YES; 261 | SDKROOT = iphoneos; 262 | TARGETED_DEVICE_FAMILY = "1,2"; 263 | VERSIONING_SYSTEM = "apple-generic"; 264 | VERSION_INFO_PREFIX = ""; 265 | }; 266 | name = Debug; 267 | }; 268 | EECB64C31E6B9B3100F3DC7E /* Release */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | ALWAYS_SEARCH_USER_PATHS = NO; 272 | CLANG_ANALYZER_NONNULL = YES; 273 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 274 | CLANG_CXX_LIBRARY = "libc++"; 275 | CLANG_ENABLE_MODULES = YES; 276 | CLANG_ENABLE_OBJC_ARC = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 280 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 281 | CLANG_WARN_EMPTY_BODY = YES; 282 | CLANG_WARN_ENUM_CONVERSION = YES; 283 | CLANG_WARN_INFINITE_RECURSION = YES; 284 | CLANG_WARN_INT_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 287 | CLANG_WARN_UNREACHABLE_CODE = YES; 288 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 289 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 290 | COPY_PHASE_STRIP = NO; 291 | CURRENT_PROJECT_VERSION = 1; 292 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 293 | ENABLE_NS_ASSERTIONS = NO; 294 | ENABLE_STRICT_OBJC_MSGSEND = YES; 295 | GCC_C_LANGUAGE_STANDARD = gnu99; 296 | GCC_NO_COMMON_BLOCKS = YES; 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 304 | MTL_ENABLE_DEBUG_INFO = NO; 305 | SDKROOT = iphoneos; 306 | TARGETED_DEVICE_FAMILY = "1,2"; 307 | VALIDATE_PRODUCT = YES; 308 | VERSIONING_SYSTEM = "apple-generic"; 309 | VERSION_INFO_PREFIX = ""; 310 | }; 311 | name = Release; 312 | }; 313 | EECB64C51E6B9B3100F3DC7E /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | baseConfigurationReference = BB2B39081495930401FA623D /* Pods-Bussiness2.debug.xcconfig */; 316 | buildSettings = { 317 | CODE_SIGN_IDENTITY = ""; 318 | DEFINES_MODULE = YES; 319 | DYLIB_COMPATIBILITY_VERSION = 1; 320 | DYLIB_CURRENT_VERSION = 1; 321 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 322 | INFOPLIST_FILE = ""; 323 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 324 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 326 | MACH_O_TYPE = staticlib; 327 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.Bussiness2; 328 | PRODUCT_NAME = "$(TARGET_NAME)"; 329 | SKIP_INSTALL = YES; 330 | }; 331 | name = Debug; 332 | }; 333 | EECB64C61E6B9B3100F3DC7E /* Release */ = { 334 | isa = XCBuildConfiguration; 335 | baseConfigurationReference = E83A679425067A181AD04724 /* Pods-Bussiness2.release.xcconfig */; 336 | buildSettings = { 337 | CODE_SIGN_IDENTITY = ""; 338 | DEFINES_MODULE = YES; 339 | DYLIB_COMPATIBILITY_VERSION = 1; 340 | DYLIB_CURRENT_VERSION = 1; 341 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 342 | INFOPLIST_FILE = ""; 343 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 344 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 345 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 346 | MACH_O_TYPE = staticlib; 347 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.Bussiness2; 348 | PRODUCT_NAME = "$(TARGET_NAME)"; 349 | SKIP_INSTALL = YES; 350 | }; 351 | name = Release; 352 | }; 353 | /* End XCBuildConfiguration section */ 354 | 355 | /* Begin XCConfigurationList section */ 356 | EECB64B61E6B9B3100F3DC7E /* Build configuration list for PBXProject "Bussiness2" */ = { 357 | isa = XCConfigurationList; 358 | buildConfigurations = ( 359 | EECB64C21E6B9B3100F3DC7E /* Debug */, 360 | EECB64C31E6B9B3100F3DC7E /* Release */, 361 | ); 362 | defaultConfigurationIsVisible = 0; 363 | defaultConfigurationName = Release; 364 | }; 365 | EECB64C41E6B9B3100F3DC7E /* Build configuration list for PBXNativeTarget "Bussiness2" */ = { 366 | isa = XCConfigurationList; 367 | buildConfigurations = ( 368 | EECB64C51E6B9B3100F3DC7E /* Debug */, 369 | EECB64C61E6B9B3100F3DC7E /* Release */, 370 | ); 371 | defaultConfigurationIsVisible = 0; 372 | defaultConfigurationName = Release; 373 | }; 374 | /* End XCConfigurationList section */ 375 | }; 376 | rootObject = EECB64B31E6B9B3100F3DC7E /* Project object */; 377 | } 378 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2/Bussiness2Manager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness2Manager.h 3 | // Bussiness2 4 | // 5 | // Created by coderyi on 2017/3/7. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Bussiness2Model.h" 11 | #import "Bussiness2Service.h" 12 | @interface Bussiness2Manager : NSObject 13 | @property (nonatomic,strong) Bussiness2Model *model; 14 | 15 | + (instancetype)sharedManager; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2/Bussiness2Manager.m: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness2Manager.m 3 | // Bussiness2 4 | // 5 | // Created by coderyi on 2017/3/7. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "Bussiness2Manager.h" 10 | #import "Bussiness2Model.h" 11 | #import "Bussiness2Service.h" 12 | 13 | @implementation Bussiness2Manager 14 | 15 | + (instancetype)sharedInstance { 16 | return [Bussiness2Manager sharedManager]; 17 | } 18 | 19 | + (instancetype)sharedManager 20 | { 21 | static Bussiness2Manager *_sharedInstance = nil; 22 | static dispatch_once_t onceToken; 23 | dispatch_once(&onceToken, ^{ 24 | _sharedInstance = [[self alloc] init]; 25 | }); 26 | return _sharedInstance; 27 | } 28 | 29 | - (id)init 30 | { 31 | self = [super init]; 32 | if (self) { 33 | _model = [[Bussiness2Model alloc] init]; 34 | 35 | } 36 | return self; 37 | } 38 | 39 | 40 | - (NSDictionary *)fetchBussiness2DataWithName:(NSString *)name age:(NSString *)age{ 41 | Bussiness2Model *bussiness2Model =[[Bussiness2Model alloc] init]; 42 | bussiness2Model.name =name?:@"xx"; 43 | bussiness2Model.age=age?:@"12"; 44 | NSLog(@"Bussiness2 fetch name is %@ age is %@",bussiness2Model.name,bussiness2Model.age); 45 | _model = bussiness2Model; 46 | return @{@"name":bussiness2Model.name,@"age":bussiness2Model.age}; 47 | } 48 | 49 | + (void)callClassMethod { 50 | NSLog(@"business1 callClassMethod"); 51 | } 52 | @end 53 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2/Bussiness2Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness2Model.h 3 | // Bussiness2 4 | // 5 | // Created by coderyi on 2017/3/7. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Bussiness2Model : NSObject 12 | @property (nonatomic,copy) NSString *name; 13 | @property (nonatomic,copy) NSString *age; 14 | @end 15 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2/Bussiness2Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness2Model.m 3 | // Bussiness2 4 | // 5 | // Created by coderyi on 2017/3/7. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "Bussiness2Model.h" 10 | 11 | @implementation Bussiness2Model 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2/Bussiness2ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness2ViewController.h 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/2. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Bussiness2ViewController : UIViewController 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/Bussiness2/Bussiness2/Bussiness2ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness2ViewController.m 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/2. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "Bussiness2ViewController.h" 10 | #import "Bussiness2Manager.h" 11 | #import "Bussiness2Model.h" 12 | 13 | @interface Bussiness2ViewController () 14 | @property (nonatomic,strong) UILabel *label; 15 | @property (nonatomic,copy) NSString *bussinessName; 16 | @end 17 | 18 | @implementation Bussiness2ViewController 19 | @synthesize label; 20 | 21 | 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view. 26 | self.view.backgroundColor = [UIColor whiteColor]; 27 | self.title =@"Bussiness2"; 28 | 29 | label = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 300)/2, 0, 300, 300)]; 30 | label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 31 | label.textAlignment = NSTextAlignmentCenter; 32 | label.text = [NSString stringWithFormat:@"%@", @"null data"]; 33 | 34 | [self.view addSubview:label]; 35 | 36 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMidX(self.view.frame)-50, 37 | CGRectGetMaxY(label.frame)-20, 38 | 100, 39 | 80)]; 40 | btn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 41 | btn.backgroundColor = [UIColor blackColor]; 42 | 43 | [btn setTitle:@"click me" forState:UIControlStateNormal]; 44 | 45 | [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; 46 | 47 | [self.view addSubview:btn]; 48 | 49 | } 50 | 51 | - (void)viewDidAppear:(BOOL)animated { 52 | [super viewDidAppear:animated]; 53 | if ([Bussiness2Manager sharedManager].model) { 54 | label.text = [NSString stringWithFormat:@"bussiness2 called Bussiness2 \n name is %@ ",[Bussiness2Manager sharedManager].model.name]; 55 | 56 | } 57 | } 58 | 59 | -(void)click:(UIButton *)btn { 60 | if ([Bussiness2Manager sharedManager].model) { 61 | label.text = [NSString stringWithFormat:@"bussiness2 called Bussiness2 \n name is %@ ",[Bussiness2Manager sharedManager].model.name]; 62 | 63 | } 64 | 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Example/Bussiness2/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | target "Bussiness2" do 4 | pod 'DecouplingKit', :path=>'../../’ 5 | pod 'BussinessPublicService', :path=>'../BussinessPublicService’ 6 | #pod 'Bussiness2', :path=>'/Users/youku/Music/github/DecouplingKit1/Bussiness2’ 7 | 8 | end 9 | -------------------------------------------------------------------------------- /Example/Bussiness2/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BussinessPublicService (0.0.1) 3 | - DecouplingKit (0.0.2) 4 | 5 | DEPENDENCIES: 6 | - BussinessPublicService (from `../BussinessPublicService`) 7 | - DecouplingKit (from `../../`) 8 | 9 | EXTERNAL SOURCES: 10 | BussinessPublicService: 11 | :path: ../BussinessPublicService 12 | DecouplingKit: 13 | :path: ../../ 14 | 15 | SPEC CHECKSUMS: 16 | BussinessPublicService: 671cb1e5f60c09eefdf5f28eaee170220068a654 17 | DecouplingKit: 77c56383787059f35c56668136d78f8add6f0359 18 | 19 | PODFILE CHECKSUM: 9c6833c0fa7015c6f076256b15fcb0e70f45349e 20 | 21 | COCOAPODS: 1.1.0.rc.2 22 | -------------------------------------------------------------------------------- /Example/BussinessPublicService/BussinessPublicService.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "BussinessPublicService" 5 | s.version = "0.0.1" 6 | s.summary = "BussinessPublicService" 7 | s.description = "BussinessPublicService" 8 | 9 | 10 | 11 | s.homepage = "https://github.com/coderyi/BussinessPublicService" 12 | 13 | 14 | s.author = { "coderyi" => "coderyi@foxmail.com" } 15 | s.platform = :ios, "7.0" 16 | s.source = { :git => "https://github.com/coderyi/BussinessPublicService", :tag => "#{s.version}" } 17 | 18 | s.source_files = "BussinessPublicService/**/*.{h,m,mm}" 19 | s.requires_arc = true 20 | s.resources = "BussinessPublicService/**/*.{png,plist}" 21 | 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Example/BussinessPublicService/BussinessPublicService.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EE247D601E6E4FEF0044E168 /* Bussiness2Service.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247D5F1E6E4FEF0044E168 /* Bussiness2Service.h */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXFileReference section */ 14 | EE247D541E6E4FCC0044E168 /* BussinessPublicService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BussinessPublicService.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 15 | EE247D5F1E6E4FEF0044E168 /* Bussiness2Service.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bussiness2Service.h; sourceTree = ""; }; 16 | /* End PBXFileReference section */ 17 | 18 | /* Begin PBXFrameworksBuildPhase section */ 19 | EE247D501E6E4FCC0044E168 /* Frameworks */ = { 20 | isa = PBXFrameworksBuildPhase; 21 | buildActionMask = 2147483647; 22 | files = ( 23 | ); 24 | runOnlyForDeploymentPostprocessing = 0; 25 | }; 26 | /* End PBXFrameworksBuildPhase section */ 27 | 28 | /* Begin PBXGroup section */ 29 | EE247D4A1E6E4FCC0044E168 = { 30 | isa = PBXGroup; 31 | children = ( 32 | EE247D561E6E4FCC0044E168 /* BussinessPublicService */, 33 | EE247D551E6E4FCC0044E168 /* Products */, 34 | ); 35 | sourceTree = ""; 36 | }; 37 | EE247D551E6E4FCC0044E168 /* Products */ = { 38 | isa = PBXGroup; 39 | children = ( 40 | EE247D541E6E4FCC0044E168 /* BussinessPublicService.framework */, 41 | ); 42 | name = Products; 43 | sourceTree = ""; 44 | }; 45 | EE247D561E6E4FCC0044E168 /* BussinessPublicService */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | EE247D5F1E6E4FEF0044E168 /* Bussiness2Service.h */, 49 | ); 50 | path = BussinessPublicService; 51 | sourceTree = ""; 52 | }; 53 | /* End PBXGroup section */ 54 | 55 | /* Begin PBXHeadersBuildPhase section */ 56 | EE247D511E6E4FCC0044E168 /* Headers */ = { 57 | isa = PBXHeadersBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | EE247D601E6E4FEF0044E168 /* Bussiness2Service.h in Headers */, 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXHeadersBuildPhase section */ 65 | 66 | /* Begin PBXNativeTarget section */ 67 | EE247D531E6E4FCC0044E168 /* BussinessPublicService */ = { 68 | isa = PBXNativeTarget; 69 | buildConfigurationList = EE247D5C1E6E4FCC0044E168 /* Build configuration list for PBXNativeTarget "BussinessPublicService" */; 70 | buildPhases = ( 71 | EE247D4F1E6E4FCC0044E168 /* Sources */, 72 | EE247D501E6E4FCC0044E168 /* Frameworks */, 73 | EE247D511E6E4FCC0044E168 /* Headers */, 74 | EE247D521E6E4FCC0044E168 /* Resources */, 75 | ); 76 | buildRules = ( 77 | ); 78 | dependencies = ( 79 | ); 80 | name = BussinessPublicService; 81 | productName = BussinessPublicService; 82 | productReference = EE247D541E6E4FCC0044E168 /* BussinessPublicService.framework */; 83 | productType = "com.apple.product-type.framework"; 84 | }; 85 | /* End PBXNativeTarget section */ 86 | 87 | /* Begin PBXProject section */ 88 | EE247D4B1E6E4FCC0044E168 /* Project object */ = { 89 | isa = PBXProject; 90 | attributes = { 91 | LastUpgradeCheck = 0820; 92 | ORGANIZATIONNAME = coderyi; 93 | TargetAttributes = { 94 | EE247D531E6E4FCC0044E168 = { 95 | CreatedOnToolsVersion = 8.2; 96 | ProvisioningStyle = Automatic; 97 | }; 98 | }; 99 | }; 100 | buildConfigurationList = EE247D4E1E6E4FCC0044E168 /* Build configuration list for PBXProject "BussinessPublicService" */; 101 | compatibilityVersion = "Xcode 3.2"; 102 | developmentRegion = English; 103 | hasScannedForEncodings = 0; 104 | knownRegions = ( 105 | en, 106 | ); 107 | mainGroup = EE247D4A1E6E4FCC0044E168; 108 | productRefGroup = EE247D551E6E4FCC0044E168 /* Products */; 109 | projectDirPath = ""; 110 | projectRoot = ""; 111 | targets = ( 112 | EE247D531E6E4FCC0044E168 /* BussinessPublicService */, 113 | ); 114 | }; 115 | /* End PBXProject section */ 116 | 117 | /* Begin PBXResourcesBuildPhase section */ 118 | EE247D521E6E4FCC0044E168 /* Resources */ = { 119 | isa = PBXResourcesBuildPhase; 120 | buildActionMask = 2147483647; 121 | files = ( 122 | ); 123 | runOnlyForDeploymentPostprocessing = 0; 124 | }; 125 | /* End PBXResourcesBuildPhase section */ 126 | 127 | /* Begin PBXSourcesBuildPhase section */ 128 | EE247D4F1E6E4FCC0044E168 /* Sources */ = { 129 | isa = PBXSourcesBuildPhase; 130 | buildActionMask = 2147483647; 131 | files = ( 132 | ); 133 | runOnlyForDeploymentPostprocessing = 0; 134 | }; 135 | /* End PBXSourcesBuildPhase section */ 136 | 137 | /* Begin XCBuildConfiguration section */ 138 | EE247D5A1E6E4FCC0044E168 /* Debug */ = { 139 | isa = XCBuildConfiguration; 140 | buildSettings = { 141 | ALWAYS_SEARCH_USER_PATHS = NO; 142 | CLANG_ANALYZER_NONNULL = YES; 143 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 144 | CLANG_CXX_LIBRARY = "libc++"; 145 | CLANG_ENABLE_MODULES = YES; 146 | CLANG_ENABLE_OBJC_ARC = YES; 147 | CLANG_WARN_BOOL_CONVERSION = YES; 148 | CLANG_WARN_CONSTANT_CONVERSION = YES; 149 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 150 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 151 | CLANG_WARN_EMPTY_BODY = YES; 152 | CLANG_WARN_ENUM_CONVERSION = YES; 153 | CLANG_WARN_INFINITE_RECURSION = YES; 154 | CLANG_WARN_INT_CONVERSION = YES; 155 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 156 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 157 | CLANG_WARN_UNREACHABLE_CODE = YES; 158 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 159 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 160 | COPY_PHASE_STRIP = NO; 161 | CURRENT_PROJECT_VERSION = 1; 162 | DEBUG_INFORMATION_FORMAT = dwarf; 163 | ENABLE_STRICT_OBJC_MSGSEND = YES; 164 | ENABLE_TESTABILITY = YES; 165 | GCC_C_LANGUAGE_STANDARD = gnu99; 166 | GCC_DYNAMIC_NO_PIC = NO; 167 | GCC_NO_COMMON_BLOCKS = YES; 168 | GCC_OPTIMIZATION_LEVEL = 0; 169 | GCC_PREPROCESSOR_DEFINITIONS = ( 170 | "DEBUG=1", 171 | "$(inherited)", 172 | ); 173 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 174 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 175 | GCC_WARN_UNDECLARED_SELECTOR = YES; 176 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 177 | GCC_WARN_UNUSED_FUNCTION = YES; 178 | GCC_WARN_UNUSED_VARIABLE = YES; 179 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 180 | MTL_ENABLE_DEBUG_INFO = YES; 181 | ONLY_ACTIVE_ARCH = YES; 182 | SDKROOT = iphoneos; 183 | TARGETED_DEVICE_FAMILY = "1,2"; 184 | VERSIONING_SYSTEM = "apple-generic"; 185 | VERSION_INFO_PREFIX = ""; 186 | }; 187 | name = Debug; 188 | }; 189 | EE247D5B1E6E4FCC0044E168 /* Release */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ALWAYS_SEARCH_USER_PATHS = NO; 193 | CLANG_ANALYZER_NONNULL = YES; 194 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 195 | CLANG_CXX_LIBRARY = "libc++"; 196 | CLANG_ENABLE_MODULES = YES; 197 | CLANG_ENABLE_OBJC_ARC = YES; 198 | CLANG_WARN_BOOL_CONVERSION = YES; 199 | CLANG_WARN_CONSTANT_CONVERSION = YES; 200 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 201 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 202 | CLANG_WARN_EMPTY_BODY = YES; 203 | CLANG_WARN_ENUM_CONVERSION = YES; 204 | CLANG_WARN_INFINITE_RECURSION = YES; 205 | CLANG_WARN_INT_CONVERSION = YES; 206 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 207 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 208 | CLANG_WARN_UNREACHABLE_CODE = YES; 209 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 210 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 211 | COPY_PHASE_STRIP = NO; 212 | CURRENT_PROJECT_VERSION = 1; 213 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 214 | ENABLE_NS_ASSERTIONS = NO; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | GCC_C_LANGUAGE_STANDARD = gnu99; 217 | GCC_NO_COMMON_BLOCKS = YES; 218 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 219 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 220 | GCC_WARN_UNDECLARED_SELECTOR = YES; 221 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 222 | GCC_WARN_UNUSED_FUNCTION = YES; 223 | GCC_WARN_UNUSED_VARIABLE = YES; 224 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 225 | MTL_ENABLE_DEBUG_INFO = NO; 226 | SDKROOT = iphoneos; 227 | TARGETED_DEVICE_FAMILY = "1,2"; 228 | VALIDATE_PRODUCT = YES; 229 | VERSIONING_SYSTEM = "apple-generic"; 230 | VERSION_INFO_PREFIX = ""; 231 | }; 232 | name = Release; 233 | }; 234 | EE247D5D1E6E4FCC0044E168 /* Debug */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | CODE_SIGN_IDENTITY = ""; 238 | DEFINES_MODULE = YES; 239 | DYLIB_COMPATIBILITY_VERSION = 1; 240 | DYLIB_CURRENT_VERSION = 1; 241 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 242 | INFOPLIST_FILE = ""; 243 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 244 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 245 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 246 | MACH_O_TYPE = staticlib; 247 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.BussinessPublicService; 248 | PRODUCT_NAME = "$(TARGET_NAME)"; 249 | SKIP_INSTALL = YES; 250 | }; 251 | name = Debug; 252 | }; 253 | EE247D5E1E6E4FCC0044E168 /* Release */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | CODE_SIGN_IDENTITY = ""; 257 | DEFINES_MODULE = YES; 258 | DYLIB_COMPATIBILITY_VERSION = 1; 259 | DYLIB_CURRENT_VERSION = 1; 260 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 261 | INFOPLIST_FILE = ""; 262 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 263 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 264 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 265 | MACH_O_TYPE = staticlib; 266 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.BussinessPublicService; 267 | PRODUCT_NAME = "$(TARGET_NAME)"; 268 | SKIP_INSTALL = YES; 269 | }; 270 | name = Release; 271 | }; 272 | /* End XCBuildConfiguration section */ 273 | 274 | /* Begin XCConfigurationList section */ 275 | EE247D4E1E6E4FCC0044E168 /* Build configuration list for PBXProject "BussinessPublicService" */ = { 276 | isa = XCConfigurationList; 277 | buildConfigurations = ( 278 | EE247D5A1E6E4FCC0044E168 /* Debug */, 279 | EE247D5B1E6E4FCC0044E168 /* Release */, 280 | ); 281 | defaultConfigurationIsVisible = 0; 282 | defaultConfigurationName = Release; 283 | }; 284 | EE247D5C1E6E4FCC0044E168 /* Build configuration list for PBXNativeTarget "BussinessPublicService" */ = { 285 | isa = XCConfigurationList; 286 | buildConfigurations = ( 287 | EE247D5D1E6E4FCC0044E168 /* Debug */, 288 | EE247D5E1E6E4FCC0044E168 /* Release */, 289 | ); 290 | defaultConfigurationIsVisible = 0; 291 | defaultConfigurationName = Release; 292 | }; 293 | /* End XCConfigurationList section */ 294 | }; 295 | rootObject = EE247D4B1E6E4FCC0044E168 /* Project object */; 296 | } 297 | -------------------------------------------------------------------------------- /Example/BussinessPublicService/BussinessPublicService.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/BussinessPublicService/BussinessPublicService/Bussiness2Service.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bussiness1Service.h 3 | // DecouplingKit 4 | // 5 | // Created by coderyi on 2017/3/3. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | #import 9 | #import "DKServiceProtocol.h" 10 | @protocol Bussiness2ServiceProtocol 11 | @property (nonatomic,copy) NSString *name; 12 | - (NSDictionary *)fetchBussiness2DataWithName:(NSString *)name age:(NSString *)age; 13 | + (void)callClassMethod; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 40A1F25FCD8E27CF9A2672BE /* libPods-DecouplingKitExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D326CFD0FA3ACE777940DA8 /* libPods-DecouplingKitExample.a */; }; 11 | EE53694D1E6BA7B00080B60C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EE53694C1E6BA7B00080B60C /* main.m */; }; 12 | EE5369501E6BA7B00080B60C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EE53694F1E6BA7B00080B60C /* AppDelegate.m */; }; 13 | EE5369561E6BA7B00080B60C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE5369541E6BA7B00080B60C /* Main.storyboard */; }; 14 | EE5369581E6BA7B00080B60C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EE5369571E6BA7B00080B60C /* Assets.xcassets */; }; 15 | EE53695B1E6BA7B00080B60C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE5369591E6BA7B00080B60C /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 0D326CFD0FA3ACE777940DA8 /* libPods-DecouplingKitExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-DecouplingKitExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 11AD58253C9AAEB36135D311 /* Pods-DecouplingKitExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DecouplingKitExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-DecouplingKitExample/Pods-DecouplingKitExample.release.xcconfig"; sourceTree = ""; }; 21 | C392C2DA446708E62207DB16 /* Pods-DecouplingKitExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DecouplingKitExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DecouplingKitExample/Pods-DecouplingKitExample.debug.xcconfig"; sourceTree = ""; }; 22 | EE5369481E6BA7B00080B60C /* DecouplingKitExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DecouplingKitExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | EE53694C1E6BA7B00080B60C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 24 | EE53694E1E6BA7B00080B60C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | EE53694F1E6BA7B00080B60C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | EE5369551E6BA7B00080B60C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | EE5369571E6BA7B00080B60C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | EE53695A1E6BA7B00080B60C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | EE53695C1E6BA7B00080B60C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | EE5369451E6BA7B00080B60C /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | 40A1F25FCD8E27CF9A2672BE /* libPods-DecouplingKitExample.a in Frameworks */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 394DA35DCBF4CC92387686C2 /* Frameworks */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | 0D326CFD0FA3ACE777940DA8 /* libPods-DecouplingKitExample.a */, 48 | ); 49 | name = Frameworks; 50 | sourceTree = ""; 51 | }; 52 | EE53693F1E6BA7B00080B60C = { 53 | isa = PBXGroup; 54 | children = ( 55 | EE53694A1E6BA7B00080B60C /* DecouplingKitExample */, 56 | EE5369491E6BA7B00080B60C /* Products */, 57 | F7D8B5AE8813A43A133C4707 /* Pods */, 58 | 394DA35DCBF4CC92387686C2 /* Frameworks */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | EE5369491E6BA7B00080B60C /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | EE5369481E6BA7B00080B60C /* DecouplingKitExample.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | EE53694A1E6BA7B00080B60C /* DecouplingKitExample */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | EE53694E1E6BA7B00080B60C /* AppDelegate.h */, 74 | EE53694F1E6BA7B00080B60C /* AppDelegate.m */, 75 | EE5369541E6BA7B00080B60C /* Main.storyboard */, 76 | EE5369571E6BA7B00080B60C /* Assets.xcassets */, 77 | EE5369591E6BA7B00080B60C /* LaunchScreen.storyboard */, 78 | EE53695C1E6BA7B00080B60C /* Info.plist */, 79 | EE53694B1E6BA7B00080B60C /* Supporting Files */, 80 | ); 81 | path = DecouplingKitExample; 82 | sourceTree = ""; 83 | }; 84 | EE53694B1E6BA7B00080B60C /* Supporting Files */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | EE53694C1E6BA7B00080B60C /* main.m */, 88 | ); 89 | name = "Supporting Files"; 90 | sourceTree = ""; 91 | }; 92 | F7D8B5AE8813A43A133C4707 /* Pods */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | C392C2DA446708E62207DB16 /* Pods-DecouplingKitExample.debug.xcconfig */, 96 | 11AD58253C9AAEB36135D311 /* Pods-DecouplingKitExample.release.xcconfig */, 97 | ); 98 | name = Pods; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | EE5369471E6BA7B00080B60C /* DecouplingKitExample */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = EE53695F1E6BA7B00080B60C /* Build configuration list for PBXNativeTarget "DecouplingKitExample" */; 107 | buildPhases = ( 108 | 8DAD9913E57CB093BF02CB09 /* [CP] Check Pods Manifest.lock */, 109 | EE5369441E6BA7B00080B60C /* Sources */, 110 | EE5369451E6BA7B00080B60C /* Frameworks */, 111 | EE5369461E6BA7B00080B60C /* Resources */, 112 | 94BEB9C7082073E25416ECBD /* [CP] Embed Pods Frameworks */, 113 | 8D71F2666A75F0EDCCA77FE0 /* [CP] Copy Pods Resources */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = DecouplingKitExample; 120 | productName = DecouplingKitExample; 121 | productReference = EE5369481E6BA7B00080B60C /* DecouplingKitExample.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | EE5369401E6BA7B00080B60C /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 0820; 131 | ORGANIZATIONNAME = coderyi; 132 | TargetAttributes = { 133 | EE5369471E6BA7B00080B60C = { 134 | CreatedOnToolsVersion = 8.2; 135 | ProvisioningStyle = Automatic; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = EE5369431E6BA7B00080B60C /* Build configuration list for PBXProject "DecouplingKitExample" */; 140 | compatibilityVersion = "Xcode 3.2"; 141 | developmentRegion = English; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = EE53693F1E6BA7B00080B60C; 148 | productRefGroup = EE5369491E6BA7B00080B60C /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | EE5369471E6BA7B00080B60C /* DecouplingKitExample */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | EE5369461E6BA7B00080B60C /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | EE53695B1E6BA7B00080B60C /* LaunchScreen.storyboard in Resources */, 163 | EE5369581E6BA7B00080B60C /* Assets.xcassets in Resources */, 164 | EE5369561E6BA7B00080B60C /* Main.storyboard in Resources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXShellScriptBuildPhase section */ 171 | 8D71F2666A75F0EDCCA77FE0 /* [CP] Copy Pods Resources */ = { 172 | isa = PBXShellScriptBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | ); 176 | inputPaths = ( 177 | ); 178 | name = "[CP] Copy Pods Resources"; 179 | outputPaths = ( 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | shellPath = /bin/sh; 183 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DecouplingKitExample/Pods-DecouplingKitExample-resources.sh\"\n"; 184 | showEnvVarsInLog = 0; 185 | }; 186 | 8DAD9913E57CB093BF02CB09 /* [CP] Check Pods Manifest.lock */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "[CP] Check Pods Manifest.lock"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 199 | showEnvVarsInLog = 0; 200 | }; 201 | 94BEB9C7082073E25416ECBD /* [CP] Embed Pods Frameworks */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "[CP] Embed Pods Frameworks"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DecouplingKitExample/Pods-DecouplingKitExample-frameworks.sh\"\n"; 214 | showEnvVarsInLog = 0; 215 | }; 216 | /* End PBXShellScriptBuildPhase section */ 217 | 218 | /* Begin PBXSourcesBuildPhase section */ 219 | EE5369441E6BA7B00080B60C /* Sources */ = { 220 | isa = PBXSourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | EE5369501E6BA7B00080B60C /* AppDelegate.m in Sources */, 224 | EE53694D1E6BA7B00080B60C /* main.m in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXSourcesBuildPhase section */ 229 | 230 | /* Begin PBXVariantGroup section */ 231 | EE5369541E6BA7B00080B60C /* Main.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | EE5369551E6BA7B00080B60C /* Base */, 235 | ); 236 | name = Main.storyboard; 237 | sourceTree = ""; 238 | }; 239 | EE5369591E6BA7B00080B60C /* LaunchScreen.storyboard */ = { 240 | isa = PBXVariantGroup; 241 | children = ( 242 | EE53695A1E6BA7B00080B60C /* Base */, 243 | ); 244 | name = LaunchScreen.storyboard; 245 | sourceTree = ""; 246 | }; 247 | /* End PBXVariantGroup section */ 248 | 249 | /* Begin XCBuildConfiguration section */ 250 | EE53695D1E6BA7B00080B60C /* Debug */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_ANALYZER_NONNULL = YES; 255 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 256 | CLANG_CXX_LIBRARY = "libc++"; 257 | CLANG_ENABLE_MODULES = YES; 258 | CLANG_ENABLE_OBJC_ARC = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_CONSTANT_CONVERSION = YES; 261 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 262 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 263 | CLANG_WARN_EMPTY_BODY = YES; 264 | CLANG_WARN_ENUM_CONVERSION = YES; 265 | CLANG_WARN_INFINITE_RECURSION = YES; 266 | CLANG_WARN_INT_CONVERSION = YES; 267 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 268 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | DEBUG_INFORMATION_FORMAT = dwarf; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | ENABLE_TESTABILITY = YES; 276 | GCC_C_LANGUAGE_STANDARD = gnu99; 277 | GCC_DYNAMIC_NO_PIC = NO; 278 | GCC_NO_COMMON_BLOCKS = YES; 279 | GCC_OPTIMIZATION_LEVEL = 0; 280 | GCC_PREPROCESSOR_DEFINITIONS = ( 281 | "DEBUG=1", 282 | "$(inherited)", 283 | ); 284 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 285 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 286 | GCC_WARN_UNDECLARED_SELECTOR = YES; 287 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 288 | GCC_WARN_UNUSED_FUNCTION = YES; 289 | GCC_WARN_UNUSED_VARIABLE = YES; 290 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 291 | MTL_ENABLE_DEBUG_INFO = YES; 292 | ONLY_ACTIVE_ARCH = YES; 293 | SDKROOT = iphoneos; 294 | TARGETED_DEVICE_FAMILY = "1,2"; 295 | }; 296 | name = Debug; 297 | }; 298 | EE53695E1E6BA7B00080B60C /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_ANALYZER_NONNULL = YES; 303 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 304 | CLANG_CXX_LIBRARY = "libc++"; 305 | CLANG_ENABLE_MODULES = YES; 306 | CLANG_ENABLE_OBJC_ARC = YES; 307 | CLANG_WARN_BOOL_CONVERSION = YES; 308 | CLANG_WARN_CONSTANT_CONVERSION = YES; 309 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 310 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 311 | CLANG_WARN_EMPTY_BODY = YES; 312 | CLANG_WARN_ENUM_CONVERSION = YES; 313 | CLANG_WARN_INFINITE_RECURSION = YES; 314 | CLANG_WARN_INT_CONVERSION = YES; 315 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 316 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 317 | CLANG_WARN_UNREACHABLE_CODE = YES; 318 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 319 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 320 | COPY_PHASE_STRIP = NO; 321 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 322 | ENABLE_NS_ASSERTIONS = NO; 323 | ENABLE_STRICT_OBJC_MSGSEND = YES; 324 | GCC_C_LANGUAGE_STANDARD = gnu99; 325 | GCC_NO_COMMON_BLOCKS = YES; 326 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 327 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 328 | GCC_WARN_UNDECLARED_SELECTOR = YES; 329 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 330 | GCC_WARN_UNUSED_FUNCTION = YES; 331 | GCC_WARN_UNUSED_VARIABLE = YES; 332 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 333 | MTL_ENABLE_DEBUG_INFO = NO; 334 | SDKROOT = iphoneos; 335 | TARGETED_DEVICE_FAMILY = "1,2"; 336 | VALIDATE_PRODUCT = YES; 337 | }; 338 | name = Release; 339 | }; 340 | EE5369601E6BA7B00080B60C /* Debug */ = { 341 | isa = XCBuildConfiguration; 342 | baseConfigurationReference = C392C2DA446708E62207DB16 /* Pods-DecouplingKitExample.debug.xcconfig */; 343 | buildSettings = { 344 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 345 | INFOPLIST_FILE = DecouplingKitExample/Info.plist; 346 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 347 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 348 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.DecouplingKitExample; 349 | PRODUCT_NAME = "$(TARGET_NAME)"; 350 | }; 351 | name = Debug; 352 | }; 353 | EE5369611E6BA7B00080B60C /* Release */ = { 354 | isa = XCBuildConfiguration; 355 | baseConfigurationReference = 11AD58253C9AAEB36135D311 /* Pods-DecouplingKitExample.release.xcconfig */; 356 | buildSettings = { 357 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 358 | INFOPLIST_FILE = DecouplingKitExample/Info.plist; 359 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 360 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 361 | PRODUCT_BUNDLE_IDENTIFIER = com.coderyi.DecouplingKitExample; 362 | PRODUCT_NAME = "$(TARGET_NAME)"; 363 | }; 364 | name = Release; 365 | }; 366 | /* End XCBuildConfiguration section */ 367 | 368 | /* Begin XCConfigurationList section */ 369 | EE5369431E6BA7B00080B60C /* Build configuration list for PBXProject "DecouplingKitExample" */ = { 370 | isa = XCConfigurationList; 371 | buildConfigurations = ( 372 | EE53695D1E6BA7B00080B60C /* Debug */, 373 | EE53695E1E6BA7B00080B60C /* Release */, 374 | ); 375 | defaultConfigurationIsVisible = 0; 376 | defaultConfigurationName = Release; 377 | }; 378 | EE53695F1E6BA7B00080B60C /* Build configuration list for PBXNativeTarget "DecouplingKitExample" */ = { 379 | isa = XCConfigurationList; 380 | buildConfigurations = ( 381 | EE5369601E6BA7B00080B60C /* Debug */, 382 | EE5369611E6BA7B00080B60C /* Release */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | defaultConfigurationName = Release; 386 | }; 387 | /* End XCConfigurationList section */ 388 | }; 389 | rootObject = EE5369401E6BA7B00080B60C /* Project object */; 390 | } 391 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DecouplingKitExample 4 | // 5 | // Created by coderyi on 2017/3/5. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DecouplingKitExample 4 | // 5 | // Created by coderyi on 2017/3/5. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "Bussiness1ViewController.h" 11 | #import "Bussiness2ViewController.h" 12 | #import "DKServiceManager.h" 13 | 14 | @interface AppDelegate () 15 | 16 | @end 17 | 18 | @implementation AppDelegate 19 | 20 | 21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 22 | // Override point for customization after application launch. 23 | 24 | 25 | 26 | //注册DecouplingKit 27 | [[DKServiceManager sharedInstance] registerLocalServices]; 28 | 29 | 30 | 31 | 32 | 33 | 34 | Bussiness1ViewController *more=[[Bussiness1ViewController alloc] init]; 35 | UINavigationController *navMore = [[UINavigationController alloc] initWithRootViewController:more]; 36 | navMore.navigationBar.tintColor=[UIColor whiteColor]; 37 | navMore.navigationBar.titleTextAttributes=[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; 38 | 39 | 40 | Bussiness2ViewController *more1=[[Bussiness2ViewController alloc] init]; 41 | UINavigationController *navMore1 = [[UINavigationController alloc] initWithRootViewController:more1]; 42 | navMore.navigationBar.tintColor=[UIColor whiteColor]; 43 | navMore.navigationBar.titleTextAttributes=[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; 44 | 45 | 46 | UITabBarController *tab=[[UITabBarController alloc] init]; 47 | tab.viewControllers=@[navMore,navMore1]; 48 | UITabBar *tabBar = tab.tabBar; 49 | tab.tabBar.backgroundColor=[UIColor whiteColor]; 50 | 51 | UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0]; 52 | UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1]; 53 | tabBarItem1.title=@"Bussiness1"; 54 | 55 | tabBarItem2.title=@"Bussiness2"; 56 | 57 | self.window.rootViewController=tab; 58 | 59 | return YES; 60 | } 61 | 62 | 63 | - (void)applicationWillResignActive:(UIApplication *)application { 64 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 65 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 66 | } 67 | 68 | 69 | - (void)applicationDidEnterBackground:(UIApplication *)application { 70 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 71 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 72 | } 73 | 74 | 75 | - (void)applicationWillEnterForeground:(UIApplication *)application { 76 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 77 | } 78 | 79 | 80 | - (void)applicationDidBecomeActive:(UIApplication *)application { 81 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 82 | } 83 | 84 | 85 | - (void)applicationWillTerminate:(UIApplication *)application { 86 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 87 | } 88 | 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/DecouplingKitExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DecouplingKitExample 4 | // 5 | // Created by coderyi on 2017/3/5. 6 | // Copyright © 2017年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/DecouplingKitExample/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | target "DecouplingKitExample" do 4 | pod 'DecouplingKit', :path=>'../../’ 5 | pod 'Bussiness1', :path=>'../Bussiness1’ 6 | pod 'Bussiness2', :path=>'../Bussiness2’ 7 | pod 'BussinessPublicService', :path=>'../BussinessPublicService’ 8 | 9 | end -------------------------------------------------------------------------------- /Example/DecouplingKitExample/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Bussiness1 (0.0.1) 3 | - Bussiness2 (0.0.1) 4 | - BussinessPublicService (0.0.1) 5 | - DecouplingKit (0.0.2) 6 | 7 | DEPENDENCIES: 8 | - Bussiness1 (from `../Bussiness1`) 9 | - Bussiness2 (from `../Bussiness2`) 10 | - BussinessPublicService (from `../BussinessPublicService`) 11 | - DecouplingKit (from `../../`) 12 | 13 | EXTERNAL SOURCES: 14 | Bussiness1: 15 | :path: ../Bussiness1 16 | Bussiness2: 17 | :path: ../Bussiness2 18 | BussinessPublicService: 19 | :path: ../BussinessPublicService 20 | DecouplingKit: 21 | :path: ../../ 22 | 23 | SPEC CHECKSUMS: 24 | Bussiness1: 4d47ae41c800e1e13bbb1354614ec89f09e2aeaa 25 | Bussiness2: fe8f5a1fd93aa68faf471cec830d23e718e85618 26 | BussinessPublicService: 671cb1e5f60c09eefdf5f28eaee170220068a654 27 | DecouplingKit: 77c56383787059f35c56668136d78f8add6f0359 28 | 29 | PODFILE CHECKSUM: bf5b0afb9975cc549ba9ca3ec3b582e925c0374c 30 | 31 | COCOAPODS: 1.1.0.rc.2 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 coderyi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # DecouplingKit 2 | 3 | 4 | [![Twitter](https://img.shields.io/badge/twitter-@coderyi9-green.svg?style=flat)](http://twitter.com/coderyi9) 5 | 6 | [中文readme](https://github.com/coderyi/DecouplingKit/blob/master/Documents/Readme_cn.md) 7 | #### Podfile 8 | 9 | ```ruby 10 | 11 | platform :ios, '7.0' 12 | pod 'DecouplingKit', '~> 0.0.2' 13 | 14 | ``` 15 | 16 | 17 | 18 | DecouplingKit, decoupling between modules in your iOS Project. 19 | 20 | 21 | 22 | ![](https://github.com/coderyi/DecouplingKit/blob/master/Documents/DecouplingKit.png) 23 | 24 | 25 | 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. 26 | 27 | 28 | 29 | 30 | 31 | 32 | 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. 33 | 34 | #### Use 35 | 36 | Register the default DKService.plist service list 37 | 38 | ``` 39 | [[DKServiceManager sharedInstance] registerLocalServices]; 40 | ``` 41 | 42 | Register a list of custom paths for services 43 | 44 | ``` 45 | [[DKServiceManager sharedInstance] registerLocalServicesWithServiceConfigName:@"DecouplingKit.bundle/DKService"]; 46 | 47 | ``` 48 | 49 | singleton 50 | 51 | ``` 52 | id bussiness2 =[[DKServiceManager sharedInstance] createInstance:@protocol(Bussiness2ServiceProtocol)]; 53 | 54 | NSDictionary *data =[bussiness2 fetchBussiness2DataWithName:@"DecouplingKit" age:@"1"]; 55 | 56 | ``` 57 | 58 | 59 | Create a class and then call the corresponding class method 60 | 61 | ``` 62 | Class Bussiness2 = [[DKServiceManager sharedInstance] createClass:@protocol(Bussiness2ServiceProtocol)]; 63 | 64 | [Bussiness2 callClassMethod]; 65 | 66 | ``` 67 | 68 | 69 | Create a service protocol for your business class 70 | 71 | ``` 72 | @protocol Bussiness2ServiceProtocol 73 | @property (nonatomic,copy) NSString *name; 74 | - (NSDictionary *)fetchBussiness2DataWithName:(NSString *)name age:(NSString *)age; 75 | + (void)callClassMethod; 76 | 77 | @end 78 | 79 | ``` 80 | 81 | 82 | 83 | 84 | #### Licenses 85 | 86 | All source code is licensed under the [MIT License](https://github.com/coderyi/DecouplingKit/blob/master/LICENSE). 87 | 88 | 89 | 90 | 91 | --------------------------------------------------------------------------------