├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ ├── Private │ │ └── Objection │ │ │ ├── JSObjectFactory.h │ │ │ ├── JSObjection.h │ │ │ ├── JSObjectionBindingEntry.h │ │ │ ├── JSObjectionEntry.h │ │ │ ├── JSObjectionInjector.h │ │ │ ├── JSObjectionInjectorEntry.h │ │ │ ├── JSObjectionModule.h │ │ │ ├── JSObjectionProviderEntry.h │ │ │ ├── JSObjectionRuntimePropertyReflector.h │ │ │ ├── JSObjectionUtils.h │ │ │ ├── NSObject+Objection.h │ │ │ └── Objection.h │ └── Public │ │ └── Objection │ │ ├── JSObjectFactory.h │ │ ├── JSObjection.h │ │ ├── JSObjectionBindingEntry.h │ │ ├── JSObjectionEntry.h │ │ ├── JSObjectionInjector.h │ │ ├── JSObjectionInjectorEntry.h │ │ ├── JSObjectionModule.h │ │ ├── JSObjectionProviderEntry.h │ │ ├── JSObjectionRuntimePropertyReflector.h │ │ ├── JSObjectionUtils.h │ │ ├── NSObject+Objection.h │ │ └── Objection.h ├── Manifest.lock ├── Objection │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── JSObjectFactory.h │ │ ├── JSObjectFactory.m │ │ ├── JSObjection.h │ │ ├── JSObjection.m │ │ ├── JSObjectionBindingEntry.h │ │ ├── JSObjectionBindingEntry.m │ │ ├── JSObjectionEntry.h │ │ ├── JSObjectionEntry.m │ │ ├── JSObjectionInjector.h │ │ ├── JSObjectionInjector.m │ │ ├── JSObjectionInjectorEntry.h │ │ ├── JSObjectionInjectorEntry.m │ │ ├── JSObjectionModule.h │ │ ├── JSObjectionModule.m │ │ ├── JSObjectionProviderEntry.h │ │ ├── JSObjectionProviderEntry.m │ │ ├── JSObjectionRuntimePropertyReflector.h │ │ ├── JSObjectionRuntimePropertyReflector.m │ │ ├── JSObjectionUtils.h │ │ ├── JSObjectionUtils.m │ │ ├── NSObject+Objection.h │ │ ├── NSObject+Objection.m │ │ └── Objection.h ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── haijiao.xcuserdatad │ │ └── xcschemes │ │ ├── Objection.xcscheme │ │ ├── Pods-ProtocolProgrammingDemo.xcscheme │ │ └── xcschememanagement.plist └── Target Support Files │ ├── Objection │ ├── Objection-Private.xcconfig │ ├── Objection-dummy.m │ ├── Objection-prefix.pch │ └── Objection.xcconfig │ └── Pods-ProtocolProgrammingDemo │ ├── Pods-ProtocolProgrammingDemo-acknowledgements.markdown │ ├── Pods-ProtocolProgrammingDemo-acknowledgements.plist │ ├── Pods-ProtocolProgrammingDemo-dummy.m │ ├── Pods-ProtocolProgrammingDemo-resources.sh │ ├── Pods-ProtocolProgrammingDemo.debug.xcconfig │ └── Pods-ProtocolProgrammingDemo.release.xcconfig ├── ProtocolProgrammingDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── haijiao.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── haijiao.xcuserdatad │ └── xcschemes │ ├── ProtocolProgrammingDemo.xcscheme │ └── xcschememanagement.plist ├── ProtocolProgrammingDemo.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── haijiao.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── ProtocolProgrammingDemo ├── ApiServicePassthrough.h ├── ApiServicePassthrough.m ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── GetApiService.h ├── GetApiService.m ├── Info.plist ├── NSObject+ApiServiceProtocol.h ├── NSObject+ApiServiceProtocol.m ├── PostApiService.h ├── PostApiService.m ├── ViewController.h ├── ViewController.m └── main.m └── README.md /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '6.0' 3 | 4 | target 'ProtocolProgrammingDemo' do 5 | 6 | pod 'Objection', '~> 1.6.1' 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Objection (1.6.1) 3 | 4 | DEPENDENCIES: 5 | - Objection (~> 1.6.1) 6 | 7 | SPEC CHECKSUMS: 8 | Objection: ed03f2219cb22d2b5b893114219fe6c7e3263bde 9 | 10 | COCOAPODS: 0.38.2 11 | -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectFactory.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectFactory.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjection.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjection.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionBindingEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionBindingEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionInjector.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionInjector.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionInjectorEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionInjectorEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionModule.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionModule.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionProviderEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionProviderEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionRuntimePropertyReflector.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionRuntimePropertyReflector.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/JSObjectionUtils.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionUtils.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/NSObject+Objection.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/NSObject+Objection.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Objection/Objection.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/Objection.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectFactory.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectFactory.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjection.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjection.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionBindingEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionBindingEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionInjector.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionInjector.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionInjectorEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionInjectorEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionModule.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionModule.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionProviderEntry.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionProviderEntry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionRuntimePropertyReflector.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionRuntimePropertyReflector.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/JSObjectionUtils.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/JSObjectionUtils.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/NSObject+Objection.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/NSObject+Objection.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Objection/Objection.h: -------------------------------------------------------------------------------- 1 | ../../../Objection/Source/Objection.h -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Objection (1.6.1) 3 | 4 | DEPENDENCIES: 5 | - Objection (~> 1.6.1) 6 | 7 | SPEC CHECKSUMS: 8 | Objection: ed03f2219cb22d2b5b893114219fe6c7e3263bde 9 | 10 | COCOAPODS: 0.38.2 11 | -------------------------------------------------------------------------------- /Pods/Objection/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2012-2013 Justin DeWind 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/Objection/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/atomicobject/objection.png)](https://travis-ci.org/atomicobject/objection) 2 | 3 | ## Description 4 | 5 | Objection is a lightweight dependency injection framework for Objective-C for MacOS X and iOS. For those of you that have used [Guice](http://code.google.com/p/google-guice/), Objection will feel familiar. Objection was built to stay out of your way and alleviate the need to maintain a large XML container or manually construct objects. 6 | 7 | ## Features 8 | 9 | * "Annotation" Based Dependency Injection 10 | * Seamless support for integrating custom and external dependencies 11 | * Custom Object Providers 12 | * Meta Class Bindings 13 | * Protocol Bindings 14 | * Instance Bindings 15 | * Named Bindings 16 | * Lazily instantiates dependencies 17 | * Eager Singletons 18 | * Initializer Support 19 | * Default and custom arguments 20 | 21 | ## Using Objection 22 | 23 | For questions, visit the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/objection-framework) 24 | ### Basic Usage 25 | 26 | A class can be registered with objection using the macros *objection_register* (optional) or *objection_register_singleton*. The *objection_requires* macro can be used to declare what dependencies objection should provide to all instances it creates of that class. *objection_requires* can be used safely with inheritance. 27 | 28 | #### Example 29 | ```objective-c 30 | @class Engine, Brakes; 31 | 32 | @interface Car : NSObject 33 | { 34 | Engine *engine; 35 | Brakes *brakes; 36 | BOOL awake; 37 | } 38 | 39 | // Will be filled in by objection 40 | @property(nonatomic, strong) Engine *engine; 41 | // Will be filled in by objection 42 | @property(nonatomic, strong) Brakes *brakes; 43 | @property(nonatomic) BOOL awake; 44 | 45 | @implementation Car 46 | objection_requires(@"engine", @"brakes") 47 | @synthesize engine, brakes, awake; 48 | @end 49 | ``` 50 | #### Defining dependencies with selectors 51 | 52 | You can alternatively use selectors to define dependencies. The compiler will generate a warning if a given selector is not visible or cannot be found. 53 | 54 | #### Example 55 | 56 | ```objective-c 57 | @implementation Car 58 | objection_requires_sel(@selector(engine), @selector(brakes)) 59 | @synthesize engine, brakes, awake; 60 | @end 61 | ``` 62 | 63 | ### Fetching Objects from Objection 64 | 65 | An object can be fetched from objection by creating an injector and then asking for an instance of a particular class or protocol. An injector manages its own object context. Which means that a singleton is per injector and is not necessarily a *true* singleton. 66 | 67 | ```objective-c 68 | - (void)someMethod { 69 | JSObjectionInjector *injector = [JSObjection createInjector]; 70 | id car = [injector getObject:[Car class]]; 71 | } 72 | ``` 73 | 74 | A default injector can be registered with Objection which can be used throughout your application or library. 75 | 76 | ```objective-c 77 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 78 | JSObjectionInjector *injector = [JSObjection createInjector]; 79 | [JSObjection setDefaultInjector:injector]; 80 | } 81 | 82 | - (void)viewDidLoad { 83 | id myModel = [[JSObjection defaultInjector] getObject:[MyModel class]]; 84 | } 85 | ``` 86 | 87 | #### Injecting dependencies 88 | 89 | There may be instances where an object is allocated outside of the injector's life cycle. If the object's class declared its dependencies using *objection_requires* an injector can satisfy its dependencies via the *injectDependencies:* method. 90 | 91 | ```objective-c 92 | @implementation JSTableModel 93 | objection_requires(@"RESTClient") 94 | - (void)awakeFromNib { 95 | [[JSObjection defaultInjector] injectDependencies:self]; 96 | } 97 | @end 98 | ``` 99 | 100 | #### Subscripting 101 | 102 | Objection has support for the subscripting operator to retrieve objects from the injection context. 103 | 104 | ```objective-c 105 | - (void)someMethod { 106 | JSObjectionInjector *injector = [JSObjection createInjector]; 107 | id car = injector[[Car class]]; 108 | } 109 | ``` 110 | 111 | ### Awaking from Objection 112 | 113 | If an object is interested in knowing when it has been fully instantiated by objection it can implement the method 114 | *awakeFromObjection*. 115 | 116 | #### Example 117 | ```objective-c 118 | @implementation Car 119 | //... 120 | objection_register_singleton(Car) 121 | - (void)awakeFromObjection { 122 | awake = YES; 123 | } 124 | @end 125 | ``` 126 | 127 | ### Object Factory 128 | 129 | A class can get objects from the injector context through an object factory. 130 | 131 | ### Example 132 | ```objective-c 133 | @interface RequestDispatcher 134 | @property(nonatomic, strong) JSObjectFactory *objectFactory 135 | @end 136 | 137 | @implementation RequestDispatcher 138 | - (void)dispatch:(NSDictionary *)params 139 | { 140 | Request *request = [self.objectFactory getObject:[Request class]]; 141 | request.params = params; 142 | [request send]; 143 | } 144 | @end 145 | ``` 146 | ## Modules 147 | 148 | A module is a set of bindings which contributes additional configuration information to the injector. It is especially useful for integrating external depencies and binding protocols to classes or instances. 149 | 150 | #### Instance and Protocol Bindings 151 | 152 | * Bind a protocol or class to a specific instance of that type 153 | * Bind a class that is registered with Objection to a protocol 154 | 155 | #### Example 156 | ```objective-c 157 | @interface MyAppModule : JSObjectionModule { 158 | 159 | } 160 | @end 161 | 162 | @implementation MyAppModule 163 | - (void)configure { 164 | [self bind:[UIApplication sharedApplication] toClass:[UIApplication class]]; 165 | [self bind:[UIApplication sharedApplication].delegate toProtocol:@protocol(UIApplicationDelegate)]; 166 | [self bindClass:[MyAPIService class] toProtocol:@protocol(APIService)]; 167 | } 168 | 169 | @end 170 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 171 | JSObjectionInjector *injector = [JSObjection createInjector:[[MyAppModule alloc] init]]; 172 | [JSObjection setDefaultInjector:injector]; 173 | } 174 | ``` 175 | #### Meta Class Bindings 176 | 177 | There are times when a dependency -- usually external -- is implemented using only class methods. Objection can explicitly support binding to 178 | the meta class instance through a protocol. This avoids having to unnecessarily create a wrapper class that passes through to the class 179 | methods. The catch, of course, is that it requires a protocol definition so that Objection knows how to bind the meta class to objects 180 | in the injector context. 181 | 182 | #### Example 183 | ```objective-c 184 | @protocol ExternalUtility 185 | - (void)doSomething; 186 | @end 187 | 188 | @interface ExternalUtility 189 | + (void)doSomething; 190 | @end 191 | 192 | @implementation ExternalUtility 193 | + (void)doSomething {...} 194 | @end 195 | 196 | // Module Configuration 197 | - (void)configure { 198 | [self bindMetaClass:[ExternalUtility class] toProtocol:@protocol(ExternalUtility)]; 199 | } 200 | 201 | @interface SomeClass 202 | { 203 | ... 204 | } 205 | // Use 'assign' because a meta class is not subject to the normal retain/release lifecycle. 206 | // It will exist until the application is terminated (Class Initialization -> Application Termination) 207 | // regardless of the number of objects in the runtime that reference it. 208 | @property (nonatomic, assign) id externalUtility 209 | @end 210 | ``` 211 | #### Providers 212 | 213 | Occasionally you'll want to manually construct an object within Objection. Providers allow you to use a custom mechanism for building objects that are bound to a type. You can create a class that _conforms_ to the ObjectionProvider protocol or you can use a _block_ to build the object. 214 | 215 | #### Example 216 | ```objective-c 217 | @interface CarProvider : NSObject 218 | @end 219 | 220 | @implementation CarProvider 221 | - (id)provide:(JSObjectionInjector *)context arguments:(NSArray *)arguments { 222 | // Manually build object 223 | return car; 224 | } 225 | @end 226 | 227 | @implementation MyAppModule 228 | - (void)configure { 229 | [self bindProvider:[[CarProvider alloc] init] toClass:[Car class]]; 230 | [self bindBlock:^(JSObjectionInjector *context) { 231 | // Manually build object 232 | return car; 233 | } toClass:[Car class]]; 234 | } 235 | @end 236 | ``` 237 | 238 | ### Scopes 239 | 240 | A class can be scoped as a singleton in a module. Conversely, a registered singleton can be demoted to a normal lifecycle with in the injector's context. 241 | 242 | ### Example 243 | ```objective-c 244 | @implementation MyAppModule 245 | - (void)configure { 246 | [self bindClass:[Singleton class] inScope:JSObjectionScopeNormal]; 247 | [self bindClass:[Car class] inScope:JSObjectionScopeSingleton]; 248 | } 249 | @end 250 | ``` 251 | 252 | ### Named Bindings 253 | 254 | Dependencies of the same class or protocol can be identified using the *objection_requires_names* macro, which takes a dictionary of names to properties as a parameter. 255 | 256 | #### Example 257 | ```objective-c 258 | @interface ShinyCar : NSObject 259 | @property (nonatomic, strong) Headlight *leftHeadlight; 260 | @property (nonatomic, strong) Headlight *rightHeadlight; 261 | @end 262 | 263 | @implementation ShinyCar 264 | objection_register(ShinyCar) 265 | objection_requires_names((@{@"LeftHeadlight":@"leftHeadlight", @"RightHeadlight":@"rightHeadlight"})) 266 | @synthesize leftHeadlight, rightHeadlight; 267 | @end 268 | 269 | @implementation NamedModule 270 | 271 | - (void)configure 272 | { 273 | [self bind:[[Headlight alloc]init] toClass:[Headlight class] named:@"RightHeadlight"]; 274 | [self bindClass:[HIDHeadlight class] toClass:[Headlight class] named:@"LeftHeadlight"]; 275 | 276 | } 277 | @end 278 | 279 | ``` 280 | 281 | 282 | ### Eager Singletons 283 | 284 | You can mark registered singleton classes as eager singletons. Eager singletons will be instantiated during the creation of the injector rather than being lazily instantiated. 285 | 286 | ### Example 287 | ```objective-c 288 | @implementation MyAppModule 289 | - (void)configure { 290 | [self registerEagerSingleton:[Car class]]; 291 | } 292 | 293 | @end 294 | ``` 295 | 296 | ### Deriving a new injector from an existing injector 297 | 298 | A new injector can be created from an existing injector using the *withModule:* method. A new injector will be created containing the same bindings as the injector it was derived from. The new injector will also contain additional bindings provided by the new module. 299 | 300 | Conversley, if *withoutModuleOfType:* is used the new injector will _not_ contain the bindings of the removed module. 301 | 302 | ### Example 303 | ```objective-c 304 | injector = [otherInjector withModule:[[Level18Module alloc] init]] 305 | withoutModuleOfType:[Level17Module class]]; 306 | 307 | ``` 308 | 309 | ## Initializers 310 | 311 | By default, Objection allocates objects with the default initializer init. If you'd like to instantiate an object with an alternate ininitializer the objection_initializer macro can be used to do so. The macro supports passing in default arguments (scalar values are not currently supported) as well. 312 | 313 | #### Default Arguments Example 314 | ```objective-c 315 | @implementation ViewController 316 | objection_initializer(initWithNibName:bundle:, @"ViewController") 317 | @end 318 | ``` 319 | 320 | #### Custom Arguments Example 321 | ```objective-c 322 | @implementation ConfigurableCar 323 | objection_requires(@"engine", @"brakes") 324 | objection_initializer(initWithMake:model:) 325 | 326 | @synthesize make; 327 | @synthesize model; 328 | 329 | - (instancetype)initWithMake:(NSString *)make model:(NSString *)model { 330 | ... 331 | } 332 | @end 333 | 334 | - (void)buildCar { 335 | ConfigurableCar *car = [self.objectFactory getObjectWithArgs:[ConfigurableCar class], @"VW", @"Passat", nil]; 336 | NSLog(@"Make: %@ Model: %@", car.make, car.model); 337 | } 338 | ``` 339 | 340 | #### Class Method Initializer 341 | ```objective-c 342 | @implementation Truck 343 | objection_requires(@"engine", @"brakes") 344 | objection_initializer(truckWithMake:model:) 345 | + (instancetype)truckWithMake:(NSString *) make model: (NSString *)model { 346 | ... 347 | } 348 | @end 349 | 350 | ``` 351 | 352 | #### Ad-Hoc Initializer 353 | ```objective-c 354 | @implementation ConfigurableCar 355 | - (instancetype) initWithModel:(NSString *)model { 356 | //.... 357 | } 358 | @end 359 | 360 | - (void)buildCar { 361 | ConfigurableCar *car = [self.objectFactory getObject:[ConfigurableCar class], 362 | initializer: @selector(initWithModel:) 363 | withArgumentList:@[@"Passat"]]; 364 | } 365 | ``` 366 | 367 | ## Testing 368 | 369 | If you're using [Kiwi](https://github.com/allending/Kiwi) for testing, checkout [MSSpec](https://github.com/mindsnacks/MSSpec). It provides a convenient way inject mocks into your specs using Objection. 370 | 371 | ## TODO 372 | 373 | * Add a motivation section that speaks to _why_ Objection was created 374 | 375 | ## Installation 376 | 377 | ### Static Framework and Linkable Framework 378 | 379 | It can be downloaded [here](http://objection-framework.org/files/Objection-1.5.tar.gz) 380 | 381 | ### Building Static Framework 382 | 383 | git clone git://github.com/atomicobject/objection.git 384 | git checkout 1.5 385 | 386 | #### iOS 387 | 388 | 389 | 1. rake artifact:ios 390 | 2. cp -R build/Release-iphoneuniversal/Objection-iOS.framework ${DEST_DIR} 391 | 3. In XCode -> Project Icon -> Your Target -> Build Phases -> Link Binary With Libraries -> Add (+) -> Add Other 392 | 4. Add -ObjC and -all_load to Other Link Flags in your project 393 | 394 | #### Include framework 395 | #import 396 | 397 | #### MacOS X 398 | 399 | 1. rake artifact:osx 400 | 2. cp -R build/Release/Objection.framework ${DEST_DIR} 401 | 3. In XCode -> Project Icon -> Your Target -> Build Phases -> Link Binary With Libraries -> Add (+) -> Add Other 402 | 403 | #### Include framework 404 | #import 405 | 406 | ### CocoaPods 407 | 408 | Edit your Pofile 409 | 410 | edit Podfile 411 | pod 'Objection', '1.6.1' 412 | 413 | Now you can install Objection 414 | 415 | pod install 416 | 417 | #### Include framework 418 | #import 419 | 420 | Learn more at [CocoaPods](http://cocoapods.org). 421 | 422 | ### Ruby Motion 423 | 424 | A companion library for Objection was created called [motion-objection](https://github.com/atomicobject/motion-objection) 425 | 426 | ```bash 427 | gem install motion-objection 428 | ``` 429 | 430 | ## Requirements 431 | 432 | * MacOS X 10.8 + 433 | * iOS 7.0 + 434 | 435 | ## Authors 436 | 437 | * Justin DeWind (dewind@atomicobject.com, @dewind on Twitter) 438 | * © 2013 [Atomic Object](http://www.atomicobject.com/) 439 | * More Atomic Object [open source](http://www.atomicobject.com/pages/Software+Commons) projects 440 | 441 | ## Other Dependency Injection Libraries 442 | 443 | One only has to [search GitHub](https://github.com/search?l=Objective-C&p=1&q=dependency+injection&repo=&type=Repositories) 444 | 445 | ## Applications that use Objection 446 | 447 | * [Bubble Island](http://www.wooga.com/games/bubble-island/) 448 | * [Monster World](http://www.wooga.com/games/monster-world/) 449 | * [Pocket Village](http://www.wooga.com/games/pocket-village/) 450 | * [SideReel](https://itunes.apple.com/us/app/id417270961?mt=8) 451 | * [Google Wallet](http://www.google.com/wallet/) 452 | 453 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectFactory.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class JSObjectionInjector; 4 | 5 | @interface JSObjectFactory : NSObject 6 | 7 | @property (nonatomic, readonly, weak) JSObjectionInjector *injector; 8 | 9 | - (instancetype)initWithInjector:(JSObjectionInjector *)injector; 10 | - (id)getObject:(id)classOrProtocol; 11 | - (id)getObject:(id)classOrProtocol withArgumentList:(NSArray *)arguments; 12 | - (id)getObject:(id)classOrProtocol initializer:(SEL)initializer withArgumentList:(NSArray *)arguments; 13 | - (id)getObject:(id)classOrProtocol named:(NSString *)named withArgumentList:(NSArray *)arguments; 14 | - (id)objectForKeyedSubscript: (id)key; 15 | - (id)getObjectWithArgs:(id)classOrProtocol, ... NS_REQUIRES_NIL_TERMINATION; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectFactory.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectFactory.h" 2 | #import "Objection.h" 3 | 4 | @implementation JSObjectFactory 5 | 6 | - (instancetype)initWithInjector:(JSObjectionInjector *)injector { 7 | if ((self = [super init])) { 8 | _injector = injector; 9 | } 10 | return self; 11 | } 12 | 13 | - (id)getObject:(id)classOrProtocol { 14 | return [self.injector getObject:classOrProtocol]; 15 | } 16 | 17 | - (id)getObject:(id)classOrProtocol withArgumentList:(NSArray *)arguments { 18 | return [self.injector getObject:classOrProtocol argumentList:arguments]; 19 | } 20 | 21 | - (id)getObject:(id)classOrProtocol initializer:(SEL)initializer withArgumentList:(NSArray *)arguments { 22 | return [self.injector getObject:classOrProtocol named:nil initializer:initializer argumentList:arguments]; 23 | } 24 | 25 | - (id)getObject:(id)classOrProtocol named:(NSString *)named withArgumentList:(NSArray *)arguments { 26 | return [self.injector getObject:classOrProtocol named:named argumentList:arguments]; 27 | } 28 | 29 | - (id)objectForKeyedSubscript:(id)key { 30 | return [self getObject:key]; 31 | } 32 | 33 | - (id)getObjectWithArgs:(id)classOrProtocol, ... { 34 | va_list va_arguments; 35 | va_start(va_arguments, classOrProtocol); 36 | id object = [self.injector getObject:classOrProtocol arguments:va_arguments]; 37 | va_end(va_arguments); 38 | return object; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionInjector.h" 3 | #import "JSObjectionEntry.h" 4 | #import "JSObjectionUtils.h" 5 | 6 | @interface JSObjection : NSObject 7 | 8 | + (JSObjectionInjector *)createInjectorWithModules:(JSObjectionModule *)first, ... NS_REQUIRES_NIL_TERMINATION; 9 | + (JSObjectionInjector *)createInjectorWithModulesArray:(NSArray *)modules; 10 | + (JSObjectionInjector *)createInjector:(JSObjectionModule *)module; 11 | + (JSObjectionInjector *)createInjector; 12 | + (void)registerClass:(Class)theClass scope:(JSObjectionScope)scope; 13 | + (void)setDefaultInjector:(JSObjectionInjector *)anInjector; 14 | + (JSObjectionInjector *)defaultInjector; 15 | + (void)reset; 16 | + (JSObjectionPropertyInfo)propertyForClass:(Class)theClass andProperty:(NSString *)propertyName; 17 | + (void)setPropertyReflector:(Class)reflector; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjection.m: -------------------------------------------------------------------------------- 1 | #import "JSObjection.h" 2 | #import 3 | #import "JSObjectionInjectorEntry.h" 4 | #import "JSObjectionRuntimePropertyReflector.h" 5 | 6 | static NSMutableDictionary *gObjectionContext; 7 | static pthread_mutex_t gObjectionMutex; 8 | static JSObjectionInjector *gGlobalInjector; 9 | static id gPropertyReflector; 10 | 11 | @implementation JSObjection 12 | 13 | + (JSObjectionInjector *)createInjector:(JSObjectionModule *)module { 14 | pthread_mutex_lock(&gObjectionMutex); 15 | @try { 16 | return [[JSObjectionInjector alloc] initWithContext:gObjectionContext andModule:module]; 17 | } 18 | @finally { 19 | pthread_mutex_unlock(&gObjectionMutex); 20 | } 21 | 22 | return nil; 23 | } 24 | 25 | + (JSObjectionInjector *)createInjectorWithModulesArray:(NSArray *)modules { 26 | pthread_mutex_lock(&gObjectionMutex); 27 | @try { 28 | return [[JSObjectionInjector alloc] initWithContext:gObjectionContext andModules:modules]; 29 | } 30 | @finally { 31 | pthread_mutex_unlock(&gObjectionMutex); 32 | } 33 | 34 | return nil; 35 | } 36 | 37 | + (JSObjectionInjector *)createInjectorWithModules:(JSObjectionModule *)first, ... { 38 | va_list va_modules; 39 | NSMutableArray *modules = [NSMutableArray arrayWithObject:first]; 40 | va_start(va_modules, first); 41 | 42 | JSObjectionModule *module; 43 | while ((module = va_arg( va_modules, JSObjectionModule *) )) { 44 | [modules addObject:module]; 45 | } 46 | 47 | va_end(va_modules); 48 | return [self createInjectorWithModulesArray:modules]; 49 | } 50 | 51 | + (JSObjectionInjector *)createInjector { 52 | pthread_mutex_lock(&gObjectionMutex); 53 | @try { 54 | return [[JSObjectionInjector alloc] initWithContext:gObjectionContext]; 55 | } 56 | @finally { 57 | pthread_mutex_unlock(&gObjectionMutex); 58 | } 59 | 60 | return nil; 61 | } 62 | 63 | + (void)initialize { 64 | if (self == [JSObjection class]) { 65 | gObjectionContext = [[NSMutableDictionary alloc] init]; 66 | gPropertyReflector = [[JSObjectionRuntimePropertyReflector alloc] init]; 67 | pthread_mutexattr_t mutexattr; 68 | pthread_mutexattr_init(&mutexattr); 69 | pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); 70 | pthread_mutex_init(&gObjectionMutex, &mutexattr); 71 | pthread_mutexattr_destroy(&mutexattr); 72 | } 73 | } 74 | 75 | + (void)registerClass:(Class)theClass scope:(JSObjectionScope)scope { 76 | pthread_mutex_lock(&gObjectionMutex); 77 | if (scope != JSObjectionScopeSingleton && scope != JSObjectionScopeNormal) { 78 | @throw [NSException exceptionWithName:@"JSObjectionInjectorException" reason:@"Invalid Instantiation Rule" userInfo:nil]; 79 | } 80 | 81 | if (theClass && [gObjectionContext objectForKey:NSStringFromClass(theClass)] == nil) { 82 | [gObjectionContext setObject:[JSObjectionInjectorEntry entryWithClass:theClass scope:scope] forKey:NSStringFromClass(theClass)]; 83 | } 84 | pthread_mutex_unlock(&gObjectionMutex); 85 | } 86 | 87 | + (void)reset { 88 | pthread_mutex_lock(&gObjectionMutex); 89 | [gObjectionContext removeAllObjects]; 90 | pthread_mutex_unlock(&gObjectionMutex); 91 | } 92 | 93 | + (void)setDefaultInjector:(JSObjectionInjector *)anInjector { 94 | if (gGlobalInjector != anInjector) { 95 | gGlobalInjector = anInjector; 96 | } 97 | } 98 | 99 | + (JSObjectionInjector *)defaultInjector { 100 | return gGlobalInjector; 101 | } 102 | 103 | + (JSObjectionPropertyInfo)propertyForClass:(Class)theClass andProperty:(NSString *)propertyName { 104 | return [gPropertyReflector propertyForClass:theClass andProperty: propertyName]; 105 | } 106 | 107 | + (void)setPropertyReflector:(id)reflector { 108 | if(gPropertyReflector != reflector) { 109 | gPropertyReflector = reflector; 110 | } 111 | } 112 | @end 113 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionBindingEntry.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionEntry.h" 3 | 4 | @interface JSObjectionBindingEntry : JSObjectionEntry 5 | 6 | - (id)initWithObject:(id)theObject; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionBindingEntry.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectionBindingEntry.h" 2 | 3 | @interface JSObjectionBindingEntry () { 4 | id _instance; 5 | } 6 | 7 | @end 8 | 9 | @implementation JSObjectionBindingEntry 10 | 11 | - (instancetype)initWithObject:(id)theObject { 12 | if ((self = [super init])) { 13 | _instance = theObject; 14 | } 15 | return self; 16 | } 17 | 18 | - (id)extractObject:(NSArray *)arguments { 19 | return _instance; 20 | } 21 | 22 | - (JSObjectionScope)lifeCycle { 23 | return JSObjectionScopeSingleton; 24 | } 25 | 26 | - (void)dealloc { 27 | _instance = nil; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionEntry.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | typedef enum { 4 | JSObjectionScopeNone = -1, 5 | JSObjectionScopeNormal, 6 | JSObjectionScopeSingleton 7 | } JSObjectionScope; 8 | 9 | 10 | @class JSObjectionInjector, JSObjectionEntry; 11 | 12 | @protocol JSObjectionEntry 13 | 14 | @property (nonatomic, readonly) JSObjectionScope lifeCycle; 15 | @property (nonatomic, assign) JSObjectionInjector *injector; 16 | 17 | @required 18 | - (id)extractObject:(NSArray *)arguments; 19 | + (id)entryWithEntry:(JSObjectionEntry *)entry; 20 | @optional 21 | -(id) extractObject:(NSArray *)arguments initializer: (SEL)initializer; 22 | 23 | @end 24 | 25 | 26 | @interface JSObjectionEntry : NSObject 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionEntry.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectionEntry.h" 2 | 3 | @implementation JSObjectionEntry 4 | 5 | @synthesize injector; 6 | @dynamic lifeCycle; 7 | 8 | - (id)extractObject:(NSArray *)arguments { 9 | return nil; 10 | } 11 | 12 | + (id)entryWithEntry:(JSObjectionEntry *)entry { 13 | return entry; 14 | } 15 | 16 | - (JSObjectionScope)lifeCycle { 17 | return JSObjectionScopeNone; 18 | } 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionInjector.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionModule.h" 3 | 4 | @interface JSObjectionInjector : NSObject 5 | 6 | - (instancetype)initWithContext:(NSDictionary *)theGlobalContext; 7 | - (instancetype)initWithContext:(NSDictionary *)theGlobalContext andModule:(JSObjectionModule *)theModule; 8 | - (instancetype)initWithContext:(NSDictionary *)theGlobalContext andModules:(NSArray *)theModules; 9 | - (id)getObject:(id)classOrProtocol; 10 | - (id)getObject:(id)classOrProtocol named:(NSString*)name; 11 | - (id)getObjectWithArgs:(id)classOrProtocol, ... NS_REQUIRES_NIL_TERMINATION; 12 | - (id)getObject:(id)classOrProtocol namedWithArgs:(NSString*)name, ... NS_REQUIRES_NIL_TERMINATION; 13 | - (id)getObject:(id)classOrProtocol arguments:(va_list)argList; 14 | - (id)getObject:(id)classOrProtocol named:(NSString*)name arguments:(va_list)argList; 15 | - (id)getObject:(id)classOrProtocol argumentList:(NSArray *)argumentList; 16 | - (id)getObject:(id)classOrProtocol initializer:(SEL)selector argumentList:(NSArray *)argumentList; 17 | - (id)getObject:(id)classOrProtocol named:(NSString*)name argumentList:(NSArray *)argumentList; 18 | - (id)getObject:(id)classOrProtocol named:(NSString*)name initializer:(SEL)selector argumentList:(NSArray *)argumentList; 19 | - (id)withModule:(JSObjectionModule *)theModule; 20 | - (id)withModules:(JSObjectionModule *)first, ... NS_REQUIRES_NIL_TERMINATION; 21 | - (id)withModuleCollection:(NSArray *)theModules; 22 | - (id)withoutModuleOfType:(Class)moduleClass; 23 | - (id)withoutModuleOfTypes:(Class)first, ... NS_REQUIRES_NIL_TERMINATION; 24 | - (id)withoutModuleCollection:(NSArray *)moduleClasses; 25 | - (void)injectDependencies:(id)object; 26 | - (id)objectForKeyedSubscript: (id)key; 27 | - (NSArray *)modules; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionInjector.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectionInjector.h" 2 | #import "JSObjectionEntry.h" 3 | #import "JSObjectFactory.h" 4 | #import "JSObjectionUtils.h" 5 | #import "JSObjectionInjectorEntry.h" 6 | 7 | #import 8 | #import 9 | 10 | @interface __JSObjectionInjectorDefaultModule : JSObjectionModule 11 | 12 | @property (nonatomic, weak) JSObjectionInjector *injector; 13 | 14 | @end 15 | 16 | @implementation __JSObjectionInjectorDefaultModule 17 | 18 | - (instancetype)initWithInjector:(JSObjectionInjector *)injector { 19 | if ((self = [super init])) { 20 | self.injector = injector; 21 | } 22 | return self; 23 | } 24 | 25 | - (void)configure { 26 | [self bind:[[JSObjectFactory alloc] initWithInjector:self.injector] toClass:[JSObjectFactory class]]; 27 | } 28 | 29 | @end 30 | 31 | @interface JSObjectionInjector() { 32 | NSDictionary *_globalContext; 33 | NSMutableDictionary *_context; 34 | NSSet *_eagerSingletons; 35 | NSMutableArray *_modules; 36 | } 37 | 38 | - (void)initializeEagerSingletons; 39 | - (void)configureDefaultModule; 40 | - (void)configureModule:(JSObjectionModule *)module; 41 | 42 | @end 43 | 44 | @implementation JSObjectionInjector 45 | 46 | - (instancetype)initWithContext:(NSDictionary *)theGlobalContext { 47 | if ((self = [super init])) { 48 | _globalContext = theGlobalContext; 49 | _context = [[NSMutableDictionary alloc] init]; 50 | _modules = [[NSMutableArray alloc] init]; 51 | [self configureDefaultModule]; 52 | [self initializeEagerSingletons]; 53 | } 54 | 55 | return self; 56 | } 57 | 58 | - (instancetype)initWithContext:(NSDictionary *)theGlobalContext andModule:(JSObjectionModule *)theModule { 59 | if ((self = [self initWithContext:theGlobalContext])) { 60 | [self configureModule:theModule]; 61 | [self initializeEagerSingletons]; 62 | } 63 | return self; 64 | } 65 | 66 | - (instancetype)initWithContext:(NSDictionary *)theGlobalContext andModules:(NSArray *)theModules { 67 | if ((self = [self initWithContext:theGlobalContext])) { 68 | for (JSObjectionModule *module in theModules) { 69 | [self configureModule:module]; 70 | } 71 | [self initializeEagerSingletons]; 72 | } 73 | return self; 74 | } 75 | 76 | - (id)getObject:(id)classOrProtocol { 77 | return [self getObjectWithArgs:classOrProtocol, nil]; 78 | } 79 | 80 | - (id)getObject:(id)classOrProtocol named:(NSString*)name { 81 | return [self getObject:classOrProtocol namedWithArgs:name, nil]; 82 | } 83 | 84 | - (id)getObjectWithArgs:(id)classOrProtocol, ... { 85 | va_list va_arguments; 86 | va_start(va_arguments, classOrProtocol); 87 | id object = [self getObject:classOrProtocol arguments:va_arguments]; 88 | va_end(va_arguments); 89 | return object; 90 | } 91 | 92 | - (id)getObject:(id)classOrProtocol namedWithArgs:(NSString *)name, ... { 93 | va_list va_arguments; 94 | va_start(va_arguments, name); 95 | id object = [self getObject:classOrProtocol named:name arguments:va_arguments]; 96 | va_end(va_arguments); 97 | return object; 98 | } 99 | 100 | - (id)getObject:(id)classOrProtocol arguments:(va_list)argList { 101 | return [self getObject:classOrProtocol named:nil arguments:argList]; 102 | } 103 | 104 | - (id)getObject:(id)classOrProtocol initializer:(SEL)selector argumentList:(NSArray *)argumentList { 105 | return [self getObject:classOrProtocol named:nil initializer:selector argumentList:argumentList]; 106 | } 107 | 108 | - (id)getObject:(id)classOrProtocol named:name arguments:(va_list)argList { 109 | NSArray *arguments = JSObjectionUtils.transformVariadicArgsToArray(argList); 110 | return [self getObject:classOrProtocol named:name argumentList:arguments]; 111 | } 112 | 113 | - (id)getObject:(id)classOrProtocol argumentList:(NSArray *)argumentList { 114 | return [self getObject:classOrProtocol named:nil argumentList:argumentList]; 115 | } 116 | 117 | - (id)getObject:(id)classOrProtocol named:(NSString*)name initializer:(SEL)selector argumentList:(NSArray *)argumentList { 118 | @synchronized(self) { 119 | if (!classOrProtocol) { 120 | return nil; 121 | } 122 | NSString *key = nil; 123 | BOOL isClass = class_isMetaClass(object_getClass(classOrProtocol)); 124 | 125 | if (isClass) { 126 | key = NSStringFromClass(classOrProtocol); 127 | } else { 128 | key = [NSString stringWithFormat:@"<%@>", NSStringFromProtocol(classOrProtocol)]; 129 | } 130 | 131 | if (name) 132 | { 133 | key = [NSString stringWithFormat:@"%@:%@",key,name]; 134 | } 135 | 136 | id injectorEntry = [_context objectForKey:key]; 137 | injectorEntry.injector = self; 138 | 139 | if (!injectorEntry) { 140 | id entry = [_globalContext objectForKey:key]; 141 | if (entry) { 142 | injectorEntry = [[entry class] entryWithEntry:entry]; 143 | injectorEntry.injector = self; 144 | [_context setObject:injectorEntry forKey:key]; 145 | } else if(isClass) { 146 | injectorEntry = [JSObjectionInjectorEntry entryWithClass:classOrProtocol scope:JSObjectionScopeNormal]; 147 | injectorEntry.injector = self; 148 | [_context setObject:injectorEntry forKey:key]; 149 | } 150 | } 151 | 152 | if (classOrProtocol && injectorEntry) { 153 | if ([injectorEntry respondsToSelector:@selector(extractObject:initializer:)]) { 154 | return [injectorEntry extractObject:argumentList initializer:selector]; 155 | } 156 | return [injectorEntry extractObject:argumentList]; 157 | } 158 | 159 | return nil; 160 | } 161 | 162 | return nil; 163 | 164 | } 165 | 166 | - (id)getObject:(id)classOrProtocol named:(NSString*)name argumentList:(NSArray *)argumentList { 167 | return [self getObject:classOrProtocol named:name initializer: nil argumentList:argumentList]; 168 | } 169 | 170 | - (id)objectForKeyedSubscript: (id)key { 171 | return [self getObjectWithArgs:key, nil]; 172 | } 173 | 174 | 175 | - (id)withModule:(JSObjectionModule *)theModule { 176 | return [self withModuleCollection:[NSArray arrayWithObject:theModule]]; 177 | } 178 | 179 | - (id)withModules:(JSObjectionModule *)first, ... { 180 | va_list va_modules; 181 | NSMutableArray *modules = [NSMutableArray arrayWithObject:first]; 182 | va_start(va_modules, first); 183 | 184 | JSObjectionModule *module; 185 | while ((module = va_arg( va_modules, JSObjectionModule *) )) { 186 | [modules addObject:module]; 187 | } 188 | 189 | va_end(va_modules); 190 | return [self withModuleCollection:modules]; 191 | 192 | } 193 | 194 | - (id)withModuleCollection:(NSArray *)theModules { 195 | NSMutableArray *mergedModules = [NSMutableArray arrayWithArray:_modules]; 196 | [mergedModules addObjectsFromArray:theModules]; 197 | return [[[self class] alloc] initWithContext:_globalContext andModules:mergedModules]; 198 | } 199 | 200 | - (id)withoutModuleOfType:(Class)moduleClass { 201 | return [self withoutModuleCollection:[NSArray arrayWithObject:moduleClass]]; 202 | } 203 | 204 | - (id)withoutModuleOfTypes:(Class)first, ... { 205 | va_list va_modules; 206 | NSMutableArray *classes = [NSMutableArray arrayWithObject:first]; 207 | va_start(va_modules, first); 208 | 209 | Class aClass; 210 | while ((aClass = va_arg( va_modules, Class) )) { 211 | [classes addObject:aClass]; 212 | } 213 | 214 | va_end(va_modules); 215 | return [self withoutModuleCollection:classes]; 216 | 217 | } 218 | 219 | - (id)withoutModuleCollection:(NSArray *)moduleClasses { 220 | NSMutableArray *remainingModules = [NSMutableArray arrayWithArray:_modules]; 221 | NSMutableArray *withDefaultModule = [NSMutableArray arrayWithArray:moduleClasses]; 222 | [withDefaultModule addObject:[__JSObjectionInjectorDefaultModule class]]; 223 | for (JSObjectionModule *module in _modules) { 224 | for (Class moduleClass in withDefaultModule) { 225 | if([module isKindOfClass:moduleClass]) { 226 | [remainingModules removeObject:module]; 227 | } 228 | } 229 | } 230 | return [[[self class] alloc] initWithContext:_globalContext andModules:remainingModules]; 231 | } 232 | 233 | 234 | - (void)injectDependencies:(id)object { 235 | JSObjectionUtils.injectDependenciesIntoProperties(self, [object class], object); 236 | } 237 | 238 | - (NSArray *)modules { 239 | return [_modules copy]; 240 | } 241 | 242 | 243 | #pragma mark - Private 244 | 245 | - (void)initializeEagerSingletons { 246 | for (NSString *eagerSingletonKey in _eagerSingletons) { 247 | id entry = [_context objectForKey:eagerSingletonKey] ?: [_globalContext objectForKey:eagerSingletonKey]; 248 | if ([entry lifeCycle] == JSObjectionScopeSingleton) { 249 | [self getObject:NSClassFromString(eagerSingletonKey)]; 250 | } else { 251 | @throw [NSException exceptionWithName:@"JSObjectionException" 252 | reason:[NSString stringWithFormat:@"Unable to initialize eager singleton for the class '%@' because it was never registered as a singleton", eagerSingletonKey] 253 | userInfo:nil]; 254 | } 255 | } 256 | } 257 | 258 | - (void)configureModule:(JSObjectionModule *)module { 259 | [_modules addObject:module]; 260 | [module configure]; 261 | NSSet *mergedSet = [module.eagerSingletons setByAddingObjectsFromSet:_eagerSingletons]; 262 | _eagerSingletons = mergedSet; 263 | [_context addEntriesFromDictionary:module.bindings]; 264 | } 265 | 266 | - (void)configureDefaultModule { 267 | __JSObjectionInjectorDefaultModule *module = [[__JSObjectionInjectorDefaultModule alloc] initWithInjector:self]; 268 | [self configureModule:module]; 269 | } 270 | 271 | #pragma mark - 272 | 273 | 274 | @end 275 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionInjectorEntry.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionEntry.h" 3 | 4 | @interface JSObjectionInjectorEntry : JSObjectionEntry 5 | 6 | @property (nonatomic, readonly) Class classEntry; 7 | 8 | - (instancetype)initWithClass:(Class)theClass lifeCycle:(JSObjectionScope)theLifeCycle; 9 | + (instancetype)entryWithClass:(Class)theClass scope:(JSObjectionScope)theLifeCycle; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionInjectorEntry.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectionInjectorEntry.h" 2 | #import "JSObjection.h" 3 | #import "JSObjectionUtils.h" 4 | #import "NSObject+Objection.h" 5 | 6 | @interface JSObjectionInjectorEntry() { 7 | JSObjectionScope _lifeCycle; 8 | id _storageCache; 9 | } 10 | 11 | - (id)buildObject:(NSArray *)arguments initializer:(SEL)initializer; 12 | - (id)argumentsForObject:(NSArray *)givenArguments; 13 | - (SEL)initializerForObject; 14 | 15 | @end 16 | 17 | 18 | @implementation JSObjectionInjectorEntry 19 | 20 | @synthesize lifeCycle = _lifeCycle; 21 | @synthesize classEntry = _classEntry; 22 | 23 | 24 | #pragma mark - Instance Methods 25 | 26 | - (instancetype)initWithClass:(Class)theClass lifeCycle:(JSObjectionScope)theLifeCycle { 27 | if ((self = [super init])) { 28 | _lifeCycle = theLifeCycle; 29 | _classEntry = theClass; 30 | _storageCache = nil; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (instancetype) extractObject:(NSArray *)arguments initializer:(SEL)initializer { 37 | if (self.lifeCycle == JSObjectionScopeNormal || !_storageCache) { 38 | return [self buildObject:arguments initializer: initializer]; 39 | } 40 | return _storageCache; 41 | } 42 | 43 | - (instancetype)extractObject:(NSArray *)arguments { 44 | return [self extractObject:arguments initializer:nil]; 45 | } 46 | 47 | - (void)dealloc { 48 | _storageCache = nil; 49 | } 50 | 51 | 52 | #pragma mark - Private Methods 53 | 54 | - (id)buildObject:(NSArray *)arguments initializer: (SEL) initializer { 55 | 56 | id objectUnderConstruction = nil; 57 | 58 | if(initializer != nil) { 59 | objectUnderConstruction = JSObjectionUtils.buildObjectWithInitializer(self.classEntry, initializer, arguments); 60 | } else if ([self.classEntry respondsToSelector:@selector(objectionInitializer)]) { 61 | objectUnderConstruction = JSObjectionUtils.buildObjectWithInitializer(self.classEntry, [self initializerForObject], [self argumentsForObject:arguments]); 62 | } else { 63 | objectUnderConstruction = [[self.classEntry alloc] init]; 64 | } 65 | 66 | if (self.lifeCycle == JSObjectionScopeSingleton) { 67 | _storageCache = objectUnderConstruction; 68 | } 69 | 70 | JSObjectionUtils.injectDependenciesIntoProperties(self.injector, self.classEntry, objectUnderConstruction); 71 | 72 | return objectUnderConstruction; 73 | } 74 | 75 | - (SEL)initializerForObject { 76 | return NSSelectorFromString([[self.classEntry performSelector:@selector(objectionInitializer)] objectForKey:JSObjectionInitializerKey]); 77 | } 78 | 79 | - (NSArray *)argumentsForObject:(NSArray *)givenArguments { 80 | return givenArguments.count > 0 ? givenArguments : [[self.classEntry performSelector:@selector(objectionInitializer)] objectForKey:JSObjectionDefaultArgumentsKey]; 81 | } 82 | 83 | 84 | #pragma mark - Class Methods 85 | 86 | + (id)entryWithClass:(Class)theClass scope:(JSObjectionScope)theLifeCycle { 87 | return [[JSObjectionInjectorEntry alloc] initWithClass:theClass lifeCycle:theLifeCycle]; 88 | } 89 | 90 | + (id)entryWithEntry:(JSObjectionInjectorEntry *)entry { 91 | return [[JSObjectionInjectorEntry alloc] initWithClass:entry.classEntry lifeCycle:entry.lifeCycle]; 92 | } 93 | @end 94 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionModule.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionEntry.h" 3 | 4 | @class JSObjectionInjector; 5 | 6 | @protocol JSObjectionProvider 7 | 8 | - (id)provide:(JSObjectionInjector *)context arguments:(NSArray *)arguments; 9 | 10 | @end 11 | 12 | 13 | @interface JSObjectionModule : NSObject 14 | 15 | @property (nonatomic, readonly) NSDictionary *bindings; 16 | @property (nonatomic, readonly) NSSet *eagerSingletons; 17 | 18 | - (void)bind:(id)instance toClass:(Class)aClass; 19 | - (void)bind:(id)instance toClass:(Class)aClass named:(NSString *)name; 20 | - (void)bind:(id)instance toProtocol:(Protocol *)aProtocol; 21 | - (void)bind:(id)instance toProtocol:(Protocol *)aProtocol named:(NSString *)name; 22 | - (void)bindMetaClass:(Class)metaClass toProtocol:(Protocol *)aProtocol; 23 | - (void)bindProvider:(id)provider toClass:(Class)aClass; 24 | - (void)bindProvider:(id)provider toClass:(Class)aClass named:(NSString *)name; 25 | - (void)bindProvider:(id)provider toProtocol:(Protocol *)aProtocol; 26 | - (void)bindProvider:(id)provider toProtocol:(Protocol *)aProtocol named:(NSString *)name; 27 | - (void)bindProvider:(id)provider toClass:(Class)aClass inScope:(JSObjectionScope)scope; 28 | - (void)bindProvider:(id)provider toClass:(Class)aClass inScope:(JSObjectionScope)scope named:(NSString *)name; 29 | - (void)bindProvider:(id)provider toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope; 30 | - (void)bindProvider:(id)provider toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope named:(NSString *)name; 31 | - (void)bindClass:(Class)aClass toProtocol:(Protocol *)aProtocol; 32 | - (void)bindClass:(Class)aClass toProtocol:(Protocol *)aProtocol named:(NSString*)name; 33 | - (void)bindClass:(Class)aClass toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope named:(NSString*)name; 34 | - (void)bindClass:(Class)aClass toClass:(Class)toClass; 35 | - (void)bindClass:(Class)aClass toClass:(Class)toClass named:(NSString*)name; 36 | - (void)bindClass:(Class)aClass toClass:(Class)toClass inScope:(JSObjectionScope)scope named:(NSString*)name; 37 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toClass:(Class)aClass; 38 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toClass:(Class)aClass named:(NSString *)name; 39 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toProtocol:(Protocol *)aProtocol; 40 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toProtocol:(Protocol *)aProtocol named:(NSString *)name; 41 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toClass:(Class)aClass inScope:(JSObjectionScope)scope; 42 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toClass:(Class)aClass inScope:(JSObjectionScope)scope named:(NSString *)name; 43 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope; 44 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope named:(NSString *)name; 45 | - (void)bindClass:(Class)aClass inScope:(JSObjectionScope)scope; 46 | - (void)registerEagerSingleton:(Class)aClass; 47 | - (BOOL)hasBindingForClass:(Class)aClass; 48 | - (BOOL)hasBindingForClass:(Class)aClass withName:(NSString*)name; 49 | - (BOOL)hasBindingForProtocol:(Protocol *)protocol; 50 | - (BOOL)hasBindingForProtocol:(Protocol *)protocol withName:(NSString*)name; 51 | - (void)configure; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionModule.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectionModule.h" 2 | #import "JSObjectionBindingEntry.h" 3 | #import "JSObjectionInjectorEntry.h" 4 | #import 5 | #import "JSObjectionProviderEntry.h" 6 | #import "JSObjectionInjector.h" 7 | 8 | @interface __JSClassProvider : NSObject { 9 | Class _class; 10 | } 11 | 12 | - (id)initWithClass:(Class)aClass; 13 | 14 | @end 15 | 16 | @implementation __JSClassProvider 17 | 18 | - (id)initWithClass:(Class)aClass { 19 | if ((self = [super init])) { 20 | _class = aClass; 21 | } 22 | return self; 23 | } 24 | 25 | - (id)provide:(JSObjectionInjector *)context arguments:(NSArray *)arguments { 26 | return [context getObject:_class argumentList:arguments]; 27 | } 28 | 29 | @end 30 | 31 | 32 | @interface JSObjectionModule() { 33 | NSMutableDictionary *_bindings; 34 | NSMutableSet *_eagerSingletons; 35 | } 36 | 37 | - (NSString *)classKey:(Class)class withName:(NSString*)name; 38 | - (NSString *)protocolKey:(Protocol *)aProtocol withName:(NSString*)name; 39 | - (void)ensureInstance:(id)instance conformsTo:(Protocol *)aProtocol; 40 | 41 | @end 42 | 43 | 44 | @implementation JSObjectionModule 45 | 46 | @synthesize bindings = _bindings; 47 | @synthesize eagerSingletons = _eagerSingletons; 48 | 49 | - (id)init { 50 | if ((self = [super init])) { 51 | _bindings = [[NSMutableDictionary alloc] init]; 52 | _eagerSingletons = [[NSMutableSet alloc] init]; 53 | } 54 | return self; 55 | } 56 | 57 | - (void)bindMetaClass:(Class)metaClass toProtocol:(Protocol *)aProtocol { 58 | if (!class_isMetaClass(object_getClass(metaClass))) { 59 | @throw [NSException exceptionWithName:@"JSObjectionException" 60 | reason:[NSString stringWithFormat:@"\"%@\" can not be bound to the protocol \"%@\" because it is not a meta class", metaClass, NSStringFromProtocol(aProtocol)] 61 | userInfo:nil]; 62 | } 63 | NSString *key = [self protocolKey:aProtocol withName:nil]; 64 | JSObjectionBindingEntry *entry = [[JSObjectionBindingEntry alloc] initWithObject:metaClass]; 65 | [_bindings setObject:entry forKey:key]; 66 | } 67 | 68 | - (void) bind:(id)instance toProtocol:(Protocol *)aProtocol { 69 | [self bind:instance toProtocol:aProtocol named:nil]; 70 | } 71 | 72 | - (void)bind:(id)instance toProtocol:(Protocol *)aProtocol named:(NSString *)name { 73 | [self ensureInstance: instance conformsTo: aProtocol]; 74 | NSString *key = [self protocolKey:aProtocol withName:name]; 75 | JSObjectionBindingEntry *entry = [[JSObjectionBindingEntry alloc] initWithObject:instance]; 76 | [_bindings setObject:entry forKey:key]; 77 | } 78 | 79 | - (void) bind:(id)instance toClass:(Class)aClass { 80 | [self bind:instance toClass:aClass named:nil]; 81 | } 82 | 83 | - (void)bind:(id)instance toClass:(Class)aClass named:(NSString *)name { 84 | NSString *key = [self classKey:aClass withName:name]; 85 | JSObjectionBindingEntry *entry = [[JSObjectionBindingEntry alloc] initWithObject:instance]; 86 | [_bindings setObject:entry forKey:key]; 87 | } 88 | 89 | - (void)bindProvider:(id)provider toClass:(Class)aClass { 90 | [self bindProvider:provider toClass:aClass named:nil]; 91 | } 92 | 93 | - (void)bindProvider:(id )provider toClass:(Class)aClass named:(NSString *)name { 94 | [self bindProvider:provider toClass:aClass inScope:JSObjectionScopeNormal named:name]; 95 | } 96 | 97 | - (void)bindProvider:(id)provider toProtocol:(Protocol *)aProtocol { 98 | [self bindProvider:provider toProtocol:aProtocol named:nil]; 99 | } 100 | 101 | - (void)bindProvider:(id )provider toProtocol:(Protocol *)aProtocol named:(NSString *)name { 102 | [self bindProvider:provider toProtocol:aProtocol inScope:JSObjectionScopeNormal named:name]; 103 | } 104 | 105 | - (void)bindProvider:(id )provider toClass:(Class)aClass inScope:(JSObjectionScope)scope { 106 | [self bindProvider:provider toClass:aClass inScope:scope named:nil]; 107 | } 108 | 109 | - (void)bindProvider:(id )provider toClass:(Class)aClass inScope:(JSObjectionScope)scope 110 | named:(NSString *)name { 111 | NSString *key = [self classKey:aClass withName:name]; 112 | JSObjectionProviderEntry *entry = [[JSObjectionProviderEntry alloc] initWithProvider:provider lifeCycle:scope]; 113 | [_bindings setObject:entry forKey:key]; 114 | } 115 | 116 | - (void)bindProvider:(id )provider toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope { 117 | [self bindProvider:provider toProtocol:aProtocol inScope:scope named:nil]; 118 | } 119 | 120 | - (void)bindProvider:(id )provider toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope 121 | named:(NSString *)name { 122 | NSString *key = [self protocolKey:aProtocol withName:name]; 123 | JSObjectionProviderEntry *entry = [[JSObjectionProviderEntry alloc] initWithProvider:provider lifeCycle:scope]; 124 | [_bindings setObject:entry forKey:key]; 125 | } 126 | 127 | - (void)bindClass:(Class)aClass toProtocol:(Protocol *)aProtocol { 128 | [self bindClass:aClass toProtocol:aProtocol named:nil]; 129 | } 130 | 131 | - (void)bindClass:(Class)aClass toProtocol:(Protocol *)aProtocol named:(NSString*)name { 132 | [self bindClass:aClass toProtocol:aProtocol inScope:JSObjectionScopeNormal named:name]; 133 | } 134 | 135 | - (void)bindClass:(Class)aClass toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope named:(NSString*)name{ 136 | __JSClassProvider *provider = [[__JSClassProvider alloc] initWithClass:aClass]; 137 | [self bindProvider:provider toProtocol:aProtocol inScope:scope named:name]; 138 | } 139 | 140 | - (void)bindClass:(Class)aClass toClass:(Class)toClass { 141 | [self bindClass:aClass toClass:toClass named:nil]; 142 | } 143 | 144 | - (void)bindClass:(Class)aClass toClass:(Class)toClass named:(NSString*)name { 145 | [self bindClass:aClass toClass:toClass inScope:JSObjectionScopeNormal named:name]; 146 | } 147 | 148 | - (void)bindClass:(Class)aClass toClass:(Class)toClass inScope:(JSObjectionScope)scope named:(NSString*)name { 149 | __JSClassProvider *provider = [[__JSClassProvider alloc] initWithClass:aClass]; 150 | [self bindProvider:provider toClass:toClass inScope:scope named:name]; 151 | } 152 | 153 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toClass:(Class)aClass { 154 | [self bindBlock:block toClass:aClass named:nil]; 155 | } 156 | 157 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toClass:(Class)aClass named:(NSString *)name { 158 | [self bindBlock:block toClass:aClass inScope:JSObjectionScopeNormal named:name]; 159 | } 160 | 161 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toProtocol:(Protocol *)aProtocol { 162 | [self bindBlock:block toProtocol:aProtocol named:nil]; 163 | } 164 | 165 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toProtocol:(Protocol *)aProtocol named:(NSString *)name { 166 | [self bindBlock:block toProtocol:aProtocol inScope:JSObjectionScopeNormal named:name]; 167 | } 168 | 169 | - (void)bindBlock:(id (^)(JSObjectionInjector *))block toClass:(Class)aClass inScope:(JSObjectionScope)scope { 170 | [self bindBlock:block toClass:aClass inScope:scope named:nil]; 171 | } 172 | 173 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toClass:(Class)aClass inScope:(JSObjectionScope)scope 174 | named:(NSString *)name { 175 | NSString *key = [self classKey:aClass withName:name]; 176 | JSObjectionProviderEntry *entry = [[JSObjectionProviderEntry alloc] initWithBlock:block lifeCycle:scope]; 177 | [_bindings setObject:entry forKey:key]; 178 | } 179 | 180 | - (void)bindBlock:(id (^)(JSObjectionInjector *))block toProtocol:(Protocol *)aProtocol inScope:(JSObjectionScope)scope { 181 | [self bindBlock:block toProtocol:aProtocol inScope:scope named:nil]; 182 | } 183 | 184 | - (void)bindBlock:(id (^)(JSObjectionInjector *context))block toProtocol:(Protocol *)aProtocol 185 | inScope:(JSObjectionScope)scope named:(NSString *)name { 186 | NSString *key = [self protocolKey:aProtocol withName:name]; 187 | JSObjectionProviderEntry *entry = [[JSObjectionProviderEntry alloc] initWithBlock:block lifeCycle: scope]; 188 | [_bindings setObject:entry forKey:key]; 189 | } 190 | 191 | - (void)bindClass:(Class)aClass inScope:(JSObjectionScope)scope { 192 | [_bindings setObject:[JSObjectionInjectorEntry entryWithClass:aClass scope:scope] forKey:[self classKey:aClass withName:nil]]; 193 | } 194 | 195 | - (void) registerEagerSingleton:(Class)aClass { 196 | [_eagerSingletons addObject:[self classKey:aClass withName:nil]]; 197 | } 198 | 199 | - (BOOL)hasBindingForClass:(Class)aClass { 200 | return [self hasBindingForClass:aClass withName:nil]; 201 | } 202 | 203 | - (BOOL)hasBindingForClass:(Class)aClass withName:(NSString*)name { 204 | return [_bindings objectForKey:[self classKey:aClass withName:name]] != nil; 205 | } 206 | 207 | - (BOOL)hasBindingForProtocol:(Protocol *)protocol { 208 | return [self hasBindingForProtocol:protocol withName:nil]; 209 | } 210 | 211 | - (BOOL)hasBindingForProtocol:(Protocol *)protocol withName:(NSString*)name { 212 | return [_bindings objectForKey:[self protocolKey:protocol withName:name]] != nil; 213 | } 214 | 215 | - (void) configure { 216 | } 217 | 218 | 219 | #pragma mark - Private 220 | 221 | - (void)ensureInstance:(id)instance conformsTo:(Protocol *)aProtocol { 222 | if (![instance conformsToProtocol:aProtocol]) { 223 | @throw [NSException exceptionWithName:@"JSObjectionException" 224 | reason:[NSString stringWithFormat:@"Instance does not conform to the %@ protocol", NSStringFromProtocol(aProtocol)] 225 | userInfo:nil]; 226 | } 227 | } 228 | 229 | - (NSString *)classKey:(Class) aClass withName:(NSString*)name { 230 | return [NSString stringWithFormat:@"%@%@%@", NSStringFromClass(aClass), name ? @":" : @"", name ? name : @""]; 231 | } 232 | 233 | - (NSString *)protocolKey:(Protocol *)aProtocol withName:(NSString*)name{ 234 | return [NSString stringWithFormat:@"<%@>%@%@", NSStringFromProtocol(aProtocol), name ? @":" : @"", name ? name : @""]; 235 | } 236 | 237 | @end 238 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionProviderEntry.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionEntry.h" 3 | #import "JSObjectionModule.h" 4 | 5 | @class JSObjectionInjector; 6 | 7 | @interface JSObjectionProviderEntry : JSObjectionEntry 8 | 9 | - (id)initWithProvider:(id)theProvider lifeCycle:(JSObjectionScope)theLifeCycle; 10 | - (id)initWithBlock:(id(^)(JSObjectionInjector *context))theBlock lifeCycle:(JSObjectionScope)theLifeCycle; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionProviderEntry.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectionProviderEntry.h" 2 | 3 | @interface JSObjectionProviderEntry () { 4 | id _provider; 5 | id(^_block)(JSObjectionInjector *context); 6 | JSObjectionScope _lifeCycle; 7 | id _storageCache; 8 | } 9 | 10 | @end 11 | 12 | @implementation JSObjectionProviderEntry 13 | @synthesize lifeCycle = _lifeCycle; 14 | 15 | - (id)initWithProvider:(id)theProvider lifeCycle:(JSObjectionScope)theLifeCycle { 16 | if ((self = [super init])) { 17 | _provider = theProvider; 18 | _lifeCycle = theLifeCycle; 19 | _storageCache = nil; 20 | } 21 | 22 | return self; 23 | } 24 | 25 | - (id)initWithBlock:(id(^)(JSObjectionInjector *context))theBlock lifeCycle:(JSObjectionScope)theLifeCycle { 26 | if ((self = [super init])) { 27 | _block = [theBlock copy]; 28 | _lifeCycle = theLifeCycle; 29 | _storageCache = nil; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (id)extractObject:(NSArray *)arguments { 36 | if (self.lifeCycle == JSObjectionScopeNormal || !_storageCache) { 37 | return [self buildObject:arguments]; 38 | } 39 | 40 | return _storageCache; 41 | } 42 | 43 | - (void)dealloc { 44 | _storageCache = nil; 45 | } 46 | 47 | - (id)buildObject:(NSArray *)arguments { 48 | id objectUnderConstruction = nil; 49 | if (_block) { 50 | objectUnderConstruction = _block(self.injector); 51 | } 52 | else { 53 | objectUnderConstruction = [_provider provide:self.injector arguments:arguments]; 54 | } 55 | if (self.lifeCycle == JSObjectionScopeSingleton) { 56 | _storageCache = objectUnderConstruction; 57 | } 58 | return objectUnderConstruction; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionRuntimePropertyReflector.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionUtils.h" 3 | 4 | @interface JSObjectionRuntimePropertyReflector : NSObject 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionRuntimePropertyReflector.m: -------------------------------------------------------------------------------- 1 | #import "JSObjectionRuntimePropertyReflector.h" 2 | 3 | @implementation JSObjectionRuntimePropertyReflector 4 | 5 | - (JSObjectionPropertyInfo)propertyForClass:(Class)theClass andProperty:(NSString *)propertyName { 6 | objc_property_t property = JSObjectionUtils.propertyForClass(theClass, propertyName); 7 | return JSObjectionUtils.findClassOrProtocolForProperty(property); 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionUtils.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | extern NSString *const JSObjectionInitializerKey; 5 | extern NSString *const JSObjectionDefaultArgumentsKey; 6 | 7 | typedef enum { 8 | JSObjectionTypeClass, 9 | JSObjectionTypeProtocol 10 | } JSObjectionType; 11 | 12 | 13 | typedef struct JSObjectionPropertyInfo { 14 | __unsafe_unretained id value; 15 | JSObjectionType type; 16 | } JSObjectionPropertyInfo; 17 | 18 | 19 | @protocol JSObjectionPropertyReflector 20 | 21 | - (JSObjectionPropertyInfo)propertyForClass:(Class)theClass andProperty:(NSString *)propertyName; 22 | 23 | @end 24 | 25 | 26 | @class JSObjectionInjector; 27 | 28 | extern const struct JSObjectionUtils { 29 | JSObjectionPropertyInfo (*findClassOrProtocolForProperty)(objc_property_t property); 30 | objc_property_t (*propertyForClass)(Class klass, NSString *propertyName); 31 | NSSet* (*buildDependenciesForClass)(Class klass, NSSet *requirements); 32 | NSDictionary* (*buildNamedDependenciesForClass)(Class klass, NSDictionary *namedRequirements); 33 | NSDictionary* (*buildInitializer)(SEL selector, NSArray *arguments); 34 | NSArray* (*transformVariadicArgsToArray)(va_list va_arguments); 35 | id (*buildObjectWithInitializer)(Class klass, SEL initializer, NSArray *arguments); 36 | void (*injectDependenciesIntoProperties)(JSObjectionInjector *injector, Class klass, id object); 37 | } JSObjectionUtils; 38 | -------------------------------------------------------------------------------- /Pods/Objection/Source/JSObjectionUtils.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "JSObjectionUtils.h" 3 | #import "JSObjectionInjector.h" 4 | #import "JSObjection.h" 5 | #import "NSObject+Objection.h" 6 | 7 | static NSString *const JSObjectionException = @"JSObjectionException"; 8 | 9 | NSString *const JSObjectionInitializerKey = @"initializer"; 10 | NSString *const JSObjectionDefaultArgumentsKey = @"arguments"; 11 | 12 | static JSObjectionPropertyInfo FindClassOrProtocolForProperty(objc_property_t property) { 13 | NSString *attributes = [NSString stringWithCString: property_getAttributes(property) encoding: NSASCIIStringEncoding]; 14 | NSString *propertyName = [NSString stringWithCString:property_getName(property) encoding:NSASCIIStringEncoding]; 15 | 16 | NSRange startRange = [attributes rangeOfString:@"T@\""]; 17 | if (startRange.location == NSNotFound) { 18 | @throw [NSException exceptionWithName:JSObjectionException reason:[NSString stringWithFormat:@"Unable to determine class type for property declaration: '%@'", propertyName] userInfo:nil]; 19 | } 20 | 21 | NSString *startOfClassName = [attributes substringFromIndex:startRange.length]; 22 | NSRange endRange = [startOfClassName rangeOfString:@"\""]; 23 | 24 | if (endRange.location == NSNotFound) { 25 | @throw [NSException exceptionWithName:JSObjectionException reason:[NSString stringWithFormat:@"Unable to determine class type for property declaration: '%@'", propertyName] userInfo:nil]; 26 | } 27 | 28 | NSString *classOrProtocolName = [startOfClassName substringToIndex:endRange.location]; 29 | id classOrProtocol = nil; 30 | JSObjectionPropertyInfo propertyInfo; 31 | 32 | if ([classOrProtocolName hasPrefix:@"<"] && [classOrProtocolName hasSuffix:@">"]) { 33 | classOrProtocolName = [classOrProtocolName stringByReplacingOccurrencesOfString:@"<" withString:@""]; 34 | classOrProtocolName = [classOrProtocolName stringByReplacingOccurrencesOfString:@">" withString:@""]; 35 | classOrProtocol = objc_getProtocol([classOrProtocolName UTF8String]); 36 | propertyInfo.type = JSObjectionTypeProtocol; 37 | } else { 38 | classOrProtocol = NSClassFromString(classOrProtocolName); 39 | propertyInfo.type = JSObjectionTypeClass; 40 | } 41 | 42 | if(!classOrProtocol) { 43 | @throw [NSException exceptionWithName:JSObjectionException reason:[NSString stringWithFormat:@"Unable get class for name '%@' for property '%@'", classOrProtocolName, propertyName] userInfo:nil]; 44 | } 45 | propertyInfo.value = classOrProtocol; 46 | 47 | return propertyInfo; 48 | } 49 | 50 | static NSSet* BuildDependenciesForClass(Class klass, NSSet *requirements) { 51 | Class superClass = class_getSuperclass([klass class]); 52 | if([superClass respondsToSelector:@selector(objectionRequires)]) { 53 | NSSet *parentsRequirements = [superClass performSelector:@selector(objectionRequires)]; 54 | NSMutableSet *dependencies = [NSMutableSet setWithSet:parentsRequirements]; 55 | [dependencies unionSet:requirements]; 56 | requirements = dependencies; 57 | } 58 | return requirements; 59 | } 60 | 61 | static NSDictionary* BuildNamedDependenciesForClass(Class klass, NSDictionary *namedRequirements) { 62 | Class superClass = class_getSuperclass([klass class]); 63 | if([superClass respondsToSelector:@selector(objectionRequiresNames)]) { 64 | NSDictionary *parentsNamedRequirements = [superClass performSelector:@selector(objectionRequiresNames)]; 65 | NSMutableDictionary *namedDependencies = [NSMutableDictionary dictionaryWithDictionary:parentsNamedRequirements]; 66 | [namedDependencies addEntriesFromDictionary:namedRequirements]; 67 | namedRequirements = namedDependencies; 68 | } 69 | return namedRequirements; 70 | } 71 | 72 | static NSDictionary* BuildInitializer(SEL selector, NSArray *defaultArguments) { 73 | return [NSDictionary dictionaryWithObjectsAndKeys: 74 | NSStringFromSelector(selector), JSObjectionInitializerKey, 75 | defaultArguments, JSObjectionDefaultArgumentsKey 76 | , nil]; 77 | } 78 | 79 | static NSArray* TransformVariadicArgsToArray(va_list va_arguments) { 80 | NSMutableArray *arguments = [NSMutableArray array]; 81 | 82 | id object; 83 | while ((object = va_arg( va_arguments, id ))) { 84 | [arguments addObject:object]; 85 | } 86 | 87 | return [arguments copy]; 88 | } 89 | 90 | static objc_property_t GetProperty(Class klass, NSString *propertyName) { 91 | objc_property_t property = class_getProperty(klass, (const char *)[propertyName UTF8String]); 92 | if (property == NULL) { 93 | @throw [NSException exceptionWithName:JSObjectionException reason:[NSString stringWithFormat:@"Unable to find property declaration: '%@' for class '%@'", propertyName, NSStringFromClass(klass)] userInfo:nil]; 94 | } 95 | return property; 96 | } 97 | 98 | 99 | static id BuildObjectWithInitializer(Class klass, SEL initializer, NSArray *arguments) { 100 | NSMethodSignature *signature = [klass methodSignatureForSelector:initializer]; 101 | __autoreleasing id instance = nil; 102 | BOOL isClassMethod = signature != nil && initializer != @selector(init); 103 | 104 | if (!isClassMethod) { 105 | instance = [klass alloc]; 106 | signature = [klass instanceMethodSignatureForSelector:initializer]; 107 | } 108 | 109 | if (signature) { 110 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 111 | [invocation setTarget:isClassMethod ? klass : instance]; 112 | [invocation setSelector:initializer]; 113 | for (int i = 0; i < arguments.count; i++) { 114 | __unsafe_unretained id argument = [arguments objectAtIndex:i]; 115 | [invocation setArgument:&argument atIndex:i + 2]; 116 | } 117 | [invocation invoke]; 118 | [invocation getReturnValue:&instance]; 119 | return instance; 120 | } else { 121 | @throw [NSException exceptionWithName:JSObjectionException reason:[NSString stringWithFormat:@"Could not find initializer '%@' on %@", NSStringFromSelector(initializer), NSStringFromClass(klass)] userInfo:nil]; 122 | } 123 | return nil; 124 | } 125 | 126 | static void _getPropertyInfo(Class klass, NSString *propertyName, JSObjectionPropertyInfo *propertyInfo, id *desiredClassOrProtocol) { 127 | (*propertyInfo) = [JSObjection propertyForClass:klass andProperty:propertyName]; 128 | (*desiredClassOrProtocol) = propertyInfo->value; 129 | // Ensure that the class is initialized before attempting to retrieve it. 130 | // Using +load would force all registered classes to be initialized so we are 131 | // lazily initializing them. 132 | if ((*propertyInfo).type == JSObjectionTypeClass) { 133 | [*desiredClassOrProtocol class]; 134 | } 135 | } 136 | 137 | static void _validateObjectReturnedFromInjector(id *theObject, JSObjectionPropertyInfo propertyInfo, id desiredClassOrProtocol, NSString *propertyName) { 138 | if(*theObject == nil && propertyInfo.type == JSObjectionTypeProtocol) { 139 | @throw [NSException exceptionWithName:@"JSObjectionException" 140 | reason:[NSString stringWithFormat:@"Cannot find an instance that is bound to the protocol '%@' to assign to the property '%@'", NSStringFromProtocol(desiredClassOrProtocol), propertyName] 141 | userInfo:nil]; 142 | } else if (*theObject == nil) { 143 | *theObject = [NSNull null]; 144 | } 145 | } 146 | 147 | static void InjectDependenciesIntoProperties(JSObjectionInjector *injector, Class klass, id object) { 148 | if ([klass respondsToSelector:@selector(objectionRequires)]) { 149 | NSSet *properties = [klass performSelector:@selector(objectionRequires)]; 150 | NSMutableDictionary *propertiesDictionary = [NSMutableDictionary dictionaryWithCapacity:properties.count]; 151 | for (NSString *propertyName in properties) { 152 | JSObjectionPropertyInfo propertyInfo; 153 | id desiredClassOrProtocol; 154 | _getPropertyInfo(klass, propertyName, &propertyInfo, &desiredClassOrProtocol); 155 | id theObject = [injector getObject:desiredClassOrProtocol]; 156 | _validateObjectReturnedFromInjector(&theObject, propertyInfo, desiredClassOrProtocol, propertyName); 157 | [propertiesDictionary setObject:theObject forKey:propertyName]; 158 | } 159 | 160 | [object setValuesForKeysWithDictionary:propertiesDictionary]; 161 | } 162 | 163 | if ([klass respondsToSelector:@selector(objectionRequiresNames)]) { 164 | NSDictionary *namedProperties = [klass performSelector:@selector(objectionRequiresNames)]; 165 | NSMutableDictionary *propertiesDictionary = [NSMutableDictionary dictionaryWithCapacity:namedProperties.count]; 166 | for (NSString *namedPropertyKey in [namedProperties allKeys]) { 167 | NSString* propertyName = [namedProperties valueForKey:namedPropertyKey]; 168 | JSObjectionPropertyInfo propertyInfo; 169 | id desiredClassOrProtocol; 170 | _getPropertyInfo(klass, propertyName, &propertyInfo, &desiredClassOrProtocol); 171 | id theObject = [injector getObject:desiredClassOrProtocol named:namedPropertyKey]; 172 | _validateObjectReturnedFromInjector(&theObject, propertyInfo, desiredClassOrProtocol, propertyName); 173 | [propertiesDictionary setObject:theObject forKey:propertyName]; 174 | } 175 | 176 | [object setValuesForKeysWithDictionary:propertiesDictionary]; 177 | } 178 | 179 | if ([object respondsToSelector:@selector(awakeFromObjection)]) { 180 | [object performSelector:@selector(awakeFromObjection)]; 181 | } 182 | } 183 | 184 | const struct JSObjectionUtils JSObjectionUtils = { 185 | .findClassOrProtocolForProperty = FindClassOrProtocolForProperty, 186 | .propertyForClass = GetProperty, 187 | .buildDependenciesForClass = BuildDependenciesForClass, 188 | .buildNamedDependenciesForClass = BuildNamedDependenciesForClass, 189 | .buildInitializer = BuildInitializer, 190 | .transformVariadicArgsToArray = TransformVariadicArgsToArray, 191 | .buildObjectWithInitializer = BuildObjectWithInitializer, 192 | .injectDependenciesIntoProperties = InjectDependenciesIntoProperties 193 | }; 194 | -------------------------------------------------------------------------------- /Pods/Objection/Source/NSObject+Objection.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSObject(JSObjection) 4 | 5 | - (void)awakeFromObjection; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /Pods/Objection/Source/NSObject+Objection.m: -------------------------------------------------------------------------------- 1 | #import "NSObject+Objection.h" 2 | 3 | 4 | @implementation NSObject(JSObjection) 5 | 6 | - (void)awakeFromObjection { 7 | 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Pods/Objection/Source/Objection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | #import "JSObjectionModule.h" 6 | #import "JSObjectionInjector.h" 7 | #import "JSObjectionEntry.h" 8 | #import "JSObjectionBindingEntry.h" 9 | #import "NSObject+Objection.h" 10 | #import "JSObjectionInjectorEntry.h" 11 | #import "JSObjectionUtils.h" 12 | #import "JSObjectFactory.h" 13 | #import "JSObjection.h" 14 | 15 | #define objection_register(value) \ 16 | + (void)initialize { \ 17 | if (self == [value class]) { \ 18 | [JSObjection registerClass:[value class] scope: JSObjectionScopeNormal]; \ 19 | } \ 20 | } 21 | 22 | #define objection_register_singleton(value) \ 23 | + (void)initialize { \ 24 | if (self == [value class]) { \ 25 | [JSObjection registerClass:[value class] scope: JSObjectionScopeSingleton]; \ 26 | } \ 27 | } 28 | 29 | #define objection_requires(args...) \ 30 | + (NSSet *)objectionRequires { \ 31 | NSSet *requirements = [NSSet setWithObjects: args, nil]; \ 32 | return JSObjectionUtils.buildDependenciesForClass(self, requirements); \ 33 | } 34 | 35 | #define objection_requires_sel(args...) \ 36 | + (NSSet *)objectionRequires { \ 37 | SEL selectors[] = {args}; \ 38 | NSMutableSet *requirements = [NSMutableSet set]; \ 39 | for (NSUInteger j = 0; j < sizeof(selectors)/ sizeof(SEL); j++) { \ 40 | SEL selector = selectors[j]; \ 41 | [requirements addObject:NSStringFromSelector(selector)]; \ 42 | } \ 43 | return JSObjectionUtils.buildDependenciesForClass(self, requirements); \ 44 | } 45 | 46 | #define objection_requires_names(namedDependencies) \ 47 | + (NSDictionary *)objectionRequiresNames { \ 48 | return JSObjectionUtils.buildNamedDependenciesForClass(self, namedDependencies); \ 49 | } 50 | 51 | #define objection_initializer_sel(selectorSymbol, args...) \ 52 | + (NSDictionary *)objectionInitializer { \ 53 | id objs[] = {args}; \ 54 | NSArray *defaultArguments = [NSArray arrayWithObjects: objs count:sizeof(objs)/sizeof(id)]; \ 55 | return JSObjectionUtils.buildInitializer(selectorSymbol, defaultArguments); \ 56 | } 57 | 58 | #define objection_initializer(selectorSymbol, args...) objection_initializer_sel(@selector(selectorSymbol), args) 59 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 05C2F0ABAE60004D875D0DEBFEC6AEFD /* Objection-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = DD097AB7551DCA40439B7D037C7825BE /* Objection-dummy.m */; }; 11 | 0B311E863BC97276F2AB82E2F7E71781 /* JSObjectionUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = E515ADADD4CEEA5BDA9E174E502F0721 /* JSObjectionUtils.m */; }; 12 | 238F0E6FC590CD21AF731F0D790B8DAB /* NSObject+Objection.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AE32FD8BBFA70134209561C3524CA2B /* NSObject+Objection.m */; }; 13 | 30B9730A9C289F8697C6C4BED3B725AF /* NSObject+Objection.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD31AC98FE4FC0CE04F617F5652905A /* NSObject+Objection.h */; }; 14 | 30F4E6B69CA50F620072E476FB49423B /* JSObjectionEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 849FE187504108756664D8D5E62FB2FE /* JSObjectionEntry.h */; }; 15 | 3FD67673795B1B90F9FDA025859DC4F6 /* JSObjectionInjectorEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = BE9955A250285EB34F4FABAEF7BA6E67 /* JSObjectionInjectorEntry.m */; }; 16 | 4695BAD073643DF77BB4F599FCCC7DEB /* JSObjection.h in Headers */ = {isa = PBXBuildFile; fileRef = A97275A5C7A9C28B4919781C696D6FC7 /* JSObjection.h */; }; 17 | 4AFBF2B036DD819832E3536EFD87C560 /* JSObjectionUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2B0AE87807892B87C005E79EFB3767 /* JSObjectionUtils.h */; }; 18 | 4C36A5F144AE4EBAAB75A74C61C311BA /* JSObjectionRuntimePropertyReflector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7977854993152905527E9BF46516E015 /* JSObjectionRuntimePropertyReflector.h */; }; 19 | 4EF5D2C4D935759E7197C965198E2B68 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E43A0FBBE3C3E676FC5CF63830D8E2D /* Foundation.framework */; }; 20 | 512CF12A7A3B57C18DC45B5F7D9184D8 /* JSObjectionEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 228C5DC627AA6084927EB47D43D22216 /* JSObjectionEntry.m */; }; 21 | 5EECACF24EEC2C9C42BA6D46FC48E11F /* JSObjectionInjector.m in Sources */ = {isa = PBXBuildFile; fileRef = FBAFCC3E4E7F0AEEBBACF4AEE2EFA2A2 /* JSObjectionInjector.m */; }; 22 | 6A9A16A81D95A399919AAB3919FD65A5 /* JSObjectionInjector.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F781C0395B863F913948AD7AA983954 /* JSObjectionInjector.h */; }; 23 | 6CE8A270544AD8ABDF4BF497B84DB54E /* JSObjectionModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C1B7CE9994229A68104E87DCE3E4BB9 /* JSObjectionModule.m */; }; 24 | 6FF84DFB589448A3F2AE89F5A7D84E6E /* Pods-ProtocolProgrammingDemo-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 09DC150AF3ACCFAD1D9F3202B08EE1DC /* Pods-ProtocolProgrammingDemo-dummy.m */; }; 25 | 7459BFFB3BD6F821B91BE280A4CB8315 /* JSObjectFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 42CB5DFD00282D409894ADA2D29D597A /* JSObjectFactory.m */; }; 26 | 82057FF7DFFB8E56837D06030AB864B7 /* JSObjectionModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD63A13A255373FE49C26883FA9969F /* JSObjectionModule.h */; }; 27 | 8E0B4CA257AC490FC3B50A58EFF1ECC7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E43A0FBBE3C3E676FC5CF63830D8E2D /* Foundation.framework */; }; 28 | 8ECFF7990D3C95ADC055D8792192BC58 /* JSObjectionBindingEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F0F3B9CD07D33879ADDEE4C3AD7B935 /* JSObjectionBindingEntry.m */; }; 29 | 91976E0747D24D53AF009868B40C2720 /* JSObjectionBindingEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2155BCFEA7E2FDA91B23CC230A4BAAFB /* JSObjectionBindingEntry.h */; }; 30 | 9468471B2C8F3E1E8DBC5BEA612E1FF2 /* JSObjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DCC617AC708A847645D85A5B1B6B0D /* JSObjection.m */; }; 31 | 96637504BF2511DC298466BABC91D171 /* JSObjectionRuntimePropertyReflector.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D73B4CF143693C35348801C7BC6D1A /* JSObjectionRuntimePropertyReflector.m */; }; 32 | A55D2E3D212A110C20CEA88767BF9EE3 /* Objection.h in Headers */ = {isa = PBXBuildFile; fileRef = BDBA0730DF548AFEC80B9D90C2D6BB6C /* Objection.h */; }; 33 | A5C853DD3146C664AC6E871CFC9EDA07 /* JSObjectionInjectorEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 09C98CD9D5729081B5D185D3812C6C2C /* JSObjectionInjectorEntry.h */; }; 34 | BAE6614BA418832333C8A5C137A861F4 /* JSObjectFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 82C70475C1B59B4B8346A417EC26950D /* JSObjectFactory.h */; }; 35 | BD410AD30088952759990AD0BE398554 /* JSObjectionProviderEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = B449A8DE01BEAF62AEC74D6DE86C27AB /* JSObjectionProviderEntry.h */; }; 36 | E7F3A91149544E57E7D55F8594F1CECE /* JSObjectionProviderEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = A38782EB8ADE91AFE74AD0EBF35F85A6 /* JSObjectionProviderEntry.m */; }; 37 | /* End PBXBuildFile section */ 38 | 39 | /* Begin PBXContainerItemProxy section */ 40 | 016B677175B86241791D837035E65244 /* PBXContainerItemProxy */ = { 41 | isa = PBXContainerItemProxy; 42 | containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 43 | proxyType = 1; 44 | remoteGlobalIDString = 4167039043E481C7275254582F8588E1; 45 | remoteInfo = Objection; 46 | }; 47 | /* End PBXContainerItemProxy section */ 48 | 49 | /* Begin PBXFileReference section */ 50 | 09C98CD9D5729081B5D185D3812C6C2C /* JSObjectionInjectorEntry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionInjectorEntry.h; path = Source/JSObjectionInjectorEntry.h; sourceTree = ""; }; 51 | 09DC150AF3ACCFAD1D9F3202B08EE1DC /* Pods-ProtocolProgrammingDemo-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-ProtocolProgrammingDemo-dummy.m"; sourceTree = ""; }; 52 | 0A7CCA748052F32E8A2B02696F36BF71 /* libObjection.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libObjection.a; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 0FD31AC98FE4FC0CE04F617F5652905A /* NSObject+Objection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSObject+Objection.h"; path = "Source/NSObject+Objection.h"; sourceTree = ""; }; 54 | 145027FC5D6C7E918A45ECCBBA711EAA /* Pods-ProtocolProgrammingDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-ProtocolProgrammingDemo.debug.xcconfig"; sourceTree = ""; }; 55 | 1A2B0AE87807892B87C005E79EFB3767 /* JSObjectionUtils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionUtils.h; path = Source/JSObjectionUtils.h; sourceTree = ""; }; 56 | 1AE32FD8BBFA70134209561C3524CA2B /* NSObject+Objection.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSObject+Objection.m"; path = "Source/NSObject+Objection.m"; sourceTree = ""; }; 57 | 2155BCFEA7E2FDA91B23CC230A4BAAFB /* JSObjectionBindingEntry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionBindingEntry.h; path = Source/JSObjectionBindingEntry.h; sourceTree = ""; }; 58 | 228C5DC627AA6084927EB47D43D22216 /* JSObjectionEntry.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionEntry.m; path = Source/JSObjectionEntry.m; sourceTree = ""; }; 59 | 2F781C0395B863F913948AD7AA983954 /* JSObjectionInjector.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionInjector.h; path = Source/JSObjectionInjector.h; sourceTree = ""; }; 60 | 33B91933DE06354B1A202F74C5D21167 /* Objection.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Objection.xcconfig; sourceTree = ""; }; 61 | 3F0F3B9CD07D33879ADDEE4C3AD7B935 /* JSObjectionBindingEntry.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionBindingEntry.m; path = Source/JSObjectionBindingEntry.m; sourceTree = ""; }; 62 | 42CB5DFD00282D409894ADA2D29D597A /* JSObjectFactory.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectFactory.m; path = Source/JSObjectFactory.m; sourceTree = ""; }; 63 | 71DCC617AC708A847645D85A5B1B6B0D /* JSObjection.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjection.m; path = Source/JSObjection.m; sourceTree = ""; }; 64 | 792F8C2CC88D2C05BA4F93F4010FACF3 /* Pods-ProtocolProgrammingDemo-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-ProtocolProgrammingDemo-resources.sh"; sourceTree = ""; }; 65 | 7977854993152905527E9BF46516E015 /* JSObjectionRuntimePropertyReflector.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionRuntimePropertyReflector.h; path = Source/JSObjectionRuntimePropertyReflector.h; sourceTree = ""; }; 66 | 82C70475C1B59B4B8346A417EC26950D /* JSObjectFactory.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectFactory.h; path = Source/JSObjectFactory.h; sourceTree = ""; }; 67 | 849FE187504108756664D8D5E62FB2FE /* JSObjectionEntry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionEntry.h; path = Source/JSObjectionEntry.h; sourceTree = ""; }; 68 | 8C1B7CE9994229A68104E87DCE3E4BB9 /* JSObjectionModule.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionModule.m; path = Source/JSObjectionModule.m; sourceTree = ""; }; 69 | 8FC0CF05D97135957C27C837334D2AFD /* Objection-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Objection-Private.xcconfig"; sourceTree = ""; }; 70 | 928435817EE98E4F45835E4B1200AFC3 /* Pods-ProtocolProgrammingDemo-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-ProtocolProgrammingDemo-acknowledgements.markdown"; sourceTree = ""; }; 71 | 9DD63A13A255373FE49C26883FA9969F /* JSObjectionModule.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionModule.h; path = Source/JSObjectionModule.h; sourceTree = ""; }; 72 | 9E43A0FBBE3C3E676FC5CF63830D8E2D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 73 | A38782EB8ADE91AFE74AD0EBF35F85A6 /* JSObjectionProviderEntry.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionProviderEntry.m; path = Source/JSObjectionProviderEntry.m; sourceTree = ""; }; 74 | A900D7C71F6FCAD710560FC6A5D87775 /* libPods-ProtocolProgrammingDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ProtocolProgrammingDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 75 | A97275A5C7A9C28B4919781C696D6FC7 /* JSObjection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjection.h; path = Source/JSObjection.h; sourceTree = ""; }; 76 | B0D73B4CF143693C35348801C7BC6D1A /* JSObjectionRuntimePropertyReflector.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionRuntimePropertyReflector.m; path = Source/JSObjectionRuntimePropertyReflector.m; sourceTree = ""; }; 77 | B449A8DE01BEAF62AEC74D6DE86C27AB /* JSObjectionProviderEntry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = JSObjectionProviderEntry.h; path = Source/JSObjectionProviderEntry.h; sourceTree = ""; }; 78 | BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 79 | BDBA0730DF548AFEC80B9D90C2D6BB6C /* Objection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Objection.h; path = Source/Objection.h; sourceTree = ""; }; 80 | BE9955A250285EB34F4FABAEF7BA6E67 /* JSObjectionInjectorEntry.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionInjectorEntry.m; path = Source/JSObjectionInjectorEntry.m; sourceTree = ""; }; 81 | C33E384BACE77CE4DF8B08E091C001A7 /* Objection-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Objection-prefix.pch"; sourceTree = ""; }; 82 | DD097AB7551DCA40439B7D037C7825BE /* Objection-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Objection-dummy.m"; sourceTree = ""; }; 83 | E3ECA6241F33A3D53FE70BA68C3005D3 /* Pods-ProtocolProgrammingDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-ProtocolProgrammingDemo.release.xcconfig"; sourceTree = ""; }; 84 | E515ADADD4CEEA5BDA9E174E502F0721 /* JSObjectionUtils.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionUtils.m; path = Source/JSObjectionUtils.m; sourceTree = ""; }; 85 | EBE4F42F490A94C7DFB35AFB1CE54982 /* Pods-ProtocolProgrammingDemo-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-ProtocolProgrammingDemo-acknowledgements.plist"; sourceTree = ""; }; 86 | FBAFCC3E4E7F0AEEBBACF4AEE2EFA2A2 /* JSObjectionInjector.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = JSObjectionInjector.m; path = Source/JSObjectionInjector.m; sourceTree = ""; }; 87 | /* End PBXFileReference section */ 88 | 89 | /* Begin PBXFrameworksBuildPhase section */ 90 | 499F5156943C6EB8E5623DD9A1344FC7 /* Frameworks */ = { 91 | isa = PBXFrameworksBuildPhase; 92 | buildActionMask = 2147483647; 93 | files = ( 94 | 8E0B4CA257AC490FC3B50A58EFF1ECC7 /* Foundation.framework in Frameworks */, 95 | ); 96 | runOnlyForDeploymentPostprocessing = 0; 97 | }; 98 | 61A6B27161E683469F16C03BDD8D58FB /* Frameworks */ = { 99 | isa = PBXFrameworksBuildPhase; 100 | buildActionMask = 2147483647; 101 | files = ( 102 | 4EF5D2C4D935759E7197C965198E2B68 /* Foundation.framework in Frameworks */, 103 | ); 104 | runOnlyForDeploymentPostprocessing = 0; 105 | }; 106 | /* End PBXFrameworksBuildPhase section */ 107 | 108 | /* Begin PBXGroup section */ 109 | 3A2C6AD9C5659C9E4F0AF415BF4912A8 /* Objection */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 82C70475C1B59B4B8346A417EC26950D /* JSObjectFactory.h */, 113 | 42CB5DFD00282D409894ADA2D29D597A /* JSObjectFactory.m */, 114 | A97275A5C7A9C28B4919781C696D6FC7 /* JSObjection.h */, 115 | 71DCC617AC708A847645D85A5B1B6B0D /* JSObjection.m */, 116 | 2155BCFEA7E2FDA91B23CC230A4BAAFB /* JSObjectionBindingEntry.h */, 117 | 3F0F3B9CD07D33879ADDEE4C3AD7B935 /* JSObjectionBindingEntry.m */, 118 | 849FE187504108756664D8D5E62FB2FE /* JSObjectionEntry.h */, 119 | 228C5DC627AA6084927EB47D43D22216 /* JSObjectionEntry.m */, 120 | 2F781C0395B863F913948AD7AA983954 /* JSObjectionInjector.h */, 121 | FBAFCC3E4E7F0AEEBBACF4AEE2EFA2A2 /* JSObjectionInjector.m */, 122 | 09C98CD9D5729081B5D185D3812C6C2C /* JSObjectionInjectorEntry.h */, 123 | BE9955A250285EB34F4FABAEF7BA6E67 /* JSObjectionInjectorEntry.m */, 124 | 9DD63A13A255373FE49C26883FA9969F /* JSObjectionModule.h */, 125 | 8C1B7CE9994229A68104E87DCE3E4BB9 /* JSObjectionModule.m */, 126 | B449A8DE01BEAF62AEC74D6DE86C27AB /* JSObjectionProviderEntry.h */, 127 | A38782EB8ADE91AFE74AD0EBF35F85A6 /* JSObjectionProviderEntry.m */, 128 | 7977854993152905527E9BF46516E015 /* JSObjectionRuntimePropertyReflector.h */, 129 | B0D73B4CF143693C35348801C7BC6D1A /* JSObjectionRuntimePropertyReflector.m */, 130 | 1A2B0AE87807892B87C005E79EFB3767 /* JSObjectionUtils.h */, 131 | E515ADADD4CEEA5BDA9E174E502F0721 /* JSObjectionUtils.m */, 132 | 0FD31AC98FE4FC0CE04F617F5652905A /* NSObject+Objection.h */, 133 | 1AE32FD8BBFA70134209561C3524CA2B /* NSObject+Objection.m */, 134 | BDBA0730DF548AFEC80B9D90C2D6BB6C /* Objection.h */, 135 | 97222455895127797D2E5FADBEA890D8 /* Support Files */, 136 | ); 137 | path = Objection; 138 | sourceTree = ""; 139 | }; 140 | 4E6EEE3EE4E7095B5B2B6AE7C01FCCB7 /* Pods */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 3A2C6AD9C5659C9E4F0AF415BF4912A8 /* Objection */, 144 | ); 145 | name = Pods; 146 | sourceTree = ""; 147 | }; 148 | 53F661C0CA7190D2CF05023FB33D61E4 /* iOS */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 9E43A0FBBE3C3E676FC5CF63830D8E2D /* Foundation.framework */, 152 | ); 153 | name = iOS; 154 | sourceTree = ""; 155 | }; 156 | 7DB346D0F39D3F0E887471402A8071AB = { 157 | isa = PBXGroup; 158 | children = ( 159 | BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */, 160 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, 161 | 4E6EEE3EE4E7095B5B2B6AE7C01FCCB7 /* Pods */, 162 | CCA510CFBEA2D207524CDA0D73C3B561 /* Products */, 163 | 89F33B1083C65B4AF8C5F488951FABB2 /* Targets Support Files */, 164 | ); 165 | sourceTree = ""; 166 | }; 167 | 89F33B1083C65B4AF8C5F488951FABB2 /* Targets Support Files */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | FAFCF83719AA76A023775D141770F45D /* Pods-ProtocolProgrammingDemo */, 171 | ); 172 | name = "Targets Support Files"; 173 | sourceTree = ""; 174 | }; 175 | 97222455895127797D2E5FADBEA890D8 /* Support Files */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 33B91933DE06354B1A202F74C5D21167 /* Objection.xcconfig */, 179 | 8FC0CF05D97135957C27C837334D2AFD /* Objection-Private.xcconfig */, 180 | DD097AB7551DCA40439B7D037C7825BE /* Objection-dummy.m */, 181 | C33E384BACE77CE4DF8B08E091C001A7 /* Objection-prefix.pch */, 182 | ); 183 | name = "Support Files"; 184 | path = "../Target Support Files/Objection"; 185 | sourceTree = ""; 186 | }; 187 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | 53F661C0CA7190D2CF05023FB33D61E4 /* iOS */, 191 | ); 192 | name = Frameworks; 193 | sourceTree = ""; 194 | }; 195 | CCA510CFBEA2D207524CDA0D73C3B561 /* Products */ = { 196 | isa = PBXGroup; 197 | children = ( 198 | 0A7CCA748052F32E8A2B02696F36BF71 /* libObjection.a */, 199 | A900D7C71F6FCAD710560FC6A5D87775 /* libPods-ProtocolProgrammingDemo.a */, 200 | ); 201 | name = Products; 202 | sourceTree = ""; 203 | }; 204 | FAFCF83719AA76A023775D141770F45D /* Pods-ProtocolProgrammingDemo */ = { 205 | isa = PBXGroup; 206 | children = ( 207 | 928435817EE98E4F45835E4B1200AFC3 /* Pods-ProtocolProgrammingDemo-acknowledgements.markdown */, 208 | EBE4F42F490A94C7DFB35AFB1CE54982 /* Pods-ProtocolProgrammingDemo-acknowledgements.plist */, 209 | 09DC150AF3ACCFAD1D9F3202B08EE1DC /* Pods-ProtocolProgrammingDemo-dummy.m */, 210 | 792F8C2CC88D2C05BA4F93F4010FACF3 /* Pods-ProtocolProgrammingDemo-resources.sh */, 211 | 145027FC5D6C7E918A45ECCBBA711EAA /* Pods-ProtocolProgrammingDemo.debug.xcconfig */, 212 | E3ECA6241F33A3D53FE70BA68C3005D3 /* Pods-ProtocolProgrammingDemo.release.xcconfig */, 213 | ); 214 | name = "Pods-ProtocolProgrammingDemo"; 215 | path = "Target Support Files/Pods-ProtocolProgrammingDemo"; 216 | sourceTree = ""; 217 | }; 218 | /* End PBXGroup section */ 219 | 220 | /* Begin PBXHeadersBuildPhase section */ 221 | 8AB4B72C1E817DC9DB7F7D8CC8854D18 /* Headers */ = { 222 | isa = PBXHeadersBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | BAE6614BA418832333C8A5C137A861F4 /* JSObjectFactory.h in Headers */, 226 | 4695BAD073643DF77BB4F599FCCC7DEB /* JSObjection.h in Headers */, 227 | 91976E0747D24D53AF009868B40C2720 /* JSObjectionBindingEntry.h in Headers */, 228 | 30F4E6B69CA50F620072E476FB49423B /* JSObjectionEntry.h in Headers */, 229 | 6A9A16A81D95A399919AAB3919FD65A5 /* JSObjectionInjector.h in Headers */, 230 | A5C853DD3146C664AC6E871CFC9EDA07 /* JSObjectionInjectorEntry.h in Headers */, 231 | 82057FF7DFFB8E56837D06030AB864B7 /* JSObjectionModule.h in Headers */, 232 | BD410AD30088952759990AD0BE398554 /* JSObjectionProviderEntry.h in Headers */, 233 | 4C36A5F144AE4EBAAB75A74C61C311BA /* JSObjectionRuntimePropertyReflector.h in Headers */, 234 | 4AFBF2B036DD819832E3536EFD87C560 /* JSObjectionUtils.h in Headers */, 235 | 30B9730A9C289F8697C6C4BED3B725AF /* NSObject+Objection.h in Headers */, 236 | A55D2E3D212A110C20CEA88767BF9EE3 /* Objection.h in Headers */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | /* End PBXHeadersBuildPhase section */ 241 | 242 | /* Begin PBXNativeTarget section */ 243 | 4167039043E481C7275254582F8588E1 /* Objection */ = { 244 | isa = PBXNativeTarget; 245 | buildConfigurationList = DD46AB08C8A4D991EF07D0326A57CCF8 /* Build configuration list for PBXNativeTarget "Objection" */; 246 | buildPhases = ( 247 | C8877AEEF355465FB6CEE80C43BBB07A /* Sources */, 248 | 61A6B27161E683469F16C03BDD8D58FB /* Frameworks */, 249 | 8AB4B72C1E817DC9DB7F7D8CC8854D18 /* Headers */, 250 | ); 251 | buildRules = ( 252 | ); 253 | dependencies = ( 254 | ); 255 | name = Objection; 256 | productName = Objection; 257 | productReference = 0A7CCA748052F32E8A2B02696F36BF71 /* libObjection.a */; 258 | productType = "com.apple.product-type.library.static"; 259 | }; 260 | 7E544D04958735E2765C51181F67B7AC /* Pods-ProtocolProgrammingDemo */ = { 261 | isa = PBXNativeTarget; 262 | buildConfigurationList = 179B3AB779485A2D081817CB6F7A7E29 /* Build configuration list for PBXNativeTarget "Pods-ProtocolProgrammingDemo" */; 263 | buildPhases = ( 264 | BDABC5AC106AE9F316CDF3AD8DD8A044 /* Sources */, 265 | 499F5156943C6EB8E5623DD9A1344FC7 /* Frameworks */, 266 | ); 267 | buildRules = ( 268 | ); 269 | dependencies = ( 270 | A94601E064F4DE3EC40ADA9460698284 /* PBXTargetDependency */, 271 | ); 272 | name = "Pods-ProtocolProgrammingDemo"; 273 | productName = "Pods-ProtocolProgrammingDemo"; 274 | productReference = A900D7C71F6FCAD710560FC6A5D87775 /* libPods-ProtocolProgrammingDemo.a */; 275 | productType = "com.apple.product-type.library.static"; 276 | }; 277 | /* End PBXNativeTarget section */ 278 | 279 | /* Begin PBXProject section */ 280 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 281 | isa = PBXProject; 282 | attributes = { 283 | LastSwiftUpdateCheck = 0700; 284 | LastUpgradeCheck = 0700; 285 | }; 286 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 287 | compatibilityVersion = "Xcode 3.2"; 288 | developmentRegion = English; 289 | hasScannedForEncodings = 0; 290 | knownRegions = ( 291 | en, 292 | ); 293 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 294 | productRefGroup = CCA510CFBEA2D207524CDA0D73C3B561 /* Products */; 295 | projectDirPath = ""; 296 | projectRoot = ""; 297 | targets = ( 298 | 4167039043E481C7275254582F8588E1 /* Objection */, 299 | 7E544D04958735E2765C51181F67B7AC /* Pods-ProtocolProgrammingDemo */, 300 | ); 301 | }; 302 | /* End PBXProject section */ 303 | 304 | /* Begin PBXSourcesBuildPhase section */ 305 | BDABC5AC106AE9F316CDF3AD8DD8A044 /* Sources */ = { 306 | isa = PBXSourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | 6FF84DFB589448A3F2AE89F5A7D84E6E /* Pods-ProtocolProgrammingDemo-dummy.m in Sources */, 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | }; 313 | C8877AEEF355465FB6CEE80C43BBB07A /* Sources */ = { 314 | isa = PBXSourcesBuildPhase; 315 | buildActionMask = 2147483647; 316 | files = ( 317 | 7459BFFB3BD6F821B91BE280A4CB8315 /* JSObjectFactory.m in Sources */, 318 | 9468471B2C8F3E1E8DBC5BEA612E1FF2 /* JSObjection.m in Sources */, 319 | 8ECFF7990D3C95ADC055D8792192BC58 /* JSObjectionBindingEntry.m in Sources */, 320 | 512CF12A7A3B57C18DC45B5F7D9184D8 /* JSObjectionEntry.m in Sources */, 321 | 5EECACF24EEC2C9C42BA6D46FC48E11F /* JSObjectionInjector.m in Sources */, 322 | 3FD67673795B1B90F9FDA025859DC4F6 /* JSObjectionInjectorEntry.m in Sources */, 323 | 6CE8A270544AD8ABDF4BF497B84DB54E /* JSObjectionModule.m in Sources */, 324 | E7F3A91149544E57E7D55F8594F1CECE /* JSObjectionProviderEntry.m in Sources */, 325 | 96637504BF2511DC298466BABC91D171 /* JSObjectionRuntimePropertyReflector.m in Sources */, 326 | 0B311E863BC97276F2AB82E2F7E71781 /* JSObjectionUtils.m in Sources */, 327 | 238F0E6FC590CD21AF731F0D790B8DAB /* NSObject+Objection.m in Sources */, 328 | 05C2F0ABAE60004D875D0DEBFEC6AEFD /* Objection-dummy.m in Sources */, 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | }; 332 | /* End PBXSourcesBuildPhase section */ 333 | 334 | /* Begin PBXTargetDependency section */ 335 | A94601E064F4DE3EC40ADA9460698284 /* PBXTargetDependency */ = { 336 | isa = PBXTargetDependency; 337 | name = Objection; 338 | target = 4167039043E481C7275254582F8588E1 /* Objection */; 339 | targetProxy = 016B677175B86241791D837035E65244 /* PBXContainerItemProxy */; 340 | }; 341 | /* End PBXTargetDependency section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | 1F74DDA8E8D6E0FC8AC402EA3B7FE122 /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | baseConfigurationReference = 145027FC5D6C7E918A45ECCBBA711EAA /* Pods-ProtocolProgrammingDemo.debug.xcconfig */; 347 | buildSettings = { 348 | ENABLE_STRICT_OBJC_MSGSEND = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | OTHER_LDFLAGS = ""; 352 | OTHER_LIBTOOLFLAGS = ""; 353 | PODS_ROOT = "$(SRCROOT)"; 354 | PRODUCT_NAME = "$(TARGET_NAME)"; 355 | SDKROOT = iphoneos; 356 | SKIP_INSTALL = YES; 357 | }; 358 | name = Debug; 359 | }; 360 | 5CE5176205D06FF3FFE3DDDA9291E44B /* Debug */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 365 | CLANG_CXX_LIBRARY = "libc++"; 366 | CLANG_ENABLE_MODULES = YES; 367 | CLANG_ENABLE_OBJC_ARC = YES; 368 | CLANG_WARN_BOOL_CONVERSION = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 371 | CLANG_WARN_EMPTY_BODY = YES; 372 | CLANG_WARN_ENUM_CONVERSION = YES; 373 | CLANG_WARN_INT_CONVERSION = YES; 374 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 375 | CLANG_WARN_UNREACHABLE_CODE = YES; 376 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 377 | COPY_PHASE_STRIP = NO; 378 | GCC_C_LANGUAGE_STANDARD = gnu99; 379 | GCC_DYNAMIC_NO_PIC = NO; 380 | GCC_OPTIMIZATION_LEVEL = 0; 381 | GCC_PREPROCESSOR_DEFINITIONS = ( 382 | "DEBUG=1", 383 | "$(inherited)", 384 | ); 385 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 386 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 387 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 388 | GCC_WARN_UNDECLARED_SELECTOR = YES; 389 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 390 | GCC_WARN_UNUSED_FUNCTION = YES; 391 | GCC_WARN_UNUSED_VARIABLE = YES; 392 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 393 | ONLY_ACTIVE_ARCH = YES; 394 | STRIP_INSTALLED_PRODUCT = NO; 395 | SYMROOT = "${SRCROOT}/../build"; 396 | }; 397 | name = Debug; 398 | }; 399 | 74857149DC1E0D599B8A01A78349A926 /* Release */ = { 400 | isa = XCBuildConfiguration; 401 | buildSettings = { 402 | ALWAYS_SEARCH_USER_PATHS = NO; 403 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 404 | CLANG_CXX_LIBRARY = "libc++"; 405 | CLANG_ENABLE_MODULES = YES; 406 | CLANG_ENABLE_OBJC_ARC = YES; 407 | CLANG_WARN_BOOL_CONVERSION = YES; 408 | CLANG_WARN_CONSTANT_CONVERSION = YES; 409 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 410 | CLANG_WARN_EMPTY_BODY = YES; 411 | CLANG_WARN_ENUM_CONVERSION = YES; 412 | CLANG_WARN_INT_CONVERSION = YES; 413 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | COPY_PHASE_STRIP = YES; 417 | ENABLE_NS_ASSERTIONS = NO; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 427 | STRIP_INSTALLED_PRODUCT = NO; 428 | SYMROOT = "${SRCROOT}/../build"; 429 | VALIDATE_PRODUCT = YES; 430 | }; 431 | name = Release; 432 | }; 433 | 8F98F6D14B6B966F5B75AD5430B0EF77 /* Release */ = { 434 | isa = XCBuildConfiguration; 435 | baseConfigurationReference = E3ECA6241F33A3D53FE70BA68C3005D3 /* Pods-ProtocolProgrammingDemo.release.xcconfig */; 436 | buildSettings = { 437 | ENABLE_STRICT_OBJC_MSGSEND = YES; 438 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 439 | MTL_ENABLE_DEBUG_INFO = NO; 440 | OTHER_LDFLAGS = ""; 441 | OTHER_LIBTOOLFLAGS = ""; 442 | PODS_ROOT = "$(SRCROOT)"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SDKROOT = iphoneos; 445 | SKIP_INSTALL = YES; 446 | }; 447 | name = Release; 448 | }; 449 | ABC2F2764F113BA48D7D96444B8E2CC6 /* Debug */ = { 450 | isa = XCBuildConfiguration; 451 | baseConfigurationReference = 8FC0CF05D97135957C27C837334D2AFD /* Objection-Private.xcconfig */; 452 | buildSettings = { 453 | ENABLE_STRICT_OBJC_MSGSEND = YES; 454 | GCC_PREFIX_HEADER = "Target Support Files/Objection/Objection-prefix.pch"; 455 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 456 | MTL_ENABLE_DEBUG_INFO = YES; 457 | OTHER_LDFLAGS = ""; 458 | OTHER_LIBTOOLFLAGS = ""; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | SDKROOT = iphoneos; 461 | SKIP_INSTALL = YES; 462 | }; 463 | name = Debug; 464 | }; 465 | EFCAD8D876BF36C8A9CC1EA41FE72C71 /* Release */ = { 466 | isa = XCBuildConfiguration; 467 | baseConfigurationReference = 8FC0CF05D97135957C27C837334D2AFD /* Objection-Private.xcconfig */; 468 | buildSettings = { 469 | ENABLE_STRICT_OBJC_MSGSEND = YES; 470 | GCC_PREFIX_HEADER = "Target Support Files/Objection/Objection-prefix.pch"; 471 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 472 | MTL_ENABLE_DEBUG_INFO = NO; 473 | OTHER_LDFLAGS = ""; 474 | OTHER_LIBTOOLFLAGS = ""; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | SDKROOT = iphoneos; 477 | SKIP_INSTALL = YES; 478 | }; 479 | name = Release; 480 | }; 481 | /* End XCBuildConfiguration section */ 482 | 483 | /* Begin XCConfigurationList section */ 484 | 179B3AB779485A2D081817CB6F7A7E29 /* Build configuration list for PBXNativeTarget "Pods-ProtocolProgrammingDemo" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | 1F74DDA8E8D6E0FC8AC402EA3B7FE122 /* Debug */, 488 | 8F98F6D14B6B966F5B75AD5430B0EF77 /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 5CE5176205D06FF3FFE3DDDA9291E44B /* Debug */, 497 | 74857149DC1E0D599B8A01A78349A926 /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | DD46AB08C8A4D991EF07D0326A57CCF8 /* Build configuration list for PBXNativeTarget "Objection" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | ABC2F2764F113BA48D7D96444B8E2CC6 /* Debug */, 506 | EFCAD8D876BF36C8A9CC1EA41FE72C71 /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | defaultConfigurationName = Release; 510 | }; 511 | /* End XCConfigurationList section */ 512 | }; 513 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 514 | } 515 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/haijiao.xcuserdatad/xcschemes/Objection.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 47 | 48 | 54 | 55 | 57 | 58 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/haijiao.xcuserdatad/xcschemes/Pods-ProtocolProgrammingDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 47 | 48 | 54 | 55 | 57 | 58 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/haijiao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Objection.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Pods-ProtocolProgrammingDemo.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 4167039043E481C7275254582F8588E1 21 | 22 | primary 23 | 24 | 25 | 7E544D04958735E2765C51181F67B7AC 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Objection/Objection-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Objection.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Objection" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Objection" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Objection/Objection-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Objection : NSObject 3 | @end 4 | @implementation PodsDummy_Objection 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Objection/Objection-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Objection/Objection.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panghaijiao/ProtocolProgrammingDemo/8049b37df24c67f8aaaaf02048fd5ff35e011941/Pods/Target Support Files/Objection/Objection.xcconfig -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Objection 5 | 6 | The MIT License 7 | 8 | Copyright (c) 2012-2013 Justin DeWind 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | 28 | Generated by CocoaPods - http://cocoapods.org 29 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License 18 | 19 | Copyright (c) 2012-2013 Justin DeWind 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in 29 | all copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 37 | THE SOFTWARE. 38 | 39 | Title 40 | Objection 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Generated by CocoaPods - http://cocoapods.org 47 | Title 48 | 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | StringsTable 54 | Acknowledgements 55 | Title 56 | Acknowledgements 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ProtocolProgrammingDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ProtocolProgrammingDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Objection" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Objection" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Objection" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Objection" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Objection" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Objection" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /ProtocolProgrammingDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A0080BD01C26B90C001C2F92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A0080BCF1C26B90C001C2F92 /* main.m */; }; 11 | A0080BD31C26B90C001C2F92 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A0080BD21C26B90C001C2F92 /* AppDelegate.m */; }; 12 | A0080BD61C26B90D001C2F92 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A0080BD51C26B90D001C2F92 /* ViewController.m */; }; 13 | A0080BD91C26B90D001C2F92 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0080BD71C26B90D001C2F92 /* Main.storyboard */; }; 14 | A0080BDB1C26B90D001C2F92 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A0080BDA1C26B90D001C2F92 /* Assets.xcassets */; }; 15 | A0080BDE1C26B90D001C2F92 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0080BDC1C26B90D001C2F92 /* LaunchScreen.storyboard */; }; 16 | A0080BE71C26BA6F001C2F92 /* ApiServicePassthrough.m in Sources */ = {isa = PBXBuildFile; fileRef = A0080BE61C26BA6F001C2F92 /* ApiServicePassthrough.m */; settings = {ASSET_TAGS = (); }; }; 17 | A0080BEB1C26BB13001C2F92 /* GetApiService.m in Sources */ = {isa = PBXBuildFile; fileRef = A0080BEA1C26BB13001C2F92 /* GetApiService.m */; settings = {ASSET_TAGS = (); }; }; 18 | A0080BEE1C26BC07001C2F92 /* NSObject+ApiServiceProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = A0080BED1C26BC07001C2F92 /* NSObject+ApiServiceProtocol.m */; settings = {ASSET_TAGS = (); }; }; 19 | A0080BF11C26BDC9001C2F92 /* PostApiService.m in Sources */ = {isa = PBXBuildFile; fileRef = A0080BF01C26BDC9001C2F92 /* PostApiService.m */; settings = {ASSET_TAGS = (); }; }; 20 | BDD2272070087C27E7287F25 /* libPods-ProtocolProgrammingDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA265912DE125F72178614 /* libPods-ProtocolProgrammingDemo.a */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 03A31A73A91E61EE0B8C5004 /* Pods-ProtocolProgrammingDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProtocolProgrammingDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo.release.xcconfig"; sourceTree = ""; }; 25 | 68A99D17FD4974F7630B3140 /* Pods-ProtocolProgrammingDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProtocolProgrammingDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo.debug.xcconfig"; sourceTree = ""; }; 26 | A0080BCB1C26B90C001C2F92 /* ProtocolProgrammingDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProtocolProgrammingDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | A0080BCF1C26B90C001C2F92 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 28 | A0080BD11C26B90C001C2F92 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 29 | A0080BD21C26B90C001C2F92 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 30 | A0080BD41C26B90C001C2F92 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 31 | A0080BD51C26B90D001C2F92 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 32 | A0080BD81C26B90D001C2F92 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 33 | A0080BDA1C26B90D001C2F92 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 34 | A0080BDD1C26B90D001C2F92 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 35 | A0080BDF1C26B90D001C2F92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | A0080BE51C26BA6F001C2F92 /* ApiServicePassthrough.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApiServicePassthrough.h; sourceTree = ""; }; 37 | A0080BE61C26BA6F001C2F92 /* ApiServicePassthrough.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApiServicePassthrough.m; sourceTree = ""; }; 38 | A0080BE91C26BB13001C2F92 /* GetApiService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetApiService.h; sourceTree = ""; }; 39 | A0080BEA1C26BB13001C2F92 /* GetApiService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetApiService.m; sourceTree = ""; }; 40 | A0080BEC1C26BC07001C2F92 /* NSObject+ApiServiceProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+ApiServiceProtocol.h"; sourceTree = ""; }; 41 | A0080BED1C26BC07001C2F92 /* NSObject+ApiServiceProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+ApiServiceProtocol.m"; sourceTree = ""; }; 42 | A0080BEF1C26BDC9001C2F92 /* PostApiService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostApiService.h; sourceTree = ""; }; 43 | A0080BF01C26BDC9001C2F92 /* PostApiService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PostApiService.m; sourceTree = ""; }; 44 | FABA265912DE125F72178614 /* libPods-ProtocolProgrammingDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ProtocolProgrammingDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | A0080BC81C26B90C001C2F92 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | BDD2272070087C27E7287F25 /* libPods-ProtocolProgrammingDemo.a in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | 1126FCC211B5C699F600FDB5 /* Frameworks */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | FABA265912DE125F72178614 /* libPods-ProtocolProgrammingDemo.a */, 63 | ); 64 | name = Frameworks; 65 | sourceTree = ""; 66 | }; 67 | 2A6A8DA8DF1E46B3BF1281DF /* Pods */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 68A99D17FD4974F7630B3140 /* Pods-ProtocolProgrammingDemo.debug.xcconfig */, 71 | 03A31A73A91E61EE0B8C5004 /* Pods-ProtocolProgrammingDemo.release.xcconfig */, 72 | ); 73 | name = Pods; 74 | sourceTree = ""; 75 | }; 76 | A0080BC21C26B90C001C2F92 = { 77 | isa = PBXGroup; 78 | children = ( 79 | A0080BCD1C26B90C001C2F92 /* ProtocolProgrammingDemo */, 80 | A0080BCC1C26B90C001C2F92 /* Products */, 81 | 2A6A8DA8DF1E46B3BF1281DF /* Pods */, 82 | 1126FCC211B5C699F600FDB5 /* Frameworks */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | A0080BCC1C26B90C001C2F92 /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | A0080BCB1C26B90C001C2F92 /* ProtocolProgrammingDemo.app */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | A0080BCD1C26B90C001C2F92 /* ProtocolProgrammingDemo */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | A0080BD11C26B90C001C2F92 /* AppDelegate.h */, 98 | A0080BD21C26B90C001C2F92 /* AppDelegate.m */, 99 | A0080BD41C26B90C001C2F92 /* ViewController.h */, 100 | A0080BD51C26B90D001C2F92 /* ViewController.m */, 101 | A0080BEC1C26BC07001C2F92 /* NSObject+ApiServiceProtocol.h */, 102 | A0080BED1C26BC07001C2F92 /* NSObject+ApiServiceProtocol.m */, 103 | A0080BF21C26BF44001C2F92 /* Protocol */, 104 | A0080BD71C26B90D001C2F92 /* Main.storyboard */, 105 | A0080BDA1C26B90D001C2F92 /* Assets.xcassets */, 106 | A0080BDC1C26B90D001C2F92 /* LaunchScreen.storyboard */, 107 | A0080BDF1C26B90D001C2F92 /* Info.plist */, 108 | A0080BCE1C26B90C001C2F92 /* Supporting Files */, 109 | ); 110 | path = ProtocolProgrammingDemo; 111 | sourceTree = ""; 112 | }; 113 | A0080BCE1C26B90C001C2F92 /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | A0080BCF1C26B90C001C2F92 /* main.m */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | A0080BF21C26BF44001C2F92 /* Protocol */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | A0080BE51C26BA6F001C2F92 /* ApiServicePassthrough.h */, 125 | A0080BE61C26BA6F001C2F92 /* ApiServicePassthrough.m */, 126 | A0080BE91C26BB13001C2F92 /* GetApiService.h */, 127 | A0080BEA1C26BB13001C2F92 /* GetApiService.m */, 128 | A0080BEF1C26BDC9001C2F92 /* PostApiService.h */, 129 | A0080BF01C26BDC9001C2F92 /* PostApiService.m */, 130 | ); 131 | name = Protocol; 132 | sourceTree = ""; 133 | }; 134 | /* End PBXGroup section */ 135 | 136 | /* Begin PBXNativeTarget section */ 137 | A0080BCA1C26B90C001C2F92 /* ProtocolProgrammingDemo */ = { 138 | isa = PBXNativeTarget; 139 | buildConfigurationList = A0080BE21C26B90D001C2F92 /* Build configuration list for PBXNativeTarget "ProtocolProgrammingDemo" */; 140 | buildPhases = ( 141 | C29AB58CEF3D95B80C6BE84A /* Check Pods Manifest.lock */, 142 | A0080BC71C26B90C001C2F92 /* Sources */, 143 | A0080BC81C26B90C001C2F92 /* Frameworks */, 144 | A0080BC91C26B90C001C2F92 /* Resources */, 145 | A2E6192472CFA3E3E94EF29D /* Copy Pods Resources */, 146 | ); 147 | buildRules = ( 148 | ); 149 | dependencies = ( 150 | ); 151 | name = ProtocolProgrammingDemo; 152 | productName = ProtocolProgrammingDemo; 153 | productReference = A0080BCB1C26B90C001C2F92 /* ProtocolProgrammingDemo.app */; 154 | productType = "com.apple.product-type.application"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | A0080BC31C26B90C001C2F92 /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0700; 163 | ORGANIZATIONNAME = olinone; 164 | TargetAttributes = { 165 | A0080BCA1C26B90C001C2F92 = { 166 | CreatedOnToolsVersion = 7.0; 167 | }; 168 | }; 169 | }; 170 | buildConfigurationList = A0080BC61C26B90C001C2F92 /* Build configuration list for PBXProject "ProtocolProgrammingDemo" */; 171 | compatibilityVersion = "Xcode 3.2"; 172 | developmentRegion = English; 173 | hasScannedForEncodings = 0; 174 | knownRegions = ( 175 | en, 176 | Base, 177 | ); 178 | mainGroup = A0080BC21C26B90C001C2F92; 179 | productRefGroup = A0080BCC1C26B90C001C2F92 /* Products */; 180 | projectDirPath = ""; 181 | projectRoot = ""; 182 | targets = ( 183 | A0080BCA1C26B90C001C2F92 /* ProtocolProgrammingDemo */, 184 | ); 185 | }; 186 | /* End PBXProject section */ 187 | 188 | /* Begin PBXResourcesBuildPhase section */ 189 | A0080BC91C26B90C001C2F92 /* Resources */ = { 190 | isa = PBXResourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | A0080BDE1C26B90D001C2F92 /* LaunchScreen.storyboard in Resources */, 194 | A0080BDB1C26B90D001C2F92 /* Assets.xcassets in Resources */, 195 | A0080BD91C26B90D001C2F92 /* Main.storyboard in Resources */, 196 | ); 197 | runOnlyForDeploymentPostprocessing = 0; 198 | }; 199 | /* End PBXResourcesBuildPhase section */ 200 | 201 | /* Begin PBXShellScriptBuildPhase section */ 202 | A2E6192472CFA3E3E94EF29D /* Copy Pods Resources */ = { 203 | isa = PBXShellScriptBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | ); 207 | inputPaths = ( 208 | ); 209 | name = "Copy Pods Resources"; 210 | outputPaths = ( 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | shellPath = /bin/sh; 214 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ProtocolProgrammingDemo/Pods-ProtocolProgrammingDemo-resources.sh\"\n"; 215 | showEnvVarsInLog = 0; 216 | }; 217 | C29AB58CEF3D95B80C6BE84A /* Check Pods Manifest.lock */ = { 218 | isa = PBXShellScriptBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | ); 222 | inputPaths = ( 223 | ); 224 | name = "Check Pods Manifest.lock"; 225 | outputPaths = ( 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | shellPath = /bin/sh; 229 | 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"; 230 | showEnvVarsInLog = 0; 231 | }; 232 | /* End PBXShellScriptBuildPhase section */ 233 | 234 | /* Begin PBXSourcesBuildPhase section */ 235 | A0080BC71C26B90C001C2F92 /* Sources */ = { 236 | isa = PBXSourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | A0080BEE1C26BC07001C2F92 /* NSObject+ApiServiceProtocol.m in Sources */, 240 | A0080BD61C26B90D001C2F92 /* ViewController.m in Sources */, 241 | A0080BF11C26BDC9001C2F92 /* PostApiService.m in Sources */, 242 | A0080BE71C26BA6F001C2F92 /* ApiServicePassthrough.m in Sources */, 243 | A0080BD31C26B90C001C2F92 /* AppDelegate.m in Sources */, 244 | A0080BEB1C26BB13001C2F92 /* GetApiService.m in Sources */, 245 | A0080BD01C26B90C001C2F92 /* main.m in Sources */, 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | /* End PBXSourcesBuildPhase section */ 250 | 251 | /* Begin PBXVariantGroup section */ 252 | A0080BD71C26B90D001C2F92 /* Main.storyboard */ = { 253 | isa = PBXVariantGroup; 254 | children = ( 255 | A0080BD81C26B90D001C2F92 /* Base */, 256 | ); 257 | name = Main.storyboard; 258 | sourceTree = ""; 259 | }; 260 | A0080BDC1C26B90D001C2F92 /* LaunchScreen.storyboard */ = { 261 | isa = PBXVariantGroup; 262 | children = ( 263 | A0080BDD1C26B90D001C2F92 /* Base */, 264 | ); 265 | name = LaunchScreen.storyboard; 266 | sourceTree = ""; 267 | }; 268 | /* End PBXVariantGroup section */ 269 | 270 | /* Begin XCBuildConfiguration section */ 271 | A0080BE01C26B90D001C2F92 /* Debug */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | ALWAYS_SEARCH_USER_PATHS = NO; 275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 276 | CLANG_CXX_LIBRARY = "libc++"; 277 | CLANG_ENABLE_MODULES = YES; 278 | CLANG_ENABLE_OBJC_ARC = YES; 279 | CLANG_WARN_BOOL_CONVERSION = YES; 280 | CLANG_WARN_CONSTANT_CONVERSION = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_EMPTY_BODY = YES; 283 | CLANG_WARN_ENUM_CONVERSION = YES; 284 | CLANG_WARN_INT_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_UNREACHABLE_CODE = YES; 287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 288 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 289 | COPY_PHASE_STRIP = NO; 290 | DEBUG_INFORMATION_FORMAT = dwarf; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | ENABLE_TESTABILITY = YES; 293 | GCC_C_LANGUAGE_STANDARD = gnu99; 294 | GCC_DYNAMIC_NO_PIC = NO; 295 | GCC_NO_COMMON_BLOCKS = YES; 296 | GCC_OPTIMIZATION_LEVEL = 0; 297 | GCC_PREPROCESSOR_DEFINITIONS = ( 298 | "DEBUG=1", 299 | "$(inherited)", 300 | ); 301 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 302 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 303 | GCC_WARN_UNDECLARED_SELECTOR = YES; 304 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 305 | GCC_WARN_UNUSED_FUNCTION = YES; 306 | GCC_WARN_UNUSED_VARIABLE = YES; 307 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 308 | MTL_ENABLE_DEBUG_INFO = YES; 309 | ONLY_ACTIVE_ARCH = YES; 310 | SDKROOT = iphoneos; 311 | }; 312 | name = Debug; 313 | }; 314 | A0080BE11C26B90D001C2F92 /* Release */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ALWAYS_SEARCH_USER_PATHS = NO; 318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 319 | CLANG_CXX_LIBRARY = "libc++"; 320 | CLANG_ENABLE_MODULES = YES; 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CLANG_WARN_BOOL_CONVERSION = YES; 323 | CLANG_WARN_CONSTANT_CONVERSION = YES; 324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 325 | CLANG_WARN_EMPTY_BODY = YES; 326 | CLANG_WARN_ENUM_CONVERSION = YES; 327 | CLANG_WARN_INT_CONVERSION = YES; 328 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 332 | COPY_PHASE_STRIP = NO; 333 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 334 | ENABLE_NS_ASSERTIONS = NO; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | GCC_C_LANGUAGE_STANDARD = gnu99; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 339 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 340 | GCC_WARN_UNDECLARED_SELECTOR = YES; 341 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 342 | GCC_WARN_UNUSED_FUNCTION = YES; 343 | GCC_WARN_UNUSED_VARIABLE = YES; 344 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 345 | MTL_ENABLE_DEBUG_INFO = NO; 346 | SDKROOT = iphoneos; 347 | VALIDATE_PRODUCT = YES; 348 | }; 349 | name = Release; 350 | }; 351 | A0080BE31C26B90D001C2F92 /* Debug */ = { 352 | isa = XCBuildConfiguration; 353 | baseConfigurationReference = 68A99D17FD4974F7630B3140 /* Pods-ProtocolProgrammingDemo.debug.xcconfig */; 354 | buildSettings = { 355 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 356 | INFOPLIST_FILE = ProtocolProgrammingDemo/Info.plist; 357 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 358 | PRODUCT_BUNDLE_IDENTIFIER = com.olinone.ProtocolProgrammingDemo; 359 | PRODUCT_NAME = "$(TARGET_NAME)"; 360 | }; 361 | name = Debug; 362 | }; 363 | A0080BE41C26B90D001C2F92 /* Release */ = { 364 | isa = XCBuildConfiguration; 365 | baseConfigurationReference = 03A31A73A91E61EE0B8C5004 /* Pods-ProtocolProgrammingDemo.release.xcconfig */; 366 | buildSettings = { 367 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 368 | INFOPLIST_FILE = ProtocolProgrammingDemo/Info.plist; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 370 | PRODUCT_BUNDLE_IDENTIFIER = com.olinone.ProtocolProgrammingDemo; 371 | PRODUCT_NAME = "$(TARGET_NAME)"; 372 | }; 373 | name = Release; 374 | }; 375 | /* End XCBuildConfiguration section */ 376 | 377 | /* Begin XCConfigurationList section */ 378 | A0080BC61C26B90C001C2F92 /* Build configuration list for PBXProject "ProtocolProgrammingDemo" */ = { 379 | isa = XCConfigurationList; 380 | buildConfigurations = ( 381 | A0080BE01C26B90D001C2F92 /* Debug */, 382 | A0080BE11C26B90D001C2F92 /* Release */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | defaultConfigurationName = Release; 386 | }; 387 | A0080BE21C26B90D001C2F92 /* Build configuration list for PBXNativeTarget "ProtocolProgrammingDemo" */ = { 388 | isa = XCConfigurationList; 389 | buildConfigurations = ( 390 | A0080BE31C26B90D001C2F92 /* Debug */, 391 | A0080BE41C26B90D001C2F92 /* Release */, 392 | ); 393 | defaultConfigurationIsVisible = 0; 394 | defaultConfigurationName = Release; 395 | }; 396 | /* End XCConfigurationList section */ 397 | }; 398 | rootObject = A0080BC31C26B90C001C2F92 /* Project object */; 399 | } 400 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo.xcodeproj/project.xcworkspace/xcuserdata/haijiao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panghaijiao/ProtocolProgrammingDemo/8049b37df24c67f8aaaaf02048fd5ff35e011941/ProtocolProgrammingDemo.xcodeproj/project.xcworkspace/xcuserdata/haijiao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ProtocolProgrammingDemo.xcodeproj/xcuserdata/haijiao.xcuserdatad/xcschemes/ProtocolProgrammingDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo.xcodeproj/xcuserdata/haijiao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ProtocolProgrammingDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A0080BCA1C26B90C001C2F92 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo.xcworkspace/xcuserdata/haijiao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/panghaijiao/ProtocolProgrammingDemo/8049b37df24c67f8aaaaf02048fd5ff35e011941/ProtocolProgrammingDemo.xcworkspace/xcuserdata/haijiao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/ApiServicePassthrough.h: -------------------------------------------------------------------------------- 1 | // 2 | // ApiServicePassthrough.h 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ApiServiceProtocol 12 | 13 | - (void)requestNetWithUrl:(NSURL *)url Param:(NSDictionary *)param; 14 | 15 | @end 16 | 17 | @protocol ApiService 18 | 19 | // private functions 20 | 21 | @end 22 | 23 | @interface ApiServicePassthrough : NSObject 24 | 25 | @property (nonatomic, strong) NSURL *url; 26 | @property (nonatomic, strong) NSDictionary *param; 27 | 28 | - (instancetype)initWithApiService:(id)apiService; 29 | - (void)execNetRequest; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/ApiServicePassthrough.m: -------------------------------------------------------------------------------- 1 | // 2 | // ApiServicePassthrough.m 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import "ApiServicePassthrough.h" 10 | 11 | @interface ApiServicePassthrough () 12 | 13 | @property (nonatomic, strong) id apiService; 14 | 15 | @end 16 | 17 | @implementation ApiServicePassthrough 18 | 19 | - (instancetype)initWithApiService:(id)apiService { 20 | if (self = [super init]) { 21 | self.apiService = apiService; 22 | } 23 | return self; 24 | } 25 | 26 | - (void)execNetRequest { 27 | [self.apiService requestNetWithUrl:self.url Param:self.param]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. 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 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/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 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/GetApiService.h: -------------------------------------------------------------------------------- 1 | // 2 | // GetApiService.h 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ApiServicePassthrough.h" 11 | 12 | @interface GetApiService : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/GetApiService.m: -------------------------------------------------------------------------------- 1 | // 2 | // GetApiService.m 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import "GetApiService.h" 10 | 11 | @implementation GetApiService 12 | 13 | - (void)requestNetWithUrl:(NSURL *)url Param:(NSDictionary *)param { 14 | NSLog(@"exec get request"); 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/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 | 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 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/NSObject+ApiServiceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+ApiServiceProtocol.h 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (ApiServiceProtocol) 12 | 13 | - (void)requestGetNetWithUrl:(NSURL *)url Param:(NSDictionary *)param; 14 | - (void)requestPostNetWithUrl:(NSURL *)url Param:(NSDictionary *)param; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/NSObject+ApiServiceProtocol.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+ApiServiceProtocol.m 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import "NSObject+ApiServiceProtocol.h" 10 | #import "ApiServicePassthrough.h" 11 | #import "GetApiService.h" 12 | #import "PostApiService.h" 13 | #import "JSObjection.h" 14 | 15 | @implementation NSObject (ApiServiceProtocol) 16 | 17 | - (void)requestGetNetWithUrl:(NSURL *)url Param:(NSDictionary *)param { 18 | id apiSrevice = [[JSObjection createInjector] getObject:[GetApiService class]]; 19 | ApiServicePassthrough *apiServicePassthrough = [[ApiServicePassthrough alloc] initWithApiService:apiSrevice]; 20 | apiServicePassthrough.url = url; 21 | apiServicePassthrough.param = param; 22 | [apiServicePassthrough execNetRequest]; 23 | } 24 | 25 | - (void)requestPostNetWithUrl:(NSURL *)url Param:(NSDictionary *)param { 26 | id apiSrevice = [[JSObjection createInjector] getObject:[PostApiService class]]; 27 | ApiServicePassthrough *apiServicePassthrough = [[ApiServicePassthrough alloc] initWithApiService:apiSrevice]; 28 | apiServicePassthrough.url = url; 29 | apiServicePassthrough.param = param; 30 | [apiServicePassthrough execNetRequest]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/PostApiService.h: -------------------------------------------------------------------------------- 1 | // 2 | // PostApiService.h 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ApiServicePassthrough.h" 11 | 12 | @interface PostApiService : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/PostApiService.m: -------------------------------------------------------------------------------- 1 | // 2 | // PostApiService.m 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import "PostApiService.h" 10 | 11 | @implementation PostApiService 12 | 13 | - (void)requestNetWithUrl:(NSURL *)url Param:(NSDictionary *)param { 14 | NSLog(@"exec post request"); 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "NSObject+ApiServiceProtocol.h" 11 | 12 | @implementation ViewController 13 | 14 | - (void)viewDidLoad { 15 | [super viewDidLoad]; 16 | } 17 | 18 | - (IBAction)onGetRequestBtnClick:(id)sender { 19 | [self requestGetNetWithUrl:[NSURL URLWithString:@"www.olinone.com"] Param:nil]; 20 | } 21 | 22 | - (IBAction)onPostRequestBtnClick:(id)sender { 23 | [self requestPostNetWithUrl:[NSURL URLWithString:@"www.shenmaip.com"] Param:nil]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /ProtocolProgrammingDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ProtocolProgrammingDemo 4 | // 5 | // Created by haijiao on 15/12/20. 6 | // Copyright © 2015年 olinone. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProtocolProgrammingDemo 2 | a demo about protocol programming 3 | 4 | ###For more detail, click the page### 5 | 6 | http://www.olinone.com/?p=429 7 | 8 | --------------------------------------------------------------------------------