├── .gitignore ├── Interceptor.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── Damon.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── casa.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── Damon.xcuserdatad │ └── xcschemes │ │ ├── Interceptor.xcscheme │ │ └── xcschememanagement.plist │ ├── casa.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── Interceptor.xcscheme │ │ └── xcschememanagement.plist │ └── yofun.xcuserdatad │ └── xcschemes │ ├── Interceptor.xcscheme │ └── xcschememanagement.plist ├── Interceptor ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CTViewControllerIntercepter.h ├── CTViewControllerIntercepter.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Model.h ├── Model.m ├── ViewController.h ├── ViewController.m └── main.m ├── InterceptorTests ├── Info.plist └── InterceptorTests.m └── Podfile /.gitignore: -------------------------------------------------------------------------------- 1 | Pods 2 | Interceptor.xcworkspace/ 3 | Podfile.lock 4 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 170B35BC1B174D1400D43DAC /* Model.m in Sources */ = {isa = PBXBuildFile; fileRef = 170B35BB1B174D1400D43DAC /* Model.m */; }; 11 | 3256720B34694288B919B2BC /* libPods-Interceptor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4777C991470441C6AF91432F /* libPods-Interceptor.a */; }; 12 | 4A95186F1AE0C93F00920CC7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A95186E1AE0C93F00920CC7 /* main.m */; }; 13 | 4A9518721AE0C93F00920CC7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9518711AE0C93F00920CC7 /* AppDelegate.m */; }; 14 | 4A9518751AE0C93F00920CC7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9518741AE0C93F00920CC7 /* ViewController.m */; }; 15 | 4A9518781AE0C93F00920CC7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4A9518761AE0C93F00920CC7 /* Main.storyboard */; }; 16 | 4A95187A1AE0C93F00920CC7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4A9518791AE0C93F00920CC7 /* Images.xcassets */; }; 17 | 4A95187D1AE0C93F00920CC7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4A95187B1AE0C93F00920CC7 /* LaunchScreen.xib */; }; 18 | 4A9518891AE0C93F00920CC7 /* InterceptorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9518881AE0C93F00920CC7 /* InterceptorTests.m */; }; 19 | 4A9518941AE0D50000920CC7 /* CTViewControllerIntercepter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9518931AE0D50000920CC7 /* CTViewControllerIntercepter.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 4A9518831AE0C93F00920CC7 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 4A9518611AE0C93F00920CC7 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 4A9518681AE0C93F00920CC7; 28 | remoteInfo = Interceptor; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 170B35BA1B174D1400D43DAC /* Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Model.h; sourceTree = ""; }; 34 | 170B35BB1B174D1400D43DAC /* Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Model.m; sourceTree = ""; }; 35 | 2BE1ACA157A92775F362B3A3 /* Pods-Interceptor.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Interceptor.release.xcconfig"; path = "Pods/Target Support Files/Pods-Interceptor/Pods-Interceptor.release.xcconfig"; sourceTree = ""; }; 36 | 4777C991470441C6AF91432F /* libPods-Interceptor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Interceptor.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 4A9518691AE0C93F00920CC7 /* Interceptor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Interceptor.app; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 4A95186D1AE0C93F00920CC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | 4A95186E1AE0C93F00920CC7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 40 | 4A9518701AE0C93F00920CC7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 41 | 4A9518711AE0C93F00920CC7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 42 | 4A9518731AE0C93F00920CC7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | 4A9518741AE0C93F00920CC7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | 4A9518771AE0C93F00920CC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 4A9518791AE0C93F00920CC7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 46 | 4A95187C1AE0C93F00920CC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 47 | 4A9518821AE0C93F00920CC7 /* InterceptorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterceptorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 4A9518871AE0C93F00920CC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 4A9518881AE0C93F00920CC7 /* InterceptorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InterceptorTests.m; sourceTree = ""; }; 50 | 4A9518921AE0D50000920CC7 /* CTViewControllerIntercepter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTViewControllerIntercepter.h; sourceTree = ""; }; 51 | 4A9518931AE0D50000920CC7 /* CTViewControllerIntercepter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTViewControllerIntercepter.m; sourceTree = ""; }; 52 | CBF5A67F7484EC1C721AA154 /* Pods-Interceptor.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Interceptor.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Interceptor/Pods-Interceptor.debug.xcconfig"; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 4A9518661AE0C93F00920CC7 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 3256720B34694288B919B2BC /* libPods-Interceptor.a in Frameworks */, 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | 4A95187F1AE0C93F00920CC7 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 35AF3D0D63066C3F1D1B23FB /* Pods */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | CBF5A67F7484EC1C721AA154 /* Pods-Interceptor.debug.xcconfig */, 78 | 2BE1ACA157A92775F362B3A3 /* Pods-Interceptor.release.xcconfig */, 79 | ); 80 | name = Pods; 81 | sourceTree = ""; 82 | }; 83 | 4A9518601AE0C93F00920CC7 = { 84 | isa = PBXGroup; 85 | children = ( 86 | 4A95186B1AE0C93F00920CC7 /* Interceptor */, 87 | 4A9518851AE0C93F00920CC7 /* InterceptorTests */, 88 | 4A95186A1AE0C93F00920CC7 /* Products */, 89 | 9EEC11E73EC7412684AE78CE /* Frameworks */, 90 | 35AF3D0D63066C3F1D1B23FB /* Pods */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 4A95186A1AE0C93F00920CC7 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 4A9518691AE0C93F00920CC7 /* Interceptor.app */, 98 | 4A9518821AE0C93F00920CC7 /* InterceptorTests.xctest */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 4A95186B1AE0C93F00920CC7 /* Interceptor */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 4A9518701AE0C93F00920CC7 /* AppDelegate.h */, 107 | 4A9518711AE0C93F00920CC7 /* AppDelegate.m */, 108 | 4A9518731AE0C93F00920CC7 /* ViewController.h */, 109 | 4A9518741AE0C93F00920CC7 /* ViewController.m */, 110 | 170B35BA1B174D1400D43DAC /* Model.h */, 111 | 170B35BB1B174D1400D43DAC /* Model.m */, 112 | 4A9518921AE0D50000920CC7 /* CTViewControllerIntercepter.h */, 113 | 4A9518931AE0D50000920CC7 /* CTViewControllerIntercepter.m */, 114 | 4A9518761AE0C93F00920CC7 /* Main.storyboard */, 115 | 4A9518791AE0C93F00920CC7 /* Images.xcassets */, 116 | 4A95187B1AE0C93F00920CC7 /* LaunchScreen.xib */, 117 | 4A95186C1AE0C93F00920CC7 /* Supporting Files */, 118 | ); 119 | path = Interceptor; 120 | sourceTree = ""; 121 | }; 122 | 4A95186C1AE0C93F00920CC7 /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 4A95186D1AE0C93F00920CC7 /* Info.plist */, 126 | 4A95186E1AE0C93F00920CC7 /* main.m */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | 4A9518851AE0C93F00920CC7 /* InterceptorTests */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 4A9518881AE0C93F00920CC7 /* InterceptorTests.m */, 135 | 4A9518861AE0C93F00920CC7 /* Supporting Files */, 136 | ); 137 | path = InterceptorTests; 138 | sourceTree = ""; 139 | }; 140 | 4A9518861AE0C93F00920CC7 /* Supporting Files */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 4A9518871AE0C93F00920CC7 /* Info.plist */, 144 | ); 145 | name = "Supporting Files"; 146 | sourceTree = ""; 147 | }; 148 | 9EEC11E73EC7412684AE78CE /* Frameworks */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 4777C991470441C6AF91432F /* libPods-Interceptor.a */, 152 | ); 153 | name = Frameworks; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 4A9518681AE0C93F00920CC7 /* Interceptor */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 4A95188C1AE0C93F00920CC7 /* Build configuration list for PBXNativeTarget "Interceptor" */; 162 | buildPhases = ( 163 | 25A365938A4C462FA23AF8AF /* [CP] Check Pods Manifest.lock */, 164 | 4A9518651AE0C93F00920CC7 /* Sources */, 165 | 4A9518661AE0C93F00920CC7 /* Frameworks */, 166 | 4A9518671AE0C93F00920CC7 /* Resources */, 167 | B7ED92AE0AB545EA93FDB045 /* [CP] Copy Pods Resources */, 168 | D3DA991B388B7C270544B1B3 /* [CP] Embed Pods Frameworks */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | ); 174 | name = Interceptor; 175 | productName = Interceptor; 176 | productReference = 4A9518691AE0C93F00920CC7 /* Interceptor.app */; 177 | productType = "com.apple.product-type.application"; 178 | }; 179 | 4A9518811AE0C93F00920CC7 /* InterceptorTests */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = 4A95188F1AE0C93F00920CC7 /* Build configuration list for PBXNativeTarget "InterceptorTests" */; 182 | buildPhases = ( 183 | 4A95187E1AE0C93F00920CC7 /* Sources */, 184 | 4A95187F1AE0C93F00920CC7 /* Frameworks */, 185 | 4A9518801AE0C93F00920CC7 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | 4A9518841AE0C93F00920CC7 /* PBXTargetDependency */, 191 | ); 192 | name = InterceptorTests; 193 | productName = InterceptorTests; 194 | productReference = 4A9518821AE0C93F00920CC7 /* InterceptorTests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | 4A9518611AE0C93F00920CC7 /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastUpgradeCheck = 0630; 204 | ORGANIZATIONNAME = alibaba; 205 | TargetAttributes = { 206 | 4A9518681AE0C93F00920CC7 = { 207 | CreatedOnToolsVersion = 6.3; 208 | }; 209 | 4A9518811AE0C93F00920CC7 = { 210 | CreatedOnToolsVersion = 6.3; 211 | TestTargetID = 4A9518681AE0C93F00920CC7; 212 | }; 213 | }; 214 | }; 215 | buildConfigurationList = 4A9518641AE0C93F00920CC7 /* Build configuration list for PBXProject "Interceptor" */; 216 | compatibilityVersion = "Xcode 3.2"; 217 | developmentRegion = English; 218 | hasScannedForEncodings = 0; 219 | knownRegions = ( 220 | en, 221 | Base, 222 | ); 223 | mainGroup = 4A9518601AE0C93F00920CC7; 224 | productRefGroup = 4A95186A1AE0C93F00920CC7 /* Products */; 225 | projectDirPath = ""; 226 | projectRoot = ""; 227 | targets = ( 228 | 4A9518681AE0C93F00920CC7 /* Interceptor */, 229 | 4A9518811AE0C93F00920CC7 /* InterceptorTests */, 230 | ); 231 | }; 232 | /* End PBXProject section */ 233 | 234 | /* Begin PBXResourcesBuildPhase section */ 235 | 4A9518671AE0C93F00920CC7 /* Resources */ = { 236 | isa = PBXResourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | 4A9518781AE0C93F00920CC7 /* Main.storyboard in Resources */, 240 | 4A95187D1AE0C93F00920CC7 /* LaunchScreen.xib in Resources */, 241 | 4A95187A1AE0C93F00920CC7 /* Images.xcassets in Resources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | 4A9518801AE0C93F00920CC7 /* Resources */ = { 246 | isa = PBXResourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | /* End PBXResourcesBuildPhase section */ 253 | 254 | /* Begin PBXShellScriptBuildPhase section */ 255 | 25A365938A4C462FA23AF8AF /* [CP] Check Pods Manifest.lock */ = { 256 | isa = PBXShellScriptBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ); 260 | inputPaths = ( 261 | ); 262 | name = "[CP] Check Pods Manifest.lock"; 263 | outputPaths = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | shellPath = /bin/sh; 267 | 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"; 268 | showEnvVarsInLog = 0; 269 | }; 270 | B7ED92AE0AB545EA93FDB045 /* [CP] Copy Pods Resources */ = { 271 | isa = PBXShellScriptBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | inputPaths = ( 276 | ); 277 | name = "[CP] Copy Pods Resources"; 278 | outputPaths = ( 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | shellPath = /bin/sh; 282 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Interceptor/Pods-Interceptor-resources.sh\"\n"; 283 | showEnvVarsInLog = 0; 284 | }; 285 | D3DA991B388B7C270544B1B3 /* [CP] Embed Pods Frameworks */ = { 286 | isa = PBXShellScriptBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | ); 290 | inputPaths = ( 291 | ); 292 | name = "[CP] Embed Pods Frameworks"; 293 | outputPaths = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | shellPath = /bin/sh; 297 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Interceptor/Pods-Interceptor-frameworks.sh\"\n"; 298 | showEnvVarsInLog = 0; 299 | }; 300 | /* End PBXShellScriptBuildPhase section */ 301 | 302 | /* Begin PBXSourcesBuildPhase section */ 303 | 4A9518651AE0C93F00920CC7 /* Sources */ = { 304 | isa = PBXSourcesBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | 4A9518751AE0C93F00920CC7 /* ViewController.m in Sources */, 308 | 4A9518721AE0C93F00920CC7 /* AppDelegate.m in Sources */, 309 | 4A95186F1AE0C93F00920CC7 /* main.m in Sources */, 310 | 4A9518941AE0D50000920CC7 /* CTViewControllerIntercepter.m in Sources */, 311 | 170B35BC1B174D1400D43DAC /* Model.m in Sources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | 4A95187E1AE0C93F00920CC7 /* Sources */ = { 316 | isa = PBXSourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | 4A9518891AE0C93F00920CC7 /* InterceptorTests.m in Sources */, 320 | ); 321 | runOnlyForDeploymentPostprocessing = 0; 322 | }; 323 | /* End PBXSourcesBuildPhase section */ 324 | 325 | /* Begin PBXTargetDependency section */ 326 | 4A9518841AE0C93F00920CC7 /* PBXTargetDependency */ = { 327 | isa = PBXTargetDependency; 328 | target = 4A9518681AE0C93F00920CC7 /* Interceptor */; 329 | targetProxy = 4A9518831AE0C93F00920CC7 /* PBXContainerItemProxy */; 330 | }; 331 | /* End PBXTargetDependency section */ 332 | 333 | /* Begin PBXVariantGroup section */ 334 | 4A9518761AE0C93F00920CC7 /* Main.storyboard */ = { 335 | isa = PBXVariantGroup; 336 | children = ( 337 | 4A9518771AE0C93F00920CC7 /* Base */, 338 | ); 339 | name = Main.storyboard; 340 | sourceTree = ""; 341 | }; 342 | 4A95187B1AE0C93F00920CC7 /* LaunchScreen.xib */ = { 343 | isa = PBXVariantGroup; 344 | children = ( 345 | 4A95187C1AE0C93F00920CC7 /* Base */, 346 | ); 347 | name = LaunchScreen.xib; 348 | sourceTree = ""; 349 | }; 350 | /* End PBXVariantGroup section */ 351 | 352 | /* Begin XCBuildConfiguration section */ 353 | 4A95188A1AE0C93F00920CC7 /* Debug */ = { 354 | isa = XCBuildConfiguration; 355 | buildSettings = { 356 | ALWAYS_SEARCH_USER_PATHS = NO; 357 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 358 | CLANG_CXX_LIBRARY = "libc++"; 359 | CLANG_ENABLE_MODULES = YES; 360 | CLANG_ENABLE_OBJC_ARC = YES; 361 | CLANG_WARN_BOOL_CONVERSION = YES; 362 | CLANG_WARN_CONSTANT_CONVERSION = YES; 363 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 364 | CLANG_WARN_EMPTY_BODY = YES; 365 | CLANG_WARN_ENUM_CONVERSION = YES; 366 | CLANG_WARN_INT_CONVERSION = YES; 367 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 368 | CLANG_WARN_UNREACHABLE_CODE = YES; 369 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 370 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 371 | COPY_PHASE_STRIP = NO; 372 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 373 | ENABLE_STRICT_OBJC_MSGSEND = YES; 374 | GCC_C_LANGUAGE_STANDARD = gnu99; 375 | GCC_DYNAMIC_NO_PIC = NO; 376 | GCC_NO_COMMON_BLOCKS = YES; 377 | GCC_OPTIMIZATION_LEVEL = 0; 378 | GCC_PREPROCESSOR_DEFINITIONS = ( 379 | "DEBUG=1", 380 | "$(inherited)", 381 | ); 382 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 383 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 384 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 385 | GCC_WARN_UNDECLARED_SELECTOR = YES; 386 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 387 | GCC_WARN_UNUSED_FUNCTION = YES; 388 | GCC_WARN_UNUSED_VARIABLE = YES; 389 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 390 | MTL_ENABLE_DEBUG_INFO = YES; 391 | ONLY_ACTIVE_ARCH = YES; 392 | SDKROOT = iphoneos; 393 | }; 394 | name = Debug; 395 | }; 396 | 4A95188B1AE0C93F00920CC7 /* Release */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ALWAYS_SEARCH_USER_PATHS = NO; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_WARN_BOOL_CONVERSION = YES; 405 | CLANG_WARN_CONSTANT_CONVERSION = YES; 406 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 407 | CLANG_WARN_EMPTY_BODY = YES; 408 | CLANG_WARN_ENUM_CONVERSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | VALIDATE_PRODUCT = YES; 430 | }; 431 | name = Release; 432 | }; 433 | 4A95188D1AE0C93F00920CC7 /* Debug */ = { 434 | isa = XCBuildConfiguration; 435 | baseConfigurationReference = CBF5A67F7484EC1C721AA154 /* Pods-Interceptor.debug.xcconfig */; 436 | buildSettings = { 437 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 438 | INFOPLIST_FILE = Interceptor/Info.plist; 439 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 440 | PRODUCT_NAME = "$(TARGET_NAME)"; 441 | }; 442 | name = Debug; 443 | }; 444 | 4A95188E1AE0C93F00920CC7 /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | baseConfigurationReference = 2BE1ACA157A92775F362B3A3 /* Pods-Interceptor.release.xcconfig */; 447 | buildSettings = { 448 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 449 | INFOPLIST_FILE = Interceptor/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | }; 453 | name = Release; 454 | }; 455 | 4A9518901AE0C93F00920CC7 /* Debug */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | BUNDLE_LOADER = "$(TEST_HOST)"; 459 | FRAMEWORK_SEARCH_PATHS = ( 460 | "$(SDKROOT)/Developer/Library/Frameworks", 461 | "$(inherited)", 462 | ); 463 | GCC_PREPROCESSOR_DEFINITIONS = ( 464 | "DEBUG=1", 465 | "$(inherited)", 466 | ); 467 | INFOPLIST_FILE = InterceptorTests/Info.plist; 468 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Interceptor.app/Interceptor"; 471 | }; 472 | name = Debug; 473 | }; 474 | 4A9518911AE0C93F00920CC7 /* Release */ = { 475 | isa = XCBuildConfiguration; 476 | buildSettings = { 477 | BUNDLE_LOADER = "$(TEST_HOST)"; 478 | FRAMEWORK_SEARCH_PATHS = ( 479 | "$(SDKROOT)/Developer/Library/Frameworks", 480 | "$(inherited)", 481 | ); 482 | INFOPLIST_FILE = InterceptorTests/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 484 | PRODUCT_NAME = "$(TARGET_NAME)"; 485 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Interceptor.app/Interceptor"; 486 | }; 487 | name = Release; 488 | }; 489 | /* End XCBuildConfiguration section */ 490 | 491 | /* Begin XCConfigurationList section */ 492 | 4A9518641AE0C93F00920CC7 /* Build configuration list for PBXProject "Interceptor" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | 4A95188A1AE0C93F00920CC7 /* Debug */, 496 | 4A95188B1AE0C93F00920CC7 /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | defaultConfigurationName = Release; 500 | }; 501 | 4A95188C1AE0C93F00920CC7 /* Build configuration list for PBXNativeTarget "Interceptor" */ = { 502 | isa = XCConfigurationList; 503 | buildConfigurations = ( 504 | 4A95188D1AE0C93F00920CC7 /* Debug */, 505 | 4A95188E1AE0C93F00920CC7 /* Release */, 506 | ); 507 | defaultConfigurationIsVisible = 0; 508 | defaultConfigurationName = Release; 509 | }; 510 | 4A95188F1AE0C93F00920CC7 /* Build configuration list for PBXNativeTarget "InterceptorTests" */ = { 511 | isa = XCConfigurationList; 512 | buildConfigurations = ( 513 | 4A9518901AE0C93F00920CC7 /* Debug */, 514 | 4A9518911AE0C93F00920CC7 /* Release */, 515 | ); 516 | defaultConfigurationIsVisible = 0; 517 | defaultConfigurationName = Release; 518 | }; 519 | /* End XCConfigurationList section */ 520 | }; 521 | rootObject = 4A9518611AE0C93F00920CC7 /* Project object */; 522 | } 523 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/project.xcworkspace/xcuserdata/Damon.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonCode/iOSViewArchDemoByCasa/19ac4220e83c3a1cf9162277d9347a88172ce852/Interceptor.xcodeproj/project.xcworkspace/xcuserdata/Damon.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Interceptor.xcodeproj/project.xcworkspace/xcuserdata/casa.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DamonCode/iOSViewArchDemoByCasa/19ac4220e83c3a1cf9162277d9347a88172ce852/Interceptor.xcodeproj/project.xcworkspace/xcuserdata/casa.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Interceptor.xcodeproj/xcuserdata/Damon.xcuserdatad/xcschemes/Interceptor.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/xcuserdata/Damon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Interceptor.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4A9518681AE0C93F00920CC7 16 | 17 | primary 18 | 19 | 20 | 4A9518811AE0C93F00920CC7 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/xcuserdata/casa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/xcuserdata/casa.xcuserdatad/xcschemes/Interceptor.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/xcuserdata/casa.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Interceptor.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4A9518681AE0C93F00920CC7 16 | 17 | primary 18 | 19 | 20 | 4A9518811AE0C93F00920CC7 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/xcuserdata/yofun.xcuserdatad/xcschemes/Interceptor.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /Interceptor.xcodeproj/xcuserdata/yofun.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Interceptor.xcscheme 8 | 9 | orderHint 10 | 2 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4A9518681AE0C93F00920CC7 16 | 17 | primary 18 | 19 | 20 | 4A9518811AE0C93F00920CC7 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Interceptor/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Interceptor 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /Interceptor/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Interceptor 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 18 | return YES; 19 | } 20 | 21 | /* 22 | AppDelegate不需要任何初始化代码 23 | */ 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Interceptor/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Interceptor/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 | -------------------------------------------------------------------------------- /Interceptor/CTViewControllerIntercepter.h: -------------------------------------------------------------------------------- 1 | // 2 | // CTViewControllerIntercepter.h 3 | // Interceptor 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CTViewControllerIntercepter : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Interceptor/CTViewControllerIntercepter.m: -------------------------------------------------------------------------------- 1 | // 2 | // CTViewControllerIntercepter.m 3 | // Interceptor 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. All rights reserved. 7 | // 8 | 9 | #import "CTViewControllerIntercepter.h" 10 | #import 11 | #import 12 | 13 | @implementation CTViewControllerIntercepter 14 | 15 | + (void)load 16 | { 17 | /* + (void)load 会在应用启动的时候自动被runtime调用,通过重载这个方法来实现最小的对业务方的“代码入侵” */ 18 | [super load]; 19 | [CTViewControllerIntercepter sharedInstance]; 20 | } 21 | 22 | /* 23 | 24 | 按道理来说,这个sharedInstance单例方法是可以放在头文件的,但是对于目前这个应用来说,暂时还没有放出去的必要 25 | 26 | 当业务方对这个单例产生配置需求的时候,就可以把这个函数放出去 27 | */ 28 | + (instancetype)sharedInstance 29 | { 30 | static dispatch_once_t onceToken; 31 | static CTViewControllerIntercepter *sharedInstance; 32 | dispatch_once(&onceToken, ^{ 33 | sharedInstance = [[CTViewControllerIntercepter alloc] init]; 34 | }); 35 | return sharedInstance; 36 | } 37 | 38 | - (instancetype)init 39 | { 40 | self = [super init]; 41 | if (self) { 42 | 43 | /* 在这里做好方法拦截 */ 44 | [UIViewController aspect_hookSelector:@selector(loadView) withOptions:AspectPositionAfter usingBlock:^(idaspectInfo){ 45 | [self loadView:[aspectInfo instance]]; 46 | } error:NULL]; 47 | 48 | [UIViewController aspect_hookSelector:@selector(viewWillAppear:) withOptions:AspectPositionAfter usingBlock:^(id aspectInfo, BOOL animated){ 49 | [self viewWillAppear:animated viewController:[aspectInfo instance]]; 50 | } error:NULL]; 51 | } 52 | return self; 53 | } 54 | 55 | /* 56 | 各位架构师们,这里就是你们可以发挥聪明才智的地方啦。 57 | 你也可以随便找一个什么其他的UIViewController,只要加入工程中,不需要额外添加什么代码,就可以做到自动拦截了。 58 | 59 | 所以在你原来的架构中,大部分封装UIViewController的基类或者其他的什么基类,都可以使用这种方法让这些基类消失。 60 | */ 61 | #pragma mark - fake methods 62 | - (void)loadView:(UIViewController *)viewController 63 | { 64 | /* 你可以使用这个方法进行打日志,初始化基础业务相关的内容 */ 65 | NSLog(@"[%@ loadView]", [viewController class]); 66 | } 67 | 68 | - (void)viewWillAppear:(BOOL)animated viewController:(UIViewController *)viewController 69 | { 70 | /* 你可以使用这个方法进行打日志,初始化基础业务相关的内容 */ 71 | NSLog(@"[%@ viewWillAppear:%@]", [viewController class], animated ? @"YES" : @"NO"); 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Interceptor/Images.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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Interceptor/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | alibaba.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Interceptor/Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // Model.h 3 | // Interceptor 4 | // 5 | // Created by YoFun on 15/5/28. 6 | // Copyright (c) 2015年 alibaba. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define Deprecated(explain) __attribute__((deprecated(explain))) 12 | 13 | typedef void(^whereToGo)(NSString *str,NSArray *arr); 14 | 15 | @interface Model : NSObject 16 | { 17 | NSString *dogname; 18 | } 19 | 20 | @property(nonatomic, strong) NSString *dogname; 21 | 22 | @property(nonatomic,strong) whereToGo letitBe; 23 | 24 | -(void)tryBlock:(whereToGo)block Deprecated("测试方法"); 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Interceptor/Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // Model.m 3 | // Interceptor 4 | // 5 | // Created by YoFun on 15/5/28. 6 | // Copyright (c) 2015年 alibaba. All rights reserved. 7 | // 8 | 9 | #import "Model.h" 10 | 11 | @implementation Model 12 | 13 | -(instancetype)init 14 | { 15 | if (!self) { 16 | self = [super init]; 17 | } 18 | 19 | return self; 20 | } 21 | 22 | -(void)tryBlock:(whereToGo)block 23 | { 24 | self.letitBe = block; 25 | [self exuteBlock]; 26 | } 27 | 28 | -(void)exuteBlock 29 | { 30 | // self.letitBe = ^(NSString *str, NSArray *arr){ 31 | // str = @"hello!"; 32 | // arr = @[@"fist one",@"second one"]; 33 | // }; 34 | self.letitBe(@"hello",@[@"first",@"second!!!!"]); 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Interceptor/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Interceptor 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Interceptor/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Interceptor 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Model.h" 11 | 12 | @interface ViewController() 13 | 14 | @property(nonatomic) NSString *hasam; 15 | @property(nonatomic) NSArray *walu; 16 | @property(nonatomic) Model *model; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | /* 23 | 24 | 业务方也不需要写任何迎合框架的代码 25 | */ 26 | 27 | -(void)viewDidLoad 28 | { 29 | _model = [[Model alloc] init]; 30 | 31 | [_model tryBlock:^(NSString *str, NSArray *arr) { 32 | _hasam = str; 33 | self.walu = arr; 34 | 35 | }]; 36 | 37 | NSLog(@"this is the block val pass in:%@,%@",self.hasam,self.walu); 38 | 39 | [self.model addObserver:self forKeyPath:@"dogname" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil]; 40 | 41 | for (int i = 0; i<10; i++) { 42 | self.model.dogname = [NSString stringWithFormat:@"this is the %d th time",i]; 43 | } 44 | } 45 | 46 | -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 47 | { 48 | if ([keyPath isEqual: @"dogname"]) { 49 | NSLog(@"now the dog's name is :%@",[object valueForKey:@"dogname"]); 50 | } 51 | } 52 | 53 | -(void)viewWillDisappear:(BOOL)animated 54 | { 55 | [super viewWillDisappear:animated]; 56 | 57 | [self.model removeObserver:self forKeyPath:@"dogname" context:nil]; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Interceptor/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Interceptor 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. 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 | -------------------------------------------------------------------------------- /InterceptorTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | alibaba.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /InterceptorTests/InterceptorTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // InterceptorTests.m 3 | // InterceptorTests 4 | // 5 | // Created by casa on 4/17/15. 6 | // Copyright (c) 2015 alibaba. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface InterceptorTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation InterceptorTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, "6.0" 3 | 4 | target "Interceptor" do 5 | 6 | pod "Aspects" 7 | 8 | end 9 | 10 | --------------------------------------------------------------------------------