TyphoonMethod

Objective-C

@interface TyphoonMethod : NSObject <NSCopying> {
  NSMutableArray *_injectedParameters;
  SEL _selector;
}

Swift

class TyphoonMethod : NSObject, NSCopying

@ingroup Definition

Represents an method to inject for a component. Used in initializer and method injections

##Initializer style injection has the following advantages:

  • Presents a clear contract to put the instance in the required state before use.
  • No custom lifecycle methods (before/after property injection) are required.

##Initializer injection has the following drawbacks:

  • Not suitable for classes with a very large number of dependencies - a very large initializer method will create poor readability.
  • Auto-injection by type is not supported.
  • No type introspection for objects injected with a text representation.

Its generally recommended to use initializer-style injection, unless the above drawbacks will manifest.

  • Undocumented

    Declaration

    Objective-C

    NSMutableArray *_injectedParameters
  • Undocumented

    Declaration

    Objective-C

    SEL _selector
  • The selector used to initialize the component.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SEL selector;

    Swift

    var selector: Selector! { get }
  • Undocumented

    Declaration

    Objective-C

    - (id)initWithSelector:(SEL)selector;

    Swift

    init!(selector: Selector!)

inject

  • Undocumented

    Declaration

    Objective-C

    - (void)injectParameterWith:(id)injection;

    Swift

    func injectParameter(with injection: Any!)