swift - Typhoon: how to inject class instead of instance -


i have third-party library written in swift. library provides class has class methods in it. using typhoon, want inject class 1 of classes that, under unit testing, inject mock class provides fake class methods. i'm new typhoon , went though documentation, haven't figured out how it. doable typhoon?

yes, in user guide section on injecting configuration shows how inject primitives, scalar values , forth.

to inject class:

[initializer injectparameterwith:[someclass class]]; 

this applies property injection , method injection.

to inject selector:

[initializer injectparameterwith:nsvaluefromprimitive(@selector(selectorvalue))]; 

typhoon rules:

  • references other definitions resolved built instance.
  • simple objects, primitives , scalar values injected as-is (scalar values , primitives must wrapped).
  • collections (nsarray, nsset, etc) contain references other definitions have references resolved built instance. other values pass through is.

there typhoon config, allows storing configuration, simple objects , forth in external plist, json or properties file.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -